Skip to content
Carlos Mastalli edited this page Mar 17, 2019 · 15 revisions

Crocoddyl: Contact RObot COntrol by Differential DYnamic programming Library

I. Welcome to crocoddyl

Crocoddyl is an optimal control library for robot control under contact sequence. Its solver is based on an efficient Differential Dynamic Programming (DDP) algorithm. Crocoddyl computes optimal trajectories along to optimal feedback gains. It uses Pinocchio for fast computation of robot dynamics and its analytical derivatives.

Crocoddyl is focused on multi-contact optimal control problem (MCOP) which as the form:

$\mathbf{X}^*,\mathbf{U}^*= \begin{Bmatrix} \mathbf{x}^*_0,\cdots,\mathbf{x}^*_N \\ \mathbf{u}^*_0,\cdots,\mathbf{u}^*_N \end{Bmatrix} = \arg\min_{\mathbf{X},\mathbf{U}} \sum_{k=1}^N \int_{t_k}^{t_k+\Delta t} l(\mathbf{x},\mathbf{u})dt$

subject to

$\mathbf{\dot{x}} = \mathbf{f}(\mathbf{x},\mathbf{u}),$

$\mathbf{x}\in\mathcal{X}, \mathbf{u}\in\mathcal{U}, \boldsymbol{\lambda}\in\mathcal{K}.$

where

  • the state $\mathbf{x}=(\mathbf{q},\mathbf{v})$ lies in a manifold, e.g. Lie manifold $\mathbf{q}\in SE(3)\times \mathbb{R}^{n_j}$,
  • the system has underactuacted dynamics, i.e. $\mathbf{u}=(\mathbf{0},\boldsymbol{\tau})$,
  • $\mathcal{X}$, $\mathcal{U}$ are the state and control admissible sets, and
  • $\mathcal{K}$ represents the contact constraints.

Note that $\boldsymbol{\lambda}=\mathbf{g}(\mathbf{x},\mathbf{u})$ denotes the contact force, and is dependent on the state and control.

Let's start by understanding the concept behind crocoddyl design.

II. Action models

In crocoddyl, an action model combines dynamics and cost models. Each node, in our optimal control problem, is described through an action model. Every time that we want describe a problem, we need to provide ways of computing the dynamics, cost functions and their derivatives. All these is described inside the action model.

To understand the mathematical aspects behind an action model, let's first get a locally linearize version of our optimal control problem as:

$\mathbf{X}^*(\mathbf{x}_0),\mathbf{U}^*(\mathbf{x}_0) = \arg\max_{\mathbf{X},\mathbf{U}} = cost_T(\delta\mathbf{x}_N) + \sum_{k=1}^N cost_t(\delta\mathbf{x}_k, \delta\mathbf{u}_k)$

subject to

$dynamics(\delta\mathbf{x}_{k+1},\delta\mathbf{x}_k,\delta\mathbf{u}_k)=\mathbf{0},$

where

  • $cost_T(\delta\mathbf{x}_k) = \frac{1}{2} \begin{bmatrix} 1 \\ \delta\mathbf{x}_k \end{bmatrix}^\top \begin{bmatrix} 0 & \mathbf{l_x}^\top_k \\ \mathbf{l_x}_k & \mathbf{l_{xx}}_k \end{bmatrix} \begin{bmatrix} 1 \\ \delta\mathbf{x}_k \end{bmatrix}$,      $cost_t(\delta\mathbf{x}_k,\delta\mathbf{u}_k) = \frac{1}{2} \begin{bmatrix} 1 \\ \delta\mathbf{x}_k \\ \delta\mathbf{u}_k \end{bmatrix}^\top \begin{bmatrix} 0 & \mathbf{l_x}^\top_k & \mathbf{l_u}^\top_k\\ \mathbf{l_x}_k & \mathbf{l_{xx}}_k & \mathbf{l_{ux}}^\top_k\\ \mathbf{l_u}_k & \mathbf{l_{ux}}_k & \mathbf{l_{uu}}_k \end{bmatrix} \begin{bmatrix} 1 \\ \delta\mathbf{x}_k \\ \delta\mathbf{u}_k \end{bmatrix}$

  • $dynamics(\delta\mathbf{x}_{k+1},\delta\mathbf{x}_k,\delta\mathbf{u}_k) = \delta\mathbf{x}_{k+1} - (\mathbf{f_x}_k\delta\mathbf{x}_k + \mathbf{f_u}_k\delta\mathbf{u}_k)$

Important notes:

  • An action model describes the dynamics and cost functions for a node in our optimal control problem.
  • Action models lie in the discrete time space.
  • For debugging and prototyping, we have also implemented NumDiff abstractions. These computations depend only in the defining of the dynamics equation and cost functions. However to asses efficiency, crocoddyl uses analytical derivatives computed from Pinocchio.

Differential and Integrated Action Models

It's often convenient to implement action models in continuous time. In crocoddyl, this continuous-time action models are called Differential Action Model (DAM). And together with predefined Integrated Action Models (IAM), it possible to retrieve the time-discrete action model needed by the solver.

At the moment, we have the following integration rules:

  • simpletic Euler and
  • Runge-Kutte 4.
Clone this wiki locally