Files
rtabmap_ros/rtabmap_examples/launch/vlp16.launch.py
T
matlabbeandBorong Yuan c956e3780f Fixing topic sync lagging and delay issues, more examples (depthai, zed) (#1206)
* Fixed odometry latency

* Fixed node ID=0 issues as msgs may not have seq. (#1202)

(cherry picked from commit 097cab0667)

* Odom: removed long processing from ros callbacks (decreasing delay, also making delay independent of the message filters topic_queue_size and sync_queue_size parameters)

* Changed a log from info->debug

* Changed a log from info->debug

* Updated default topic and sync queue_size inside nodes. Exposing topic and sync queue size params in warning when cannot synchronize. Added zed and depthai examples. Odom: Fixed imu callback group, added multi-threaded executors for all odometry nodes.

* fixed merge

* Include everything needed in example launch files for simple launch. Small fixes.

---------

Co-authored-by: Borong Yuan <[email protected]>
2024-09-04 00:46:44 -07:00

128 lines
4.6 KiB
Python

# Example:
# $ ros2 launch rtabmap_examples vlp16.launch.py
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
def generate_launch_description():
use_sim_time = LaunchConfiguration('use_sim_time')
deskewing = LaunchConfiguration('deskewing')
return LaunchDescription([
# Launch arguments
DeclareLaunchArgument(
'use_sim_time', default_value='false',
description='Use simulation (Gazebo) clock if true'),
DeclareLaunchArgument(
'deskewing', default_value='true',
description='Enable lidar deskewing'),
# Nodes to launch
IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory('velodyne_driver'), 'launch'),
'/velodyne_driver_node-VLP16-launch.py']),
),
IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory('velodyne_pointcloud'), 'launch'),
'/velodyne_transform_node-VLP16-launch.py']),
),
Node(
package='rtabmap_odom', executable='icp_odometry', output='screen',
parameters=[{
'frame_id':'velodyne',
'odom_frame_id':'odom',
'wait_for_transform':0.2,
'expected_update_rate':15.0,
'deskewing':deskewing,
'use_sim_time':use_sim_time,
# RTAB-Map's internal parameters are strings:
'Icp/PointToPlane': 'true',
'Icp/Iterations': '10',
'Icp/VoxelSize': '0.1',
'Icp/Epsilon': '0.001',
'Icp/PointToPlaneK': '20',
'Icp/PointToPlaneRadius': '0',
'Icp/MaxTranslation': '2',
'Icp/MaxCorrespondenceDistance': '1',
'Icp/Strategy': '1',
'Icp/OutlierRatio': '0.7',
'Icp/CorrespondenceRatio': '0.01',
'Odom/ScanKeyFrameThr': '0.4',
'OdomF2M/ScanSubtractRadius': '0.1',
'OdomF2M/ScanMaxSize': '15000',
'OdomF2M/BundleAdjustment': 'false'
}],
remappings=[
('scan_cloud', '/velodyne_points')
]),
Node(
package='rtabmap_slam', executable='rtabmap', output='screen',
parameters=[{
'frame_id':'velodyne',
'subscribe_depth':False,
'subscribe_rgb':False,
'subscribe_scan_cloud':True,
'approx_sync':False,
'wait_for_transform':0.2,
'use_sim_time':use_sim_time,
# RTAB-Map's internal parameters are strings:
'RGBD/ProximityMaxGraphDepth': '0',
'RGBD/ProximityPathMaxNeighbors': '1',
'RGBD/AngularUpdate': '0.05',
'RGBD/LinearUpdate': '0.05',
'RGBD/CreateOccupancyGrid': 'false',
'Mem/NotLinkedNodesKept': 'false',
'Mem/STMSize': '30',
'Mem/LaserScanNormalK': '20',
'Reg/Strategy': '1',
'Icp/VoxelSize': '0.1',
'Icp/PointToPlaneK': '20',
'Icp/PointToPlaneRadius': '0',
'Icp/PointToPlane': 'true',
'Icp/Iterations': '10',
'Icp/Epsilon': '0.001',
'Icp/MaxTranslation': '3',
'Icp/MaxCorrespondenceDistance': '1',
'Icp/Strategy': '1',
'Icp/OutlierRatio': '0.7',
'Icp/CorrespondenceRatio': '0.2'
}],
remappings=[
('scan_cloud', 'odom_filtered_input_scan')
],
arguments=[
'-d' # This will delete the previous database (~/.ros/rtabmap.db)
]),
Node(
package='rtabmap_viz', executable='rtabmap_viz', output='screen',
parameters=[{
'frame_id':'velodyne',
'odom_frame_id':'odom',
'subscribe_odom_info':True,
'subscribe_scan_cloud':True,
'approx_sync':False,
'use_sim_time':use_sim_time,
}],
remappings=[
('scan_cloud', 'odom_filtered_input_scan')
]),
])