I've been following the URDF/XACRO tutorials and I've run into an issue. When I launch Gazebo the model never shows up.
- Ubuntu 18.04
- ROS Melodic
My gazebo.launch file:
<launch>
<!-- This will load Basic_Geometry_Pig as the URDF model -->
<arg name="model" default="$(find little_pig_atv)/basic_geometry_pig.urdf.xacro"/>
<!-- Setting some default args to start Gazebo with -->
<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"/>
<!-- Load an empty Gazebo world with the args above -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="debug" value="$(arg debug)" />
<arg name="gui" value="$(arg gui)" />
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="headless" value="$(arg headless)"/>
</include>
<!-- This is set with code from line 4 -->
<param name="robot_description" command="$(find xacro)/xacro.py $(arg model)" />
<!-- push robot_description to factory and spawn robot in gazebo -->
<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" args="-z 1.0 -unpause -urdf -model robot -param robot_description" respawn="false" output="screen" />
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
<param name="publish_frequency" type="double" value="30.0" />
</node>
</launch>
My basic_geometry_pig.urdf.xacro file:
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="basic_geometry_pig">
<!-- Some color definitions for the URDF Robot -->
<material name="blue">
<color rgba="0 0 0.8 1"/>
</material>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
<!-- Basic Geometry of Body -->
<xacro:property name="width" value="0.680618" />
<xacro:property name="height" value="1.065022" />
<xacro:property name="length" value="1.91" />
<!-- The Ackerman Steering Hub -->
<xacro:property name="ackerman_joint_diameter" value="0.09" />
<xacro:property name="ackerman_joint_width" value="0.09" />
<!-- Wheel Properties -->
<xacro:property name="front_wheel_width" value=".254" />
<xacro:property name="front_wheel_diameter" value="0.5588" />
<xacro:property name="rear_wheel_width" value="0.2794" />
<xacro:property name="rear_wheel_diameter" value="0.6096" />
<link name="base_link">
<inertial>
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<mass value="49.8952"/>
<inertia ixx="11.48" ixy="10.52" ixz="1.737" iyy="1.737" iyz="11.48" izz="10.52"/>
</inertial>
<visual>
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<geometry>
<box size="${length} ${width} ${height}"/>
</geometry>
<material name="blue"/>
</visual>
<gazebo reference="base_link">
<material>Gazebo/Black</material>
</gazebo>
</link>
<!-- Ackerman Steering Macro -->
<xacro:macro name="ackerman_steering" params="suffix reflect">
<link name="${suffix}_ackerman_component">
<inertial>
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<mass value="0.0"/>
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
</inertial>
<visual name="">
<origin xyz="0.0 0.0 0.0" rpy="1.57 0.0 0.0"/>
<geometry>
<cylinder radius="${ackerman_joint_diameter/2}" length="${ackerman_joint_width}"/>
</geometry>
<material name="black">
<color rgba="1.0 0.0 0.0 1.0"/>
<texture filename=""/>
</material>
</visual>
<collision>
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<geometry>
<cylinder radius="${ackerman_joint_diameter/2}" length="${ackerman_joint_width}"/>
</geometry>
</collision>
</link>
<joint name="base_link_to_${suffix}_ackerman_component" type="revolute">
<origin xyz="${length / 2.5} ${((ackerman_joint_width/2) + (width/2)) * reflect} -${(height / 2.25) + (ackerman_joint_diameter / 2)}" rpy="0.0 0.0 0.0"/>
<parent link="base_link"/>
<child link="${suffix}_ackerman_component"/>
<axis xyz="0.0 0.0 1.0"/>
<limit lower="-0.5" upper="0.5" effort="0.0" velocity="0.0"/>
</joint>
<gazebo reference="${suffix}_ackerman_component">
<material>Gazebo/Black</material>
</gazebo>
</xacro:macro>
<!-- Front Wheel Macro -->
<xacro:macro name="front_wheel" params="suffix reflect">
<link name="front_${suffix}_wheel">
<inertial>
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<mass value="20.995"/>
<inertia ixx="0.996" ixy="0.0" ixz="0.0" iyy="0.612" iyz="0.0" izz="0.612"/>
</inertial>
<visual>
<origin xyz="0.0 ${(front_wheel_width/2) * reflect} 0.0" rpy="1.57 0.0 0.0"/>
<geometry>
<cylinder radius="${front_wheel_diameter/2}" length="${front_wheel_width}"/>
</geometry>
<material name="black">
<color rgba="1.0 0.0 0.0 1.0"/>
<texture filename=""/>
</material>
</visual>
<collision>
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<geometry>
<cylinder radius="${front_wheel_diameter/2}" length="${front_wheel_width}"/>
</geometry>
</collision>
</link>
<joint name="ackerman_steering_to_front_${suffix}_wheel" type="continuous">
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<parent link="${suffix}_ackerman_component"/>
<child link="front_${suffix}_wheel"/>
<axis xyz="0.0 0.1 0.0"/>
<limit lower="0.0" upper="0.0" effort="0.0" velocity="0.0"/>
</joint>
<gazebo reference="front_${suffix}_wheel">
<material>Gazebo/Black</material>
</gazebo>
</xacro:macro>
<!-- Back Wheel Macro -->
<xacro:macro name="rear_wheel" params="suffix reflect">
<link name="rear_${suffix}_wheel">
<inertial>
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<mass value="0.0"/>
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
</inertial>
<visual>
<origin xyz="0.0 ${(rear_wheel_width / 2) * reflect} 0.0" rpy="1.57 0.0 0.0"/>
<geometry>
<cylinder radius="${rear_wheel_diameter/2}" length="${rear_wheel_width}"/>
</geometry>
<material name="black">
<color rgba="1.0 0.0 0.0 1.0"/>
<texture filename=""/>
</material>
</visual>
<collision>
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<geometry>
<cylinder radius="${rear_wheel_diameter/2}" length="${rear_wheel_width}"/>
</geometry>
</collision>
</link>
<joint name="base_link_to_rear_${suffix}_wheel" type="continuous">
<origin xyz="-${length / 2.5} ${(width /2) * reflect} -${(height / 4) + (rear_wheel_diameter / 2)}" rpy="0.0 0.0 0.0"/>
<parent link="base_link"/>
<child link="rear_${suffix}_wheel"/>
<axis xyz="0.0 0.1 0.0"/>
<limit lower="0.0" upper="0.0" effort="0.0" velocity="0.0"/>
</joint>
<gazebo reference="rear_${suffix}_wheel">
<material>Gazebo/Black</material>
</gazebo>
</xacro:macro>
<!-- Calling the ackerman steering -->
<xacro:ackerman_steering suffix="right" reflect="-1" />
<xacro:ackerman_steering suffix="left" reflect="1" />
<!-- Calling the Front Wheels -->
<xacro:front_wheel suffix="right" reflect="-1" />
<xacro:front_wheel suffix="left" reflect="1" />
<!-- Calling the Rear Wheels -->
<xacro:rear_wheel suffix="right" reflect="-1" />
<xacro:rear_wheel suffix="left" reflect="1" />
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/</robotNamespace>
</plugin>
</gazebo>
</robot>
I run roslaunch little_pig_atv gazebo.launch
and the Gazebo opens up with no model. Would anybody be so kind as to highlight what I've not done correctly?
Cheers,
Coach
Originally posted by CoachAllen on ROS Answers with karma: 25 on 2020-01-26
Post score: 0
Original comments
Comment by CoachAllen on 2020-01-26:
Chirp Chirp
Comment by CoachAllen on 2020-01-26:
After examination in the Gazebo UI, I am seeing that the folder in which my urdf.xacro model is there. I see the base_link tree on the left. I am not seeing any robot pieces in the 3D world though.
Comment by CoachAllen on 2020-01-26:
Topic [//home/coach/catkin_ws/src/little_pig_atv/urdf/basic_geometry_pig.urdf.xacro/base_link/joint_cmd] is not valid.
Comment by CoachAllen on 2020-01-26:
None of the other links are showing in the tree.