0
$\begingroup$

Rosanswers logo

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?


Originally posted by Tal on ROS Answers with karma: 108 on 2018-12-06

Post score: 0


Original comments

Comment by pmuthu2s on 2018-12-06:
Did you try putting the value in double quotes?

Like this,

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

as given in the link

Comment by PeteBlackerThe3rd on 2018-12-06:
I think the OP is asking how to put a dynamic parameter value into an argument not a literal value.

Comment by Tal on 2018-12-06:
I want to put the value of rosparm tal like $(param tal) into argument tal_arg.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by PeteBlackerThe3rd with karma: 9529 on 2018-12-06

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by Tal on 2018-12-06:
where i can put this python scrip? There is other way besides the ways in the link?

Comment by PeteBlackerThe3rd on 2018-12-06:
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.

Comment by just_a_normal_college_student on 2022-08-04:
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/361411/running-a-python-node-using-eval-in-roslaunch/. 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/issues/723, but not yet implemented as of today.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.