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

How to get param value in to arg in roslaunch?

asked 2018-12-06 03:13:25 -0500

Tal gravatar image

updated 2018-12-06 03:13:54 -0500

I am using ros kinetic
I have ros parameter name "tal"

I want to get this param value into argument tag.

<arg name="tal_arg" value=??? />

I am using ros kinetic,
this post suggest to use eval, but I don't know how to do it.
Can you help?

edit retag flag offensive close merge delete

Comments

Did you try putting the value in double quotes?

Like this,

<arg name="foo" value="bar" />

as given in the link

pmuthu2s gravatar image pmuthu2s  ( 2018-12-06 03:25:51 -0500 )edit
2

I think the OP is asking how to put a dynamic parameter value into an argument not a literal value.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-12-06 03:34:12 -0500 )edit

I want to put the value of rosparm tal like $(param tal) into argument tal_arg.

Tal gravatar image Tal  ( 2018-12-06 03:39:17 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2018-12-06 03:36:56 -0500

The solution you linked to involves making a simple python node which reads the desired parameter value and prints it to stdout. You can then use the value="{eval scriptname.py}" syntax to run that node and put the value it outputs into the argument.

Hope this helps

edit flag offensive delete link more

Comments

where i can put this python scrip? There is other way besides the ways in the link?

Tal gravatar image Tal  ( 2018-12-06 03:41:34 -0500 )edit

Ideally it should be inside a catkin package in the src directory. If you don't already have a workspace with a package setup then I recommend having a look at the tutorials to set one up and create a simple node.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-12-06 03:45:54 -0500 )edit

Warning: The mentioned solution DOES NOT work! I tried to implement a python script as recommended, but the "eval" command is not able to interprete it. A more thorough explanation is given here: https://answers.ros.org/question/3614.... As far as I know, there is currently no way to get params into args. An extension to add the "command" attribute to the arg tag is mentioned here: https://github.com/ros/ros_comm/issue..., but not yet implemented as of today.

just_a_normal_college_student gravatar image just_a_normal_college_student  ( 2022-08-04 05:07:39 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-12-06 03:13:25 -0500

Seen: 2,133 times

Last updated: Dec 06 '18