lipm_walking_controller
1.6.0
|
Main controller class. More...
#include <lipm_walking/Controller.h>
Public Member Functions | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW | Controller (mc_rbdyn::RobotModulePtr robot, double dt, const mc_rtc::Configuration &config, mc_control::ControllerParameters params={}) |
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 | 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 | updatePlan (const std::string &name) |
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 | 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... | |
ModelPredictiveControl & | mpc () |
Get model predictive control solver. More... | |
const Contact & | nextContact () const |
Get next contact in plan. More... | |
void | nextDoubleSupportDuration (double duration) |
Override next DSP duration. More... | |
mc_planning::Pendulum & | pendulum () |
This getter is only used for consistency with the rest of mc_rtc. More... | |
const Contact & | prevContact () const |
Get previous contact in plan. More... | |
double | singleSupportDuration () |
Get next SSP duration. More... | |
const Sole & | sole () const |
Get model sole properties. More... | |
std::shared_ptr< mc_tasks::lipm_stabilizer::StabilizerTask > | stabilizer () |
This getter is only used for consistency with the rest of mc_rtc. More... | |
void | setContacts (const std::vector< std::pair< mc_tasks::lipm_stabilizer::ContactState, sva::PTransformd >> &contacts, bool fullDoF=false) |
const Contact & | supportContact () |
Get current support contact. More... | |
const Contact & | targetContact () |
Get current target contact. More... | |
bool | isInOpenLoopTicker () const |
Returns true if the controller is running in an open-loop ticker. More... | |
Public Attributes | |
WalkingState | walkingState = WalkingState::Standby |
Current state. More... | |
FootstepPlan | plan |
Current footstep plan. More... | |
PlanInterpolator | planInterpolator |
Footstep plan interpolator. More... | |
ExternalPlanner | externalFootstepPlanner |
Handle requesting/receiving plans from an external planner. More... | |
bool | emergencyStop = false |
Emergency flag: if on, the controller stops doing anything. More... | |
bool | startWalking = false |
Is the walk started. 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< Preview > | preview |
Current solution trajectory from the walking pattern generator. More... | |
std::vector< std::vector< double > > | halfSitPose |
Half-sit joint-angle configuration stored when the controller starts. More... | |
std::shared_ptr< mc_tasks::SurfaceTransformTask > | swingFootTaskLeft_ |
std::shared_ptr< mc_tasks::SurfaceTransformTask > | swingFootTaskRight_ |
bool | isWalking = false |
unsigned | nbMPCFailures_ = 0 |
Number of times the walking pattern generator failed. More... | |
Main controller class.
Definition at line 60 of file Controller.h.
lipm_walking::Controller::Controller | ( | mc_rbdyn::RobotModulePtr | robot, |
double | dt, | ||
const mc_rtc::Configuration & | config, | ||
mc_control::ControllerParameters | params = {} |
||
) |
Initialize the controller.
robot | Robot model. |
dt | Control timestep. |
config | Configuration dictionary. |
Definition at line 39 of file Controller.cpp.
void lipm_walking::Controller::addGUIElements | ( | std::shared_ptr< mc_rtc::gui::StateBuilder > | gui | ) |
void lipm_walking::Controller::addGUIMarkers | ( | std::shared_ptr< mc_rtc::gui::StateBuilder > | gui | ) |
Add GUI markers.
gui | GUI handle. |
void lipm_walking::Controller::addLogEntries | ( | mc_rtc::Logger & | logger | ) |
|
inline |
Get control robot state.
Definition at line 159 of file Controller.h.
|
inline |
Get next double support duration.
Definition at line 167 of file Controller.h.
bool lipm_walking::Controller::isInOpenLoopTicker | ( | ) | const |
Returns true if the controller is running in an open-loop ticker.
Definition at line 555 of file Controller.cpp.
|
inline |
True after the last step.
Definition at line 185 of file Controller.h.
|
inline |
True during the last step.
Definition at line 193 of file Controller.h.
|
inline |
Get fraction of total weight that should be sustained by the left foot.
Definition at line 201 of file Controller.h.
void lipm_walking::Controller::leftFootRatio | ( | double | ratio | ) |
Set fraction of total weight that should be sustained by the left foot.
ratio | Number between 0 and 1. |
Definition at line 342 of file Controller.cpp.
void lipm_walking::Controller::loadFootstepPlan | ( | std::string | name | ) |
Load footstep plan from configuration.
name | Plan name. |
Definition at line 447 of file Controller.cpp.
|
inline |
Estimate left foot pressure ratio from force sensors.
Definition at line 209 of file Controller.h.
|
inline |
Get model predictive control solver.
Definition at line 221 of file Controller.h.
|
inline |
Get next contact in plan.
Definition at line 229 of file Controller.h.
|
inline |
Override next DSP duration.
duration | Custom DSP duration. |
Definition at line 239 of file Controller.h.
void lipm_walking::Controller::pauseWalkingCallback | ( | bool | verbose = false | ) |
Callback function called by "Pause walking" button.
verbose | Talk to user on the command line. |
Definition at line 393 of file Controller.cpp.
|
inline |
This getter is only used for consistency with the rest of mc_rtc.
Definition at line 247 of file Controller.h.
|
inline |
Get previous contact in plan.
Definition at line 255 of file Controller.h.
|
override |
|
overridevirtual |
Main function of the controller, called at every control cycle.
Definition at line 352 of file Controller.cpp.
void lipm_walking::Controller::setContacts | ( | const std::vector< std::pair< mc_tasks::lipm_stabilizer::ContactState, sva::PTransformd >> & | contacts, |
bool | fullDoF = false |
||
) |
Definition at line 317 of file Controller.cpp.
|
inline |
Get next SSP duration.
Definition at line 263 of file Controller.h.
|
inline |
Get model sole properties.
Definition at line 271 of file Controller.h.
|
inline |
This getter is only used for consistency with the rest of mc_rtc.
Definition at line 279 of file Controller.h.
void lipm_walking::Controller::startLogSegment | ( | const std::string & | label | ) |
Start new log segment.
label | Segment label. |
Definition at line 523 of file Controller.cpp.
void lipm_walking::Controller::stopLogSegment | ( | ) |
Stop current log segment.
Definition at line 533 of file Controller.cpp.
|
inline |
Get current support contact.
Definition at line 291 of file Controller.h.
|
inline |
Get current target contact.
Definition at line 299 of file Controller.h.
void lipm_walking::Controller::updatePlan | ( | const std::string & | name | ) |
Definition at line 485 of file Controller.cpp.
bool lipm_walking::Controller::updatePreview | ( | ) |
Update horizontal MPC preview.
Definition at line 539 of file Controller.cpp.
void lipm_walking::Controller::warnIfRobotIsInTheAir | ( | ) |
Log a warning message when robot is in the air.
Definition at line 423 of file Controller.cpp.
bool lipm_walking::Controller::emergencyStop = false |
Emergency flag: if on, the controller stops doing anything.
Definition at line 313 of file Controller.h.
ExternalPlanner lipm_walking::Controller::externalFootstepPlanner |
Handle requesting/receiving plans from an external planner.
Definition at line 312 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 319 of file Controller.h.
bool lipm_walking::Controller::isWalking = false |
Definition at line 323 of file Controller.h.
unsigned lipm_walking::Controller::nbMPCFailures_ = 0 |
Number of times the walking pattern generator failed.
Definition at line 324 of file Controller.h.
bool lipm_walking::Controller::pauseWalking = false |
Is the pause-walking behavior engaged?
Definition at line 315 of file Controller.h.
bool lipm_walking::Controller::pauseWalkingRequested = false |
Has user clicked on the "Pause walking" button?
Definition at line 316 of file Controller.h.
FootstepPlan lipm_walking::Controller::plan |
Current footstep plan.
Definition at line 309 of file Controller.h.
PlanInterpolator lipm_walking::Controller::planInterpolator |
Footstep plan interpolator.
Used to generate a simple FootstepPlan when we are not using an external planner
Definition at line 310 of file Controller.h.
std::shared_ptr<Preview> lipm_walking::Controller::preview |
Current solution trajectory from the walking pattern generator.
Definition at line 317 of file Controller.h.
bool lipm_walking::Controller::startWalking = false |
Is the walk started.
Definition at line 314 of file Controller.h.
std::shared_ptr<mc_tasks::SurfaceTransformTask> lipm_walking::Controller::swingFootTaskLeft_ |
Definition at line 321 of file Controller.h.
std::shared_ptr<mc_tasks::SurfaceTransformTask> lipm_walking::Controller::swingFootTaskRight_ |
Definition at line 322 of file Controller.h.
WalkingState lipm_walking::Controller::walkingState = WalkingState::Standby |
Current state.
Definition at line 308 of file Controller.h.