0
$\begingroup$

Rosanswers logo

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=SY7rScDd5h8 (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?


Originally posted by jc17 on ROS Answers with karma: 39 on 2014-06-13

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by al-dev with karma: 883 on 2014-06-13

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by jc17 on 2014-06-14:
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.

Comment by al-dev on 2014-06-14:
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.

Comment by al-dev on 2014-06-14:
You might want to have a look at this tutorial as well : http://wiki.ros.org/navigation/Tutorials/RobotSetup/Sensors

Comment by jc17 on 2014-06-16:
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

Comment by jc17 on 2014-06-16:
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?

Comment by al-dev on 2014-06-17:
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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.