Skip to content

TypeError in blensor.tof.scan_advanced #30

@aoikaneko

Description

@aoikaneko

Issue description:

Hi, I get TypeError: unsupported operand type(s) for <<: 'tuple' and 'int' when I run blensor.tof.scan_advanced from script in Blensor 1.0.18 RC 10 Windows.
Here is a simple script producing the error:

import bpy
import blensor

camera = bpy.data.objects['Camera']

camera.select = True
blensor.tof.scan_advanced(camera, evd_file='cube.pcd')  # TypeError
camera.select = False

and I get:

Traceback (most recent call last):
  File "Blensor-1.0.18-Blender-2.79-Winx64\2.79\scripts\addons\blensor\evd.py", line 225, in writePCLFile
    self.write_point(pcl, pcl_noisy, INVALID_POINT, self.output_labels)
  File "Blensor-1.0.18-Blender-2.79-Winx64\2.79\scripts\addons\blensor\evd.py", line 190, in write_point
    color_uint32 = (e[12]<<16) | (e[13]<<8) | (e[14])
TypeError: unsupported operand type(s) for <<: 'tuple' and 'int'

Solution:

The following quick fix solved the issue:
modifying the line 42-44 in evd.py

INVALID_POINT = [0.0, 0.0, 0.0, float('NaN'), float('NaN'),
                 float('NaN'),float('NaN'),float('NaN'),float('NaN'),
                 float('NaN'),float('NaN'),-1,(0,0,0),-1]

to

INVALID_POINT = [0.0, 0.0, 0.0, float('NaN'), float('NaN'),
                 float('NaN'),float('NaN'),float('NaN'),float('NaN'),
                 float('NaN'),float('NaN'),-1,0,0,0,-1]

snapshot

Hope this helps!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions