ros_gz icon indicating copy to clipboard operation
ros_gz copied to clipboard

SpawnEntity, DeleteEntity, SetPose Services

Open retinfai opened this issue 1 year ago • 15 comments

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

retinfai avatar Feb 10 '23 20:02 retinfai

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

azeey avatar Feb 16 '23 18:02 azeey

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

retinfai avatar Feb 16 '23 18:02 retinfai

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

zp-yang avatar Mar 01 '23 22:03 zp-yang

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.

retinfai avatar Mar 01 '23 22:03 retinfai

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

zp-yang avatar Mar 04 '23 23:03 zp-yang

I'm using that too.

ROS2 Humble & Gazebo Garden

retinfai avatar Mar 04 '23 23:03 retinfai

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.

zp-yang avatar Mar 04 '23 23:03 zp-yang

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

retinfai avatar Mar 04 '23 23:03 retinfai

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

Mildred34 avatar Mar 08 '23 15:03 Mildred34

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

azeey avatar Mar 08 '23 22:03 azeey

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

Mildred34 avatar Mar 09 '23 09:03 Mildred34

@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

retinfai avatar Mar 09 '23 09:03 retinfai

@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 !

Mildred34 avatar Mar 09 '23 10:03 Mildred34

@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

retinfai avatar Mar 09 '23 19:03 retinfai

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

Mildred34 avatar Mar 10 '23 10:03 Mildred34