Robotics StackExchange | Archived questions

multiple msg (messages) combining to one

Hello!

Is it possible to write a C++ file which makes out of 16 messages just one? I need to use the ray sensor 16 times, so I will get 16 of the messages (i need to use it with ros, so i'm talking about this msg: http://docs.ros.org/api/sensor_msgs/html/msg/LaserScan.html) but I need to have just ONE message at the end. Is that possible?

thank you in aadvance

Asked by Boni on 2014-08-03 04:41:17 UTC

Comments

Is this a question about ros messages or gazebo messages? I know it's possible with gazebo messages, but if it's ros messages, then please post this to answers.ros.org

Asked by scpeters on 2014-08-04 19:20:57 UTC

Answers

There's a tutorial how to create ros messages here:

http://wiki.ros.org/ROS/Tutorials/CreatingMsgAndSrv

And you'll have to do define a message in the manner of the following:

Header header
string child_frame_id
sensor_msgs/LaserScan scan1
sensor_msgs/LaserScan scan2
sensor_msgs/LaserScan scan3
...

And then you could either write a gazebo plugin that maps the gazebo scans directly to a ros message, you would avoid some overhead or then as you suggested map the 16 ros messages to a single one, therefore you could write a simple ros node that does that, subscribe to your 16 messages and publish a single one, of the newly defined type.

Hope that helps, and yes as scpeters said, post ros only related questions on answers.ros.org.

Cheers

Asked by ffurrer on 2014-08-05 02:09:28 UTC

Comments