Gazebo | Ignition | Community
Ask Your Question
0

How to spawn sdf object in Ignition Gazebo?

asked 2020-10-30 10:46:42 -0500

azazdeaz gravatar image

How can I spawn a model into a running simulation in Ignition Gazebo? I'm looking for something like rosrun gazebo spawn_model but for Ignition.

This was the closest thing I found but I couldn't get it working so far: https://github.com/ignitionrobotics/r...

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2020-10-30 14:37:23 -0500

nlamprian gravatar image

You already have the answer in your link above. There is an example in ros_ign_gazebo_demos:

<node
  pkg="ros_ign_gazebo"
  type="create"
  name="spawn_model"
  args="-world <world_name> -name <model_name> -param robot_description">
</node>
edit flag offensive delete link more
1

answered 2020-12-18 13:10:33 -0500

ahcorde gravatar image

Hi

you can have a look in the empty.sdf world.

Inserting:

ign service -s /world/empty/create \
--reqtype ignition.msgs.EntityFactory \
--reptype ignition.msgs.Boolean \
--timeout 300 \
--req 'sdf: '\
'"<?xml version=\"1.0\" ?>'\
'<sdf version=\"1.6\">'\
'<model name=\"spawned_model\">'\
'<link name=\"link\">'\
'<visual name=\"visual\">'\
'<geometry><sphere><radius>1.0</radius></sphere></geometry>'\
'</visual>'\
'<collision name=\"visual\">'\
'<geometry><sphere><radius>1.0</radius></sphere></geometry>'\
'</collision>'\
'</link>'\
'</model>'\
'</sdf>" '\
'pose: {position: {z: 10}} '\
'name: "new_name" '\
'allow_renaming: true'

Deleting

ign service -s /world/empty/remove \
--reqtype ignition.msgs.Entity \
--reptype ignition.msgs.Boolean \
--timeout 300 \
--req 'name: "new_name" type: MODEL'
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-10-30 10:46:42 -0500

Seen: 111 times

Last updated: Dec 18 '20