Ask Your Question

interactive markers not fully pitching

asked 2012-11-05 06:57:12 -0500

seth_g gravatar image

updated 2012-11-06 04:56:27 -0500

Maybe it's my lack of a fundamental understanding of quaternions but I can't seem to pitch an interactive marker beyond 1.57rad. I'm building my own robot model using interactive markers but have also run through the tutorial on basic control of interactive markers and none of them seem to want to pitch past PI/2.

Is this a bug or am I missing something in the mathematics of a quaternion calculation? I'm using tf to convert from a quaternion to euler.

Edit 1: I'm running Fuerte on Precise. I don't generate the quaternion, rather, I receive the pose via callbacks that are registered to the interactive markers which I then convert using tf:

processInteractiveObjectFeedback(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback) 
      tf::Quaternion q;
      tf::quaternionMsgToTF(feedback->pose.orientation, q);
      double r, p, y;
      tf::Matrix3x3(q).getRPY(r, p, y);

The 'Y' value of the quaternion seems to be valid, so I must be missing something with the math behind the 'W' (orientation) value. Basically when I pitch the interactive marker beyond 1.57rad, the pitch starts going back down to 0 as if the quaternion to euler conversion doesn't utilize the orientation?

Edit 2: The following are some images captured and smashed together, overlook the bad quality. I'm using the green ring to pitch the interactive marker down.

Image 1: pitching hand to show result is as expected. example case.

image description

Image 2: pitched hand ~1.57rad. this seems to be the limit for correct pitch values. Y and W from the quaternion still look good.

image description

Image 3: shows the hand (clearly) pitched beyond 1.57rad but the pitch value seems to go back to 0. Y from the quaternion still seems valid (range is +/- 1).

image description

edit retag flag offensive close merge delete


Unfortunately, your question does not provide enough information to help. How is your setup? How are you generating the quaternion? How are you converting it? Which ros distro are you using? Code snippets would also help. Have a look at

Lorenz gravatar image Lorenz  ( 2012-11-05 21:29:19 -0500 )edit

To me, your code looks good. Can you also add the quaternion and the values of rpy for a case that is failing? Maybe also a screenshot of the interactive marker?

Lorenz gravatar image Lorenz  ( 2012-11-06 03:27:39 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2012-11-06 06:03:31 -0500

Lorenz gravatar image

I do think the values you get are correct. The roll and yaw values are close to PI. Thus the yaw value does make sense. If you convert the quaternion of your last example to an axis angle representation, you will see that it is essentially a rotation along the y axis with either a negative axis and an angle of about 2.72 or a positive axis and an angle of about -2.72.

Have a look at this wikipedia page to find out more about the different representations of rotations. I would not suggest to use euler angles because of several problems including the gimbal lock and ambiguities (e.g. the order in which roll pitch and yaw rotations are applied matters).

edit flag offensive delete link more


thanks for the pointers, those are both very interesting reads and gimbal lock isn't anything I've heard of before so thanks for pointing that out. unfortunately the IK plugin I have requires euler to solve. I found a workaround (hack, really) for the time being until we can alter the IK.

seth_g gravatar image seth_g  ( 2012-11-08 09:51:47 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-11-05 06:57:12 -0500

Seen: 402 times

Last updated: Nov 06 '12