# Principle of virtual work

Although derivations based on Gauss's principle of least constraint are now more commonplace (thank goodness!), the principle of virtual work is an equivalent approach that we can still find in the literature. Also called d'Alembert's principle, it relates constrained motions to their constraint forces.

## Virtual displacements

Consider the holonomic constraint $$\bfc(\bfq) = \bfzero$$, which stacks a set of equations that our system must follow troughout its motions. It could be for instance a biped keeping its feet in contact with the ground, or a humanoid pushing against a wall. The corresponding constraint Jacobian is:

\begin{equation*} \bfJ_c(\bfq) \qd = \frac{\partial \bfc}{\partial \bfq}(\bfq) \qd = \bfzero \end{equation*}

Let us define a virtual displacement $$\Delta \bfq$$ as any vector in the nullspace of the constraint Jacobian:

\begin{equation*} \bfJ_c(\bfq) \Delta \bfq = \bfzero \end{equation*}

Note that a virtual displacement $$\Delta \bfq$$ is not the same thing as an actual displacement of the robot. At the acceleration level, a virtual displacement $$(\Delta \bfq, \Delta \qd)$$ only satisfies the constraint:

\begin{equation*} \bfJ_c(\bfq) \Delta \qd + \Delta \bfq^\top \bfH_c(\bfq) \Delta \bfq = \bfzero \end{equation*}

Whereas an actual displacement $$(\qd, \qdd)$$ satisfies both the constraint and the equation of motion:

\begin{align} \bfM(\bfq) \qdd + \qd^\top \bfC(\bfq) \qd & = \bfS^T \bftau + \bftau_g(\bfq) + \bfJ_c(\bfq)^\top \bff \\ \bfJ_c(\bfq) \qdd + \qd^\top \bfH_c(\bfq) \qd & = \bfzero \end{align}

This distinction shows that virtual displacements are more general than actual displacements. It is important to keep in mind for what follows.

## Virtual work

The principle of virtual work applies to ideal constraints, i.e., constraints whose virtual displacements are reversible. In robotics, this basically means all constraints except those that involve friction. The principle states that constraint forces, i.e., the joint torques $$\bftau_c$$ that maintain the constraint $$\bfc(\bfq) = \bfzero$$ along a virtual displacement $$\Delta \bfq$$, do not produce any virtual work. That is:

\begin{equation*} \bftau_c^\top \Delta \bfq = \bfzero \end{equation*}

Since $$\Delta \bfq$$ can be any virtual displacement in the nullspace $${\cal N}(\bfJ_c)$$ of the constraint Jacobian, this means $$\bftau_c$$ belongs to the orthogonal to this nullspace, which is also equal to the range of the Jacobian transpose:

\begin{equation*} \bftau_c \in {\cal N}(\bfJ_c)^\bot = {\cal R}(\bfJ_c^\top) \end{equation*}

As a consequence, there exists a vector $$\bff$$ of dual vectors such that $$\bftau_c = \bfJ_c^\top \bff$$. We define constraint forces as these dual vectors. To continue our example, if the constraint is that the biped's feet stay in contact with the ground, then $$\bff$$ are the ground contact forces; if our constraint is that the humanoid's hands push against the wall, then $$\bff$$ are the wall contact forces.

## To go further

The alternative Lagrangian derivation from the principle of least constraint characterizes forces further than what we did above. As a matter of fact, the principle of virtual work can be seen as the critical condition associated with the principle of least constraint: for the latter, motions minimize an objective function (deviation from unconstrained motion), for the former, motions are in the nullspace of the gradient of this objective function. Informally, since the critical point of a strictly convex function is its global optimum, the two principles are equivalent.

The principle of virtual work is not always applicable: it only works with ideal constraints where forces do not work along virtual displacements. This is in particular not true for sliding friction where forces are opposite end-effector velocities. In that case, the most straightforward solution is to use a model of the friction force and map it through the Jacobian transpose in the constrained equations of motion. For a proof of why this is valid, see for instance equation (13) in Wieber's comments on the structure of the dynamics of articulated motion. Alternatively, the Udwadia-Kalaba formulation provides an equivalent generalization of the principle of virtual work to non-ideal constraints. It also derives from the principle of least constraint, yet it involves pseudoinverses which are not as numerically stable as working directly with the constrained equation of motion.

© Stéphane Caron — All content on this website is under the CC BY 4.0 license.
π