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

Add gain scheduling to create_statefbk_iosystem()#827

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
murrayrm merged 6 commits intopython-control:mainfrommurrayrm:gainsched-23Dec2022
Dec 30, 2022

Conversation

murrayrm
Copy link
Member

This PR adds functionality to thecreate_statefbk_iosystem function, allowing it to be used to set up a simple gain scheduled controller. From the documentation:

Gain scheduling on the desired state, desired input, or system state can be implemented by setting the gain to a 2-tuple consisting of a list of gains and a list of points at which the gains
were computed, as well as a description of the scheduling variables

  ctrl, clsys = ct.create_statefbk_iosystem(      sys, ([g1, ..., gN], [p1, ..., pN]), gainsched_indices=[s1, ..., sq])

The list of indices can either be integers indicating the offset into the controller input vector or a list of strings matching the names of the input signals.

Example:

    # Create a simple nonlinear system to check (kinematic car)    def unicycle_update(t, x, u, params):        return np.array([np.cos(x[2]) * u[0], np.sin(x[2]) * u[0], u[1]])    def unicycle_output(t, x, u, params):        return x    unicycle = ct.NonlinearIOSystem(        unicycle_update, unicycle_output, inputs = ['v', 'phi'],         outputs = ['x', 'y', 'theta'], states = ['x_', 'y_', 'theta_'])    # Speeds and angles at which to compute the gains    speeds = [1, 5, 10]    angles = np.linspace(0, pi/2, 4)    points = list(itertools.product(speeds, angles))    # Gains for each speed (using LQR controller)    Q = np.identity(unicycle.nstates)    R = np.identity(unicycle.ninputs)    gains = [np.array(ct.lqr(unicycle.linearize(        [0, 0, angle], [speed, 0]), Q, R)[0]) for speed, angle in points]    #    # Schedule on desired speed and angle    #    # Create gain scheduled controller    ctrl, clsys = ct.create_statefbk_iosystem(        unicycle, (gains, points), gainsched_indices=['vd', 'theta'])

Includes unit tests and documentation.

@murrayrmmurrayrm added this to the0.9.3 milestoneDec 29, 2022
@coveralls
Copy link

coveralls commentedDec 29, 2022
edited
Loading

Coverage Status

Coverage: 94.845% (-0.002%) from 94.846% when pulling51f3b6b on murrayrm:gainsched-23Dec2022 into49b0077 on python-control:main.

@murrayrmmurrayrm merged commitc3488cd intopython-control:mainDec 30, 2022
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.3
Development

Successfully merging this pull request may close these issues.

2 participants
@murrayrm@coveralls

[8]ページ先頭

©2009-2025 Movatter.jp