Home | Tutorials | Wiki | Issues
Ask Your Question
0

multiple msg (messages) combining to one

asked 2014-08-03 04:41:17 -0500

Boni gravatar image

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/h...) but I need to have just ONE message at the end. Is that possible?

thank you in aadvance

edit retag flag offensive close merge delete

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

scpeters gravatar imagescpeters ( 2014-08-04 19:20:57 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-08-05 02:09:28 -0500

ffurrer gravatar image

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

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

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

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-08-03 04:41:17 -0500

Seen: 402 times

Last updated: Aug 05 '14