Advertisement
Guest User

online_async_launch.py

a guest
Jul 30th, 2023
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. import os
  2.  
  3. from launch import LaunchDescription
  4. from launch.actions import DeclareLaunchArgument
  5. from launch.substitutions import LaunchConfiguration
  6. from launch_ros.actions import Node
  7. from ament_index_python.packages import get_package_share_directory
  8.  
  9.  
  10. def generate_launch_description():
  11. use_sim_time = LaunchConfiguration('use_sim_time')
  12. slam_params_file = LaunchConfiguration('slam_params_file')
  13.  
  14. declare_use_sim_time_argument = DeclareLaunchArgument(
  15. 'use_sim_time',
  16. default_value='false',
  17. description='Use simulation/Gazebo clock')
  18. declare_slam_params_file_cmd = DeclareLaunchArgument(
  19. 'slam_params_file',
  20. default_value=os.path.join(get_package_share_directory("nav2_bringup"),
  21. 'params', 'mapper_params_online_async.yaml'),
  22. description='Full path to the ROS2 parameters file to use for the slam_toolbox node')
  23.  
  24. start_async_slam_toolbox_node = Node(
  25. parameters=[
  26. slam_params_file,
  27. {'use_sim_time': use_sim_time}
  28. ],
  29. package='slam_toolbox',
  30. executable='async_slam_toolbox_node',
  31. name='slam_toolbox',
  32. output='screen')
  33.  
  34. ld = LaunchDescription()
  35.  
  36. ld.add_action(declare_use_sim_time_argument)
  37. ld.add_action(declare_slam_params_file_cmd)
  38. ld.add_action(start_async_slam_toolbox_node)
  39.  
  40. return ld
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement