-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add gzyarp::ConfigurationOverride plugin to permit to override initialConfiguration tag in gzyarp::ControlBoard plugins #232
Conversation
Note that the functionality of the added
However, this PR already achieves parity with |
fyi @Nicogene @martinaxgloria, this was another missing features in gz-sim-yarp-plugins that was complicating the migration from gazebo-yarp-plugins . |
Ah, given that I did not add tests, how did I checked this is working? I run the
|
I added some tests to check that this feature works as intended in https://github.com/robotology/gz-sim-yarp-plugins/tree/addoverrideinitialconftests, but the test fail with mysterious errors like:
even if the exact same plugin is loaded normally by gz-sim . Interestingly, the same error occurs in |
Moving the test out of |
Now the PR also has tests, so it is ready for review. I did not curated the commits, so if anyone merges please remember to merge with squash. |
I also did a bit of cleanup of the instances of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Thanks @traversaro for addressing the issue in harmonic! Just checking the logs I saw a difference in the two versions: Harmonic(v8):
Ionic(v9):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to go for me!
If it is not a problem I will squash together some commits and then merge since lot fo them are meaningful :) |
Feel free to curate the commit as you prefer! |
d03178f
to
b3f352b
Compare
b3f352b
to
901816e
Compare
Fix #159 .
This PR still misses some tests, but other then that is complete. It adds a
gzyarp::ConfigurationOverride
plugin that can be used to override theinitialConfiguration
tag ofgzyarp::ControlBoard
plugins in the world files, and hence specify an arbitrary initial configuration for models even without modifying the model itself.To describe the plugin itself, I would just copy the documentation that I added in the PR.
gzyarp::ConfigurationOverride functionalities
name
filename
gzyarp::ConfigurationOverride
gz-sim-yarp-configurationoverride-system
The
gzyarp::ConfigurationOverride
plugin can be attached to a model in order to override the configuration of any othergz-sim-yarp
plugin that is attached to the same model and that occurs inxml
after the insertion of the ConfigurationOverride plugin, even in a nested model.Each ConfigurationOverride plugin points to another plugin using a unique identifier, and can override the values of its configuration parameters.
The parameters and plugins currently supported by the
gzyarp::ConfigurationOverride
plugin are:initialConfiguration
gzyarp::ControlBoard
Any other parameter is not overriden. The plan for the future is to support more parameters in the
gzyarp::ConfigurationOverride
.Usage
Add the
gzyarp::ConfigurationOverride
plugin to the model SDF before the overriden plugin declaration (i.e. before the<include>
) and define theyarpDeviceName
attribute of theyarpPluginConfigurationOverride
element as theyarpDeviceName
of the YARP plugin that will be overriden.A typical usage of the
gzyarp::ConfigurationOverride
plugin is to specify parameters of a model included in a world, without the need to modify the model itself, that is convenient when the model is installed by another package and so it cannot be easily modified.An example of its usage can be seen in the
tutorial/single_pendulum/single_pendulum_world.sdf
world.The relevant snippet is:
The original
initialConfiguration
of thecontrolboard_plugin_device
was0.0
, while via thegzyarp::ConfigurationOverride
plugin we override its value to be1.57079632679
rad (i.e. 90 degrees).Migration from gazebo-yarp-plugins
In
gazebo-yarp-plugins
with Gazebo Classic, thelibgazebo_yarp_configurationoverride.so
plugin can be used to override parameters in nested plugins, for example:the equivalent syntax with
gz-sim-yarp-plugins
is:Beside the change of the
name
andfilename
attributes of theplugin
element, the main difference is how we identify the plugin of which we want to override the parameters: ingazebo-yarp-plugins
we use thename
element of the overriden plugin, that may be unique even if you have multiple controlboards. Ingz-sim-yarp-plugins
, thename
element of each controlboard plugin must begzyarp::ControlBoard
, so it will not be unique among different controlboards. For this reason, to identify the plugin to override we use instead theyarpDeviceName
, that is unique for each plugin in the same model, and that needs already to be defined to expose each plugins with Network Wrapper Servers instantiated by thegzyarp::RobotInterface
plugin.