chapulina / dolly

🤖🐑 It's a sheep, it's a dolly, it's a following robot. Dolly was born to be cloned.
Apache License 2.0
224 stars 66 forks source link

Example package for ignition systems plugin #28

Open ruffsl opened 3 years ago

ruffsl commented 3 years ago

It would be nice to have an example of how to package a custom systems plugin for ignition. For example, the classic gazebo version of dolly uses the libgazebo_ros_diff_drive plugin for mapping command velocities to the joint control for a respective wheelbase of the robot:

https://github.com/chapulina/dolly/blob/349c35288b3a78a66249a1eef66bd507a0fed750/dolly_gazebo/models/dolly/model.sdf#L330

The ignition gazebo version of dolly uses the libignition-gazebo-diff-drive-system instead:

https://github.com/chapulina/dolly/blob/349c35288b3a78a66249a1eef66bd507a0fed750/dolly_ignition/models/dolly_ignition/model.sdf#L330-L332

For instances where an existing plugin bundled in ignition may not suffice or not exist, it would be helpful to have a packaged example of something like the diff_drive plugin as a local package here.

https://github.com/ignitionrobotics/ign-gazebo/tree/5b21ec87306c35b3494adc25694fac8b8d1bb7de/src/systems/diff_drive

Perhaps a simple ignition plugin to control the tail_joint of dolly, that could be controlled via topic to active waggle, passively dampen, or hold still/break. It would also provide as a reference template for the cmake and ament exports necessary for ignition to find and load the externally compiled plugin.

https://github.com/chapulina/dolly/blob/349c35288b3a78a66249a1eef66bd507a0fed750/dolly_ignition/models/dolly_ignition/model.sdf#L296

Personally, I'd like to prototype an ackermann steering model, but want to avoid having to rebuild the entire ign-gazebo code base until the plugin is working and ready to upstream, keeping my development confined to a minimal dolly like colcon workspace/repo. As of yet, the current Ignition Robotics plugin and systems docs do not specify how to write your own, external from the upstream binaries.

chapulina commented 3 years ago

an example of how to package a custom systems plugin for ignition

There are a few examples here:

https://github.com/ignitionrobotics/ign-gazebo/tree/master/examples/plugin

This tutorial should also be helpful:

https://ignitionrobotics.org/api/gazebo/3.3/createsystemplugins.html

The recommendation is to write pure CMake packages for all functionality that isn't ROS-specific and use the ros-ign bridge to connect to ROS. This is meant to make the code more reusable. For example, on Gazebo-classic, we have a pure-cmake gazebo::DiffDrivePlugin, and also the ROS-enabled gazebo_plugins::GazeboRosDiffDrive - which has always been a pain to maintain.

I'd like to prototype an ackermann steering model, but want to avoid having to rebuild the entire ign-gazebo code base until the plugin is working

With the separation of concerns above in mind, I'd recommend you write a ROS package that contains:

Perhaps a simple ignition plugin to control the tail_joint of dolly, that could be controlled via topic to active waggle, passively dampen, or hold still/break. It would also provide as a reference template for the cmake and ament exports necessary for ignition to find and load the externally compiled plugin.

I agree that this would be a valuable example, I'll look into adding one

As of yet, the current Ignition Robotics plugin and systems docs do not specify how to write your own, external from the upstream binaries.

I think we could do a better job linking to the resources I pointed out above: the example plugins and the tutorials.

cocodmdr commented 3 years ago

Hello,

Are there news on this issue ?

I would like to build a modified version of diff_drive plugin in order to control a third directionnal wheel. Instead of the caster wheel there is a motorised fork with a motorised wheel.

I am trying to understand how to add a plugin but I am facing issues when I import custom plugins.

Regards.

chapulina commented 3 years ago

Hi @cocodmdr , did you look into the example system plugin?

https://github.com/ignitionrobotics/ign-gazebo/tree/master/examples/plugin/system_plugin

Also this tutorial:

https://ignitionrobotics.org/api/gazebo/4.0/createsystemplugins.html