How to publish whole message to a topic? [closed]
hello, how can i publish a whole message to a topic?, for example i have Laser Data being published on /lms200 topic, i have made a subscriber node which subscribes to the /lms200 topic which gives me the message in the following format:-
header:
seq: 296
stamp:
secs: 1417864716
nsecs: 451817364
frame_id: lms200
angle_min: -1.5707000494
angle_max: 1.5707000494
angle_increment: 0.0174000002444
time_increment: 0.0
scan_time: 0.0
range_min: 0.10000000149
range_max: 20.0
ranges: [9.380000114440918, 9.380000114440918, 9.380000114440918, 9.390000343322754, 9.390000343322754, 9.399999618530273, 9.420000076293945, 9.430000305175781, 9.449999809265137, 9.470000267028809, 9.5, 9.529999732971191, 9.5600004196167, 9.59000015258789, 9.630000114440918, 9.670000076293945, 1.7699999809265137, 1.7699999809265137]
intensities: []
now i want to group all these variables in a message (LaserScan.msg) and publish it on the /Scan topic.
I have gone through the Writing a Simple Publisher and Subscriber (C++)/Tutorial but there they have published the value only one variable, but i want to publish whole message, how can i do it??