ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROS2 Nav2 Not Starting with namespace

asked 2023-02-26 08:02:18 -0500

hussein_mo gravatar image

I have a ROS2 workspace with a package that is functioning properly. This package starts Nav2 using the bringup_launch script.

Now I want to start Nav2 with a given namespace. However, when I pass the namespace argument (as below), everything starts correctly but the Nav2 stack doesn't show any info in the command line and also shows up as unknown in RViz (It hasn't started). The other nodes being launched along with Nav2 start correctly with the namespace argument (ex. robot_state_publisher and robot_localization)

Nav2 is started as follows:

nav2_launch = IncludeLaunchDescription(
    PythonLaunchDescriptionSource(os.path.join(nav2_launch_dir, 'bringup_launch.py')),
    launch_arguments = {'map': static_map_path, 
                        'params_file': nav2_params_path, 
                        'use_sim_time': LaunchConfiguration('use_sim_time'), 
                        'autostart': 'true',
                        'namespace': 'abc',
                        'use_namespace': 'true'}.items()
)

Any Ideas why? Also, can someone please provide the correct way to launch Nav2 if the given approach is not correct?

For reference, the following comments show how the other nodes are started

remappings = [('/tf', 'tf'), 
              ('/tf_static', 'tf_static')]

robot_state_publisher_node = launch_ros.actions.Node(
    package='robot_state_publisher',
    executable='robot_state_publisher',
    parameters=[{'robot_description': Command(['xacro ', LaunchConfiguration('model')]), 
                 'use_sim_time': LaunchConfiguration('use_sim_time')}],
    remappings=remappings,
    namespace='abc',
)

map_odom_publisher = launch_ros.actions.Node(
    package="tf2_ros",
    executable="static_transform_publisher",
    output="screen" ,
    arguments=["--x", "0", "--y", "0", "--z", "0", "--roll", "0", "--pitch", "0", "--yaw", "0", "--frame-id", "map", "--child-frame-id", "odom"],
    remappings=remappings,
    namespace='abc',
)

robot_localization_node = launch_ros.actions.Node(
    package='robot_localization',
    executable='ekf_node',
    name='ekf_filter_node',
    output='screen',
    parameters=[os.path.join(pkg_share, 'config', 'ekf.yaml'), 
                {'use_sim_time': LaunchConfiguration('use_sim_time')}],
    remappings=remappings,
    namespace='abc'
)

ROS2 Distribution: humble

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-04-17 03:24:35 -0500

Filipe Cerveira gravatar image

Hi,

The problem is not related to the navigation stack. The problem is the launch_ros package, this commit fixes your issue: https://github.com/ros2/launch_ros/co...

Unfortunately, at the moment of writing this response, the apt installation of launch_ros still does not have this fix. What you can do is to clone the package to your workspace and build it locally. That will solve your problem.

cd ~/your_ws/src
git clone -b humble https://github.com/ros2/launch_ros.git
colcon build

Hope that solves your issue.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-02-26 08:02:18 -0500

Seen: 748 times

Last updated: Apr 17 '23