Overview of the code

The LIPM walking controller is built with the mc_rtc framework.

In mc_rtc, the role of a controller is to initialize and update a set of tasks for whole-body control. These tasks are in turn used to formulate and solve an inverse-kinematics or inverse-dynamics quadratic program (QP) using the Tasks library. Solving the QP provides joint torques that are sent directly to torque-controlled robots, or joint accelerations that are integrated into positions and sent to position-controlled robots. All of this is done automatically by the framework, so that the only task of a controller is to update... tasks.

There are two main functions in the controller:

Main components

The Controller class has some main attributes that you will see everywhere in the code:

As a general rule, look out for documentation in header files or on the API documentation.

Walking state machine

The last instruction in the controller's run() function calls mc_control::fsm::Controller::run(), which runs the main function of the current state in the finite state machine (FSM). Check out how the FSM works in the FSM wiki page. The four states in the walking controller's FSM are described in the Graphical user interface guide:

If you just want some balance control without walking, you can modify the Standing state to suit your needs.

If you want the robot to do something while walking, you can extend the FSM and execute your new states in parallel with states::SingleSupport and states::DoubleSupport.