Ask Your Question
0

Why does a marker still have roll, pitch and yaw when using tf::createQuaternionMsgFromYaw?

asked 2015-11-03 12:23:30 -0500

Lolita390 gravatar image

Hello,

From a downloaded project I have access to a marker in rviz which is defined by position and orientation(quaternion). However, I would like to create a marker at the same position and with only the yaw as orientation. This means that roll and pitch should be zero and even though the original marker were to have roll and pitch, the second marker should only rotate when there is a variation in yaw. In this way the marker I create should only move on a 2D plane. I used the following function to create the quaternion for my marker: q = tf::createQuaternionMsgFromYaw(yaw); where q is a geometry_msgs::qauternion. Then I pass q.x, q.y, q.z and q.w to my marker.

tf::Matrix3x3(transform.getRotation()).getRPY(pitch, yaw, roll);
geometry_msgs::Quaternion q;
q = tf::createQuaternionMsgFromYaw(yaw);
oPose_msg.orientation.x = q.x;
oPose_msg.orientation.y = q.y;
oPose_msg.orientation.z = q.z;
oPose_msg.orientation.w = q.w;

However when observing in Rviz my marker still tilts in roll and pitch as the original marker does. Why is this and what could I change to achieve the output I desire?

Note: I obtain roll, pitch and yaw from a rotation matrix. These are in this order to be consistent with the designated angles. I have the same problem when using q = tf::createQuaternionMsgFromRollPitchYaw(0.0,yaw,0.0); instead of q = tf::createQuaternionMsgFromYaw(yaw);

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-11-03 13:38:11 -0500

tfoote gravatar image

I suspect that you need to pay attention to which coordinate frame your defining the marker to be with zero pitch and roll. If the frame_id of the marker and target_frame are different it will be transformed before being displayed.

edit flag offensive delete link more

Comments

In this particular case I am dealing with a world frame, which is the origin of the world, and a robot position which is the target frame. The frame_id of my marker is the world frame. Could you please give me a little more detail of what I should do to correct this. Thanks.

Lolita390 gravatar image Lolita390  ( 2015-11-03 15:01:38 -0500 )edit
1

I was completely guessing in my answer as you have not given enough information to reproduce your problem. If you want more help please provide enough information to reproduce your problem. Such as your entire tf tree, everything you're doing to publish the marker etc.

tfoote gravatar image tfoote  ( 2015-11-03 15:50:51 -0500 )edit
0

answered 2015-11-03 15:00:16 -0500

Lolita390 gravatar image

Sorry. Aparrently with tf::createQuaternionMsgFromYaw(yaw) function, the marker does not even rotate. When I use tf::createQuaternionMsgFromRollPitchYaw(0.0,yaw,0.0) function rotation of the marker ocurrs, but still on the undesired axes. In this particular case I am dealing with a world frame, which is the origin of the world, and a robot position which is the target frame. The frame_id of my marker is the world frame. Could you please give me a little more detail of what I should do to correct this. Thanks.

edit flag offensive delete link more

Comments

Please don't use an answer field to clarify your question. Use the edit button to add more to your question.

tfoote gravatar image tfoote  ( 2015-11-03 15:48:57 -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

Stats

Asked: 2015-11-03 12:23:30 -0500

Seen: 1,186 times

Last updated: Nov 03 '15