webots
webots copied to clipboard
BallJoint axes not correctly updated when rotating parent node
Reported by user (Johan2021) on Discord,:
Hi, I am using a ballJoint with 3 rotational motors as shown in the extract, to control a robot joint. The jointParameters nodes specify the axes of rotation (https://cyberbotics.com/doc/reference/jointparameters?tab-language=python). When I spawn the model with a different orientation (either inside the proto file or the wbt file), these axes seem to be in absolute coordinates, and not w.r.t. the body frame. While if the robot is spawned with zero rotation, the axes remain expressed w.r.t. the body frame while the robot is moving and changing its global orientation. Is this intended or is there a way to express the axes in relative coordinates?
This can be reproduced with the motor3.wbt
:
- Open the
motor3.wbt
simulation - Run some steps of simulation: the end point moves in directiion of the robots' z-axis
- Reload the simulation and change the
Robot.rotation
value to0 1 0 1.57
- Run some steps of simulation
-> it would be expected that the end point still moves in direction of the robot's z-axis but it moves in -x-axis direction (exactly the same as before rotating the top robot node)
BallJoint axes should be defined in local coordicates w.r.t parent node (as for all the other joints) and correctly updated when an ancestor node is moved.
To what the axis is supposed to be relative to is determined by the third parameter of this function (and similarly all other calls present in this class).
According to the manual, a value of 1 implies that it is relative to the first body and indeed that's how it appears to be applied in this context (and in all other joint classes for that matter), so it should be correct. Weirdly enough however, if I set it to 0 (i.e. global frame) on those lines at 712, 714 instead, the BallJoint
appears to be working as intended.