Gazebo | Ignition | Community
Ask Your Question
0

How to spawn sdf object in Ignition Gazebo?

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

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 -0600

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

Comments

Is there a ROS2 Galactic node equivalent to remove an entity? I've just found a node to create an entity here.

benedikt gravatar imagebenedikt ( 2022-09-01 13:12:21 -0600 )edit
3

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

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

Comments

Omg...i love you! This is what I need!!! Just like that! God bless you

kakcalu13 gravatar imagekakcalu13 ( 2022-02-17 11:06:17 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 3,184 times

Last updated: Dec 18 '20