lipm_walking::Controller Struct Reference

Main controller class. More...

#include <lipm_walking/Controller.h>

Inheritance diagram for lipm_walking::Controller:

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW Controller (std::shared_ptr< mc_rbdyn::RobotModule > robot, double dt, const mc_rtc::Configuration &config)
 Initialize the controller. More...
 
void reset (const mc_control::ControllerResetData &data) override
 Reset controller. More...
 
void addGUIElements (std::shared_ptr< mc_rtc::gui::StateBuilder > gui)
 Add GUI panel. More...
 
void addGUIMarkers (std::shared_ptr< mc_rtc::gui::StateBuilder > gui)
 Add GUI markers. More...
 
void addLogEntries (mc_rtc::Logger &logger)
 Log controller entries. More...
 
void internalReset ()
 Reset robot to its initial (half-sitting) configuration. More...
 
void leftFootRatio (double ratio)
 Set fraction of total weight that should be sustained by the left foot. More...
 
void loadFootstepPlan (std::string name)
 Load footstep plan from configuration. More...
 
void pauseWalkingCallback (bool verbose=false)
 Callback function called by "Pause walking" button. More...
 
virtual bool run () override
 Main function of the controller, called at every control cycle. More...
 
void startLogSegment (const std::string &label)
 Start new log segment. More...
 
void stopLogSegment ()
 Stop current log segment. More...
 
bool updatePreview ()
 Update horizontal MPC preview. More...
 
void updateRealFromKinematics ()
 Update measured robot's floating base from kinematic observer. More...
 
void warnIfRobotIsInTheAir ()
 Log a warning message when robot is in the air. More...
 
mc_rbdyn::Robot & controlRobot ()
 Get control robot state. More...
 
double doubleSupportDuration ()
 Get next double support duration. More...
 
bool isLastDSP ()
 True after the last step. More...
 
bool isLastSSP ()
 True during the last step. More...
 
double leftFootRatio ()
 Get fraction of total weight that should be sustained by the left foot. More...
 
double measuredLeftFootRatio ()
 Estimate left foot pressure ratio from force sensors. More...
 
ModelPredictiveControlmpc ()
 Get model predictive control solver. More...
 
const ContactnextContact () const
 Get next contact in plan. More...
 
void nextDoubleSupportDuration (double duration)
 Override next DSP duration. More...
 
Pendulumpendulum ()
 This getter is only used for consistency with the rest of mc_rtc. More...
 
const ContactprevContact () const
 Get previous contact in plan. More...
 
mc_rbdyn::Robot & realRobot ()
 Get observed robot state. More...
 
double singleSupportDuration ()
 Get next SSP duration. More...
 
const Solesole () const
 Get model sole properties. More...
 
Stabilizerstabilizer ()
 This getter is only used for consistency with the rest of mc_rtc. More...
 
const ContactsupportContact ()
 Get current support contact. More...
 
const ContacttargetContact ()
 Get current target contact. More...
 

Public Attributes

FootstepPlan plan
 Current footstep plan. More...
 
PlanInterpolator planInterpolator
 Footstep plan interpolator. More...
 
bool emergencyStop = false
 Emergency flag: if on, the controller stops doing anything. More...
 
bool pauseWalking = false
 Is the pause-walking behavior engaged? More...
 
bool pauseWalkingRequested = false
 Has user clicked on the "Pause walking" button? More...
 
std::shared_ptr< Previewpreview
 Current solution trajectory from the walking pattern generator. More...
 
std::shared_ptr< mc_tasks::OrientationTask > pelvisTask
 Pelvis orientation task. More...
 
std::shared_ptr< mc_tasks::OrientationTask > torsoTask
 Torso orientation task. More...
 
std::vector< std::vector< double > > halfSitPose
 Half-sit joint-angle configuration stored when the controller starts. More...
 

Detailed Description

Main controller class.

Definition at line 67 of file Controller.h.

Constructor & Destructor Documentation

lipm_walking::Controller::Controller ( std::shared_ptr< mc_rbdyn::RobotModule >  robot,
double  dt,
const mc_rtc::Configuration &  config 
)

Initialize the controller.

Parameters
robotRobot model.
dtControl timestep.
configConfiguration dictionary.

Definition at line 36 of file Controller.cpp.

Member Function Documentation

void lipm_walking::Controller::addGUIElements ( std::shared_ptr< mc_rtc::gui::StateBuilder >  gui)

Add GUI panel.

Parameters
guiGUI handle.

Definition at line 187 of file Controller.cpp.

void lipm_walking::Controller::addGUIMarkers ( std::shared_ptr< mc_rtc::gui::StateBuilder >  gui)

Add GUI markers.

Parameters
guiGUI handle.
void lipm_walking::Controller::addLogEntries ( mc_rtc::Logger &  logger)

Log controller entries.

Parameters
loggerLogger.

Definition at line 144 of file Controller.cpp.

mc_rbdyn::Robot& lipm_walking::Controller::controlRobot ( )
inline

Get control robot state.

Definition at line 175 of file Controller.h.

double lipm_walking::Controller::doubleSupportDuration ( )
inline

Get next double support duration.

Definition at line 183 of file Controller.h.

void lipm_walking::Controller::internalReset ( )

Reset robot to its initial (half-sitting) configuration.

The reason why I do it inside the controller rather than via the current mc_rtc way (switching to half_sitting controller then back to this one) is https://gite.lirmm.fr/multi-contact/mc_rtc/issues/54.

