Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Optimal control module#549

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sawyerbfuller merged 18 commits intopython-control:masterfrommurrayrm:obc
Mar 2, 2021
Merged

Conversation

murrayrm
Copy link
Member

@murrayrmmurrayrm commentedFeb 21, 2021
edited
Loading

This PR adds a new optimal control module,control.optimal, that implements finite horizon optimal control problems with constraints, including rudimentary model predictive control (MPC). The underlying algorithms are not super-efficient, so this is more of a "reference implementation" than something that you could use on a large problem, but it does allow you to explore ideas around tradeoffs in various types of cost functions, constraints, and other concepts. The PR includes unit tests and documentation on the use of the module.

(The motivation for this PR is that I'll be teaching an optimal control class next year, and I'd like to have some tools around that students can use to get a feel for the concepts. The hope is to implement most of the concepts that are in my (very incomplete) notes on "Optimization-Based Control".)

A few notes (for feedback):

  • I have called the modulecontrol.optimal and it isnot loaded by default. So, like thescipy.optimize package, you have to load the module separately if you want to use it (control.flatsys is also like this, so there is a precedent). I'm initially called the moduleobc (for optimization-based control, but decided thatoptimalwas probably better (and matchedoptimize`, used in SciPy).
  • The module is basically just a wrapper around thescipy.optimize.minimize function: it essentially takes the element of an optimal control problem and creates an optimization problem for SciPy to solve. For this reason I have tried to make things consistent withscipy.optimize when possible (eg, the form of constraints, the way results are returned).
  • The unit tests are a bit finicky and seem to depend on what system they are tested on. Everything is working in GitHub Actions, but you'll see some conditional checks in the code for things that work differently there versus my local machine. For this reason, it would be useful if people can try things out on other platforms and let me know what happens.
  • Finally, as noted already above, the code is not super efficient, particularly for continuous time systems. You'll see this if you run theexamples/steering-optimal.py script, which takes about 30 seconds to do solve some pretty straightforward problems.It also takes about 15 seconds forcontrol/tests/optimal_test.py to run on my Mac, which can get annoying (a fullpytest run takes about a 45 seconds, so this is 30% for just one module).

Other changes along the way:

  • Added in some functionality to check for unrecognized keywords in theconfig.py parsing function_get_param.
  • 28 Feb 2021: Added a new 'bezier' basis function inflatsys, though only a partial implementation (needed for examples of optimizing over a set of basis functions).
  • 28 Feb 2021: Added abenchmark directory with some airspeed velocity (asv) benchmarks for optimal control. These are mainly for development purposes, but might be something we use more generally at a future date.

Comments and advice welcome!

@murrayrmmurrayrm marked this pull request as draftFebruary 21, 2021 00:24
@coveralls
Copy link

coveralls commentedFeb 21, 2021
edited
Loading

Coverage Status

Coverage increased (+0.07%) to 88.861% when pullingc49ee90 on murrayrm:obc into8cba949 on python-control:master.

@sawyerbfuller
Copy link
Contributor

This is super cool. Having these features conveniently in the library (rather than having to roll your own optimal controller) seems like it could facilitate incorporating these more advanced controls concepts into the digital controls class I teach, whcih is something I've been wanting to do.

I probably won't be able to try your version before it's merged with the master branch, but I'll let you know if I encounter any issues once it is and I've gotten a chance to try it.

@murrayrmmurrayrm marked this pull request as ready for reviewMarch 1, 2021 21:39
@sawyerbfullersawyerbfuller merged commit66d4a53 intopython-control:masterMar 2, 2021
@murrayrmmurrayrm deleted the obc branchMarch 3, 2021 02:56
@murrayrmmurrayrm added this to the0.9.0 milestoneMar 20, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
0.9.0
Development

Successfully merging this pull request may close these issues.

3 participants
@murrayrm@coveralls@sawyerbfuller

[8]ページ先頭

©2009-2025 Movatter.jp