Ask Your Question

How to merge two different topics and create a new one?

asked 2017-08-12 16:53:49 -0500

pmundt gravatar image

I am trying to publish odometry data from a STM32-F446re over serial and using rosserial_python for subscribing/publishing.

Since odometry messages are very big to transfer over serial, I only want to publish pose and twist without covariance matrices and would like to construct odom topic at the host side (add covariance at the host side).

How can I merge pose and twist messages to create a odom message?

edit retag flag offensive close merge delete



If both of these messages are coming from the same source, it might be easier to define a custom message that contains a pose and a twist so that you can publish that on a single topic, and then write a node which converts that into a full odom message.

ahendrix gravatar image ahendrix  ( 2017-08-12 17:07:38 -0500 )edit

Other than creating a custom message and writing a node, can I achieve this with using any tool (like any topic_tools feature)?

pmundt gravatar image pmundt  ( 2017-08-12 17:12:41 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-08-13 04:20:19 -0500

To the best of my knowledge there is no such tool for automated merging of messages. As in your case a fair amount of additional information would need to be filled (i.e. covariances) your best bet is writing a small node yourself. You could also consider creating a custom message that contains all the data you need in compressed/minimal form (i.e. only transmit yaw angle and x,y etc.). I've taken a similar approach (albeit in the PC -> Arduino direction) for transmitting motion commands: DiffDriveCommand is the minimal pwm message sent over rosserial and the translator node takes care of translating ROS commands (joystick or Twist) to the minimal representation.

edit flag offensive delete link more


Thank you very much for giving me a starting point.

pmundt gravatar image pmundt  ( 2017-08-13 10:06:30 -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



Asked: 2017-08-12 16:53:49 -0500

Seen: 861 times

Last updated: Aug 13 '17