This repo documents how RTAB-Map can be used to compare the mapping and localization performance of various sensor combinations on a robotic wheelchair.
Maintainer: Jit Ern
This package has been tested under ROS Noetic on Ubuntu 20.04.
- RTAB-Map installed and built from source with -DRTABMAP_SYNC_MULTI_RGBD=ON added to catkin_make, official installation instructions: https://github.com/introlab/rtabmap_ros?tab=readme-ov-file#build-from-source
- Python evo package to evaluate the localization accuracy: https://github.com/MichaelGrupp/evo.git
In a catkin workspace
cd ~/catkin_ws/src
git clone https://github.com/JITERN/FYP.git
cd ..
catkin_make
source devel/setup.bash
Parameters:
- num_cameras: 1 or 2
- scan: true or false
- cloud: true or false
- grid: 0,1 or 2 (Create occupancy grid from selected sensor: 0=laser scan, 1=depth image(s) or 2=both laser scan and depth image(s).)
- mapping: true or false (defaults to false = localization only mode)
Note: scan and cloud cannot be set to true at the same time.
Example with 3DLidar+2RGBD using both sensors for grid creation
roslaunch my_robot_navigation rtabmap.launch num_cameras:=2 scan:=false cloud:=true grid_sensor:=2 mapping:=true
To clear the rtabmap database and restart mapping from scratch, click "Edit>Delete memory" in RTAB-Map Viz window. Always click "Detection>Trigger a new map" on every seperate mapping session.
Play a rosbag or drive the robot in real-time, CTRL-C in the terminal where RTAB-Map is running to end the session and the session will be automatically saved.
rosbag play --clock lab.bag
To export the 2D occupancy grid
#rtabmap-databaseViewer <path_to_rtabmap.db>
rtabmap-databaseViewer .ros/rtabmap.db
Click "File>Regenerate optimized 2D map", then "File>Export optimized 2D map"
Example with 2DLidar+1RGBD
roslaunch my_robot_navigation rtabmap.launch num_cameras:=1 scan:=true cloud:=false grid_sensor:=2
Start roscore
roscore
On another terminal, record new rosbag with only TF data for localization trajectory evaluation
rosparam set use_sim_time true
rosbag record /tf /tf_static
On another terminal
rosbag play --clock lab.bag
Use Python evo package to process the new rosbag
evo_traj bag <new_rosbag_name>.bag /tf:map.base_footprint --save_as_tum
One .tum file will be created, rename to match the sensors used (i.e. 1cam2DLidar.tum)
Next, generate .zip file results
#evo_ape tum <ground_truth>.tum <test>.tum --save_results <output_file_path>.zip
evo_ape tum 2cam3DLidar_REF.tum 1cam2DLidar.tum --save_results ape/1cam2DLidar.zip
Repeat the above process with different sensor combinations to get multiple .zip files in the ape/ folder
Compare all the results
evo_res ape/*.zip
Available at https://entuedu-my.sharepoint.com/:f:/r/personal/limj0231_e_ntu_edu_sg/Documents/FYP?csf=1&web=1&e=XMSFgL
When using ROSbags recorded at ICH, play those in the folder 3DlidarTF_removed with the following running
rosrun tf2_ros static_transform_publisher -0.09 0 1.865 0 0.015 0.015 base_link rslidar
For recording more ROSbags on the MRCA, use
rosbag record /tf /tf_static /odometry/filtered /user/joy /cmd_vel /encoders/odom /imu /scan /rslidar_points --node=/laserscan_multi_merger -e '/ob_camera_(.*)/(color|depth)/(image_raw|camera_info)' "