Ask Your Question
0

how to set parameter in rosrun command line?

asked 2020-05-22 00:24:40 -0500

improve100 gravatar image

updated 2020-05-22 00:25:13 -0500

my code:

ros::NodeHandle priv_nh("~");

priv_nh.getParam ("filename", filename_);

i use:

rosrun my_package my_node _filename:=test

it is not working.

edit retag flag offensive close merge delete

Comments

Please show a complete piece of code. There is a chance you are missing some lines which could cause the problems you are having.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-22 03:40:17 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2020-05-25 16:40:25 -0500

borgcons gravatar image

If filename_ is an std::string then:

rosrun my_package my_node _filename:="test"
edit flag offensive delete link more
0

answered 2020-05-22 01:24:33 -0500

You could set the param first after starting roscore.

rosparam set filename test
rosrun my_package my_node
edit flag offensive delete link more

Comments

global nodehandle setting parameter can use rosrun commandline .private nodehandle not.

improve100 gravatar image improve100  ( 2020-05-22 01:33:59 -0500 )edit

Emmm, you may add node_name before the filename, like "rosparam set node_name/filename test"

tianb03 gravatar image tianb03  ( 2020-05-22 01:56:19 -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

1 follower

Stats

Asked: 2020-05-22 00:24:40 -0500

Seen: 16 times

Last updated: May 25