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

writing a revolute joint

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

ccm gravatar image

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

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">
    <visual>
      <geometry>
        <box size="0.6 0.05 0.6"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0 0 0.3"/>
      <material name="white">
        <color rgba="1 1 1 1"/>
      </material>
    </visual>
    <!--<inertia  ixx="1.0" ixy="0.0"  ixz="0.0"  iyy="100.0"  iyz="0.0"  izz="1.0" />
    </inertia>-->
  </link>

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

  <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"/>
  </joint> 
</robot>

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/minidom.py", line 1930, in parseString
    return expatbuilder.parseString(string)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
    return builder.parseString(string)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", 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.

Thanks!

edit retag flag offensive close merge delete

Comments

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 -0600 )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 -0600 )edit

This guy is very handsome and might answer your question: https://www.youtube.com/watch?v=g9WHxOpAUns&t=16m34s

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

1 Answer

Sort by » oldest newest most voted
2

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

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

Comments

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 -0600 )edit

Question Tools

Stats

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

Seen: 720 times

Last updated: Oct 09 '12