Simple-Robotics / aligator

A versatile and efficient framework for constrained trajectory optimization
https://simple-robotics.github.io/aligator/
BSD 2-Clause "Simplified" License
121 stars 18 forks source link

Implementing dynamic cast for CostStack, Integrator and Dynamics #204

Closed edantec closed 1 month ago

edantec commented 1 month ago

Following the implementation of dynamic cast for components and residuals, Aligator should manage the templated cast of abstract classes for CostStack, all Integrators and all Dynamics. We should have a function getCostStack() in TrajOptProblem, getIntegrator() in integrator abstract class, and getDynamics() in dynamics abstract class.

ManifoldFR commented 1 month ago

Instead of just a shortcut for getting a CostStack from the StageModel, we can do the same as in the previous PR, i.e.

// in StageModelTpl

template<typename U> U* getCost() { return dynamic_cast<U*>(&*this->cost_); }