0
$\begingroup$

Rosanswers logo

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);


Originally posted by Lolita390 on ROS Answers with karma: 31 on 2015-11-03

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by tfoote with karma: 58457 on 2015-11-03

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Lolita390 on 2015-11-03:
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.

Comment by tfoote on 2015-11-03:
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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.