Definition at line 358 of file Controller.cpp.

bool lipm_walking::Controller::isLastDSP ( )
inline

True after the last step.

Definition at line 201 of file Controller.h.

bool lipm_walking::Controller::isLastSSP ( )
inline

True during the last step.

Definition at line 209 of file Controller.h.

void lipm_walking::Controller::leftFootRatio ( double  ratio)

Set fraction of total weight that should be sustained by the left foot.

Parameters
ratioNumber between 0 and 1.

Definition at line 400 of file Controller.cpp.

double lipm_walking::Controller::leftFootRatio ( )
inline

Get fraction of total weight that should be sustained by the left foot.

Definition at line 217 of file Controller.h.

void lipm_walking::Controller::loadFootstepPlan ( std::string  name)

Load footstep plan from configuration.

Parameters
namePlan name.

Definition at line 525 of file Controller.cpp.

double lipm_walking::Controller::measuredLeftFootRatio ( )
inline

Estimate left foot pressure ratio from force sensors.

Definition at line 225 of file Controller.h.

ModelPredictiveControl& lipm_walking::Controller::mpc ( )
inline

Get model predictive control solver.

Definition at line 237 of file Controller.h.

const Contact& lipm_walking::Controller::nextContact ( ) const
inline

Get next contact in plan.

Definition at line 245 of file Controller.h.

void lipm_walking::Controller::nextDoubleSupportDuration ( double  duration)
inline

Override next DSP duration.

Parameters
durationCustom DSP duration.

Definition at line 255 of file Controller.h.

void lipm_walking::Controller::pauseWalkingCallback ( bool  verbose = false)

Callback function called by "Pause walking" button.

Parameters
verboseTalk to user on the command line.

Definition at line 455 of file Controller.cpp.

Pendulum& lipm_walking::Controller::pendulum ( )
inline

This getter is only used for consistency with the rest of mc_rtc.

Definition at line 263 of file Controller.h.

const Contact& lipm_walking::Controller::prevContact ( ) const
inline

Get previous contact in plan.

Definition at line 271 of file Controller.h.

mc_rbdyn::Robot& lipm_walking::Controller::realRobot ( )
inline

Get observed robot state.

Definition at line 279 of file Controller.h.

void lipm_walking::Controller::reset ( const mc_control::ControllerResetData &  data)
override

Reset controller.

Parameters
dataReset data.

Definition at line 349 of file Controller.cpp.

bool lipm_walking::Controller::run ( )
overridevirtual

Main function of the controller, called at every control cycle.

Definition at line 411 of file Controller.cpp.

double lipm_walking::Controller::singleSupportDuration ( )
inline

Get next SSP duration.

Definition at line 287 of file Controller.h.

const Sole& lipm_walking::Controller::sole ( ) const
inline

Get model sole properties.

Definition at line 295 of file Controller.h.

Stabilizer& lipm_walking::Controller::stabilizer ( )
inline

This getter is only used for consistency with the rest of mc_rtc.

Definition at line 303 of file Controller.h.

void lipm_walking::Controller::startLogSegment ( const std::string &  label)

Start new log segment.

Parameters
labelSegment label.

Definition at line 558 of file Controller.cpp.

void lipm_walking::Controller::stopLogSegment ( )

Stop current log segment.

Definition at line 568 of file Controller.cpp.

const Contact& lipm_walking::Controller::supportContact ( )
inline

Get current support contact.

Definition at line 311 of file Controller.h.

const Contact& lipm_walking::Controller::targetContact ( )
inline

Get current target contact.

Definition at line 319 of file Controller.h.

bool lipm_walking::Controller::updatePreview ( )

Update horizontal MPC preview.

Definition at line 574 of file Controller.cpp.

void lipm_walking::Controller::updateRealFromKinematics ( )

Update measured robot's floating base from kinematic observer.

Definition at line 509 of file Controller.cpp.

void lipm_walking::Controller::warnIfRobotIsInTheAir ( )

Log a warning message when robot is in the air.

Definition at line 485 of file Controller.cpp.

Member Data Documentation

bool lipm_walking::Controller::emergencyStop = false

Emergency flag: if on, the controller stops doing anything.

Definition at line 327 of file Controller.h.

std::vector<std::vector<double> > lipm_walking::Controller::halfSitPose

Half-sit joint-angle configuration stored when the controller starts.

Definition at line 334 of file Controller.h.

bool lipm_walking::Controller::pauseWalking = false

Is the pause-walking behavior engaged?

Definition at line 328 of file Controller.h.

bool lipm_walking::Controller::pauseWalkingRequested = false

Has user clicked on the "Pause walking" button?

Definition at line 329 of file Controller.h.

std::shared_ptr<mc_tasks::OrientationTask> lipm_walking::Controller::pelvisTask

Pelvis orientation task.

Definition at line 331 of file Controller.h.

FootstepPlan lipm_walking::Controller::plan

Current footstep plan.

Definition at line 325 of file Controller.h.

PlanInterpolator lipm_walking::Controller::planInterpolator

Footstep plan interpolator.

Definition at line 326 of file Controller.h.

std::shared_ptr<Preview> lipm_walking::Controller::preview

Current solution trajectory from the walking pattern generator.

Definition at line 330 of file Controller.h.

std::shared_ptr<mc_tasks::OrientationTask> lipm_walking::Controller::torsoTask

Torso orientation task.

Definition at line 332 of file Controller.h.