Skip to content

Support inputs that are variables and their derivatives.#450

Draft
moorepants wants to merge 1 commit into
csu-hmc:masterfrom
moorepants:deriatives-in-inputs
Draft

Support inputs that are variables and their derivatives.#450
moorepants wants to merge 1 commit into
csu-hmc:masterfrom
moorepants:deriatives-in-inputs

Conversation

@moorepants

Copy link
Copy Markdown
Member

It is common for kinematically driven dynamics models that the inputs are a position, it's derivative, and it's double derivative. The bicycle countersteer example is one such example. We currently need a hack to support this. The hack being adding an extra differential equation.

This PR doesn't use the hack but fails silently, i.e. it solves but with an incorrect solution.

The discretized equations of motion do not treat the derivative term correctly:

In [3]: prob.collocator.discrete_eom
Out[3]: 
Matrix([
[                                                                                                                                                                       -omegai + (thetai - thetap)/Delta_t],
[-g*h*m*sin(thetai) + h*m*(Derivativei*a*v/(b*cos(deltai)**2) + v*tan(deltai))*cos(thetai) + v**2*(-I2 + I3 - h**2*m)*sin(thetai)*cos(thetai)*tan(deltai)**2/b**2 + (I1 + h**2*m)*(omegai - omegap)/Delta_t],
[                                                                                                                                                                          -v*cos(psii) + (xi - xp)/Delta_t],
[                                                                                                                                                                          -v*sin(psii) + (yi - yp)/Delta_t],
[                                                                                                                                                                  -v*tan(deltai)/b + (psii - psip)/Delta_t]])

In [4]: prob.collocator.discrete_eom.free_symbols
Out[4]: 
{Delta_t,
 Derivativei,
 I1,
 I2,
 I3,
 a,
 b,
 deltai,
 g,
 h,
 m,
 omegai,
 omegap,
 psii,
 psip,
 thetai,
 thetap,
 v,
 xi,
 xp,
 yi,
 yp}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant