csu-hmc / opty

A library for using direct collocation in the optimization of dynamic systems.
http://opty.readthedocs.io
Other
94 stars 20 forks source link

A question about forming the EOMs #167

Closed Peter230655 closed 5 months ago

Peter230655 commented 5 months ago

If I have a linear nonholonomic constraint, which results from a holonomic constraint, I form the EOMs for opty like this: EOM = kinematic-differential equations / (fr + frstar) / holonomic constraint. ( / means col.join)

But what do I do if I have a real linear nonholonomic constraint, not reduceable to a holonomic constraint? What would be the last equation(s)?

(What I did was this: I formed rhs = KM.rhs() and the set EOM = (rhs - y.diff(t), where y = [gen. coordinates, gen. speeds] This seemed to work, but does not look very elegant. Also KM.rhs() is very time consuming for larger problems)

Thanks for any help!

tjstienstra commented 5 months ago

You should be able to use kdes / fr + frstart / hol_eqs / nonhol_eqs

Peter230655 commented 5 months ago

Thanks, I will try it! ( I tried it with a complex constraint, the result was utter garbage ) Would the sequence matter, that is kdes / fr + frstar / hol_eqs / nonhol_eqs as good as kdes / fr + frstar / nonhol_eqs / hol_eqs ?

Thanks!

tjstienstra commented 5 months ago

The order should officially not matter.

Peter230655 commented 5 months ago

Thanks! I will play around some more this evening - now even I have to work. :-(

Peter230655 commented 5 months ago

It worked exactly like you said! Thanks!