BipedalLocomotion::ReducedModelControllers::CentroidalMPC class

CentroidalMPC implements a Non-Linear Model Predictive Controller for humanoid robot locomotion with online step adjustment capabilities.

The proposed controller considers the Centroidal Dynamics of the system to compute the desired contact forces and torques and contact locations. Let us assume the presence of a high-level contact planner that generates only the contact location and timings, the CentroidalMPC objective is to implement a control law that generates feasible contact wrenches and locations while considering the Centroidal dynamics of the floating base system, and a nominal set of contact positions and timings. The control problem is formulated using the Model Predictive Control (MPC) framework.

Base classes

template<class Output>
class BipedalLocomotion::System::Source<CentroidalMPCOutput>
Source is a template specialization of Advanceable and represents a block that does not contains input.

Constructors, destructors, conversion operators

CentroidalMPC()
Constructor.
~CentroidalMPC()
Destructor.

Public functions

auto initialize(std::weak_ptr<const ParametersHandler::IParametersHandler> handler) -> bool final
Initialize the controller.
auto setContactPhaseList(const Contacts::ContactPhaseList& contactPhaseList) -> bool
Set the contact phase list considered by the controller as nominal contact location.
auto setState(Eigen::Ref<const Eigen::Vector3d> com, Eigen::Ref<const Eigen::Vector3d> dcom, Eigen::Ref<const Eigen::Vector3d> angularMomentum) -> bool
Set the state of the centroidal dynamics.
auto setState(Eigen::Ref<const Eigen::Vector3d> com, Eigen::Ref<const Eigen::Vector3d> dcom, Eigen::Ref<const Eigen::Vector3d> angularMomentum, const Math::Wrenchd& externalWrench) -> bool
Set the state of the centroidal dynamics.
auto setState(Eigen::Ref<const Eigen::Vector3d> com, Eigen::Ref<const Eigen::Vector3d> dcom, Eigen::Ref<const Eigen::Vector3d> angularMomentum, const Math::Wrenchd& externalWrench, Eigen::Ref<const Eigen::Vector3d> gravity) -> bool
Set the state of the centroidal dynamics.
auto setReferenceTrajectory(const std::vector<Eigen::Vector3d>& com, const std::vector<Eigen::Vector3d>& angularMomentum) -> bool
Set the reference trajectories for the CoM and the centroidal angular momentum.
auto setGravity(const Eigen::Ref<Eigen::Vector3d>& gravity) -> bool
Set the gravity vector used in the centroidal dynamics.
auto getOutput() const -> const CentroidalMPCOutput& final
Get the output of the controller.
auto isOutputValid() const -> bool final
Determines the validity of the object retrieved with getOutput()
auto advance() -> bool final
Perform one control cycle.

Function documentation

bool BipedalLocomotion::ReducedModelControllers::CentroidalMPC::initialize(std::weak_ptr<const ParametersHandler::IParametersHandler> handler) final

Initialize the controller.

Parameters
handler pointer to the parameter handler.
Returns true in case of success/false otherwise.

Moreover for each contact $i$ where $ 0 \le i \le $ number_of_maximum_contacts-1 it is required to define a group CONTACT_<i> that contains the following parameters

Parameter NameTypeDescriptionMandatory
contact_namestringName associated to the contact.Yes
bounding_box_upper_limitvector<double>Upper limit of the bounding box where the adjusted contact must belong to. The limits are expressed in the contact local frame.Yes
bounding_box_lower_limitvector<double>Lower limit of the bounding box where the adjusted contact must belong to. The limits are expressed in the contact local frame.Yes
number_of_cornersintNumber of corners associated to the foot.Yes
corner_<j>vector<double>Position of the corner expressed in the foot frame. I must be from 0 to number_of_corners - 1.Yes

bool BipedalLocomotion::ReducedModelControllers::CentroidalMPC::setContactPhaseList(const Contacts::ContactPhaseList& contactPhaseList)

Set the contact phase list considered by the controller as nominal contact location.

Parameters
contactPhaseList contact phase.
Returns True in case of success, false otherwise.

bool BipedalLocomotion::ReducedModelControllers::CentroidalMPC::setState(Eigen::Ref<const Eigen::Vector3d> com, Eigen::Ref<const Eigen::Vector3d> dcom, Eigen::Ref<const Eigen::Vector3d> angularMomentum)

Set the state of the centroidal dynamics.

Parameters
com position of the CoM expressed in the inertial frame.
dcom velocity of the CoM expressed in a frame centered in the CoM and oriented as the inertial frame.
angularMomentum centroidal angular momentum.
Returns True in case of success, false otherwise.

bool BipedalLocomotion::ReducedModelControllers::CentroidalMPC::setState(Eigen::Ref<const Eigen::Vector3d> com, Eigen::Ref<const Eigen::Vector3d> dcom, Eigen::Ref<const Eigen::Vector3d> angularMomentum, const Math::Wrenchd& externalWrench)

Set the state of the centroidal dynamics.

Parameters
com position of the CoM expressed in the inertial frame.
dcom velocity of the CoM expressed in a frame centered in the CoM and oriented as the inertial frame.
angularMomentum centroidal angular momentum.
externalWrench optional parameter used to represent an external wrench applied to the robot CoM.
Returns True in case of success, false otherwise.

bool BipedalLocomotion::ReducedModelControllers::CentroidalMPC::setState(Eigen::Ref<const Eigen::Vector3d> com, Eigen::Ref<const Eigen::Vector3d> dcom, Eigen::Ref<const Eigen::Vector3d> angularMomentum, const Math::Wrenchd& externalWrench, Eigen::Ref<const Eigen::Vector3d> gravity)

Set the state of the centroidal dynamics.

Parameters
com position of the CoM expressed in the inertial frame.
dcom velocity of the CoM expressed in a frame centered in the CoM and oriented as the inertial frame.
angularMomentum centroidal angular momentum.
externalWrench optional parameter used to represent an external wrench applied to the robot CoM.
gravity gravity vector.
Returns True in case of success, false otherwise.

bool BipedalLocomotion::ReducedModelControllers::CentroidalMPC::setReferenceTrajectory(const std::vector<Eigen::Vector3d>& com, const std::vector<Eigen::Vector3d>& angularMomentum)

Set the reference trajectories for the CoM and the centroidal angular momentum.

Parameters
com desired trajectory of the CoM. The rows contain the x, y and z coordinates while the columns the position at each time instant.
angularMomentum centroidal angular momentum. The rows contain the x, y and z coordinates while the columns the trajectory at each time instant.
Returns True in case of success, false otherwise.

bool BipedalLocomotion::ReducedModelControllers::CentroidalMPC::setGravity(const Eigen::Ref<Eigen::Vector3d>& gravity)

Set the gravity vector used in the centroidal dynamics.

Parameters
gravity gravity vector.
Returns True in case of success, false otherwise.

const CentroidalMPCOutput& BipedalLocomotion::ReducedModelControllers::CentroidalMPC::getOutput() const final

Get the output of the controller.

Returns a const reference of the output of the controller.

bool BipedalLocomotion::ReducedModelControllers::CentroidalMPC::isOutputValid() const final

Determines the validity of the object retrieved with getOutput()

Returns True if the object is valid, false otherwise.

bool BipedalLocomotion::ReducedModelControllers::CentroidalMPC::advance() final

Perform one control cycle.

Returns True if the advance is successfull.