RoboCup-Humanoid-TC / webots

Webots Robot Simulator
https://cyberbotics.com
Apache License 2.0
14 stars 14 forks source link

referee: rotate_along_z does not rotate along z #137

Closed timonegk closed 3 years ago

timonegk commented 3 years ago

Describe the Bug In the auto-referee, the function rotate_along_z currently converts the rotation to a quaternion, multiplies it with the unit quaternion, and converts it back to axis angle. This does not actually rotate along the z axis. For our robot, that's a problem because it falls down when it is spawned on the other side of the field.

Screenshots

https://user-images.githubusercontent.com/25013222/120329702-65beb700-c2ec-11eb-8b71-39031319916f.mp4

omichel commented 3 years ago

That's correct. For some reason, the rotation quaternion was commented out and the unit quaternion was used instead. I will investigate and fix it as soon as possible. Did you try to uncomment the Z rotation quaternion to see if that resolves your problem?

timonegk commented 3 years ago

Okay, [0,0,0,1] is not actually the unit quaternion, because the library uses the wxyz order. That actually is a rotation of 180° degrees around the z axis, but the result is wrong because the rotation is not around the global z axis. The commented out line rotates around the x axis, which is also wrong.

timonegk commented 3 years ago

I thin rotate_along_z should be called before applying the rotation from the startingPose.

timonegk commented 3 years ago

So that would be keeping rz as [0,0,0,1], but switching the arguments of qmul, that change fixes the issue.

omichel commented 3 years ago

Fixed in #139.