map_server: Original error: parameter 'yaml_filename' is not initialized

asked 2023-04-01 11:24:37 -0500

bribri123 gravatar image

I have a launch file that uses the bringup_launch.py from the nav2_bringup package to bringup the nav2 stack, in my launch file I specify the map launch_argument for the bringup_launch.py, but when I run the launch file i get this error from the map_server

[component_container_isolated-1] [ERROR] [1680365329.934080822] []: Caught exception in callback for transition 10
[component_container_isolated-1] [ERROR] [1680365329.934091435] []: Original error: parameter 'yaml_filename' is not initialized
[component_container_isolated-1] [WARN] [1680365329.934112034] []: Error occurred while doing error handling.

Then when I try to use the bringup_launch.py directly, and I specify the map launch_argument manually, I don't get the error and the map is published

my launch file:

import os

from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription
from launch.actions import (DeclareLaunchArgument, GroupAction,
                            IncludeLaunchDescription, SetEnvironmentVariable)
from launch.conditions import IfCondition
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration, PythonExpression
from launch_ros.actions import PushRosNamespace
import launch_ros

def generate_launch_description():
    pkg_share = get_package_share_directory('neatonav2')
    nav_config_path = LaunchConfiguration('nav_params')
    rviz_config_path = LaunchConfiguration('rviz_path')
    map_path = LaunchConfiguration('map_path')
    bringup_dir = get_package_share_directory('nav2_bringup')

    nav_yaml_params = DeclareLaunchArgument(
        'nav_params',
        default_value=os.path.join(pkg_share, 'config', 'nav_params.yaml'),
        description='.yaml file for navigation config')

    rviz_path = DeclareLaunchArgument(
        'rviz_path',
        default_value=os.path.join(pkg_share, 'rviz', 'nav.rviz'),
        description='path for .rviz file')



 map_yaml_path = DeclareLaunchArgument(
        'map_path',
        default_value=os.path.join(pkg_share, "map", "map_save.yaml"),
        description='path for map file')

    rviz = launch_ros.actions.Node(
        package='rviz2',
        executable='rviz2',
        name='rviz2',
        arguments=['-d', rviz_config_path]
    )

    nav2_launch = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(os.path.join(bringup_dir, 'launch', 'bringup_launch.py')),
        launch_arguments={
                            "map": map_path,
                            "use_sim_time": "False",
                        "params_file": nav_config_path
                    }.items()
)

rviz = launch_ros.actions.Node(
    package='rviz2',
    executable='rviz2',
    name='rviz2',
    arguments=['-d', rviz_config_path]
)   

ld = LaunchDescription()
ld.add_action(nav_yaml_params)
ld.add_action(map_yaml_path)
ld.add_action(rviz_path)
ld.add_action(nav2_launch)
ld.add_action(rviz)
edit retag flag offensive close merge delete