Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

debugging spawning sdf model in Gazebo

Hi,

I am trying to spawn SDF model of a human in Gazebo environment. The human sdf model I have got from here. In order to spawn that model in Gazebo, I have created 3 roslaunch files. The first roslaunch file (named start_world.launch) is just to start the empty Gazebo world in ROS which is as below

<?xml version="1.0"?>
 <launch>
    <!-- startup simulated world -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
  </include>
</launch>

The second launch file, spawn_sdf.launch, is pertaining to spawning a general sdf model in Gazebo which is as below

<?xml version="1.0"?>
<launch>
  <arg name="x" default="0.0" />
  <arg name="y" default="0.0" />
  <arg name="z" default="0.0" />
  <arg name="roll" default="0.0" />
  <arg name="pitch" default="0.0" />
  <arg name="yaw" default="0.0" />
  <arg name="sdf_robot_file" default="$(find person_sim)/models/model.sdf"/>
  <arg name="robot_name" default="person_standing"/>

  <node name="$(arg robot_name)_spawn_urdf" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" args="-file $(arg sdf_robot_file) -sdf -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg roll) -P $(arg pitch) -Y $(arg yaw) -model $(arg robot_name)"/>
</launch>

The third roslaunch file, spawn_person.launch, includes the second roslaunch file and presented below

<?xml version="1.0"?>
<launch>
  <arg name="x" default="0.0" />
  <arg name="y" default="0.0" />
  <arg name="z" default="0.0" />
  <arg name="yaw" default="0.0" />
  <arg name="sdf_robot_file" default="$(find person_sim)/models/model.sdf"/>
  <arg name="robot_name" default="person_standing"/>

  <!-- startup simulated world -->
  <include file="$(find person_sim)/launch/spawn_sdf.launch">
      <arg name="sdf_robot_file" value="$(arg sdf_robot_file)"/>
      <arg name="robot_name" value="$(arg robot_name)" />
      <arg name="x" value="1.0" />
      <arg name="y" value="1.0" />
      <arg name="z" value="0.0" />
      <arg name="yaw" value="0.0" />
  </include>
</launch>

In one terminal I launch start_world.launch and in the second terminal I launch spawn_person.launch. Please note that all these launch files and the sdf model reside in a package named person_sim. After running the second launch file in the terminal, I see the following output

$ roslaunch person_sim spawn_person.launch 
... logging to /home/robot/.ros/log/d4d37442-ff59-11eb-906a-db8f4ebf8eb8/roslaunch-robot-133639.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://robot:43401/

SUMMARY
========

PARAMETERS
 * /rosdistro: noetic
 * /rosversion: 1.15.11

NODES
  /
    person_standing_spawn_urdf (gazebo_ros/spawn_model)

ROS_MASTER_URI=http://localhost:11311

process[person_standing_spawn_urdf-1]: started with pid [133668]
[INFO] [1629204731.354375, 0.000000]: Loading model XML from file /home/robot/robot_ws/src/ur5-simulation-package/person_sim/models/model.sdf
[INFO] [1629204731.359082, 43.753000]: Waiting for service /gazebo/spawn_sdf_model
[INFO] [1629204731.364632, 43.759000]: Calling service /gazebo/spawn_sdf_model
[INFO] [1629204731.552085, 43.889000]: Spawn status: SpawnModel: Successfully spawned entity
[person_standing_spawn_urdf-1] process has finished cleanly
log file: /home/robot/.ros/log/d4d37442-ff59-11eb-906a-db8f4ebf8eb8/person_standing_spawn_urdf-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done

After that I do not see any sdf model was spawned in the Gazebo world and also as can be seen above that it prompts as all processes on the machine have died, roslaunch woll exit. Any help in resolving this issue would be appreciated.

Thank you.