RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.34k stars 1.26k forks source link

Implement RegionOfAttraction(system, context, options) #10863

Closed RussTedrake closed 4 years ago

RussTedrake commented 5 years ago

I've been updating all of the sums-of-squares code for underactuated. While it's fresh in my head, I want to go ahead and knock this long-time missing feature out.

This will be an updated, modernized version of https://github.com/RobotLocomotion/drake/blob/last_sha_with_original_matlab/drake/matlab/systems/%40PolynomialSystem/regionOfAttraction.m

Depends on https://github.com/RobotLocomotion/drake/issues/6732 Depends on https://github.com/RobotLocomotion/drake/issues/10862

RussTedrake commented 5 years ago

First piece to land will be some visualization helpers. Something like:

PlotEllipse(ax, A,b=[0,0],c=-1, edgecolor, fillcolor) # plots x'Ax + b'x + c = 0 on matplotlib axis.  A must be 2x2
PlotSublevelSet(ax, e, level=1, edgecolor, fillcolor) # plots the sublevel-set of the symbolic::Expression e <= 1.  e must be in two variables.

Could do the symbolic::Formula version, too? will also needs args for x and y limits, at least for the deg>2 case. (as I will likely implement it using contour). I also want to make sure it's easy to slice/project higher-dimensional elements here. slice is just Substitute. Projection needs more care/helpers.

RussTedrake commented 5 years ago

Variations to (potentially) implement:

Other options / variations:

RussTedrake commented 5 years ago

note to self: made progress in van der pol ROA notebook, but i need a few of the dependencies to land before i can push much farther. also waiting on (or need to work around) #11007

RussTedrake commented 5 years ago

Basic examples working well in python now.

RussTedrake commented 5 years ago

since this stalled, here is my WIP: https://www.dropbox.com/s/pj0vpl62ywhbbfk/van%20der%20Pol%20ROA.ipynb

sguysc commented 5 years ago

Is there any modern Drake example of computing funnels for a trajectory? (stabilizing a model over a trajectory, tvlqr, finding largest funnel with time varying Lyapunov functions)

RussTedrake commented 5 years ago

I’m afraid not yet. It will be the next on the list once this lands.

RussTedrake commented 4 years ago

12827 has landed, and I intend to fill in the different variants. But I am tracking them in my class todo list, and prefer to track it there instead of here.