ros_gz
ros_gz copied to clipboard
Add SpawnEntity, DeleteEntity, & SetEntityPose Support
🎉 New feature
Closes #363
Summary
Add support for SpawnEntity, DeleteEntity, & SetEntityPose services Add support for EntityFactory
Test it
Spin up a parameter bridge for the service you are testing, and make a ros2 service call to it
Example for SpawnEntity
gz sim empty.sdf
ros2 run ros_gz_bridge parameter_bridge /world/empty/create@ros_gz_interfaces/srv/SpawnEntity
ros2 service call /world/empty/create ros_gz_interfaces/srv/SpawnEntity "{entity_factory: {name: "cool_sdf", sdf_filename: 'path/to/sdf'}}"
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.
@retinfai Did you mean to close this PR?
I wasn't sure whether I had to have all the things checked off before opening the PR? Or can it be open, while I complete all the tasks
You can mark it as a draft PR if you're still working on it. Reviewers might give you initial feedback.
Perfect, thanks
Is there any updates on this?
Is there any updates on this?
Not that I know if. It would be great to get this PR moving again.
Is there any updates on this?
Functionally everything in this PR works. I've been using it in my projects fine. Just haven't had time to go back and follow the process properly. Will try to move things along
@retinfai I tried using the SetEntityPose service, but I'm not getting any response. any ideas? Using Gazebo Garden and Ros2 humble
ros2 run ros_gz_bridge parameter_bridge /world/bluerov2_heavy_underwater/set_pose@ros_gz_interfaces/srv/SetEntityPose
ros2 service call /world/bluerov2_heavy_underwater/set_pose ros_gz_interfaces/srv/SetEntityPose "{entity: {id: 8, name: "rgbd_camera2", type: 6}, pose: {position: {x: 0.2, y: 0.0, z: 0.0}, orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}}}"
It prints this, but no response after this,
requester: making request: ros_gz_interfaces.srv.SetEntityPose_Request(entity=ros_gz_interfaces.msg.Entity(id=8, name='rgbd_camera2', type=6), pose=geometry_msgs.msg.Pose(position=geometry_msgs.msg.Point(x=0.2, y=0.0, z=0.0), orientation=geometry_msgs.msg.Quaternion(x=0.0, y=0.0, z=0.0, w=1.0)))
It prints this, but no response after this, I guess it doesn't all work haha. Haven't tried the services on sensors, there could be a gap
@retinfai I tried using the SetEntityPose service, but I'm not getting any response. any ideas? Using Gazebo Garden and Ros2 humble
ros2 run ros_gz_bridge parameter_bridge /world/bluerov2_heavy_underwater/set_pose@ros_gz_interfaces/srv/SetEntityPose ros2 service call /world/bluerov2_heavy_underwater/set_pose ros_gz_interfaces/srv/SetEntityPose "{entity: {id: 8, name: "rgbd_camera2", type: 6}, pose: {position: {x: 0.2, y: 0.0, z: 0.0}, orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}}}"
It prints this, but no response after this,
requester: making request: ros_gz_interfaces.srv.SetEntityPose_Request(entity=ros_gz_interfaces.msg.Entity(id=8, name='rgbd_camera2', type=6), pose=geometry_msgs.msg.Pose(position=geometry_msgs.msg.Point(x=0.2, y=0.0, z=0.0), orientation=geometry_msgs.msg.Quaternion(x=0.0, y=0.0, z=0.0, w=1.0)))
Hmm, not quite sure. Everything looks fine; haven't tried services on things other than a model, so i guess it isn't all working haha. Can you verify that you get the correct expected behaviour calling the service from the gazebo side? gz service ...
.
@retinfai There was some problem in my package. The model is moving fine using the service.
Edit
The sensors doesn't work and the behavior is not same using gazebo service. It changes values of world pose cmd
instead of pose
. gazebo service doesn't do anything. Not sure if I'm using it right