Table of Contents
Background
A central pattern generator (CPG) is a biological neural circuit that produces rhythmic motor patterns, such as walking, breathing, flying, or swimming. CPGs are found in humans and many kinds of animals.
For control tasks such as locomotion of bipedal or quadrupedal robots, the action space is both high-dimensional and continuous, finding methods to directly control all joints is very difficult. It's natural to think controlling each leg motion rather than each joint torque may reduce the complexity of the solution.
CPG assumes each leg's motion follows some rhythmic or quasi-periodic pattern, and divides one full-joints control task into 2(biped)/4(quadruped) leg-joints control tasks, this strategy simplifies the problem and also improves interpretability/controllability.
BD Spot-Mini Robot Dog
Introduction
There are different types of math models for CPG, here in this blog we focus on a specific oscillator model as follows: Auke.Ijspeert.Science.2007
$$ \left\{ \begin{align} \ddot{r}_i &= a \left( \frac{a}{4} \left( \mu_i - r_i \right) - \dot{r}_i \right) \\ \dot{\theta}_i &= \omega_i + \textstyle\sum\nolimits_{j} r_j w_{ij} \sin(\theta_j - \theta_i - \phi_{ij}) \\ \end{align} \right. $$where $r_i$ is the current amplitude of the oscillator, $\theta_i$ is the phase of the oscillator, $\mu_i$ and $\omega_i$ are the intrinsic amplitude and frequency, $a$ is a positive constant representing the convergence factor. Couplings between oscillators are defined by the weights $w_{ij}$ and phase biases $\phi_{ij}$.
There are different choices for how to associate oscillator's output to joint's command, such as:
- one oscillator per joint: this directly maps oscillator output to joint command in joint space, which is a $N\text{-}to\text{-}1$ mapping, hence increases action space's dimension and corresponding problem complexity.
- one oscillator per leg: this maps oscillator output to leg movement in task space, and then solves leg's joints commands via inverse kinematics.
In this blog we focus on the second case, i.e., implementing CPG with one oscillator per limb, this choice on the one hand doesn't increase control complexity as it's a $3\text{-}to\text{-}3$ mapping per limb, on the other hand it exposes explicit model physical parameters to adjust on the fly.
The oscillators' couplings parameters $w_{ij}$ and $\phi_{ij}$ are strongly related to legged robots' various gaits, like walking, trotting, galloping. However this is not necessary if there is a global controller for the agent to tune all oscillators' intrinsic parameters in real-time Robin.Thandiackal.scirobotics.2021 Dai.Owaki.Nature.2017. Thus a simplified CPG model which ignores explicit couplings between oscillators is used here and the oscillator model of each limb is in the following:
$$ \left\{ \begin{align} \ddot{r}_i &= a \left(\frac{a}{4} \left(\mu_i - r_i \right) - \dot{r}_i \right) \\ \dot{\theta}_i &= \omega_i \\ \dot{\phi}_i &= \psi_i \\ \end{align} \right. $$To map each oscillator's states to corresponding joints command, 2 steps are included:
- map leg oscillator's states to corresponding foot position.
- calculate leg's joints angle from foot position with inverse kinematics.
Although there is no directly physical connection between leg's CPG parameters ${\{ r_i, \theta_i, \phi_i \}}_{i=0,\dots}^{\{ 1,\dots,4 \}}$ and foot's position ${\{ x_i, y_i, z_i \}}_{i=0,\dots}^{\{ 1,\dots,4 \}}$, one commonly used formulation is as follows:
$$ \left\{ \begin{align} x_{i,\text{foot}} &= -d_{step} (r_i-1) \cos(\theta_i) \cos(\phi_i) \\ y_{i,\text{foot}} &= -d_{step} (r_i-1) \cos(\theta_i) \sin(\phi_i) \\ z_{i,\text{foot}} &= \begin{cases} -h + g_c\sin(\theta_i) & \text{if } \sin(\theta_i) > 0 \\ -h + g_p\sin(\theta_i) & \text{otherwise} \\ \end{cases} \\ \end{align} \right. $$where $d_{step}$ is the max step length, $h$ is the robot height, $g_c$ is the max ground clearance during swing, and $g_p$ is the max ground penetration during stance.
Refs
- [Auke.Ijspeert.Science.2007]: From swimming to walking with a salamander robot driven by a spinal cord model
- [Dai.Owaki.Nature.2017]: A quadruped robot exhibiting spontaneous gait transitions from walking to trotting to galloping
- [Robin.Thandiackal.scirobotics.2021]: Emergence of robust self-organized undulatory swimming based on local hydrodynamic force sensing
- [Guillaume.Bellegarda.RAL.2022]: CPG-RL: Learning Central Pattern Generators for Quadruped Locomotion
- [Guillaume.Bellegarda.ICRA.2024]: Visual CPG-RL: Learning Central Pattern Generators for Visually-Guided Quadruped Locomotion