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

writing a revolute joint

asked 2012-10-09 21:25:27 -0500

ccm gravatar image

updated 2014-01-28 17:13:54 -0500

ngrennan gravatar image

I'm trying to build a door model but I can't seem to get the coding for revolute joints right. the "base_link" is the wall and "door" is the door.

My code "door.xml" is here

<?xml version="1.0"?>
<robot name="door">
  <link name="base_link">
        <box size="0.6 0.05 0.6"/>
      <origin rpy="0 0 0" xyz="0 0 0.3"/>
      <material name="white">
        <color rgba="1 1 1 1"/>
    <!--<inertia  ixx="1.0" ixy="0.0"  ixz="0.0"  iyy="100.0"  iyz="0.0"  izz="1.0" />

  <link name="door">
        <box size="0.3 0.05 0.6"/>
      <origin rpy="0 0 0" xyz="0.15 -0.025 0"/>

  <joint name="hinge" type="revolute">
    <limit upper="0" lower="-1.57"velocity="10" effort="10"/>
    <origin xyz="0.3 0.025 .3"/>
    <axis xyz="0 0 1" />
    <parent link="base_link"/>
    <child link="door"/>

I yield the following error

Traceback (most recent call last):
  File "/opt/ros/fuerte/stacks/robot_model_visualization/joint_state_publisher/joint_state_publisher", line 202, in <module>
    jsp = JointStatePublisher()
  File "/opt/ros/fuerte/stacks/robot_model_visualization/joint_state_publisher/joint_state_publisher", line 25, in __init__
    robot = xml.dom.minidom.parseString(description).getElementsByTagName('robot')[0]
  File "/usr/lib/python2.7/xml/dom/", line 1930, in parseString
    return expatbuilder.parseString(string)
  File "/usr/lib/python2.7/xml/dom/", line 940, in parseString
    return builder.parseString(string)
  File "/usr/lib/python2.7/xml/dom/", line 223, in parseString
    parser.Parse(string, True)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 47, column 34

Here's a picture of how it looks like on rviz when I run roslaunch urdf_tutorial display.launch model:=door.xml door.png

The visualization on rviz works perfectly find when I use continuous or fixed joints. So I'm not sure whether it is due to my code or some python related script. I'm running on Ubuntu 12.04, Fuerte.


edit retag flag offensive close merge delete


I wouldn't define origin of the "door" link. It's excessive. Instead define it in the joint declaration.

Peter Listov gravatar image Peter Listov  ( 2012-10-09 23:15:27 -0500 )edit

Peter>> How do you define it in joint declaration? I want the joint to be connected to the side of the door rather than right smack in the middle. The only way I know how to shift it is to declare origin for the door. >.<

ccm gravatar image ccm  ( 2012-10-11 03:36:34 -0500 )edit

This guy is very handsome and might answer your question:

David Lu gravatar image David Lu  ( 2012-10-12 06:25:17 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2012-10-09 22:56:07 -0500

The error message means that your XML is invalid: there's a " " missing in front of velocity. You can validate XML using the following command:

xmlstarlet val myfile.xml

Apart from that, your file looks good. Later, you'll want to add <collision> tags (just copy the <visual> tags).

edit flag offensive delete link more


Thank you! It managed to generate in Rviz now :D Feel kind of stupid for not noticing that missing space. I shall try to add collision tags now. Thanks a lot.

ccm gravatar image ccm  ( 2012-10-11 05:18:45 -0500 )edit

Question Tools


Asked: 2012-10-09 21:25:27 -0500

Seen: 679 times

Last updated: Oct 09 '12