Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Cannot set params from rosrun #293

Open
tommy91 opened this issue Mar 16, 2019 · 0 comments
Open

Cannot set params from rosrun #293

tommy91 opened this issue Mar 16, 2019 · 0 comments

Comments

@tommy91
Copy link

tommy91 commented Mar 16, 2019

I would like to set a parameter (in the parameter server) for a node using rosrun,
because I need to run a lot of nodes, each one with a different configuration.

Running the command:

rosrun PACKAGE PROJECT com.github.rosjava.PACKAGE.PROJECT.CLASS __myParam:=55

I'd expect to see the parameter myParam in the parameter server, with the value of 55.
But it doesn't work.
(With _myParam:=55 and myParam:=55 I got RosRuntimeException: Invalid graph name: 55)

In fact, with the commandrosparam list, myParam doesn't show up
and I cannot even get it with the code inside the class of the node:

public void onStart(final ConnectedNode connectedNode) {  
  DefaultParameterTree params = (DefaultParameterTree) connectedNode.getParameterTree();  
 
  int myParam = params.getInteger(connectedNode.resolveName("~myParam").toString());
  // doesn't work: throws ParameterNotFoundException 
 
  int myParam = params.getInteger("myParam");
  // doesn't work: throws ParameterNotFoundException
  
  int myParam = params.getInteger("/myParam");
  // doesn't work: throws ParameterNotFoundException
}

I also tried to look in the rosjava code, starting from RosRun.java
and I found out that in CommandLineLoader.java
the params defined as __myParam:=55 are collected:

  1. in the Map remappingArguments by the method parseArgv() and
  2. in the Map specialRemappings by the method parseRemappingArguments() called by build()

but then only the ones corresponding to the command line variables defined in CommandLineVariables.java are considered.
So I'm also asking if I'm missing something in the code, or if it's missing something in the code, or if I'm totally wrong.

So, is there a way to make it work?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants