Ask Your Question
0

Best way to fill urdf.xacro files from a Database

asked 2015-06-26 03:03:10 -0600

NEngelhard gravatar image

Hello!

I have some robots with a very similar hardware that therefore share some urdf.xacro files. However, some of the values (e.g. ranges for linear axis) differ, and I don't want to copy the whole file to change only two values and have both versions in one repository.

Is there a way to maybe read some values from a db (even using xacro?). I'd like to call a (python) script that reads the values from a database and inserts these values into the final urdf.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-06-30 10:21:12 -0600

NEngelhard gravatar image

I found a solution that works for me:

In my launch-file, I have a -Tag that let's me include a script:

<param name="robot_description" command="$(find robot_description_pkg)/scripts/create_urdf.py"/>

(This tag is also evaluated before nodes are launched, so I don't have to care for race conditions).

In my create_urdf.py, I read my values from the db and call the xacro.py with my base-urdf.xacro and the new params.

My base.urdf.xacro then contains entries like:

  <joint name="z_joint" type="prismatic">
      <parent link="insertion_x"/>
      <xacro:arg name="insertion_x_max" default="0"/>
      <limit effort="37" velocity="1" lower="0" upper="$(arg insertion_z_max)"  /> 
      <joint_properties damping="0.1" friction="0.5" />
  </joint>

If my db doesn't provide a value for the upper_limit, the default is used, otherwise the new value is inserted into the final urdf.

The return value of the xacro.py-call is then written to the parameter-server, so that a robot-state publisher can get it.

   <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" respawn="true" respawn_delay="50"/>

Using the param-Tag to start the script is maybe a bit hackish, but it provides a way to call my script (and to only start the robot_state_publisher after I have updated the model).

With this approach, I only have to change the values in the DB and the robot will have the new values after the next launch.

edit flag offensive delete link more
0

answered 2015-06-27 08:09:26 -0600

Maybe you could have a file for each component you have in your robot and include them together in one single file for a robot, like I for example did here:

https://github.com/Hacks4ROS/h4r_rapi...

There you probably could also set parameters changing for each robot. So every robot version would have it's own "tiny" file including all components it has and the changed parameters for the components.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2015-06-26 03:03:10 -0600

Seen: 190 times

Last updated: Jun 30 '15