urdf/ Tutorials/ Using a URDF in Gazebo: Robot model nowhere to be seen in Gazebo

asked 2021-03-31 12:15:23 -0500

karwei gravatar image

updated 2021-03-31 17:09:21 -0500

tryan gravatar image

Hi, I'm currently using ROS melodic on an Ubuntu 18.04.5 LTS virtual machine, and I'm currently following part 2 of the urdf Tutorialsprovided by wiki.ros.org. However, I decided to use this tutorial as a template to build another robot model of my own, instead of building the default R2D2 robot model. I'm currently at the part of using the URDF in Gazebo, where I have already created my .urdf file and .xacro file for my robot model. I have managed to spawn my robot model in rviz as instructed in the previous parts of the tutorial using the .urdf file, however when it comes to spawning the model into Gazebo using gazebo.launch:

<launch>

  <!-- these are the arguments you can pass this launch file, for example paused:=true -->
  <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 urdf_tutorial)/urdf/08-macroed.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">
    <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>

  <param name="robot_description" command="$(find xacro)/xacro $(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>

Where it spawns the robot model described in the file "08-macroed.urdf.xacro", into Gazebo's empty world, the robot is nowhere to be seen. No warnings or errors were shown when running the "roslaunch urdf_sim_tutorial gazebo.launch" command as stated in the tutorial.

Here is the description of my robot model in the file "08-macroed.urdf.xacro":

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

  <link name="base_link">
    <visual>
      <geometry>
        <cylinder length="0.176" radius="0.295051"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0 0 0.153988"/>
    </visual>

    <collision>
      <geometry>
        <cylinder length="0.176" radius="0.295051"/>
      </geometry>
    </collision>
  </link>

  <link name="upper_chassis">
    <visual>
      <geometry>
        <cylinder length="0.601382" radius="0.295051"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0 0 0"/>
    </visual>

    <collision>
      <geometry>
        <cylinder length="0.601382" radius="0.295051"/>
      </geometry>
    </collision>
  </link>

  <joint name="upper_chassis_hinge" type="fixed">
    <parent link="base_link"/>
    <child link="upper_chassis"/>
    <origin xyz="0 0 .602679"/>
  </joint>

  <link name="front_caster">
    <visual>
      <geometry> ...
(more)
edit retag flag offensive close merge delete