centroidal_control_collection
|
Go to the documentation of this file.
5 #include <nmpc_ddp/DDPSolver.h>
21 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
24 Eigen::Vector3d
zmp = Eigen::Vector3d::Zero();
33 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
36 Eigen::Vector2d
zmp = Eigen::Vector2d::Zero();
72 double _running_zmp = 1e-1,
73 double _running_force_z = 1e-4,
74 double _terminal_com_pos_xy = 1.0,
75 double _terminal_com_pos_z = 1e2,
76 double _terminal_com_vel = 1.0)
104 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
130 virtual StateDimVector
stateEq(
double t,
const StateDimVector & x,
const InputDimVector & u)
const override;
138 virtual double runningCost(
double t,
const StateDimVector & x,
const InputDimVector & u)
const override;
145 virtual double terminalCost(
double t,
const StateDimVector & x)
const override;
155 const StateDimVector & x,
156 const InputDimVector & u,
157 Eigen::Ref<StateStateDimMatrix> state_eq_deriv_x,
158 Eigen::Ref<StateInputDimMatrix> state_eq_deriv_u)
const override;
171 const StateDimVector &,
172 const InputDimVector &,
173 Eigen::Ref<StateStateDimMatrix>,
174 Eigen::Ref<StateInputDimMatrix>,
175 std::vector<StateStateDimMatrix> &,
176 std::vector<InputInputDimMatrix> &,
177 std::vector<StateInputDimMatrix> &
180 throw std::runtime_error(
"Second-order derivatives of state equation are not implemented.");
191 const StateDimVector & x,
192 const InputDimVector & u,
193 Eigen::Ref<StateDimVector> running_cost_deriv_x,
194 Eigen::Ref<InputDimVector> running_cost_deriv_u)
const override;
207 const StateDimVector & x,
208 const InputDimVector & u,
209 Eigen::Ref<StateDimVector> running_cost_deriv_x,
210 Eigen::Ref<InputDimVector> running_cost_deriv_u,
211 Eigen::Ref<StateStateDimMatrix> running_cost_deriv_xx,
212 Eigen::Ref<InputInputDimMatrix> running_cost_deriv_uu,
213 Eigen::Ref<StateInputDimMatrix> running_cost_deriv_xu)
const override;
221 const StateDimVector & x,
222 Eigen::Ref<StateDimVector> terminal_cost_deriv_x)
const override;
231 const StateDimVector & x,
232 Eigen::Ref<StateDimVector> terminal_cost_deriv_x,
233 Eigen::Ref<StateStateDimMatrix> terminal_cost_deriv_xx)
const override;
249 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
252 Eigen::Vector3d
pos = Eigen::Vector3d::Zero();
255 Eigen::Vector3d
vel = Eigen::Vector3d::Zero();
262 std::vector<DdpProblem::InputDimVector>
u_list = {};
265 DdpProblem::StateDimVector
toState()
const;
269 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
281 ddp_solver_->config().horizon_steps = horizon_steps;
290 PlannedData
planOnce(
const std::function<RefData(
double)> & ref_data_func,
291 const InitialParam & initial_param,
292 double current_time);
DDP problem of CoM-ZMP model.
double terminal_com_vel
CoM velocity weight in terminal cost.
double force_z
Z force [N].
PlannedData planOnce(const std::function< RefData(double)> &ref_data_func, const InitialParam &initial_param, double current_time)
Plan one step.
virtual void calcTerminalCostDeriv(double t, const StateDimVector &x, Eigen::Ref< StateDimVector > terminal_cost_deriv_x) const override
Calculate first-order derivatives of terminal cost.
Eigen::Vector3d vel
CoM velocity [m/s].
DdpProblem::StateDimVector toState() const
Get state of DDP problem.
virtual void calcStateEqDeriv(double t, const StateDimVector &x, const InputDimVector &u, Eigen::Ref< StateStateDimMatrix > state_eq_deriv_x, Eigen::Ref< StateInputDimMatrix > state_eq_deriv_u) const override
Calculate first-order derivatives of discrete state equation.
double running_zmp
ZMP weight in running cost.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW DdpProblem(double horizon_dt, double mass, const WeightParam &weight_param)
Constructor.
WeightParam weight_param_
Weight parameter.
void setRefDataFunc(const std::function< RefData(double)> &ref_data_func)
Set function of reference data.
std::vector< DdpProblem::InputDimVector > u_list
Initial guess of input sequence.
virtual void calcStateEqDeriv(double, const StateDimVector &, const InputDimVector &, Eigen::Ref< StateStateDimMatrix >, Eigen::Ref< StateInputDimMatrix >, std::vector< StateStateDimMatrix > &, std::vector< InputInputDimMatrix > &, std::vector< StateInputDimMatrix > &) const override
Calculate first-order and second-order derivatives of discrete state equation.
virtual StateDimVector stateEq(double t, const StateDimVector &x, const InputDimVector &u) const override
Calculate discrete state equation.
double terminal_com_pos_z
CoM z position weight in terminal cost.
virtual void calcRunningCostDeriv(double t, const StateDimVector &x, const InputDimVector &u, Eigen::Ref< StateDimVector > running_cost_deriv_x, Eigen::Ref< InputDimVector > running_cost_deriv_u) const override
Calculate first-order derivatives of running cost.
double running_force_z
Z force weight in running cost.
WeightParam(double _running_com_pos_z=1e2, double _running_zmp=1e-1, double _running_force_z=1e-4, double _terminal_com_pos_xy=1.0, double _terminal_com_pos_z=1e2, double _terminal_com_vel=1.0)
Constructor.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW DdpZmp(double mass, double horizon_dt, int horizon_steps, const WeightParam &weight_param=WeightParam())
Constructor.
double terminal_com_pos_xy
CoM x and y position weight in terminal cost.
std::shared_ptr< nmpc_ddp::DDPSolver< 6, 3 > > ddp_solver_
DDP solver.
double com_z
CoM z position [m].
Differential dynamic programming (DDP) for CoM-ZMP model.
virtual double terminalCost(double t, const StateDimVector &x) const override
Calculate terminal cost.
double running_com_pos_z
CoM z position weight in running cost.
std::function< RefData(double)> ref_data_func_
Function of reference data.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::Vector2d zmp
ZMP [m].
virtual double runningCost(double t, const StateDimVector &x, const InputDimVector &u) const override
Calculate running cost.
double mass_
Robot mass [Kg].
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::Vector3d pos
CoM position [m].
std::shared_ptr< DdpProblem > ddp_problem_
DDP problem.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Eigen::Vector3d zmp
ZMP [m].