# How to see (visualize) the robot orientation (Yaw) in rviz

Hello

I need a help regarding a robot orientation. I made a node that calculate the orientation of the robot to some object in the map/ So I can get the Yaw from my transformation, but that is just a number. Is there any tool that can visualize that orientation??This the part of the code where I get the YAW

.... some code.. while (node.ok()) {

            //Speed and Yaw calculation
tf::StampedTransform transform2;
if(speed_count==9)
{
try{
ros::Time(0), transform2);

}
catch (tf::TransformException ex){};

vel = hypotenuse(xlast,ylast, transform2.getOrigin().x(),transform2.getOrigin().y());
if(vel<0.003){
yaw = tf::getYaw(transform2.getRotation());
}

speed_count = 0;
xlast = transform2.getOrigin().x(); ylast = transform2.getOrigin().y();
}
else speed_count++;


..... more code

Any help??

edit retag close merge delete

Sort by » oldest newest most voted

You can simply display the tf for /base_link. That way you not only get the orientation, but the full pose as a coordinate frame.

more

1

If the /base_link tf is being published (it seems like it is from your code) you can visualize it directly in rviz. Just make sure you choose a proper fixed frame in the global options, such as /map

But that gives me a quaternion X Y Z W. So what that mean for the robot orientation?? I have for example a Yaw of 80 deg. So what the relation of that to the quaternion X Y Z W?

1

The TF display in rviz will show you a coordinate frame (a red/green/blue thing as the ones in the link provided). If you are interested in the numerical value of the angle in degrees it won't help you, but then again if you only want that you don't need rviz. All it takes is a std::cout statement.