Skip to content

Can I write my own walking pattern generator?

Stéphane Caron edited this page Oct 31, 2020 · 1 revision

This note describes the steps required to change the walking pattern generator of the controller.

Note to developers: this walking controller is, on purpose, made to have a single walking pattern generator and a single stabilizer. In the long run, the mc_rtc control framework will eat it up and propose a generic way to switch between pattern generators and stabilizers. For now, this controller serves as a reference we fork when we want to make a new one. You can check out the capture_walking_controller for an example of controller with two pattern generators, or the vhip_walking_controller for an example of controller with two stabilizers.

Pipeline

The controller holds an instance Controller::mpc_ of the ModelPredictiveControl class which is used to build and solve the underlying optimization problem. Its comHeight(), initState() and contact setters are called to update its state in the course of walking.

Walking states (SingleSupport and DoubleSupport) call Controller::updatePreview to update the pattern generator state, solve its optimization problem and store the resulting trajectory in Controller::preview. The preview is then integrated into Controller::pendulum_, which holds the reference state of the CoM and ZMP used by the stabilizer.

In short

  • Update ModelPredictiveControl class
  • Update the corresponding integrators in Preview class