0
$\begingroup$

Rosanswers logo

Hello,

I am working on my own robot model made up of a wheel and a body with the body considered as my base_link. I decided to use xacro files to build the robot. Originally I created one file name "skeleton.xacro" with all the macro stuff inside it and the other named "wheel_robot.xacro" to build the robot that includes the "skeleton.xacro" files. When i run check_urdf on the files there is an error shows no link elements found in urd f file. I tried to do it without xacro it works showing the parent and child link perfectly. The file named "wheel_robot_works.xacro" is the file that is successful. Is there any mistake or error in my skeleton.xacro file or wheel_robot.xacro file? Am i including skeleton.xacro file into wheel_robot.xacro file correctly as it seems to be the problem here?

Thank you in advance for the assists!

The files are:

skeleton.xacro:

<?xml version="1.0"?>

<robot name="wheel_robot" xmlns:xacro="http://www.ros.org/wiki/xacro">

<xacro:macro name="link_mesh" params="name origin_xyz origin_rpy meshfile meshscale mass ixx ixy ixz iyy iyz izz" >
  <link name="${name}">
    <inertial>
      <mass value="${mass}" />
      <origin rpy="${origin_rpy}" xyz="${origin_xyz}" />
      <inertia ixx="${ixx}" ixy="${ixy}" ixz="${ixz}" iyy="${iyy}" iyz="${iyz}" izz="${izz}" />
    </inertial>
    <collision>
      <origin rpy="${origin_rpy}" xyz="${origin_xyz}" />
      <geometry>
        <mesh filename="${meshfile}" scale="${meshscale}" />
      </geometry>
    </collision>
    <visual>
      <origin rpy="${origin_rpy}" xyz="${origin_xyz}" />
      <geometry>
        <mesh filename="${meshfile}" scale="${meshscale}" />
      </geometry>
    </visual>
  </link>
</xacro:macro>

<xacro:macro name="add_joint" params="name type axis_xyz origin_rpy origin_xyz parent child" >   <joint name="${name}" type="${type}">
    <axis xyz="${axis_xyz}"/>
    <limit effort="1000.0" velocity="0.5" />
    <origin rpy="${origin_rpy}" xyz="${origin_xyz}" />
    <parent link="${parent}" />
    <child link="${child}" />   </joint> </xacro:macro>

</robot>

wheel_robots.xacro:

<?xml version="1.0"?>

<robot name="wheel_robot" xmlns:xacro="http://www.ros.org/wiki/xacro">


<xacro:include filename="$(find wheel_robot)/urdf/skeleton.xacro" />



<xacro:link_mesh    name="base_link"
            origin_rpy="0 0 0" origin_xyz="0 0 0"
            meshfile="package://wheel_robot/meshes/Body.stl"
            meshscale="0.001 0.001 0001" 
            mass="11.65"
            ixx="0.0976" ixy="0.0" ixz="0.0" iyy="0.07809" iyz="0.00007541" izz="0.1037" />


<xacro:add_joint    name="base_link_wheel" type="continuous"
        axis_xyz="0 1 0"
        origin_rpy="0 0 0" origin_xyz="0.100 0.080 -0.035"
        parent="base_link" child="wheel" />


<xacro:link_mesh    name="wheel"
            origin_rpy="0 -1.5708 0" origin_xyz="0 0 0"
            meshfile="package://wheel_robot/meshes/Wheel.stl"
            meshscale="0.001 0.001 0.001"
            mass="0.194527"
            ixx="0.00009240" ixy="0.0" ixz="0.0" iyy="0.000009240" iyz="0.0" izz="0.0001556" />


</robot>

wheel_robot_works.xacro:

<?xml version="1.0"?>

<robot name="wheel_robot" xmlns:xacro="http://www.ros.org/wiki/xacro">

  <link name="base_link">
    <inertial>
      <mass value="11.65" />
      <origin rpy="0 0 0" xyz="0 0 0" />
      <inertia ixx="0.0976" ixy="0.0" ixz="0.0" iyy="0.07809" iyz="0.00007541" izz="0.1037" />
    </inertial>
    <collision>
      <origin rpy="0 0 0" xyz="0 0 0" />
      <geometry> 
        <mesh filename="package://wheel_robot/meshes/Body.stl" scale="0.001 0.001 0.001" />
      </geometry>
    </collision>
    <visual>
      <origin rpy="0 0 0" xyz="0 0 0" />
      <geometry>
        <mesh filename="package://wheel_robot/meshes/Body.stl" scale="0.001 0.001 0.001" />
      </geometry>
    </visual>
  </link>




  <joint name="base_link_wheel" type="continuous">
    <axis xyz="0 1 0" />
    <limit effort="1000.0" velocity="0.5" />
    <origin xyz="0.1 0.08 -0.035" />
    <parent link="base_link" />
    <child link="wheel" />
  </joint>




  <link name="wheel">
    <inertial>
      <mass value="0.194527" />
      <origin rpy="0 1.5708 0" xyz="0 0 0" />
      <inertia ixx="0.00009240" ixy="0.0" ixz="0.0" iyy="0.000009240" iyz="0.0" izz="0.0001556" />
    </inertial>
    <collision>
      <origin rpy="0 1.5708 0" xyz="0 0 0" />
      <geometry> 
        <mesh filename="package://wheel_robot/meshes/Wheel.stl" scale="0.001 0.001 0.001" />
      </geometry>
    </collision>
    <visual>
      <origin rpy="0 1.5708 0" xyz="0 0 0" />
      <geometry>
        <mesh filename="package://wheel_robot/meshes/Wheel.stl" scale="0.001 0.001 0.001" />
      </geometry>
    </visual>
  </link>

</robot>

Originally posted by wtt on ROS Answers with karma: 1 on 2020-06-11

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Make sure you are calling xacro before doing check_urdf. If you run check_urdf wheel_robots.xacro it won't run xacro for you. Check out this tutorial.


Originally posted by David Lu with karma: 10932 on 2020-06-11

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.