2020-01-30 17:18:48 -05:00
|
|
|
# Requirements:
|
|
|
|
|
# Install Turtlebot3 packages
|
|
|
|
|
# Install https://github.com/mlherd/ros2_turtlebot3_waffle_intel_realsense
|
|
|
|
|
# Example:
|
2021-10-04 19:29:19 -04:00
|
|
|
# $ export TURTLEBOT3_MODEL=waffle
|
2020-01-30 17:18:48 -05:00
|
|
|
# $ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
|
2021-10-04 19:29:19 -04:00
|
|
|
# $ ros2 run turtlebot3_teleop teleop_keyboard
|
2021-10-01 18:48:45 -04:00
|
|
|
#
|
2020-01-30 17:18:48 -05:00
|
|
|
# $ ros2 launch rtabmap_ros turtlebot3_rgbd_sync.launch.py
|
2021-10-01 18:48:45 -04:00
|
|
|
# OR
|
2021-10-04 19:29:19 -04:00
|
|
|
# $ ros2 launch rtabmap_ros rtabmap.launch.py visual_odometry:=false frame_id:=base_footprint subscribe_scan:=true approx_sync:=true odom_topic:=/odom args:="-d --RGBD/NeighborLinkRefining true --Reg/Strategy 1" use_sim_time:=true rgbd_sync:=true rgb_topic:=/intel_realsense_r200_depth/image_raw depth_topic:=/intel_realsense_r200_depth/depth/image_raw camera_info_topic:=/intel_realsense_r200_depth/camera_info
|
2020-01-30 17:18:48 -05:00
|
|
|
|
|
|
|
|
from launch import LaunchDescription
|
|
|
|
|
from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable
|
|
|
|
|
from launch.substitutions import LaunchConfiguration
|
2020-10-16 18:02:08 +03:00
|
|
|
from launch_ros.actions import Node
|
|
|
|
|
|
2020-01-30 17:18:48 -05:00
|
|
|
|
|
|
|
|
def generate_launch_description():
|
|
|
|
|
|
|
|
|
|
use_sim_time = LaunchConfiguration('use_sim_time')
|
2021-11-08 18:36:19 -05:00
|
|
|
qos = LaunchConfiguration('qos')
|
2020-01-30 17:18:48 -05:00
|
|
|
|
|
|
|
|
parameters=[{
|
|
|
|
|
'frame_id':'base_footprint',
|
|
|
|
|
'use_sim_time':use_sim_time,
|
|
|
|
|
'subscribe_rgbd':True,
|
2021-10-04 19:29:19 -04:00
|
|
|
'subscribe_scan':True,
|
2021-11-08 18:36:19 -05:00
|
|
|
'qos_scan':qos,
|
|
|
|
|
'qos_image':qos,
|
|
|
|
|
'qos_imu':qos,
|
2021-10-05 18:01:30 -04:00
|
|
|
# RTAB-Map's parameters should be strings:
|
2021-10-04 19:29:19 -04:00
|
|
|
'Reg/Strategy':'1',
|
2021-10-05 18:01:30 -04:00
|
|
|
'RGBD/NeighborLinkRefining':'True',
|
|
|
|
|
'Optimizer/GravitySigma':'0' # Disable imu constraints (we are already in 2D)
|
|
|
|
|
}]
|
2020-01-30 17:18:48 -05:00
|
|
|
|
|
|
|
|
remappings=[
|
|
|
|
|
('rgb/image', '/intel_realsense_r200_depth/image_raw'),
|
|
|
|
|
('rgb/camera_info', '/intel_realsense_r200_depth/camera_info'),
|
|
|
|
|
('depth/image', '/intel_realsense_r200_depth/depth/image_raw')]
|
|
|
|
|
|
|
|
|
|
return LaunchDescription([
|
|
|
|
|
|
|
|
|
|
# Launch arguments
|
|
|
|
|
DeclareLaunchArgument(
|
|
|
|
|
'use_sim_time', default_value='true',
|
|
|
|
|
description='Use simulation (Gazebo) clock if true'),
|
2021-11-08 18:36:19 -05:00
|
|
|
|
|
|
|
|
DeclareLaunchArgument(
|
|
|
|
|
'qos', default_value='2',
|
|
|
|
|
description='QoS used for input sensor topics'),
|
2020-01-30 17:18:48 -05:00
|
|
|
|
|
|
|
|
# Nodes to launch
|
|
|
|
|
Node(
|
2021-07-13 09:05:07 +02:00
|
|
|
package='rtabmap_ros', executable='rgbd_sync', output='screen',
|
2021-11-08 18:36:19 -05:00
|
|
|
parameters=[{'approx_sync':True, 'use_sim_time':use_sim_time, 'qos':qos}],
|
2020-01-30 17:18:48 -05:00
|
|
|
remappings=remappings),
|
|
|
|
|
|
|
|
|
|
Node(
|
2021-07-13 09:05:07 +02:00
|
|
|
package='rtabmap_ros', executable='rtabmap', output='screen',
|
2020-01-30 17:18:48 -05:00
|
|
|
parameters=parameters,
|
|
|
|
|
remappings=remappings,
|
|
|
|
|
arguments=['-d']),
|
|
|
|
|
|
|
|
|
|
Node(
|
2021-07-13 09:05:07 +02:00
|
|
|
package='rtabmap_ros', executable='rtabmapviz', output='screen',
|
2020-01-30 17:18:48 -05:00
|
|
|
parameters=parameters,
|
|
|
|
|
remappings=remappings),
|
|
|
|
|
])
|