Gazebo doesn't open xacro elements
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" />
<xacro:leg prefix="right_forward" reflect_big_link="-0.05 -0.05 -0.05" reflect_big_joint="-0.15 -0.1 0.2" reflect_small_link="0.05 -0.05 -0.05" reflect_small_joint="-0.15 -0.055 -0.1" />
<xacro:leg prefix="left_forward" reflect_big_link="-0.05 -0.05 -0.05" reflect_big_joint="0.15 -0.1 0.2" reflect_small_link="0.05 -0.05 -0.05" reflect_small_joint="-0.15 -0.055 -0.1" />
</robot>
this is main code and this is launch:
<launch>
<!-- these are the arguments you can pass this launch file -->
<arg name="paused" default="false"/>
<arg name="use_sim_time" default="true"/>
<arg name="gui" default="true"/>
<arg name="headless" default="false"/>
<arg name="debug" default="false"/>
<!--<arg name="model" default="$(find my_pkg)/urdf/robot.xacro"/>-->
<arg name="model" default="$(find myrobot)/urdf/thespot.urdf.xacro"/>
<!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
</include>
<!-- Load the XACRO into the ROS Parameter Server -->
<param name="robot_description" command="$(find xacro)/xacro.py $(arg model)" />
<!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
args="-urdf -model hammer -param robot_description"/>
</launch>
Asked by Marina on 2019-09-26 09:49:27 UTC
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.Asked by David Lu on 2019-09-26 11:29:51 UTC
I am sorry. I restart my computer and everything works correctly. Merely, Ubuntu. Topic may be closed
Asked by Marina on 2019-09-26 15:03:43 UTC
Actually, it was strange: in the rviz everything was just perfect, and nothing similar to gazebo. Ubuntu is very strange...
Asked by Marina on 2019-09-26 15:04:52 UTC
So it's all set?
Asked by David Lu on 2019-09-27 08:10:13 UTC