ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

rosnodejs get private param

asked 2019-03-22 09:29:25 -0500

griffin gravatar image

I've written a ROS node using rosnodejs, and I would like to pass it a privately scoped parameter on the command line like:

rosrun mynode myscript.js _myparam:=foo

What would be as simple as rospy.getParam('~myparam') in rospy seems to not work in rosnodejs. What is the correct way to get a private parameter using rosnodejs?

edit retag flag offensive close merge delete


After a bit more research, it would appear to me that there is not feature parity between rospy and rosnodejs. rosnodejs does not appear to handle commandline parameters as of this time and this may be impossible to support.

griffin gravatar image griffin  ( 2019-03-22 09:47:35 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-22 10:28:30 -0500

griffin gravatar image

It appears that rosrun just passes all arguments through to the executable in question. Rospy modules have a built-in step that strips all arguments containing the "remapping" string ":=" and sends them to the parameter server namespaced under the parent node's name. The relevant code is here.

rosnodejs does not currently pass any privately scoped parameters up to the parameter server. Command line arguments are parsed here, and only ROS_IP/related arguments are dealt with in netutils, and the only other code that deals with remappings is in Names.js, which explicitly ignores any remappings that start with an underscore. This is likely due to the fact that properly parsing parameter types must be done using YAML syntax, and a YAML parser for rosnodejs would introduce another dependency and be a PITA to maintain.

I'll figure out how to do what I want without private parameters I guess.

edit flag offensive delete link more


Also seems that I can't accept my own answer, so I'll leave it up to a mod

griffin gravatar image griffin  ( 2019-03-22 10:31:10 -0500 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2019-03-22 09:29:25 -0500

Seen: 306 times

Last updated: Mar 22 '19