echandler5956f / Galileo

A light-weight and extensible C++ library for Pseudospectral Collocation of Switched Systems
MIT License
34 stars 3 forks source link

Dealing with multiphase dynamics #26

Open echandler5956f opened 7 months ago

echandler5956f commented 7 months ago

Figuring out how to handle multiphase dynamics has been bothering me for some time. The original approach used in huron_centroidal_v4 is no longer valid because it reduces generality, and masking the input does not work because it would necessitate either a rule to prune decision variables that get masked from the decision vector, or it would require us to keep those extra decision variables in the problem, which MIT Cheetah Software discovered would dramatically increase solving time.

We should have a dynamics function for each phase, which is included in the problem data. This makes it completely general to multi-phase systems which do not have such trivial changes in dynamics.

echandler5956f commented 7 months ago

general_phase_sequences branch is dealing with this

Akshay5312 commented 6 months ago

As the current approach works, I'm going to change the label.

The mode specific dynamics were addressed in commit 42b41e14d954f7a4443c7bef7e9955d39e794ab9, and merged with "general_phase_sequences".

As per an in-person discussion, a proposed solution for large solution time (for each phase) is to add flags for decision variables. The cost generator and constraint generator objects can return a set of flags that correspond to decision variables. When generating dynamics/constraints for a phase, the flags can be used to eliminate decision variables or add equality constraints on the decision variables.

Alternatively, the analytic gradient can be used.

echandler5956f commented 5 months ago

Our bottleneck is in the Casadi function evaluation. I wonder if this should be looked into again...