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

ROS2: how to specify parameter with namespace in python launch file?

asked 2022-01-31 04:27:44 -0600

philipp_glira gravatar image

It is unclear to me how a parameter with namespace is accessed in a python launch file.

I define a parameter in my node with:

    parameters=[("bar", "default_value_bar_ns1")],

In my python launch file I'm trying to set a new value for this parameter with:

        "": "new_value_bar_ns1", # this does not work!

With this the parameter "bar" in namespace "ns1" remains unchanged.

What am I doing wrong? Thanks in advance.

Minimal working example here:

I'm using ROS2 galactic with the official docker image "ros:galactic".

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-02-10 17:58:50 -0600

guru_florida gravatar image

updated 2022-02-10 17:59:22 -0600

I've run into the same issue and I've submitted a githib issue. I adapted some of your code (see my github gist) and figured out that if you change your declare_parameters() syntax to the following it works as expected. It does indeed seem like a bug:

    parameters=[("", "default_value_bar_ns1")],

I'll follow up when the issue is resolved.

edit flag offensive delete link more

Question Tools



Asked: 2022-01-31 04:27:44 -0600

Seen: 670 times

Last updated: Feb 10 '22