ROS2 Nav2 Not Starting with namespace
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