Here's a sample nav_msgs/Odometry message, the first part of which is a geometry_msgs/Pose message:
header:
seq: 239
stamp:
secs: 1408542253
nsecs: 730130796
frame_id: odom
child_frame_id: base_link
pose:
pose:
position:
x: 19.4294389
y: -1.4772684
z: -0.6923008
orientation:
x: 0.01773404
y: 0.01089619
z: -0.0490339
w: 0.99858021
covariance: [0.00145422, 0.00000001, 0.00000018, -0.0000000, 0.00000000, 0.00000000, 0.00000001, 0.00145451, -0.0000003, -0.0000000, -0.0000000, 0.00000000, 0.00000018, -0.0000003, 0.01903145, 0.00000000, -0.0000000, 0.00000000, -0.0000000, -0.0000000, 0.00000000, 0.00000099, 0.00000000, 0.00000000, 0.00000000, -0.0000000, -0.0000000, 0.00000000, 0.00000099, -0.0000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, -0.0000000, 0.00000099]
The part you need is the "orientation." It is represented as a quaternion instead of Euler angles. To get the Euler angles, you need to carry out a conversion. If you want to do it with C++, you can do something like this:
tf::Quaterion quat;
tf::quaternionMsgToTF(msg->pose.pose.orientation, orientation);
tf::Matrix3x3 orTmp(quat);
orTmp.getRPY(roll, pitch, yaw);
If you're doing it in Excel, you'll need to carry out the conversion yourself. If you're simply after the robot's heading, you want the "yaw" value.
You should provide more information. Where do you get these values from? What robot are you talking about (something like turtlebot with x,y,theta or a arm with an end effector)? What is the root of you world coordinate system?
It is a mobile robot like turtlebot. The message type is Odometry obtained from nav_msgs.msg. I obtain pose from this message type. In this pose, the first two values are easting and northing. The third value is the yaw value. Can you tell me if its possible to know direction using yaw value?
In that case, as dornhege said, the direction IS the yaw value. At some point you have defined a world reference system. Maybe it is the first position the robot is in, when you start the program. From this orientation, the yaw value tells you in which direction the robot is currently pointing.
Thanks. But how do I use yaw = -0.058558705984261855 and give it a direction in the form of an arrow? Seems difficult to me.
I don't know how to plot in excel. Depending on how you define an arrow in excel, you might need to transform the value from rad to degree. But I guess for plotting in excel, this is the wrong forum to ask.
So, do you agree that the yaw value that I have mentioned is in radians?
It most likely is. But you can check that very easily via moving the robot. Let it turn for 180degrees and check the values. Or keep the orientation and just move forward a bit, check which values change by how much.
If you know how to draw a line segment in Excel (is that possible?) and you just want to see which direction it's pointing, make the line start point (0, 0) and the end (cos(yaw), sin(yaw)).