yaml parameters to node args

asked 2017-06-13 08:29:34 -0600

blevesque gravatar image

updated 2017-06-13 08:32:05 -0600

hi all,

In a roslaunch file I instanciate nodes which use yaml's data. I have 3D points where I want to spawn urdf models

Here an example for 1 node / 3D point.

example.yaml :

E1_position_X: 30.03
E1_position_Y: 32.93
E1_position_Z: 10.10

example.launch :

<param name="robot_description" command="$(find xacro)/xacro --inorder $(find simulation)/urdf/robot.urdf.xacro"/>
<node name="spawn_urdf_car_E1" pkg="gazebo_ros" type="spawn_model" 

args= "-param robot_description 
                             -urdf 
                             -model $(arg immat) 
                              -x ? (Should be E1_position_X)
                             -y  ? (Should be E1_position_Y) 
                             -z ? (Should be E1_position_Z)
                             output="screen"/>

I don't know how to use yaml's data in this case. If someone has an idea :) Thanks

RosKinetic / Gazebo7

edit retag flag offensive close merge delete

Comments

Similar question from a while ago http://answers.ros.org/question/11522... - a similar answer for you would be to use launch files instead of yamls for parameters like this, which may not be satisfactory.

lucasw gravatar image lucasw  ( 2017-06-13 11:33:54 -0600 )edit

$(eval rospy.get_param('/E1_position_X')) doesn't work...

lucasw gravatar image lucasw  ( 2017-06-13 11:56:09 -0600 )edit
1

$(eval compile('''import rospy; rospy.get_param('/testx')''', 'abc', 'single')) doesn't fail, but the value is the code of compile() (e.g. <code object <module> at 0x762d99f8, file "abc", line 1>), not the executed compiled code output.

lucasw gravatar image lucasw  ( 2017-06-13 12:12:51 -0600 )edit

I didn't suceed with this method so I wrote a short Python script who teleports models at the good coordonates in yaml file. Thanks for your time :)

blevesque gravatar image blevesque  ( 2017-06-16 09:04:36 -0600 )edit