Gazebo 1.9: xacro to urdf doesnt work [closed]

asked 2013-08-23 01:05:12 -0600

psei gravatar image

Hello there!

I am currently developing a new robot urdf file for the latest gazebo version using xacro. (Why URDF and not SDF you might ask? We are using ROS alot...)

When I try to convert the xacro files to urdf with the command

rosrun xacro xacro.py myrobot.urdf.xacro > test.urdf

I get the following error:

Traceback (most recent call last): File "/opt/ros/hydro/share/xacro/xacro.py", line 60, in <module> xacro.main() File "/opt/ros/hydro/lib/python2.7/dist-packages/xacro/__init__.py", line 601, in main output.write(doc.toprettyxml(indent=' ')) UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 529: ordinal not in range(128)

I looked that error message up, it looks as it is a problem with the xacro files beeing encoded in UTF-8, and python trying to write in ASCII. Now what I do NOT understand is, why other xacro files that come with some ROS-packages work fine and I get a resulting urdf file...

Here is my code:

robot.urdf.xacro (includes all desired parts of my robot):

<?xml version="1.0"?> 
<robot name="myrobot" xmlns:xacro="URL 2 Xacro">
      <!-- common parameters for the model-->
      <include filename="$(find myrobot_description)/urdf/common.urdf.xacro" />

      <!-- base chasis-->
      <include filename="$(find myrobot_description)/urdf/base/base.urdf.xacro" />
</robot>

common.urdf.xacro (just contains parameters):

<robot>
     <property name="M_PI" value="3.1415926535897931" />

     <!-- Main Body-base-->
     <property name="base_x_com" value="-0.08748000" />
     <property name="base_y_com" value="-0.00085000" />
     <property name="base_z_com" value="0.09947000" />
     .
     . 
     .
</robot>

base.urdf.xacro (description of base chasis, 2 links and 1 joint):

<robot>
  <link name="link1">
  <inertial>
    <mass value="0.0001" />
    <origin xyz="0 0 0" />
    <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
             iyy="0.0001" iyz="0.0" izz="0.0001" />
  </inertial>

  <visual>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <geometry>
        <box size="0.001 0.001 0.001" />
    </geometry>
  </visual>
  </link>     

  <link name="link2">
  <inertial>
    <mass value="0.0001" />
    <origin xyz="0 0 0" />
    <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
             iyy="0.0001" iyz="0.0" izz="0.0001" />
  </inertial>

  <visual>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <geometry>
        <box size="0.001 0.001 0.001" />
    </geometry>
  </visual>
  </link>   

  <joint name="link1_link2_joint" type="fixed">
    <origin xyz="0 0 0" rpy="0 0 0" />
    <parent link="link1"/>
    <child link="link2" />
  </joint>
</robot>

What can I do to fix the parser error? There are no strange things in my urdf code....

Thanks for your help

best regards

psei

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by David Lu
close date 2014-05-14 09:11:13

Comments

Can you narrow down where your error occurs? What if you don't include the common file? Or the base? Or both? Do you still get the error?

David Lu gravatar image David Lu  ( 2013-08-23 05:57:24 -0600 )edit

I cannot really say what the problem was. I set it up from the scratch again and now it works, i guess it was some parsing error.... errror messages are quite poorly in xacro.

psei gravatar image psei  ( 2013-10-07 03:10:16 -0600 )edit