Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urdf_parser_py: False errors reported when parsing urdf with <transmission> tags #36

Closed
jbohren opened this issue Jun 5, 2014 · 8 comments

Comments

@jbohren
Copy link
Member

jbohren commented Jun 5, 2014

If you try to parse an urdf with urdf_parser_py it throws an error if your <transmission><joint>.. tags don't have a type attribute.

Exception: Required attribute not set in XML: type

This is an incorrect error, see http://wiki.ros.org/urdf/XML/Transmission

@adolfo-rt
Copy link

Might be related, but test-driving urdf_parser_py on REEM chokes on:

Exception: Required attribute not set in XML: upper

The only attribute named upper in the URDF spec is the joint position limit, and it's optional, see http://wiki.ros.org/urdf/XML/joint

I haven't tried on a minimal single-joint example.

@eacousineau
Copy link
Contributor

I've added in a patch to set the default values for 'lower' and 'upper'. Thank you for reporting that!

And Adolfo, I tried out parsing REEM after adding the default values in. It looks like hardwareInterface has been placed as a child node of joint instead of in actuator. Should it instead be in actuator?

<transmission name="wheel_right_trans">
  <type>transmission_interface/SimpleTransmission</type>
  <actuator name="wheel_right_motor">
    <mechanicalReduction>1.0</mechanicalReduction>
  </actuator>
  <joint name="wheel_right_joint">
    <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
  </joint>
</transmission>

Sample bash session:

$ # NOTE: reem_robot and urdfdom have been placed in the same workspace
$ git clone https://github.com/pal-robotics/reem_robot.git
$ cd reem_robot
$ git rev-parse --short HEAD
2cec3cf
$ roslaunch reem_description upload_reem.launch
$ rosparam get -p /robot_description > /tmp/test.urdf
$ cd ../urdfdom/urdf_parser_py
$ git rev-parse --short HEAD
0b3e9e1
$ ./scripts/display_urdf # From param server
...
Exception: Could not perform duck-typed parsing.
Value Type: <class 'urdf_parser_py.urdf.Transmission'>
Exception: Required element not set in XML: hardwareInterface

Value Type: <class 'urdf_parser_py.urdf.PR2Transmission'>
Exception: Required attribute not set in XML: type

@adolfo-rt
Copy link

Sigh, this issue is having lots of ramifications.

The correct behavior is to specify hardware interfaces under the <joint> element, but because of a design discussion mistake, gazebo_ros_control was released into hydro parsing hardware_interfaces from the <actuator> element. In indigo, gazebo_ros_control accepts both, but the <actuator> spec is on a deprecation cycle, and will no longer be supported in J-Turtle.

To fix urdf_parser_py, one could either check that <hardware_interface> is under either <joint> or <actuator>, but I don't know if this becomes clumsy implementation-wise. Let me know what you think.

@adolfo-rt
Copy link

With #38 fixed, we can get back to the original subject (apologies for the detour):

If you try to parse an urdf with urdf_parser_py it throws an error if your .. tags don't have a type attribute.

Exception: Required attribute not set in XML: type

It seems that the <transmission> element is interpreted as a PR2-style transmission. From the ducktyping statement here, I interpret that the parser is trying to resolve the type of transmission specification (pr2_transmission vs new_transmission) from the provided elements and attributes. I don't understand the code well enough to know why it fails.

@goretkin
Copy link
Contributor

I think I'm running up against this. My PR2 URDF has, for example,

  <transmission name="l_wrist_trans" type="pr2_mechanism_model/WristTransmission">
    <rightActuator mechanicalReduction="60.1714285714" name="l_wrist_r_motor"/>
    <leftActuator mechanicalReduction="60.1714285714" name="l_wrist_l_motor"/>
    <flexJoint mechanicalReduction="-1.0" name="l_wrist_flex_joint"/>
    <rollJoint mechanicalReduction="1.0" name="l_wrist_roll_joint"/>
  </transmission>

and the error I get is.

Exception: Could not perform duck-typed parsing.
Value Type: <class 'urdf_parser_py.urdf.Transmission'>
Exception: Required element not set in XML: type

Value Type: <class 'urdf_parser_py.urdf.PR2Transmission'>
Exception: Required element not set in XML: joint

It try to go up the stack trace to find out where in the file this error is, and I think it's in the part of the URDF I indicated above.

As I indicated in #58, I am under Groovy, so the actual error I'm getting is

Exception: Required element not set in XML: joint

@ugocupcic
Copy link

As far as I can tell, this should be fixed in #63.

When can we expect a new release of urdfdom to fix this?

@jacquelinekay
Copy link
Contributor

The latest incarnation of the fix for this issue (#68) has been pushed to 0.2, 0.3 and master branch (targeting 0.4).

Now that the fix has been backported I will try to release a new ros-indigo-urdfdom-py and ros-jade-urdfdom-py today. After the release I will consider this issue resolved.

@ugocupcic
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants