navigation.launch.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #
  2. # Copyright (c) Contributors to the Open 3D Engine Project.
  3. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. import pathlib
  8. from ament_index_python.packages import get_package_share_directory
  9. from launch import LaunchDescription
  10. from launch.actions import IncludeLaunchDescription
  11. from launch.launch_description_sources import PythonLaunchDescriptionSource
  12. from launch_ros.actions import Node
  13. def generate_launch_description():
  14. slam_launch_file = pathlib.Path(__file__).parent.absolute().joinpath('slam.launch.py')
  15. navigation_launch_file = pathlib.Path(
  16. get_package_share_directory("nav2_bringup")).joinpath(
  17. 'launch', 'navigation_launch.py')
  18. navigation_param_file = pathlib.Path(__file__).parent.absolute().joinpath(
  19. 'config', 'navigation_params.yaml')
  20. rviz_config_file = pathlib.Path(__file__).parent.absolute().joinpath(
  21. 'config', 'config.rviz')
  22. return LaunchDescription([
  23. IncludeLaunchDescription(
  24. PythonLaunchDescriptionSource([str(slam_launch_file)])
  25. ),
  26. IncludeLaunchDescription(
  27. PythonLaunchDescriptionSource([str(navigation_launch_file)]),
  28. launch_arguments={
  29. 'params_file': str(navigation_param_file)
  30. }.items()
  31. ),
  32. Node(
  33. package='rviz2',
  34. executable='rviz2',
  35. name='slam',
  36. output='log',
  37. arguments=[
  38. '-d', str(rviz_config_file),
  39. ]
  40. ),
  41. ])