54 template <
typename OPTCON_SOLVER>
58 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
60 static const size_t STATE_DIM = OPTCON_SOLVER::STATE_D;
63 static const size_t P_DIM = OPTCON_SOLVER::POS_DIM;
64 static const size_t V_DIM = OPTCON_SOLVER::VEL_DIM;
66 using Scalar_t =
typename OPTCON_SOLVER::Scalar_t;
67 using Policy_t =
typename OPTCON_SOLVER::Policy_t;
88 const typename OPTCON_SOLVER::Settings_t& solverSettings,
210 void integrateForward(
const Scalar_t startTime,
222 OPTCON_SOLVER solver_;
228 typename OPTCON_SOLVER::OptConProblem_t::DynamicsPtr_t dynamics_;
237 size_t runCallCounter_;
240 std::shared_ptr<PolicyHandler<Policy_t, STATE_DIM, CONTROL_DIM, Scalar_t>> policyHandler_;
246 std::shared_ptr<tpl::MpcTimeHorizon<Scalar_t>> timeHorizonStrategy_;
void printMpcSummary()
printout simple statistical data
Definition: MPC-impl.h:300
Definition: PolicyHandler.h:12
const Scalar_t timeSinceFirstSuccessfulSolve(const Scalar_t &extTime)
retrieve the time that elapsed since the first successful solve() call to an Optimal Control Problem ...
Definition: MPC-impl.h:108
bool finishIteration(const core::StateVector< STATE_DIM, Scalar_t > &x, const Scalar_t x_ts, Policy_t &newPolicy, Scalar_t &newPolicy_ts, const std::shared_ptr< core::Controller< STATE_DIM, CONTROL_DIM, Scalar_t >> forwardIntegrationController=nullptr)
finish MPC iteration
Definition: MPC-impl.h:177
bool timeHorizonReached()
Check if final time horizon for this task was reached.
Definition: MPC-impl.h:101
MPC(const OptConProblem_t &problem, const typename OPTCON_SOLVER::Settings_t &solverSettings, const mpc_settings &mpcsettings=mpc_settings(), std::shared_ptr< PolicyHandler< Policy_t, STATE_DIM, CONTROL_DIM, Scalar_t >> customPolicyHandler=nullptr, std::shared_ptr< tpl::MpcTimeHorizon< Scalar_t >> customTimeHorizon=nullptr)
MPC solver constructor.
Definition: MPC-impl.h:12
void prepareIteration(const Scalar_t &ext_ts)
Definition: MPC-impl.h:138
static const size_t CONTROL_DIM
Definition: MPC.h:61
static EIGEN_MAKE_ALIGNED_OPERATOR_NEW const size_t STATE_DIM
Definition: MPC.h:60
typename OPTCON_SOLVER::Policy_t Policy_t
Definition: MPC.h:67
void doForwardIntegration(const Scalar_t &t_forward_start, const Scalar_t &t_forward_stop, core::StateVector< STATE_DIM, Scalar_t > &x_start, const std::shared_ptr< core::Controller< STATE_DIM, CONTROL_DIM, Scalar_t >> forwardIntegrationController=nullptr)
perform forward integration of the measured system state, to compensate for expected or already occur...
Definition: MPC-impl.h:115
MPC Settings struct.
Definition: MpcSettings.h:45
Main MPC class.
Definition: MPC.h:55
void setTimeHorizonStrategy(std::shared_ptr< tpl::MpcTimeHorizon< Scalar_t >> timeHorizonStrategy)
Additional method to insert a custom time horizon strategy, independent from the constructor.
Definition: MPC-impl.h:85
Definition: MpcTimeHorizon.h:20
typename OPTCON_SOLVER::Scalar_t Scalar_t
Definition: MPC.h:66
ct::core::StateVector< state_dim > x
Definition: LoadFromFileTest.cpp:20
static const size_t P_DIM
Definition: MPC.h:63
void resetMpc(const Scalar_t &newTimeHorizon)
reset the mpc problem and provide new problem time horizon (mandatory)
Definition: MPC-impl.h:270
void setInitialGuess(const Policy_t &initGuess)
set a new initial guess for the policy
Definition: MPC-impl.h:92
Definition: OptConProblemBase.h:40
void updateSettings(const mpc_settings &settings)
update the mpc settings in all instances (main class, time keeper class, etc)
Definition: MPC-impl.h:286
static const size_t V_DIM
Definition: MPC.h:64
OPTCON_SOLVER & getSolver()
Allows access to the solver member, required mainly for unit testing.
Definition: MPC-impl.h:78