Ask Your Question
0

failed to pass ros argument via command line

asked 2019-05-15 03:40:21 -0600

xhuan28 gravatar image

updated 2019-05-16 00:19:07 -0600

jayess gravatar image

I used to pass ros argument via command line in crystal release successfully, but it failed when I synchronized code with the latest code in master branch. Is there any design change in recent code? The command I used to pass argument was:

ros2 run my_package my_node __params:=my_param.yaml
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2019-05-16 00:24:43 -0600

xhuan28 gravatar image

updated 2019-05-16 02:09:06 -0600

gvdhoorn gravatar image

it should be a design change in dashing release: Parameter Configuration using a YAML File:

As of Dashing, parameters in a YAML configuration file, e.g. passed to the node via the command line argument __params:=, are only used to override a parameter’s default value when declaring the parameter.

Before Dashing, any parameters you passed via a YAML file would be implicitly set on the node.

Since Dashing, this is no longer the case, as parameters need to be declared in order to appear on the node to external observers, like ros2 param list.

The old behavior may be achieved using the automatically_declare_initial_parameters option when creating a node. This option, if set to true, will automatically declare all parameters in the input YAML file when the node is constructed. This may be used to avoid major changes to your existing code or to serve specific use cases. For example, a “global parameter server” may want to be seeded with arbitrary parameters on launch, which it could not have declared ahead of time. Most of the time, however, this option is not recommended, as it may lead to setting a parameter in a YAML file with the assumption that the node will use it, even if the node does not actually use it.

In the future we hope to have a checker that will warn you if you pass a parameter to a node that it was not expecting.

The parameters in the YAML file will continue to influence the value of parameters when they are first declared.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-05-15 03:40:21 -0600

Seen: 44 times

Last updated: May 16