<latex>{\fontsize{16pt}\selectfont \textbf{Rigid Body Contact Force Solver}} </latex>

<latex>{\fontsize{12pt}\selectfont \textbf{Bolutife Ogunsola}} </latex>
<latex>{\fontsize{10pt}\selectfont \textit{Semester Project, RSC}} </latex>

<latex> {\fontsize{12pt}\selectfont \textbf{Abstract} </latex>

In this project, a hard friction-less contact model as well as an impulse dynamics model for HyQ has been implemented in C++. These models are useful for simulation and trajectory optimization tasks. The models implemented in code depend exclusively on the dynamics library generated by RoboticsCodeGenerator1), as such, this project also presents a template for the implementation of contact/impulse models for other robots for which a dynamics library has been generated using the RoboticsCodeGenerator. Suggestions are presented for future work.

<latex> {\fontsize{12pt}\selectfont \textbf{Overview} </latex>

HyQ is a quadruped robot. Its trunk has 6 DoFs and each of its legs has 3 joint DoFs. As such, HyQ's state (both position/pose and velocity) can be described using a 36 dimensional state vector.

In general the dynamics of a rigid body system is expressible as: \begin{equation} H\ddot{q} + C = \tau + \textcolor{red}{\tau_c} \end{equation} Where:

The goal of a contact model is to find the contact forces, $\textcolor{red}{\tau_c}$, experienced by the body when there are contact constraints on it. In this project, it is assumed that these contact constraints are possible only on the end-effectors on each of HyQ's legs. For contact on a frictionless surface, where there are no tangential components of the contact forces, $\textcolor{red}{\tau_c}$ can be written as: \begin{equation} \setcounter{equation}{2} \textcolor{red}{\tau_c} = \boldsymbol{T}\boldsymbol{\lambda} \end{equation}

$\boldsymbol{T}$ is referred to as the 'contact jacobian'. It is a mapping from the coefficients of the contact forces, $\boldsymbol{\lambda}$ along the normal direction to the joint-space.

In order to solve for these contact forces, we have to solve the following linear complementary problem (LCP): \begin{equation} \setcounter{equation}{3} \begin{split} \dot{\boldsymbol{\zeta}} = \boldsymbol{M}\boldsymbol{\lambda} + \boldsymbol{d}
\dot{\boldsymbol{\zeta}} \geq 0
\boldsymbol{\lambda} \geq 0
\dot{\boldsymbol{\zeta}}^T\boldsymbol{\lambda} = 0 \end{split} \end{equation} Where:

Non-negativity of contact forces specifies that a contact surface may push, but never pull. A non-negative separation acceleration while in contact, is required since a negative separation acceleration leads to an immediate violation of contact constraint. Finally, the complementary term specifies that a non-zero contact force implies zero separation acceleration (equivalently, if there is a positive separation velocity, there cannot be any contact force). For a detailed derivation of the LCP, we refer to (Featherstone, 2008)2)

When a collision occurs between one of the end-effectors and a contact surface, there is an instantaneous change in velocity experienced by the whole system. This change in velocity is cause by impulsive forces experienced by the end-effectors during contact gain. The relationship between impulsive forces and change in velocity experienced by end-effectors during contact gain is modeled by: \begin{equation} \setcounter{equation}{4} \begin{bmatrix}\boldsymbol{H} & -\boldsymbol{T}

		\boldsymbol{T}^T & \mathbf{0}
          \end{bmatrix} 
          \begin{bmatrix}\dot{\boldsymbol{q}}^{+}\\
          \boldsymbol{\Lambda}\end{bmatrix} = 
          \begin{bmatrix}\boldsymbol{H}\dot{\boldsymbol{q}}^-
          \\-e\boldsymbol{T}^T\dot{\boldsymbol{q}}^{-}
          \end{bmatrix}

\end{equation} Where:

This equation is an expression of conservation of momentum (joint-space), including constraints on the direction of the (task-space) velocity of the end-effectors after collision.

<latex> {\fontsize{12pt}\selectfont \textbf{Design} </latex>

The following is the project's class diagram.

The contact force model is implemented in the class HyQContactModel, HyQImpulseDynamics implements contact dynamics. ContactSurfaceModelBase is an abstract class that defines an interface for describing a contact surface. An abstraction over the existing dynamics library that provides the terms required for equations (3) and (4) is provided by HyQRBDModel. HyQState provides a common description of HyQ state, together with related helper functions.

For simulation/visualization of contact dynamics the classes StatePropagator and HyQForwardDynamics are provided. HyQForwardDynamics provides an abstraction over the forward dynamics algorithm available in the dynamics library as well as a method to specify the controller to be used for the simulation task. StatePropagator is an abstraction over boost::odeint3) providing an implementation of simulation with contact dynamics. This class is parameterized over boost::odeint stepper types (that implement various numerical integration schemes).

<latex> {\fontsize{12pt}\selectfont \textbf{Results} </latex>

Results for simulation with contact dynamics are shown below for two scenarios. In the first, HyQ is released from an initial position with its feet 1m above ground and its trunk rotated about 5 degrees around the y-axis. In the second scenario HyQ is released from an initial position with its legs 0.5m above a contact surface that is tilted by a rotation of 5 degrees around the y-axis.

Contact Forces, Impulsive Forces and position of HyQ's center of mass (COM) over time, for scenario 1

Contact Forces, Impulsive Forces and position of HyQ's center of mass (COM) over time, for scenario 2

The code for both simulations is available in the demo folder of the project repository.

<latex> {\fontsize{12pt}\selectfont \textbf{Conclusion/Further Work} </latex>

In this work hard friction-less contact and impulse dynamics models have been implemented for HyQ. These models have been validated in simulation using different scenarios.

In implementing the contact dynamics models, a set of classes have also been developed in order to facilitate the re-use / extension of these models.

Extension is envisaged in the following directions:

1)
Marco Frigerio, Jonas Buchli, Darwin G. Caldwell and Claudio Semini, “RobCoGen: a code generator for efficient kinematics and dynamics of articulated robots, based on Domain Specific Languages”, in the Journal of Software Engineering for Robotics (JOSER), Vol 7, No 1, July 2016, pp. 36-54.
2)
R. Featherstone, Rigid body dynamics algorithms. New York: Springer, 2008, pp. 219-224.
3)
K. Ahnert and M. Mulansky, Odeint - Solving Ordinary Differential Equations in C++, AIP Conf. Proc. 1389, pp. 1586-1589 (2011); doi:http://dx.doi.org/10.1063/1.3637934