[CLOSED] Messages on the /husky/odom topic


Good morning,

I am writing to ask for an advice on how I could get a heading direction (yaw) of the husky robot. I have tried subscribing to the /husky/odom and getting the orientation values. As described in the message type, I am expecting a quaternion which I convert to Euler angles. Then I visualized the values and I am a little bit surprised, in the simulation robot rotates by less than PI/ 2.0, however, plotted odometry values indicate several 2.0 * PI rotations. I am aware of the ROS coordinates system, but there might be a bug in my conversion script. However, I am guessing the there is a misunderstanding on what type of message is being published on that particular topic. Could somebody reassure that it is the quaternion that is being published or is there a misunderstanding and a bug?

Best regards
Gabija Bernotaite


To add to that, covariance values seem to be massive, I think 1000000.0 is not a little bit too much.


Hi Gabija

So the type of the odom message is here http://docs.ros.org/en/noetic/api/nav_msgs/html/msg/Odometry.html and the Orientation is of TwistWithCovariance type that is defined here http://docs.ros.org/en/noetic/api/geometry_msgs/html/msg/TwistWithCovariance.html
which is not a Pose message that you expect (read the message type).

You can see what the message type is by doing

rostopic info /husky/odom

and then it will show you the right message type

Type: nav_msgs/OdometryPublishers:

Subscribers: None



Thank you for your reply. Yes, I have listed the information of the topic. In ROS message types are layered and I was trying to access the orientation information. As per usual, I would expect orientation information to be stored in the pose variable. Twist represents the velocity vector, are you sure I am supposed to use twist message? I am used to using it for the velocity, acceleration estimation etc., but not the robot’s heading direction?

Best regards
Gabija Bernotaite


Dear Gabija,

Actually, your approach is correct. The data is indeed a quaternion, now if it’s not the correct data, I don’t know. You can check in the code as follows if this is what you expect.
The data is published in $HBP/GazeboRosPackages/src/husky_gazebo_plugins/src/husky_plugin.cpp:

tf::Quaternion qt;
odom_.pose.pose.orientation.x = qt.getX();
odom_.pose.pose.orientation.y = qt.getY();
odom_.pose.pose.orientation.z = qt.getZ();
odom_.pose.pose.orientation.w = qt.getW();



Thank you for the reply. Where is odom_pose_[2] coming from? I am suspecting wrong data. Has anyone else tried to extract robot’s heading direction?


Is it from simulated imu?


No it is directly from gazebo.