[英]How to get TouchSensor nested under joint in Webots (Python API)
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.
但是,通过Python API,getDevice('touch_sensor')仅返回直接位于Robot父对象下的传感器。
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. 我还尝试过将传感器直接放在关节下面,在这种情况下,它确实可以移动,但是后来我无法从python API访问它。 (Using get device returns None)
(使用get device返回None)
Found the problem, I should have used getTouchSensor instead of getDevice!! 发现了问题,我应该使用getTouchSensor而不是getDevice !!
Now it works fine. 现在工作正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.