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

How to put urdf in parameter server?

asked 2017-07-25 07:51:55 -0500

dinesh gravatar image

Is it possible to use the urdf format robot in parameter server similarly like xacro format like below? :

<!-- Convert an xacro and put on parameter server -->
<param name="robot_description" command="$(find xacro)/xacro.py $(find pr2_description)/robots/pr2.urdf.xacro" />

<!-- Spawn a robot into Gazebo -->
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -model pr2" />

I have downloaded a robot model in urdf, but its very large so it's little hard to convert it into xacro format. So i want to directly use it, but what to for this robot_description parameter?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2017-07-25 08:35:17 -0500

gvdhoorn gravatar image

This is documented on the roslaunch/XML/param page:

textfile="$(find pkg-name)/path/file.txt"

The contents of the file will be read and stored as a string. The file must be locally accessible, though it is strongly recommended that you use the package-relative $(find)/file.txt syntax to specify the location.

So for robot_description, that would be:

<param name="robot_description" textfile="$(find pkg-name)/path/file.urdf"/>
edit flag offensive delete link more
0

answered 2017-07-25 08:43:18 -0500

lucasw gravatar image

updated 2017-07-25 08:52:49 -0500

It looks like http://wiki.ros.org/urdf/Tutorials/Us... is outdated but the basic approach is valid- TODO fix it.

It should look like this:

<?xml version="1.0"?>
<launch>
  <arg name="model" default="$(find r2d2)/model.urdf"/>
  <param name="robot_description" textfile="$(arg model)" />
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" >
    <param name="use_gui" value="true" />
  </node>
</launch>

And the urdf I had to add an inertia-less base_link (and made the file extension .urdf instead of .xml):

<?xml version="1.0"?>
<robot name="r2d2">

<link name="base_link">
</link>

<joint name="basec" type="fixed">
  <origin xyz="0 0 0" />
  <parent link="base_link"/>
  <child link="main_axis"/>
</joint>


<link name="main_axis">
  <inertial>
    <mass value="1"/>
    <inertia ixx="100" ixy="0" ixz="0" iyy="100" iyz="0" izz="100" />
    <origin/>
  </inertial>
  <visual>
    <origin xyz="0 0 0" rpy="1.57 0 0" />
    <geometry>
      <cylinder radius="0.01" length=".5" />
    </geometry>
    <material name="gray">
      <color rgba=".2 .2 .2 1" />
    </material>
  </visual>

  <collision>
    <origin xyz="0 0 0" rpy="1.57 0 0" />
    <geometry>
      <cylinder radius="0.01" length=".5" />
    </geometry>
    <contact_coefficients mu="0" kp="1000.0" kd="1.0"/>
  </collision>
</link>

<link name="leg1">
  <inertial>
    <mass value="1"/>
    <inertia ixx="100" ixy="0" ixz="0" iyy="100" iyz="0" izz="100" />
    <origin/>
  </inertial>

  <visual>
    <origin xyz="0 0 -.3" />
    <geometry>
      <box size=".20 .10 .8" />
    </geometry>
    <material name="white">
      <color rgba="1 1 1 1"/>
    </material>
  </visual>

  <collision>
    <origin xyz="0 0 -.3" />
    <geometry>
      <box size=".20 .10 .8" />
    </geometry>
    <contact_coefficients mu="0" kp="1000.0" kd="1.0"/>
  </collision>
</link>

<joint name="leg1connect" type="fixed">
  <origin xyz="0 .30 0" />
  <parent link="main_axis"/>
  <child link="leg1"/>
</joint>

<link name="leg2">
  <inertial>
    <mass value="1"/>
    <inertia ixx="100" ixy="0" ixz="0" iyy="100" iyz="0" izz="100" />
    <origin/>
  </inertial>

  <visual>
    <origin xyz="0 0 -.3" />
    <geometry>
      <box size=".20 .10 .8" />
    </geometry>
    <material name="white">
      <color rgba="1 1 1 1"/>
    </material>
  </visual>

  <collision>
    <origin xyz="0 0 -.3" />
    <geometry>
      <box size=".20 .10 .8" />
    </geometry>
    <contact_coefficients mu="0" kp="1000.0" kd="1.0"/>
  </collision>
</link>

<joint name="leg2connect" type="fixed">
  <origin xyz="0 -.30 0" />
  <parent link="main_axis"/>
  <child link="leg2"/>
</joint>

<link name="body">
  <inertial>
    <mass value="1"/>
    <inertia ixx="100" ixy="0" ixz="0" iyy="100" iyz="0" izz="100" />
    <origin/>
  </inertial>

  <visual>
    <origin xyz="0 0 -0.2" />
    <geometry>
      <cylinder radius=".20" length=".6"/>
    </geometry>
    <material name="white"/>
  </visual>

  <collision>
    <origin xyz="0 0 0.2" />
    <geometry>
      <cylinder radius=".20" length=".6"/>
    </geometry>
    <contact_coefficients mu="0" kp="1000.0" kd="1.0"/>
  </collision>
</link>

<joint name="tilt" type="revolute">
  <parent link="main_axis"/>
  <child link="body"/>
  <origin xyz="0 0 0" rpy="0 0 0" />
  <axis xyz="0 1 0" />
  <limit upper="0" lower="-.5" effort="10" velocity="10" />
</joint>

<link name="head">
  <inertial>
    <mass value="1"/>
    <inertia ixx="100" ixy="0" ixz="0" iyy="100" iyz="0" izz="100" />
    <origin/>
  </inertial>

  <visual>
    <geometry>
      <sphere radius=".4" />
    </geometry>
    <material name="white ...
(more)
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-07-25 07:51:55 -0500

Seen: 4,329 times

Last updated: Jul 25 '17