2022-11-20 15:08:01 -08:00
|
|
|
|
|
|
|
|
# Example to run rgbd datasets:
|
|
|
|
|
# [ROS1] Prepare ROS1 rosbag for conversion to ROS2
|
|
|
|
|
# $ wget http://vision.in.tum.de/rgbd/dataset/freiburg3/rgbd_dataset_freiburg3_long_office_household.bag
|
|
|
|
|
# $ rosbag decompress rgbd_dataset_freiburg3_long_office_household.bag
|
|
|
|
|
# $ wget https://raw.githubusercontent.com/srv/srv_tools/kinetic/bag_tools/scripts/change_frame_id.py
|
|
|
|
|
# Edit change_frame_id.py, remove/comment lines beginning with "PKG" and "import roslib", change line "Exception, e" to "Exception"
|
|
|
|
|
# $ roscore
|
|
|
|
|
# $ python3 change_frame_id.py -o rgbd_dataset_freiburg3_long_office_household_frameid_fixed.bag -i rgbd_dataset_freiburg3_long_office_household.bag -f openni_rgb_optical_frame -t /camera/rgb/image_color
|
|
|
|
|
# [ROS2]
|
|
|
|
|
# $ sudo pip install rosbags # See https://docs.openvins.com/dev-ros1-to-ros2.html
|
|
|
|
|
# $ rosbags-convert rgbd_dataset_freiburg3_long_office_household_frameid_fixed.bag
|
|
|
|
|
|
2023-02-26 18:05:08 -08:00
|
|
|
# $ ros2 launch rtabmap_examples rgbdslam_datasets.launch.py
|
2022-11-20 15:08:01 -08:00
|
|
|
# $ cd rgbd_dataset_freiburg3_long_office_household_frameid_fixed
|
2022-11-20 18:06:11 -08:00
|
|
|
# $ ros2 bag play rgbd_dataset_freiburg3_long_office_household_frameid_fixed.db3 --clock
|
2022-11-20 15:08:01 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
from launch import LaunchDescription
|
|
|
|
|
from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable
|
|
|
|
|
from launch.substitutions import LaunchConfiguration
|
|
|
|
|
from launch_ros.actions import Node
|
2022-11-20 18:06:11 -08:00
|
|
|
from launch_ros.actions import SetParameter
|
2022-11-20 15:08:01 -08:00
|
|
|
|
|
|
|
|
def generate_launch_description():
|
|
|
|
|
|
|
|
|
|
parameters=[{
|
|
|
|
|
'frame_id':'kinect',
|
|
|
|
|
'subscribe_depth':True,
|
|
|
|
|
'subscribe_odom_info':True,
|
|
|
|
|
# RTAB-Map's parameters should all be string type:
|
|
|
|
|
'Odom/Strategy':'0',
|
|
|
|
|
'Odom/ResetCountdown':'15',
|
|
|
|
|
'Odom/GuessSmoothingDelay':'0',
|
|
|
|
|
'Rtabmap/StartNewMapOnLoopClosure':'true',
|
|
|
|
|
'RGBD/CreateOccupancyGrid':'false',
|
|
|
|
|
'Rtabmap/CreateIntermediateNodes':'true',
|
|
|
|
|
'RGBD/LinearUpdate':'0',
|
|
|
|
|
'RGBD/AngularUpdate':'0'}]
|
|
|
|
|
|
|
|
|
|
remappings=[
|
|
|
|
|
('rgb/image', '/camera/rgb/image_color'),
|
|
|
|
|
('rgb/camera_info', '/camera/rgb/camera_info'),
|
|
|
|
|
('depth/image', '/camera/depth/image')]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return LaunchDescription([
|
|
|
|
|
|
2022-11-20 18:06:11 -08:00
|
|
|
SetParameter(name='use_sim_time', value=True),
|
|
|
|
|
# 'use_sim_time' will be set on all nodes following the line above
|
|
|
|
|
|
2022-11-20 15:08:01 -08:00
|
|
|
# Nodes to launch
|
|
|
|
|
Node(
|
2023-02-26 18:05:08 -08:00
|
|
|
package='rtabmap_odom', executable='rgbd_odometry', output='screen',
|
2022-11-20 15:08:01 -08:00
|
|
|
parameters=parameters,
|
|
|
|
|
remappings=remappings),
|
|
|
|
|
|
|
|
|
|
Node(
|
2023-02-26 18:05:08 -08:00
|
|
|
package='rtabmap_slam', executable='rtabmap', output='screen',
|
2022-11-20 15:08:01 -08:00
|
|
|
parameters=parameters,
|
|
|
|
|
remappings=remappings,
|
|
|
|
|
arguments=['-d']),
|
|
|
|
|
|
|
|
|
|
Node(
|
2023-02-26 18:05:08 -08:00
|
|
|
package='rtabmap_viz', executable='rtabmap_viz', output='screen',
|
2022-11-20 15:08:01 -08:00
|
|
|
parameters=parameters,
|
|
|
|
|
remappings=remappings),
|
|
|
|
|
|
2022-11-20 18:06:11 -08:00
|
|
|
# /tf topic is missing in the converted ROS2 bag, create a fake tf
|
2022-11-20 15:08:01 -08:00
|
|
|
Node(
|
|
|
|
|
package='tf2_ros', executable='static_transform_publisher', output='screen',
|
2022-11-20 18:06:11 -08:00
|
|
|
arguments=['0.0', '0.0', '0.0', '-1.57079632679', '0.0', '-1.57079632679', 'kinect', 'openni_rgb_optical_frame']),
|
2022-11-20 15:08:01 -08:00
|
|
|
])
|