ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

name of ros message

asked 2014-04-06 20:56:00 -0500

flightgong gravatar image

Hi, I write a script to listen from a robot laser. I know which topic it is, but I cannot find the message name. So, I cannot use its attribute like ranges[]. Could u please tell me how to deal with it, I am a beginner to ros

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-04-06 21:31:13 -0500

Tirjen gravatar image

updated 2014-04-06 23:23:59 -0500

I suppose you are working in python, so I suggest you to look at this tutorial. You can see the message type of a topic using the command rostopic info /topic_name, in your case the message type should be sensor_msgs/LaserScan.

edit flag offensive delete link more


Hi, I already know my topic name, but I use my script to listen the robot. SO, I need the laserscan data. However, I have no idea how to extract the laser scan data. thx!

flightgong gravatar image flightgong  ( 2014-04-06 21:46:23 -0500 )edit

maybe I didn't understood the question, but is the message type what you need? As I said use the command `rostopic info /topic_name`, where /topic_name is the name of your laser topic (should be sensor_msgs/LaserScan) then in your code (look at the tutorial) use `from sensor_msgs.msg import LaserScan` to import what you need.

Tirjen gravatar image Tirjen  ( 2014-04-06 23:22:10 -0500 )edit

Thanks, actually I want to extract the laser scan data from the stageros robot. But I don't know how to do it? Again, thx

flightgong gravatar image flightgong  ( 2014-04-06 23:32:46 -0500 )edit

Again, look at the tutorial I linked in my answer. This assumes obviously that you have done the previous tutorials and that you have programming knowledge in python (or C++).

Tirjen gravatar image Tirjen  ( 2014-04-07 00:06:15 -0500 )edit

Question Tools

1 follower


Asked: 2014-04-06 20:56:00 -0500

Seen: 163 times

Last updated: Apr 06 '14