mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 00:37:46 +08:00
* 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
179 lines
6.6 KiB
Python
179 lines
6.6 KiB
Python
|
|
# Similar to gazebo example on https://github.com/chvmp/champ/tree/ros2, we can do:
|
|
#
|
|
# Run the Gazebo environment:
|
|
# $ ros2 launch champ_config gazebo.launch.py
|
|
#
|
|
# Run Nav2's navigation and rtabmap:
|
|
# $ ros2 launch rtabmap_demos champ_vslam.launch.py use_sim_time:=true rviz:=true rtabmap_viz:=true
|
|
#
|
|
# When a map is already created using command above, we can re-launch in localization-only mode with:
|
|
# $ ros2 launch rtabmap_demos champ_vslam.launch.py use_sim_time:=true rviz:=true rtabmap_viz:=true localization:=true
|
|
#
|
|
|
|
from launch import LaunchDescription
|
|
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, OpaqueFunction
|
|
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
|
|
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
|
from launch.conditions import IfCondition, UnlessCondition
|
|
from launch_ros.substitutions import FindPackageShare
|
|
from launch_ros.actions import Node
|
|
|
|
def launch_setup(context, *args, **kwargs):
|
|
|
|
localization = LaunchConfiguration('localization')
|
|
|
|
navigation_launch_path = PathJoinSubstitution(
|
|
[FindPackageShare('nav2_bringup'), 'launch', 'navigation_launch.py']
|
|
)
|
|
|
|
nav2_params_file = PathJoinSubstitution(
|
|
[FindPackageShare('rtabmap_demos'), 'params', 'champ_nav2_params.yaml']
|
|
)
|
|
|
|
rviz_config_path = PathJoinSubstitution(
|
|
[FindPackageShare('champ_navigation'), 'rviz', 'navigation.rviz']
|
|
)
|
|
|
|
use_sim_time = LaunchConfiguration("use_sim_time")
|
|
|
|
# With the simulator, the imu is not published fast enough
|
|
# and have a huge delay, disabling imu usage from VO
|
|
use_imu = use_sim_time.perform(context) in ["false", "False"]
|
|
|
|
vslam_params ={
|
|
'frame_id':'base_link',
|
|
'guess_frame_id':'odom',
|
|
'approx_sync': False,
|
|
'use_sim_time':use_sim_time,
|
|
'subscribe_rgbd':True,
|
|
'subscribe_odom_info':True,
|
|
'use_action_for_goal':True,
|
|
'wait_imu_to_init': use_imu,
|
|
'wait_for_transform': 0.5,
|
|
# RTAB-Map's parameters should be strings
|
|
'Grid/DepthDecimation': '1',
|
|
'Grid/RangeMax': '2',
|
|
'GridGlobal/MinSize': '20',
|
|
'Grid/MinClusterSize': '20',
|
|
'Grid/MaxObstacleHeight': '2',
|
|
'Odom/ResetCountdown': '2', # sim is very flaky
|
|
'Kp/RoiRatios': '0.0 0.0 0.0 0.4' # ignore ground for loop closure detection (sim uses a very repetitive texture)
|
|
}
|
|
|
|
vslam_remappings=[('imu', 'imu/data/filtered'),
|
|
('odom', 'vo')]
|
|
|
|
return [
|
|
IncludeLaunchDescription(
|
|
PythonLaunchDescriptionSource(navigation_launch_path),
|
|
launch_arguments={
|
|
'use_sim_time': use_sim_time,
|
|
'params_file': nav2_params_file
|
|
}.items()
|
|
),
|
|
|
|
Node(
|
|
package='rviz2',
|
|
executable='rviz2',
|
|
name='rviz2',
|
|
output='screen',
|
|
arguments=['-d', rviz_config_path],
|
|
condition=IfCondition(LaunchConfiguration("rviz")),
|
|
parameters=[{'use_sim_time': use_sim_time}]
|
|
),
|
|
|
|
# compute imu orientation
|
|
Node(
|
|
package='imu_filter_madgwick', executable='imu_filter_madgwick_node', output='screen',
|
|
parameters=[{
|
|
'use_mag':False,
|
|
'world_frame':'enu',
|
|
'publish_tf':False}],
|
|
remappings=[
|
|
('imu/data_raw', 'imu/data'),
|
|
('imu/data', 'imu/data/filtered')
|
|
]),
|
|
|
|
# VSLAM nodes:
|
|
Node(
|
|
package='rtabmap_sync', executable='rgbd_sync', output='screen',
|
|
parameters=[vslam_params],
|
|
remappings=[('rgb/image', '/camera/image_raw'),
|
|
('rgb/camera_info', '/camera/camera_info'),
|
|
('depth/image', '/camera/depth/image_raw')]),
|
|
|
|
Node(
|
|
package='rtabmap_odom', executable='rgbd_odometry', output='screen',
|
|
parameters=[vslam_params, {'odom_frame_id': 'vo'}],
|
|
remappings=vslam_remappings,
|
|
arguments=["--ros-args", "--log-level", 'info']),
|
|
|
|
# SLAM Mode:
|
|
Node(
|
|
condition=UnlessCondition(localization),
|
|
package='rtabmap_slam', executable='rtabmap', output='screen',
|
|
parameters=[vslam_params],
|
|
remappings=vslam_remappings,
|
|
arguments=['-d']),
|
|
|
|
# Localization mode:
|
|
Node(
|
|
condition=IfCondition(localization),
|
|
package='rtabmap_slam', executable='rtabmap', output='screen',
|
|
parameters=[vslam_params,
|
|
{'Mem/IncrementalMemory':'False',
|
|
'Mem/InitWMWithAllNodes':'True'}],
|
|
remappings=vslam_remappings),
|
|
|
|
Node(
|
|
package='rtabmap_viz', executable='rtabmap_viz', output='screen',
|
|
condition=IfCondition(LaunchConfiguration("rtabmap_viz")),
|
|
parameters=[vslam_params],
|
|
remappings=vslam_remappings),
|
|
|
|
# Compute ground/obstacle clouds for nav2 voxel layers
|
|
Node(
|
|
package='rtabmap_util', executable='point_cloud_xyz', output='screen',
|
|
parameters=[{'decimation': 2,
|
|
'max_depth': 3.0,
|
|
'voxel_size': 0.02}],
|
|
remappings=[('depth/image', '/camera/depth/image_raw'),
|
|
('depth/camera_info', '/camera/depth/camera_info'),
|
|
('cloud', '/camera/cloud')]),
|
|
|
|
Node(
|
|
package='rtabmap_util', executable='obstacles_detection', output='screen',
|
|
parameters=[vslam_params],
|
|
remappings=[('cloud', '/camera/cloud'),
|
|
('obstacles', '/camera/obstacles'),
|
|
('ground', '/camera/ground')]),
|
|
]
|
|
|
|
def generate_launch_description():
|
|
|
|
return LaunchDescription([
|
|
DeclareLaunchArgument(
|
|
name='use_sim_time',
|
|
default_value='false',
|
|
description='Enable use_sime_time to true'
|
|
),
|
|
|
|
DeclareLaunchArgument(
|
|
name='rviz',
|
|
default_value='false',
|
|
description='Run rviz'
|
|
),
|
|
|
|
DeclareLaunchArgument(
|
|
name='rtabmap_viz',
|
|
default_value='false',
|
|
description='Run rtabmap_viz'
|
|
),
|
|
|
|
DeclareLaunchArgument(
|
|
'localization', default_value='false', choices=['true', 'false'],
|
|
description='Launch rtabmap in localization mode (a map should have been already created).'),
|
|
|
|
OpaqueFunction(function=launch_setup)
|
|
]) |