Error in xacro code

asked 2022-01-18 04:00:53 -0600

SHURIMA gravatar image

I'm trying to simulate a robotic arm with similar link lengths. I used the same xacro macro to calculate the positions of each link but have been receiving this error when i try to open the model in gazebo using roslaunch:

Error [parser_urdf.cc:3166] Unable to call parseURDF on robot model Error [parser.cc:406] parse as old deprecated model file failed.

I have looked through my code multiple times but I don't know what's the error

  <?xml version='1.0'?>
  <robot name='arm' xmlns:xacro='http://www.ros.org/wiki/xacro'>

  <xacro:property name="base_l" value="1"/>
  <xacro:property name="base_b" value="1"/>
  <xacro:property name="base_h" value="0.1"/>

  <xacro:property name="blink_l" value="0.1"/>
  <xacro:property name="blink_b" value="0.1"/>
  <xacro:property name="blink_h" value="0.3"/>

  <xacro:property name="link_l" value="0.3"/>
  <xacro:property name="link_b" value="0.1"/>
  <xacro:property name="link_h" value="0.1"/>


  <xacro:macro name="link_properties" params="linknum">

    <link name="vertical_link_${linknum}">
      <pose>0 0 0 0 0 0</pose>
      <inertial>
        <mass value="1.1"/>
        <origin rpy="0 0 0" xyz="${link_l/2} {link_b/2} {link_h/2}"/>
        <inertia
          ixx = '0.011'
          ixy = '0'
          ixz = '0'
          iyy = '0.0225'
          iyz = '0'
          izz = '0.0135'
          />
      </inertial>

      <visual name='vertical_link_${linknum}_visual'>
        <origin rpy="0 0 0" xyz="${(link_l/2)+(linknum-1)*link_l} 0 ${(link_h/2)+blink_h}"/>
        <geometry>
          <box size="${link_l} ${link_b} ${link_h}"/>
        </geometry>
      </visual>

      <collision name='vertical_link_${linknum}_collision'>
        <origin rpy="0 0 0" xyz="${(link_l/2)+(linknum-1)*link_l} 0 ${(link_h/2)+blink_h}"/>
        <geometry>
          <box size="${link_l} ${link_b} ${link_h}"/>
        </geometry>
      </collision>
    </link>

  </xacro:macro>


  <link name='robot_base'>
    <pose>0 0 0 0 0 0</pose>
    <inertial>
      <mass value="1001"/>
      <origin rpy="0 0 0" xyz="0 0 1"/>
      <inertia
        ixx = '100.11'
        ixy = '0'
        ixz = '0'
        iyy = '100.11'
        iyz = '0'
        izz = '100.01'
        />
    </inertial>

    <visual name='base_visual'>
      <origin rpy="0 0 0" xyz="${base_l/2} 0 0"/>
      <geometry>
        <box size="${base_l} ${base_b} ${base_h}"/>
      </geometry>
    </visual>

    <collision name='base_collision'>
      <geometry>
        <box size="${base_l} ${base_b} ${base_h}"/>
      </geometry>
    </collision>
  </link>


  <link name="blink">
    <pose>0 0 0 0 0 0</pose>
    <inertial>
      <mass value="1.1"/>
      <origin rpy="0 0 0" xyz="${blink_l/2} {blink_b/2} {blink_h/2}"/>
      <inertia
        ixx = '0.0135'
        ixy = '0'
        ixz = '0'
        iyy = '0.0225'
        iyz = '0'
        izz = '0.0111'
        />
    </inertial>

    <visual name='vertical_link_${linknum}_visual'>
      <origin rpy="0 0 0" xyz="{base_h/2} {base_b/2} {base_l}"/>
      <geometry>
        <box size="${blink_l} ${blink_b} ${blink_h}"/>
      </geometry>
    </visual>

    <collision name='vertical_link_${linknum}_collision'>
      <origin rpy="0 0 0" xyz="{base_h/2} {base_b/2} {base_h}"/>
      <geometry>
        <box size="${blink_l} ${blink_b} ${blink_h}"/>
      </geometry>
    </collision>
  </link>

  <xacro:link_properties linknum="1"/>
  <xacro:link_properties linknum ...
(more)
edit retag flag offensive close merge delete

Comments

I don't see any joints connecting the links. All you have here is a bunch of unrelated links.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-01-18 06:48:07 -0600 )edit

Ok I created the joints and now I have a new issue which is not being able to simulate a model with more than 1 joint. I heavily modified the code in the meantime so I will post another question.

SHURIMA gravatar image SHURIMA  ( 2022-01-18 10:02:42 -0600 )edit