mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 16:57:46 +08:00
Updated 2d scan turtlebot3 demo with deskewing option
This commit is contained in:
@@ -27,13 +27,17 @@ def launch_setup(context, *args, **kwargs):
|
|||||||
localization = localization == 'True' or localization == 'true'
|
localization = localization == 'True' or localization == 'true'
|
||||||
icp_odometry = LaunchConfiguration('icp_odometry').perform(context)
|
icp_odometry = LaunchConfiguration('icp_odometry').perform(context)
|
||||||
icp_odometry = icp_odometry == 'True' or icp_odometry == 'true'
|
icp_odometry = icp_odometry == 'True' or icp_odometry == 'true'
|
||||||
|
deskewing = LaunchConfiguration('deskewing').perform(context)
|
||||||
|
deskewing = deskewing == 'True' or deskewing == 'true'
|
||||||
|
|
||||||
parameters={
|
parameters={
|
||||||
'frame_id':'base_footprint',
|
'frame_id':'base_footprint',
|
||||||
'use_sim_time':use_sim_time,
|
'use_sim_time':use_sim_time,
|
||||||
'subscribe_depth':False,
|
'subscribe_depth':False,
|
||||||
'subscribe_rgb':False,
|
'subscribe_rgb':False,
|
||||||
'subscribe_scan':True,
|
'subscribe_scan':not deskewing,
|
||||||
|
'subscribe_scan_cloud':deskewing,
|
||||||
|
'scan_cloud_is_2d': True,
|
||||||
'approx_sync':True,
|
'approx_sync':True,
|
||||||
'use_action_for_goal':True,
|
'use_action_for_goal':True,
|
||||||
'Reg/Strategy':'1',
|
'Reg/Strategy':'1',
|
||||||
@@ -50,13 +54,24 @@ def launch_setup(context, *args, **kwargs):
|
|||||||
arguments.append('-d') # This will delete the previous database (~/.ros/rtabmap.db)
|
arguments.append('-d') # This will delete the previous database (~/.ros/rtabmap.db)
|
||||||
|
|
||||||
remappings=[
|
remappings=[
|
||||||
('scan', '/scan')]
|
('scan', '/scan' if not deskewing else 'scan_not_used'),
|
||||||
|
('scan_cloud', '/scan/deskewed' if deskewing else 'scan_cloud_not_used' )]
|
||||||
if icp_odometry:
|
if icp_odometry:
|
||||||
remappings.append(('odom', 'icp_odom'))
|
remappings.append(('odom', 'icp_odom'))
|
||||||
|
|
||||||
return [
|
return [
|
||||||
# Nodes to launch
|
# Nodes to launch
|
||||||
|
|
||||||
|
# Lidar deskewing (optional, useful with real lidar)
|
||||||
|
Node(
|
||||||
|
condition=IfCondition(LaunchConfiguration('deskewing')),
|
||||||
|
package='rtabmap_util', executable='lidar_deskewing', output='screen',
|
||||||
|
parameters=[{'wait_for_transform': 0.1,
|
||||||
|
'fixed_frame_id': 'odom',
|
||||||
|
'slerp': False,
|
||||||
|
'use_sim_time':use_sim_time}],
|
||||||
|
remappings=[('input_scan', '/scan')]),
|
||||||
|
|
||||||
# ICP odometry (optional)
|
# ICP odometry (optional)
|
||||||
Node(
|
Node(
|
||||||
condition=IfCondition(LaunchConfiguration('icp_odometry')),
|
condition=IfCondition(LaunchConfiguration('icp_odometry')),
|
||||||
@@ -97,5 +112,9 @@ def generate_launch_description():
|
|||||||
'icp_odometry', default_value='false',
|
'icp_odometry', default_value='false',
|
||||||
description='Launch ICP odometry on top of wheel odometry.'),
|
description='Launch ICP odometry on top of wheel odometry.'),
|
||||||
|
|
||||||
|
DeclareLaunchArgument(
|
||||||
|
'deskewing', default_value='false',
|
||||||
|
description='Do lidar scan deskewing based on wheel odometry.'),
|
||||||
|
|
||||||
OpaqueFunction(function=launch_setup)
|
OpaqueFunction(function=launch_setup)
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -182,6 +182,12 @@ def generate_launch_description():
|
|||||||
'icp_odometry', default_value='false',
|
'icp_odometry', default_value='false',
|
||||||
description='Launch ICP odometry on top of wheel odometry.'),
|
description='Launch ICP odometry on top of wheel odometry.'),
|
||||||
|
|
||||||
|
DeclareLaunchArgument(
|
||||||
|
'deskewing', default_value='false',
|
||||||
|
description='Do lidar scan deskewing based on wheel odometry. In simulation it '
|
||||||
|
'doesn\'t matter because laser scans are not skewed, but the option '
|
||||||
|
'is there for the demo.'),
|
||||||
|
|
||||||
DeclareLaunchArgument(
|
DeclareLaunchArgument(
|
||||||
'x_pose', default_value='-2.0',
|
'x_pose', default_value='-2.0',
|
||||||
description='Initial position of the robot in the simulator.'),
|
description='Initial position of the robot in the simulator.'),
|
||||||
|
|||||||
Reference in New Issue
Block a user