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

How can you stream sensor data to ROS then watch a map get built from that data in real time?

asked 2014-06-13 18:49:17 -0600

jc17 gravatar image

updated 2014-06-17 18:31:57 -0600

Note: the original question was "How can one make a .bag out of a sensor's serial data, then play it back in real-time using gmapping?" - I changed the question to better reflect what I meant to ask, now knowing what I was looking for.

Hi everyone!

What I'm trying to do is to take a sensor's output data - namely the distance measured by a rangefinder - and use gmapping in ROS to create a map from that data. I want the map to update in rviz as more data comes in. Ideally, I want to be able to move the rangefinder around and collect data with it all while watching the map get created/updated in real time on a laptop running ROS (as opposed to surveying the entire area, creating a bag, then watching the map get created AFTER surveying).

I want to get a function similar to what's shown in this video: http://www.youtube.com/watch?v=SY7rSc... (I haven't been able to find any detailed info on the making-of process of this gadget)

Would you do this by creating a .bag file of the data from the sensor? How can you do this with serial data input?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-06-13 20:48:52 -0600

al-dev gravatar image

updated 2014-06-17 02:38:38 -0600

If you have a SLAM algorithm running on ROS (such as gmapping) and you want to display the map "in real time" as it gets built on rviz, you just need to create a new display item such as an OccupancyGrid and link it to the topic where the node running your SLAM publishes: "/map" by default.

If you only have a rangefinder and no odometry, you might want to have a look at hector_mapping instead of gmapping. The above technique should work for any node that publishes a map, and in particular for any SLAM algorithm.

edit flag offensive delete link more

Comments

Thanks for the hector_slam suggestion! But I'm still not clear on how to take the raw sensor data and pump it into a readable form in ROS for it to be made into a map.

jc17 gravatar image jc17  ( 2014-06-14 22:34:10 -0600 )edit

You need some kind of driver to read the data from your sensor and publish it in on one or several topics, generally using the sensor_msgs formats : http://wiki.ros.org/sensor_msgs. For instance if you use hokuyo laser scanners, you can use the hokuyo_node package.

al-dev gravatar image al-dev  ( 2014-06-14 23:23:42 -0600 )edit

You might want to have a look at this tutorial as well : http://wiki.ros.org/navigation/Tutorials/RobotSetup/Sensors

al-dev gravatar image al-dev  ( 2014-06-14 23:31:00 -0600 )edit

Beautiful response, that might be just what I was looking for. One last question before I close this up, just to clarify. I understand how to publish the sensor data to ROS. How can I take this data, now in ROS, and stream map building with it in rviz w/hector slam? Tutorials use existing .bags

jc17 gravatar image jc17  ( 2014-06-16 21:55:06 -0600 )edit

AND - let's say I won't use a Hokuyo laser scanner but a single-point laser rangefinder, like a Fluke 411. Might all this still potentially work? Just, the map would build a lot slower since distance data from only a very small field is acquired at a time?

jc17 gravatar image jc17  ( 2014-06-16 21:59:52 -0600 )edit

I edited my answer. Your last comment is a different question which deserves a different post, but you can have a look at the laser_drivers packages and you can google the presentation "Writing Hardware Drivers ROSCon". I am not familiar with the Fluke 411 so I cannot tell you much more.

al-dev gravatar image al-dev  ( 2014-06-17 02:41:45 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2014-06-13 18:49:17 -0600

Seen: 2,659 times

Last updated: Jun 17 '14