gazebosim / ros_gz

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

SpawnEntity, DeleteEntity, SetPose Services #363

Open retinfai opened 1 year ago

retinfai commented 1 year ago

Desired behavior

ros_gz_bridge support SpawnEntity, DeleteEntity, and SetPose services, so I can access them through ROS2 client calls.

Alternatives considered

Running gz services through Subprocesses

Implementation suggestion

Is it just ros_gz_bridge/src/service_factories/ros_gz_interfaces.cpp that needs to be changed? Not too sure, but just a thought.

Additional context

Gazebo Garden, ROS2 Humble. The interfaces for the services, request types, and response types are already supported in ros_gz_interfaces or other

azeey commented 1 year ago

This would be a nice addition. A PR would be welcome 😉 .

retinfai commented 1 year ago

I can give it a good go. First open source contribution attempt aha

zp-yang commented 1 year ago

How is the progress on implementing these services? I would also like to help if needed.

retinfai commented 1 year ago

I've begun work on this fork and hacked a solution for my own purposes here: https://github.com/retinfai/ros_gz

But more tweaking is needed before I want to submit for review.

Would love collaboration – I haven't found a lot of time recently.

zp-yang commented 1 year ago

which ros2 version and gazebo version are you using? I am running humble and garden.

retinfai commented 1 year ago

I'm using that too.

ROS2 Humble & Gazebo Garden

zp-yang commented 1 year ago

Cool, what do you think still needs to be done? You seemed to have all of the features working. I am mainly interested in the set_pose service and it works on my side as well.

retinfai commented 1 year ago

It's more like it's incomplete. I don't convert every field.

But for set pose specifically, it gets confusing for me when gz.msgs.Pose doesn't map one to one to anything in the ROS side, so want to know the best practice for mapping 1 to N and vice versa. Set pose request (Entity and Pose on the ROS side) map to gazebo Pose but not all fields in Entity and Pose are used, so I exclude them. That sort of thing

I'm glad it works on your side. Now that I think about it, you're right: just need to iron out some things

Mildred34 commented 1 year ago

I was wondering how to set the location of an entity spawned within Gazebo Garden. But it's not officially supported.

azeey commented 1 year ago

I was wondering how to set the location of an entity spawned within Gazebo Garden. But it's not officially supported.

This is definitely supported. Checkout the message definition https://github.com/gazebosim/gz-msgs/blob/gz-msgs9/proto/gz/msgs/entity_factory.proto#L65

Mildred34 commented 1 year ago

@azeey Looks like during spawn only by reading at the comment. I was thinking about setting (or resetting) the location afterwards.

retinfai commented 1 year ago

@azeey Looks like during spawn only by reading at the comment.

I was thinking about setting (or resetting) the location afterwards.

If you're talking about the bridge supporting you're correct.

But if you're talking about gazebo supporting it, gazebo does have a /model//set_pose service or something similar. You can call from a process

Mildred34 commented 1 year ago

@retinfai I'm not an expert but to call a gazebo service from a ros node, I need the bridge support ? If not, I'm going to investigate inside the set_pose service, you mentionned !

retinfai commented 1 year ago

@retinfai I'm not an expert but to call a gazebo service from a ros node, I need the bridge support ?

If not, I'm going to investigate inside the set_pose service, you mentionned !

That's correct, calling the service from a Ros node does require bridge support . Just wanted to clarify.

In saying that, you can pull the fork, which does support it, while I fix issues and create a PR

Mildred34 commented 1 year ago

@retinfai Yes I'll do that! Thanks for the help