Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launch gz_spawn_model from xml #551

Merged
merged 74 commits into from
May 24, 2024
Merged

Launch gz_spawn_model from xml #551

merged 74 commits into from
May 24, 2024

Conversation

caguero
Copy link
Contributor

@caguero caguero commented May 20, 2024

🎉 New feature

Part of #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

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

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.

azeey and others added 30 commits February 21, 2024 15:22
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
* Launch file for the bridge

Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
* Launch file for the bridge

Signed-off-by: Carlos Agüero <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
azeey and others added 4 commits May 22, 2024 12:15
Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
@caguero caguero marked this pull request as ready for review May 22, 2024 19:41
@caguero caguero requested a review from ahcorde as a code owner May 22, 2024 19:41
Comment on lines 36 to 47
world: SomeSubstitutionsType,
file: SomeSubstitutionsType,
xml_string: SomeSubstitutionsType,
topic: SomeSubstitutionsType,
name: SomeSubstitutionsType,
allow_renaming: SomeSubstitutionsType,
x: SomeSubstitutionsType,
y: SomeSubstitutionsType,
z: SomeSubstitutionsType,
roll: SomeSubstitutionsType,
pitch: SomeSubstitutionsType,
yaw: SomeSubstitutionsType,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these be made optional similar to my other feedback?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in 04c9dc8.

caguero and others added 7 commits May 23, 2024 19:04
Co-authored-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolve conflicts too

z="$(var z)"
roll="$(var roll)"
pitch="$(var pitch)"
yaw="$(var yaw)"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong, isn't it?

Suggested change
yaw="$(var yaw)"
yaw="$(var yaw)">

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo fixed in 04c9dc8.

Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Base automatically changed from launch_gz_bridge to ros2 May 23, 2024 22:09
Signed-off-by: Carlos Agüero <[email protected]>
Signed-off-by: Carlos Agüero <[email protected]>
Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@azeey azeey requested a review from ahcorde May 24, 2024 17:08
@caguero caguero merged commit d92c1bd into ros2 May 24, 2024
3 checks passed
@caguero caguero deleted the launch_gz_spawn branch May 24, 2024 17:46
Amronos pushed a commit to Amronos/ros_gz that referenced this pull request Sep 18, 2024
Spawn models from XML.
Signed-off-by: Carlos Agüero <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants