Ask Your Question
0

How to correctly create an odometry message

asked 2014-03-23 04:54:01 -0500

Maya gravatar image

Hi everyone.

I creating a driver for my motors and I'm wondering how to create a "good" odometry data to send on the /odom topic. For instance, I know that documentation but I'm wondering if I should initialize all the parameters, especially the header part.

This is the header :

uint32 seq
time stamp
string frame_id

Should I declare stuff like header.frame_id="base_link" or is it automatically done in some way ?

For now my Odometry data is an attribute of my class robot, should I redeclare a new nav_msgs::Odometry each time I'm sending an information on the /odom topic for the header information to be updated ? Especially I didn't find constructor declaration as well.

I didn't find any clear explanation on that on the wiki. I plan on using robot_base_efk afterward.

Thanks a lot.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-03-23 05:24:48 -0500

updated 2014-03-23 06:20:16 -0500

For any message with a header, you should set the frame_id and stamp. You can ignore seq; it will be set automatically. Reusing the same object, and updating the relevant fields each time you publish should be fine, as long as it hasn't gone out of scope.

The stamp can be set with a ros::Time object like ros::Time::now(), and frame_id can be set with a string like you did in your question.

edit flag offensive delete link more

Comments

How am I suppose to initialize it correctly ? I don't understand that at all... #Two-integer timestamp that is expressed as: # * stamp.sec: seconds (stamp_secs) since epoch # * stamp.nsec: nanoseconds since stamp_secs # time-handling sugar is provided by the client library time stamp

Maya gravatar imageMaya ( 2014-03-23 05:28:50 -0500 )edit

Ah, yeah the message definition doesn't make that clear. I'll update my answer.

Dan Lazewatsky gravatar imageDan Lazewatsky ( 2014-03-23 06:18:09 -0500 )edit

Thanks a lot !

Maya gravatar imageMaya ( 2014-03-23 06:59:09 -0500 )edit

Check out the wiki on ROS Time to understand better what this is about and how to create appropriate objects: http://wiki.ros.org/roscpp/Overview/Time

demmeln gravatar imagedemmeln ( 2014-03-23 07:06:49 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-03-23 04:54:01 -0500

Seen: 377 times

Last updated: Mar 23 '14