Files
rtabmap_ros/rtabmap_demos/launch/robot_mapping_demo.launch.py
T
matlabbe 3f6adad463 ROS2 various QOL updates (preparing new binary release) (#1225)
* Updating examples and README

* updated main readme

* odom: Added always_check_imu_tf parameter. sync: increased default sync_queue_size from 2 to 5 (to be more flexible to different hardware), added input and output diagnostics. rtabmap_viz: fixed node with same name redeclared warning.

* update readme

* Added husky demo

* converted demo_robot_mapping.launch to ros2

* Converted stereo_outdoor demo from ros1 to ros2

* Converted multi-session demo to ros2

* Converted demo_find_object launch to ros2

* renamed files

* uniformized default qos, increased sync_queue_size default to 10

* Added vlp16 + imu example

* Added husky 3D lidar demos

* moved demos in subdir

* Added vlp16+zed example

* rtabmap_viz: ignore odom update if tf not ready when not using topic (to avoid showing red screen). Added champ VSLAM demo.

* forwarded camera_model arg for zed examples, removed qos for turtlebot4 demo

* pointcloud_to_depthimage: added more error logs, removed output camera_info published twice and match ros1 namespaces

* Created two base general examples for 3D lidar usage, then create hardware specific examples on top of them.

* Added isaac sim demo

* Final update of all demos. Fixed MapCloud rviz plugin crashing when floor/ceiling filtering is used and resulting cloud is empty.

* Fixed 2d scan deskewing output frame, moved nav2 params under "params" folder, added number of topics processed/dropped for odometry, added icp_odometry option for turtlebot3 scan-only demo.

* rtabmap_demos: added README with examples

* Added TOC

* bump version to 0.21.9
2024-11-30 17:28:16 -08:00

113 lines
5.1 KiB
Python

# Requirements:
# Download rosbag:
# * demo_mapping.db3: https://drive.google.com/file/d/1v9qJ2U7GlYhqBJr7OQHWbDSCfgiVaLWb/view?usp=drive_link
#
# Example:
#
# SLAM:
# $ ros2 launch rtabmap_demos robot_mapping_demo.launch.py rviz:=true rtabmap_viz:=true
#
# Rosbag:
# $ ros2 bag play demo_mapping.db3 --clock
#
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch.conditions import IfCondition, UnlessCondition
from launch_ros.actions import Node
from launch_ros.actions import SetParameter
import os
from ament_index_python.packages import get_package_share_directory
def generate_launch_description():
localization = LaunchConfiguration('localization')
parameters={
'frame_id':'base_footprint',
'odom_frame_id':'odom',
'odom_tf_linear_variance':0.001,
'odom_tf_angular_variance':0.001,
'subscribe_rgbd':True,
'subscribe_scan':True,
'approx_sync':True,
'sync_queue_size': 10,
# RTAB-Map's internal parameters should be strings
'RGBD/NeighborLinkRefining': 'true', # Do odometry correction with consecutive laser scans
'RGBD/ProximityBySpace': 'true', # Local loop closure detection (using estimated position) with locations in WM
'RGBD/ProximityByTime': 'false', # Local loop closure detection with locations in STM
'RGBD/ProximityPathMaxNeighbors': '10', # Do also proximity detection by space by merging close scans together.
'Reg/Strategy': '1', # 0=Visual, 1=ICP, 2=Visual+ICP
'Vis/MinInliers': '12', # 3D visual words minimum inliers to accept loop closure
'RGBD/OptimizeFromGraphEnd': 'false', # Optimize graph from initial node so /map -> /odom transform will be generated
'RGBD/OptimizeMaxError': '4', # Reject any loop closure causing large errors (>3x link's covariance) in the map
'Reg/Force3DoF': 'true', # 2D SLAM
'Grid/FromDepth': 'false', # Create 2D occupancy grid from laser scan
'Mem/STMSize': '30', # increased to 30 to avoid adding too many loop closures on just seen locations
'RGBD/LocalRadius': '5', # limit length of proximity detections
'Icp/CorrespondenceRatio': '0.2', # minimum scan overlap to accept loop closure
'Icp/PM': 'false',
'Icp/PointToPlane': 'false',
'Icp/MaxCorrespondenceDistance': '0.15',
'Icp/VoxelSize': '0.05'
}
remappings=[
('rgb/image', '/data_throttled_image'),
('depth/image', '/data_throttled_image_depth'),
('rgb/camera_info', '/data_throttled_camera_info'),
('scan', '/jn0/base_scan')]
config_rviz = os.path.join(
get_package_share_directory('rtabmap_demos'), 'config', 'demo_robot_mapping.rviz'
)
return LaunchDescription([
# Launch arguments
DeclareLaunchArgument('rtabmap_viz', default_value='true', description='Launch RTAB-Map UI (optional).'),
DeclareLaunchArgument('rviz', default_value='false', description='Launch RVIZ (optional).'),
DeclareLaunchArgument('localization', default_value='false', description='Launch in localization mode.'),
DeclareLaunchArgument('rviz_cfg', default_value=config_rviz, description='Configuration path of rviz2.'),
SetParameter(name='use_sim_time', value=True),
# Nodes to launch
Node(
package='rtabmap_sync', executable='rgbd_sync', output='screen',
parameters=[parameters,
{'rgb_image_transport':'compressed',
'depth_image_transport':'compressedDepth',
'approx_sync_max_interval': 0.02}],
remappings=remappings),
# SLAM mode:
Node(
condition=UnlessCondition(localization),
package='rtabmap_slam', executable='rtabmap', output='screen',
parameters=[parameters],
remappings=remappings,
arguments=['-d']), # This will delete the previous database (~/.ros/rtabmap.db)
# Localization mode:
Node(
condition=IfCondition(localization),
package='rtabmap_slam', executable='rtabmap', output='screen',
parameters=[parameters,
{'Mem/IncrementalMemory':'False',
'Mem/InitWMWithAllNodes':'True'}],
remappings=remappings),
# Visualization:
Node(
package='rtabmap_viz', executable='rtabmap_viz', output='screen',
condition=IfCondition(LaunchConfiguration("rtabmap_viz")),
parameters=[parameters],
remappings=remappings),
Node(
package='rviz2', executable='rviz2', name="rviz2", output='screen',
condition=IfCondition(LaunchConfiguration("rviz")),
arguments=[["-d"], [LaunchConfiguration("rviz_cfg")]]),
])