Robotics StackExchange | Archived questions

Ros quaternion component w not behaving as it should.

The quaternions in ros are supposed to be (x,y,z,w), where w = cos(theta/2) where theta is the angle of the rotation.

I did the following, I used tflistener to get the position of my robot tbase,rbase = tflistener.lookupTransform('/map','/base_link',rospy.Time(0))

and then I printed the last component of r_base as I did a 360° continuous turn with the robot. What I get is values between -0.3 and 0.3 with a jump in sign between -0.3 and 0.3. (So I start from -0.3 it goes up to 1 then down to 0.3 where it jumps to -0.3) as if the robot were missing around 30°from the 360°.

What is happening here?

Asked by priestoferis on 2020-04-23 08:20:32 UTC

Comments

Keep in mind what w is in a quaternion: its a normalization term.

Asked by stevemacenski on 2020-04-23 12:21:05 UTC

I don't think I get your point.

Asked by priestoferis on 2020-04-23 12:34:16 UTC

I prefer to think in euler angles rather than quaternions .. use (r,p,y) = tf.transformations.euler_from_quaternion(quaternion=r_base) to save yourself a headahe

Asked by pring on 2020-04-25 14:39:50 UTC

Answers