MatthewPeterKelly / OptimTraj

A trajectory optimization library for Matlab
MIT License
598 stars 207 forks source link

Specifying dynamics on a lower dimension #45

Open jaskaransgrover opened 3 years ago

jaskaransgrover commented 3 years ago

Hi Matt, thank you for this software package. I was wondering if there is a way to specify partial dynamics that are projected on a lower-dimensional space. For example, instead of xdot = f(t,x,u), we specify E*xdot = f(t,x,u) where E is a matrix of size (m,n) where m<n so f will be [m,1].

Normally, E is eye(n,n) and f is [n,1] but if we know dynamics only for some part of the state, then we can use an E to do the trick.

MatthewPeterKelly commented 3 years ago

There is not an easy way to implement that sort of projection directly with OptimTraj. You can probably "fake" the projection using slack variables, although it might take some thinking to figure out exactly the right formulation.

I'm somewhat confused about the premise of the question though. Typically the "state" of the system is defined to be the part where you have a constraint on its rate of change. If the way that a variable changes is arbitrary, then it should be made part of the control. If the variable is entirely unknown, then there isn't a good way to manage that in this framework -- it would be more like a sensor. It there is a part of the state that you don't care about at all (for example you want to optimize the center of mass motion for a system and don't care about the detailed dynamics), then you can directly optimize over the reduced state and drop the "hidden" state from the problem.