Comments (4)
There are multiple formulations possible. (I hope that the course notes are informative). The problem with your one line change is that if both lambda and rho are decision variables, then the new expression is bilinear in the decision variables (not a valid SOS constraint).
The code existing code is a clever way to search for both rho and lambda simultaneously. Instead of saying "for all x in which V < rho, Vdot must be < 0" -- which is what you wanted -- we can write "for all x in which Vdot >= 0, V must be > rho". This works everywhere except at the origin (because Vdot=0), so we have to multiply by x^2 to handle that case.
from underactuated.
Coool! I just read your online book and found that the code cannot match with what you have written in the chapter so that I got lost a little bit here. Thank you so much for your explanation. What a clever way!
from underactuated.
Hello, I wanna use SOS to do the lyapunov analysis of the simple pendulum. There's no bug for my code but I got V = 0 and lambda = 0 which indicates obviously that something goes wrong. Can you help me have a look at my code?
I just followed the following formulation to find the V.
import math
import numpy as np
from pydrake.all import (Jacobian, MathematicalProgram, SolutionResult,
Variables)
def dynamics(x):
return [x[1]*x[2], -x[0]*x[2], -(x[2] + 9.81*x[0])]
prog = MathematicalProgram()
x = prog.NewIndeterminates(3, "x")
# Define the Lyapunov function.
(V, constraint1) = prog.NewSosPolynomial(Variables(x), 2)
Vdot = Jacobian([V.ToExpression()], x).dot(dynamics(x))[0]
# Define the Lagrange multipliers.
(lambda_, constraint2) = prog.NewSosPolynomial(Variables(x), 4)
prog.AddSosConstraint(-Vdot - lambda_.ToExpression()*(pow(x[0],2) + pow(x[1],2) - 1))
result = prog.Solve()
assert(result == SolutionResult.kSolutionFound)
print(prog.SubstituteSolution(V.ToExpression()))
print(prog.SubstituteSolution(lambda_.ToExpression()))
from underactuated.
my version of this is here: https://github.com/RussTedrake/underactuated/blob/master/src/pendulum/global_sums_of_squares.py
i didn't check every line, but notice that i was careful to set the scaling by setting V(1) = 1. Otherwise V=0 is perfectly viable.
from underactuated.
Related Issues (20)
- intro.ipynb error HOT 1
- drop scipy dependency HOT 1
- Project guidance required HOT 2
- The Simple Pendulum.ipynb simulation not working HOT 5
- how to generate pdf correspond to latest html? HOT 4
- Can Only Import Tests and Grader if CWD is Root Directory (Causes Problem with Jupyter Notebooks) HOT 5
- ImportError: cannot import name 'ConfigureParser' from 'underactuated' HOT 3
- package.xml missing from distribution? HOT 2
- orbital transfer notebook is sensitive to the solver / order of constraints. HOT 1
- approximate_dp notebooks takes too long on CI
- No matching distribution found for drake>=1.14.0 (from underactuated) HOT 2
- Questions about jacobian in littledog.ipynb HOT 1
- SDP examples - Deepnote does not support align environment
- Error Running the DeepNote of Ch 1 HOT 1
- Question about rimless_wheel.ipynb HOT 2
- Feedback cancellation doesn't work due to tauExt term (underactuated/intro.pynb) HOT 1
- we could try to host the drcsim worlds in this repo
- Is there a printed version available of this book? HOT 1
- Error Importing MeshcatVisualizerCpp from pydrake HOT 1
- Extra characters in search box
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from underactuated.