ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

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

asked 2012-11-24 17:58:44 -0500

Astronaut gravatar image


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;
                    listener.lookupTransform("/map", "/base_link",  
                                ros::Time(0), transform2);

                    catch (tf::TransformException ex){};

                vel = hypotenuse(xlast,ylast, transform2.getOrigin().x(),transform2.getOrigin().y());
                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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-11-24 21:14:41 -0500

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.

edit flag offensive delete link more


I can do that through rviz??

Astronaut gravatar image Astronaut  ( 2012-11-24 21:37:04 -0500 )edit

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

georgebrindeiro gravatar image georgebrindeiro  ( 2012-11-24 21:55:31 -0500 )edit

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?

Astronaut gravatar image Astronaut  ( 2012-11-24 21:56:21 -0500 )edit

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.

georgebrindeiro gravatar image georgebrindeiro  ( 2012-11-24 22:00:05 -0500 )edit

Question Tools


Asked: 2012-11-24 17:58:44 -0500

Seen: 3,014 times

Last updated: Nov 24 '12