This tutorial shows how to create a map using ROS nodes. The other variant (todo: add link) is first creating dump files, and then uses the dump files to create a map.

By using ROS nodes, we can easily create a map in an online fashion, that is, creating a map live while the robot is collecting data. However since this has to run at realtime (or at least at a fixed frame rate, when using bag files), this method will inevitably drop sensor data if the data procession is too slow.

For the example below, we are using a bag file, instead of live data. Depending on your hardware, you might want to slow down the playback speed, and/or use the “-shrink” and “-skip” command line options to reduce the required computation power.

Use the thin_scan_matcher to provide odometry by using the laser range finder.

rosrun thin_scan_matcher thin_scan_matcher_node _bpr:=1 _published_odom_topic:=/odom

Start the odom_tf_publisher.

rosrun fps_mapper odom_tf_publisher_node transforms.txt

The actual mapper node.

rosrun fps_mapper fps_local_mapper_node \
  -t /calib_camera_front/depth/image_raw \
  -t /calib_camera_left/depth/image_raw \
  -t /calib_camera_right/depth/image_raw \
  -base_link_frame_id base_link -shrink 2 -skip 2 -max_distance 3.5 \
  -o house1.txt

Camera calibration, one node for each camera:

rosrun easydepthcalibration driver_node \
  _sub:=/camera_front/depth \
  _pub:=/calib_camera_front/depth \
  _calib:=calibrazioni_interne_xtion/front/front_calibration.txt
rosrun easydepthcalibration driver_node \
  _sub:=/camera_left/depth \
  _pub:=/calib_camera_left/depth \
  _calib:=calibrazioni_interne_xtion/left/left_calibration.txt
rosrun easydepthcalibration driver_node \
  _sub:=/camera_right/depth \
  _pub:=/calib_camera_right/depth \
  _calib:=calibrazioni_interne_xtion/right/right_calibration.txt

Playing form the bag file

rosbag play --pause --clock house_good1.bag /odom:=/odom_old -r 0.5 -s 140