Gazebo doesn't open xacro elements

asked 2019-09-26 09:49:27 -0500

Marina gravatar image

updated 2019-09-26 10:01:04 -0500

gvdhoorn gravatar image

I've got a model: body and 4 legs, consist of 4 parts. Legs are made through xacro. When I launch file via gazebo, body is shown, but legs - don't. What'wrong?

<?xml version='1.0'?>

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

    <link name ="body">
        <visual>
    <origin xyz="0 0 0.2" rpy="0 0 0" />
        <geometry>
        <box size="0.4 0.2 0.1" />
        </geometry>
        <material name="Cyan">
        <color rgba="0 1.0 1.0 1.0"/>
        </material>
  </visual>
        <inertial>
            <mass value="10"/>
            <inertia ixx="0.4" ixy="0.0" ixz="0.0" iyy="0.4" iyz="0.0" izz="0.2"/>
        </inertial>
        <collision>
            <geometry>
        <box size="0.4 0.2 0.1" />
        </geometry>
        </collision>
    </link> 

        <xacro:macro name="leg" params="prefix reflect_big_link reflect_big_joint reflect_small_link  reflect_small_joint">

    <link name="${prefix}_big_leg">
        <visual>
            <origin xyz="${reflect_big_link}" rpy="0 -0.7 0" />
        <geometry>
        <box size="0.2 0.03 0.03" />
        </geometry>
            <material name="red" >
        <color rgba="1.00 0 0 1.0"/>
            </material>
  </visual>
        <inertial>
            <mass value="10"/>
            <inertia ixx="0.4" ixy="0.0" ixz="0.0" iyy="0.4" iyz="0.0" izz="0.2"/>
        </inertial>
        <collision>
            <geometry>
        <box size="0.2 0.03 0.03" />
        </geometry>
        </collision>
    </link>

    <joint name="body_to_${prefix}_big_leg" type="revolute">
   <origin xyz="${reflect_big_joint}" rpy="0 0 0"/>
    <parent link="body"/>
    <child link="${prefix}_big_leg"/>
            <axis xyz = "0 1 0"/>
    <limit effort="30" velocity="1.0" lower="-2.2" upper="0.7" />
</joint>

    <link name="${prefix}_small_leg">
        <visual>
            <origin xyz="${reflect_small_link}" rpy="0 0.7 0" />
        <geometry>
        <box size="0.2 0.03 0.03" />
        </geometry>
            <material name="red" >
        <color rgba="1.00 0 0 1.0"/>
            </material>
  </visual>
            <inertial>
                <mass value="10"/>
                <inertia ixx="0.4" ixy="0.0" ixz="0.0" iyy="0.4" iyz="0.0" izz="0.2"/>
            </inertial>
        <collision>
            <geometry>
        <box size="0.2 0.03 0.03" />
        </geometry>
        </collision>
    </link>

    <joint name="${prefix}_big_leg_to_${prefix}_small_leg" type="revolute">
   <origin xyz="${reflect_small_joint}" rpy="0 0 0"/>
    <parent link="${prefix}_big_leg"/>
    <child link="${prefix}_small_leg"/>
            <axis xyz = "0 1 0"/>
    <limit effort="30" velocity="1.0" lower="-0.7" upper="0.7" />
</joint> 

        <!-- A bunch of stuff cut -->
   </xacro:macro>

    <xacro:leg prefix="left_back" reflect_big_link="-0.05 -0.05 -0.05" reflect_big_joint="-0.15 0.2 0.2" reflect_small_link="0.05 -0.05 -0.05" reflect_small_joint="-0.13 0.055 -0.1" />
<xacro:leg prefix="right_back" reflect_big_link="-0.05 -0.05 -0.05" reflect_big_joint="0.15 0.2 0.2" reflect_small_link="0.05 -0.05 -0.05" reflect_small_joint="-0.15 0.055 -0.1" /> ...
(more)
edit retag flag offensive close merge delete

Comments

I would manually run rosrun xacro xacro.py urdf/thespot.urdf.xacro and make sure the output is what you expect to see if the problem is xacro or something else.

David Lu gravatar imageDavid Lu ( 2019-09-26 11:29:51 -0500 )edit

I am sorry. I restart my computer and everything works correctly. Merely, Ubuntu. Topic may be closed

Marina gravatar imageMarina ( 2019-09-26 15:03:43 -0500 )edit

Actually, it was strange: in the rviz everything was just perfect, and nothing similar to gazebo. Ubuntu is very strange...

Marina gravatar imageMarina ( 2019-09-26 15:04:52 -0500 )edit

So it's all set?

David Lu gravatar imageDavid Lu ( 2019-09-27 08:10:13 -0500 )edit