Skip to content

PTUPosture crashes with multiple PTUs  #536

@pronobis

Description

@pronobis

When multiple PTUs are created with the same parent, MORSE crashes with the following traceback

Traceback (most recent call last):
  File "/opt/sara_morse/lib/python3.3/site-packages/morse/blender/calling.py", line 54, in sensor_action
    component_action(contr)
  File "/opt/sara_morse/lib/python3.3/site-packages/morse/blender/calling.py", line 50, in component_action
    cmpt_object.action()
  File "/opt/sara_morse/lib/python3.3/site-packages/morse/core/sensor.py", line 76, in action
    self.default_action()
  File "/opt/sara_morse/lib/python3.3/site-packages/morse/sensors/ptu_posture.py", line 72, in default_action
    if not self._ptu_obj:
AttributeError: 'PTUPosture' object has no attribute '_ptu_obj'

Example:

        self.prosilica_tilt = PTU("prosilica_tilt") 
        self.append(self.prosilica_tilt)

        self.xtion_tilt = PTU("xtion_tilt")
        self.append(self.xtion_tilt)

        self.prosilica_tilt_state = PTUPosture("prosilica_tilt_state")
        self.prosilica_tilt.append(self.prosilica_tilt_state)

        self.xtion_tilt_state = PTUPosture("xtion_tilt_state")
        self.xtion_tilt.append(self.xtion_tilt_state)

The reason seems to be that the c.name in:

   def _get_ptu(self, obj):
        if "PanBase" in [c.name for c in obj.children]:
            return obj
        elif not obj.parent:
            return None
        else:
            return self._get_ptu(obj.parent)

is not PanBase anymore but rather PanBase.001

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions