0

I wish to have a touchsensor on the end of a moving arm. However, through the Python API, getDevice('touch_sensor') only returns sensors that are directly under the Robot parent.

Is there a way I can either get a sensor that is nested (under a joint), or instead make a sensor that is under parent move in tandem with another joint?

I have tried setting the bounding box of the sensor to a shape/transform nested under the moving joint, but it simply takes on the original position of the shape and doesn't update when the joint moves.

I have also tried putting the sensor directly under the joint, in which case it does indeed move, but then I cannot access it from the python API. (Using get device returns None)

LF Deeds
  • 21
  • 1
  • I should mention, I'm on R2019a.r1 on Ubuntu 18.1 x64 – LF Deeds May 07 '19 at 12:52
  • I looked at the hoap2_sumo.wbt demo and saw that they indeed nest sensors under hinged bodies. So perhaps this is a bug, or a limitation of the Python API? – LF Deeds May 07 '19 at 12:53
  • I tried adding a python controller to hoap2_sumo.wbt and robot.getDevice("left sensor") returns None. – LF Deeds May 07 '19 at 13:16

1 Answers1

2

Found the problem, I should have used getTouchSensor instead of getDevice!!

Now it works fine.

LF Deeds
  • 21
  • 1