-
Notifications
You must be signed in to change notification settings - Fork 326
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
[JTC] Proposal for custom "controller" plugins #885
base: master
Are you sure you want to change the base?
[JTC] Proposal for custom "controller" plugins #885
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #885 +/- ##
===========================================
- Coverage 71.86% 47.40% -24.46%
===========================================
Files 41 41
Lines 3650 3894 +244
Branches 1794 1840 +46
===========================================
- Hits 2623 1846 -777
- Misses 707 777 +70
- Partials 320 1271 +951
Flags with carried forward coverage won't be shown. Click here to find out more.
|
4927435
to
8b249df
Compare
This pull request is in conflict. Could you fix it @christophfroehlich? |
This pull request is in conflict. Could you fix it @christophfroehlich? |
This pull request is in conflict. Could you fix it @christophfroehlich? |
This pull request is in conflict. Could you fix it @christophfroehlich? |
Up to now there were only two possibilities of controlling the system with JTC:
The aim of this PR is to create an interface for supporting new control strategies, and enable even creating custom controller plugins by users. This is done by plugins of base class
TrajectoryControllerBase
, loaded by the pluginlib.Together with the change of #809 it will even be supported to integrate state-space controllers, where the system output does not have the same size as the system input: See the following swing-up of a cart-pole from this demo, where I implemented a LQR as plugin. The merge of both PRs can be found here.
swingup_lqr_gh.mp4
Why to change JTC in this way:
The API was designed around the following methods:
computeControlLawNonRT
: called when a new trajectory is received. This may take some time (e.g., calculating the gains for a LQR by solving Riccati equations). This blocks the execution of the new trajectory by JTC until the calculation is finished (seeis_ready()
). The user has to implement a realtime-buffer to switch the old control law to the new one, once it is started (seestart()
).set_hold_position()
), there is acomputeControlLawRT
which needs to finish within one RT loop.updateGainsRT
: A fast update within the RT loop, e.g., update of the PID gains from reconfigured ROS parameters.computeCommands
: Evaluate the control law inside the RT loop with earlier calculated/updated gains.Notes:
joints
thancommand_joints
#809, the map for the gains should becommand_joints
. But most of the time this parameter is empty and copied over fromjoints
in JTC. Because it is a static read-only variable, it is not possible to override the parameter for the plugin from JTC -> I had to make it reconfigurable from the generate_parameter_library, but added a callback afterwards to prohibit a later change from the user. If anyone knows a better way to solve this, please let me know.