gazebosim / ros_gz

Integration between ROS (1 and 2) and Gazebo simulation
https://gazebosim.org
Apache License 2.0
233 stars 135 forks source link

Launch gz_spawn_model from xml #551

Closed caguero closed 4 months ago

caguero commented 4 months ago

🎉 New feature

Part of https://github.com/gazebosim/ros_gz/issues/552

Summary

This patch lets you spawn a gz sim model from an XML file.

How to test it?

Launch gz sim:

ros2 launch ros_gz_sim gz_sim.launch.py gz_args:=empty.sdf

Hit play.

Use the provided gz_spawn_model.launch to spawn a vehicle (change file accordingly):

ros2 launch ros_gz_sim gz_spawn_model.launch world:=empty file:=/home/caguero/ros_gz_ws/src/ros_gz/ros_gz_sim_demos/models/vehicle/model.sdf name:=my_vehicle x:=5.0 y:=5.0 z:=0.5

A vehicle should be loaded into the scene.

Confirm that no container has been created:

caguero@cold:~/ros_gz_ws$ ros2 component list

Test it

Checklist

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.