Chapter 10: Fundamentals of Robot Dynamics
Lesson 2: Generalized Forces and Work
This lesson introduces the notion of generalized forces associated with generalized coordinates in robotic manipulators. Starting from physical work and virtual displacements, we derive the definition of generalized forces, connect them to end-effector wrenches via the Jacobian transpose, and show how conservative fields arise from potential energy. We then implement these ideas in several programming languages for simple planar manipulators.
1. Physical Work, Power, and Joint Torques
In classical mechanics, the (virtual) work done by a force \( \mathbf{F} \in \mathbb{R}^3 \) acting at a point undergoing a (virtual) displacement \( \delta \mathbf{p} \in \mathbb{R}^3 \) is
\[ \delta W = \mathbf{F}^\top \delta \mathbf{p}. \]
For a pure moment (torque) \( \boldsymbol{\tau} \in \mathbb{R}^3 \) producing an infinitesimal rotation \( \delta \boldsymbol{\theta} \in \mathbb{R}^3 \), the work is
\[ \delta W = \boldsymbol{\tau}^\top \delta \boldsymbol{\theta}. \]
In robotic manipulators, joints are parametrized by generalized coordinates \( \mathbf{q} = [q_1,\dots,q_n]^\top \). For a revolute joint \( i \), the generalized coordinate is an angle \( q_i \), and the associated actuator torque is the generalized force component \( Q_i \). For a prismatic joint, \( q_i \) is a translation and \( Q_i \) is a linear force along the joint axis.
If \( \boldsymbol{Q} = [Q_1,\dots,Q_n]^\top \) denotes the vector of generalized forces corresponding to \( \mathbf{q} \), and \( \delta \mathbf{q} \) is a virtual change in joint coordinates, the total virtual work done by all joint actuators is by definition
\[ \delta W = \boldsymbol{Q}^\top \delta \mathbf{q} = \sum_{i=1}^n Q_i \, \delta q_i. \]
For a typical serial manipulator with only actuated joints, the generalized forces coincide with the actuator efforts, e.g., \( Q_i = \tau_i \) for revolute joints and \( Q_i = F_i \) for prismatic joints. However, the full power of generalized forces appears when we map physical forces acting in the workspace (wrenches) back to the joint space via kinematic relationships.
2. Generalized Coordinates and Virtual Displacements
A set of \( n \) generalized coordinates \( \mathbf{q} \) parametrizes the configuration of the mechanism while respecting all kinematic constraints. For a serial manipulator, one usually takes each independent joint displacement (revolute or prismatic) as a generalized coordinate.
Consider a configuration-dependent mapping from joint space to a Cartesian point of interest, e.g. the end-effector position \( \mathbf{p}(\mathbf{q}) \in \mathbb{R}^3 \). A virtual displacement \( \delta \mathbf{q} \) produces an associated virtual Cartesian displacement
\[ \delta \mathbf{p} = \mathbf{J}_p(\mathbf{q}) \, \delta \mathbf{q}, \]
where \( \mathbf{J}_p(\mathbf{q}) \in \mathbb{R}^{3 \times n} \) is the translational Jacobian mapping generalized velocity to linear velocity. More generally, if we consider the full spatial twist of the end-effector \( \boldsymbol{v} = [\boldsymbol{\omega}^\top,\mathbf{v}^\top]^\top \in \mathbb{R}^6 \), differential kinematics (from Chapter 7) gives
\[ \boldsymbol{v} = \mathbf{J}(\mathbf{q}) \, \dot{\mathbf{q}}, \qquad \delta \boldsymbol{x} = \mathbf{J}(\mathbf{q}) \, \delta \mathbf{q}, \]
where \( \delta \boldsymbol{x} \in \mathbb{R}^6 \) denotes a virtual twist coordinate (angular and linear parts) and \( \mathbf{J}(\mathbf{q}) \in \mathbb{R}^{6 \times n} \) is the spatial or body Jacobian, depending on the chosen convention.
The key idea is that virtual displacements in task space are linear functions of virtual displacements in joint space. This linear relationship allows us to transport forces and torques (wrenches) between spaces in a way that preserves work.
3. Principle of Virtual Work and Definition of Generalized Forces
Let a system of applied physical forces (possibly including gravity, contact forces, etc.) do virtual work \( \delta W \) under admissible virtual displacements, i.e. variations that satisfy the kinematic constraints. The principle of virtual work states that, for a system in static equilibrium, the total virtual work vanishes for all admissible virtual displacements. In dynamics, the same structure appears when inertial forces are included as additional applied forces.
For generalized coordinates \( \mathbf{q} \), we define the generalized forces \( Q_i \) as the coefficients of the virtual work expressed in joint space:
\[ \delta W = \sum_{i=1}^n Q_i \, \delta q_i \quad \text{for all admissible } \delta \mathbf{q}. \]
Thus, analytically, given a scalar work function \( \delta W(\delta \mathbf{q}) \) which is linear in \( \delta \mathbf{q} \), the generalized forces are obtained by identification:
\[ Q_i = \frac{\partial \delta W}{\partial (\delta q_i)}. \]
If multiple physical forces act at different points on the robot, their contributions to generalized forces are additive, because work is additive. This linearity is crucial for constructing complex models from simpler components (links, actuators, contacts).
In the next section we show that for a wrench applied at the end-effector, the corresponding generalized forces at the joints are given by the Jacobian transpose times the wrench, a result that is fundamental in both statics and dynamics of manipulators.
4. Wrench to Generalized Forces via the Jacobian Transpose
Let \( \boldsymbol{w} \in \mathbb{R}^6 \) be a spatial wrench applied at the end-effector, typically written as \( \boldsymbol{w} = [\mathbf{f}^\top,\boldsymbol{\mu}^\top]^\top \), where \( \mathbf{f} \) is the force and \( \boldsymbol{\mu} \) is the moment about a chosen reference frame. Let \( \delta \boldsymbol{x} \in \mathbb{R}^6 \) be the corresponding virtual twist coordinates (angular and linear virtual displacement parameters). Then the virtual work of the wrench is
\[ \delta W = \boldsymbol{w}^\top \, \delta \boldsymbol{x}. \]
Using the kinematic relationship \( \delta \boldsymbol{x} = \mathbf{J}(\mathbf{q}) \, \delta \mathbf{q} \), we obtain
\[ \delta W = \boldsymbol{w}^\top \mathbf{J}(\mathbf{q}) \, \delta \mathbf{q} = (\mathbf{J}^\top(\mathbf{q}) \, \boldsymbol{w})^\top \delta \mathbf{q}. \]
Comparing with the definition \( \delta W = \boldsymbol{Q}^\top \delta \mathbf{q} \) for all virtual \( \delta \mathbf{q} \), we identify
\[ \boldsymbol{Q}(\mathbf{q}) = \mathbf{J}^\top(\mathbf{q}) \, \boldsymbol{w}. \]
This is the fundamental Jacobian transpose mapping from task-space wrenches to joint-space generalized forces. It holds irrespective of whether we use spatial or body Jacobians, as long as the wrench and Jacobian are expressed in compatible frames.
For a planar 2R manipulator with end-effector force \( \mathbf{f} = [f_x,f_y]^\top \) in the plane, the 2D translational Jacobian \( \mathbf{J}_p(\mathbf{q}) \in \mathbb{R}^{2 \times 2} \) suffices and generalized torques are
\[ \boldsymbol{Q} = \boldsymbol{\tau} = \mathbf{J}_p^\top(\mathbf{q}) \, \mathbf{f}. \]
The equality of virtual works in task space and joint space, \( \boldsymbol{w}^\top \delta \boldsymbol{x} = \boldsymbol{Q}^\top \delta \mathbf{q} \), is the coordinate-invariant statement at the heart of generalized forces.
5. Conservative Forces and Generalized Forces from Potential Energy
Many important forces in robotics, such as gravity and elastic forces, are conservative. They can be derived from a scalar potential energy function \( V(\mathbf{q}) \). For such forces, the virtual work is
\[ \delta W = - \delta V(\mathbf{q}) = - \sum_{i=1}^n \frac{\partial V}{\partial q_i} \, \delta q_i. \]
By the definition of generalized forces, \( \delta W = \sum_{i=1}^n Q_i \, \delta q_i \), and since the virtual displacements \( \delta q_i \) are independent, we must have
\[ Q_i = - \frac{\partial V}{\partial q_i}, \qquad i = 1,\dots,n. \]
In vector form, the generalized forces due to a conservative field are simply
\[ \boldsymbol{Q}_\text{cons}(\mathbf{q}) = - \nabla_{\mathbf{q}} V(\mathbf{q}). \]
Example: Pendulum-like 1R manipulator. Consider a single-link planar arm of length \( l \) and mass \( m \), pivoting about its base with angle \( q \) measured from the downward vertical. The center of mass (COM) is at \( l_c \) from the pivot. Its gravitational potential energy (taking the downward vertical as zero reference) is
\[ V(q) = m g l_c (1 - \cos q). \]
Then the generalized force (joint torque) due to gravity is
\[ Q = \tau_g(q) = -\frac{\partial V}{\partial q} = - m g l_c \sin q. \]
This is the well-known gravitational torque for a simple pendulum-like link. In multi-link arms, the gravitational generalized forces are computed from the total potential energy of all links, differentiated with respect to each coordinate.
6. Algorithmic View – From End-Effector Wrench to Joint Torques
For a known joint configuration \( \mathbf{q} \), an external wrench \( \boldsymbol{w} \) applied at the end-effector, and a known Jacobian \( \mathbf{J}(\mathbf{q}) \), the computation of generalized forces is straightforward:
- Compute the Jacobian \( \mathbf{J}(\mathbf{q}) \) from the kinematic model.
- Form the end-effector wrench vector \( \boldsymbol{w} \) in the same frame as \( \mathbf{J} \).
- Compute generalized forces \( \boldsymbol{Q} = \mathbf{J}^\top(\mathbf{q}) \boldsymbol{w} \).
The following diagram summarizes this mapping pipeline for manipulators.
flowchart TD
Q["Joint configuration q"] --> JCOMP["Compute Jacobian J(q)"]
W["End-effector wrench w"] --> MATCH["Express w in frame of J"]
JCOMP --> MULT["Compute Q = J_transpose * w"]
MATCH --> MULT
MULT --> TORQUE["Joint torques/forces Q (actuator space)"]
When gravity and other conservative effects are included, the total generalized forces become the sum of external wrench-induced forces and potential-derived forces:
\[ \boldsymbol{Q}_\text{total}(\mathbf{q}) = \mathbf{J}^\top(\mathbf{q}) \boldsymbol{w}_\text{ext}(\mathbf{q}) - \nabla_{\mathbf{q}} V(\mathbf{q}). \]
This expression will later feed into the dynamic equations of motion in Lagrangian and Newton–Euler formulations.
7. Numerical Example – Planar 2R Manipulator
Consider a planar 2R manipulator: two revolute joints with link lengths \( l_1, l_2 \). Let joint angles be \( q_1, q_2 \) measured from the horizontal. The end-effector position in the plane is
\[ \begin{aligned} x(q_1,q_2) &= l_1 \cos q_1 + l_2 \cos(q_1 + q_2), \\ y(q_1,q_2) &= l_1 \sin q_1 + l_2 \sin(q_1 + q_2). \end{aligned} \]
The translational Jacobian \( \mathbf{J}_p(q_1,q_2) \in \mathbb{R}^{2 \times 2} \) is
\[ \mathbf{J}_p(q_1,q_2) = \begin{bmatrix} \dfrac{\partial x}{\partial q_1} & \dfrac{\partial x}{\partial q_2} \\ \dfrac{\partial y}{\partial q_1} & \dfrac{\partial y}{\partial q_2} \end{bmatrix} = \begin{bmatrix} -l_1 \sin q_1 - l_2 \sin(q_1 + q_2) & - l_2 \sin(q_1 + q_2) \\ \;\;l_1 \cos q_1 + l_2 \cos(q_1 + q_2) &\;\; l_2 \cos(q_1 + q_2) \end{bmatrix}. \]
For a planar force \( \mathbf{f} = [f_x,f_y]^\top \) at the end-effector, the generalized torques are
\[ \boldsymbol{\tau} = \mathbf{J}_p^\top(q_1,q_2) \, \mathbf{f}. \]
This model is simple yet captures the essential Jacobian transpose mapping that is widely used in robot control and dynamics.
8. Software Lab – Computing Generalized Forces
In this section we implement the Jacobian-based generalized force computation for the 2R planar manipulator in several languages. We assume that kinematic parameters \( l_1, l_2 \) and joint angles \( q_1, q_2 \) are given, as well as a planar end-effector force \( \mathbf{f} = [f_x,f_y]^\top \).
8.1 Python (NumPy / SymPy)
import numpy as np
def jacobian_2r(q, l1, l2):
q1, q2 = q
s1 = np.sin(q1)
c1 = np.cos(q1)
s12 = np.sin(q1 + q2)
c12 = np.cos(q1 + q2)
J11 = -l1 * s1 - l2 * s12
J12 = -l2 * s12
J21 = l1 * c1 + l2 * c12
J22 = l2 * c12
J = np.array([[J11, J12],
[J21, J22]])
return J
def generalized_torques_from_force(q, l1, l2, f):
"""
q : array-like, shape (2,)
f : array-like, shape (2,) planar end-effector force [fx, fy]
"""
J = jacobian_2r(q, l1, l2)
f_vec = np.asarray(f).reshape(2,)
tau = J.T @ f_vec
return tau
if __name__ == "__main__":
l1, l2 = 1.0, 0.8
q = np.array([0.5, -0.3]) # radians
f = np.array([10.0, 5.0]) # N in x-y plane
tau = generalized_torques_from_force(q, l1, l2, f)
print("Joint torques:", tau)
# Numerical check of virtual work invariance:
# Choose a small virtual joint displacement delta_q
delta_q = np.array([1e-4, -2e-4])
J = jacobian_2r(q, l1, l2)
delta_p = J @ delta_q
deltaW_task = f @ delta_p
deltaW_joint = tau @ delta_q
print("deltaW_task ~", deltaW_task, "deltaW_joint ~", deltaW_joint)
8.2 C++ (Eigen)
We use the Eigen library for matrix operations.
#include <iostream>
#include <Eigen/Dense>
using Eigen::Matrix2d;
using Eigen::Vector2d;
Matrix2d jacobian2R(double q1, double q2, double l1, double l2) {
double s1 = std::sin(q1);
double c1 = std::cos(q1);
double s12 = std::sin(q1 + q2);
double c12 = std::cos(q1 + q2);
Matrix2d J;
J(0,0) = -l1 * s1 - l2 * s12;
J(0,1) = -l2 * s12;
J(1,0) = l1 * c1 + l2 * c12;
J(1,1) = l2 * c12;
return J;
}
Vector2d generalizedTorquesFromForce(double q1, double q2,
double l1, double l2,
const Vector2d &f) {
Matrix2d J = jacobian2R(q1, q2, l1, l2);
return J.transpose() * f;
}
int main() {
double l1 = 1.0, l2 = 0.8;
double q1 = 0.5, q2 = -0.3;
Vector2d f;
f << 10.0, 5.0;
Vector2d tau = generalizedTorquesFromForce(q1, q2, l1, l2, f);
std::cout << "Joint torques: " << tau.transpose() << std::endl;
return 0;
}
8.3 Java (EJML)
Here we use the EJML library to handle small dense matrices.
import org.ejml.data.DMatrixRMaj;
import org.ejml.dense.row.CommonOps_DDRM;
public class Planar2RGeneralizedForces {
public static DMatrixRMaj jacobian2R(double q1, double q2,
double l1, double l2) {
double s1 = Math.sin(q1);
double c1 = Math.cos(q1);
double s12 = Math.sin(q1 + q2);
double c12 = Math.cos(q1 + q2);
DMatrixRMaj J = new DMatrixRMaj(2, 2);
J.set(0, 0, -l1 * s1 - l2 * s12);
J.set(0, 1, -l2 * s12);
J.set(1, 0, l1 * c1 + l2 * c12);
J.set(1, 1, l2 * c12);
return J;
}
public static DMatrixRMaj generalizedTorquesFromForce(
double q1, double q2,
double l1, double l2,
DMatrixRMaj f) {
DMatrixRMaj J = jacobian2R(q1, q2, l1, l2);
DMatrixRMaj Jt = new DMatrixRMaj(2, 2);
CommonOps_DDRM.transpose(J, Jt);
DMatrixRMaj tau = new DMatrixRMaj(2, 1);
CommonOps_DDRM.mult(Jt, f, tau);
return tau;
}
public static void main(String[] args) {
double l1 = 1.0, l2 = 0.8;
double q1 = 0.5, q2 = -0.3;
DMatrixRMaj f = new DMatrixRMaj(2, 1);
f.set(0, 0, 10.0);
f.set(1, 0, 5.0);
DMatrixRMaj tau = generalizedTorquesFromForce(q1, q2, l1, l2, f);
System.out.println("Joint torques:");
System.out.println(tau.get(0, 0) + ", " + tau.get(1, 0));
}
}
8.4 MATLAB / Simulink
In MATLAB, symbolic computation makes it easy to derive Jacobians and generalized forces symbolically, and the expressions can be exported to Simulink.
syms q1 q2 l1 l2 real
syms fx fy real
% End-effector position
x = l1*cos(q1) + l2*cos(q1 + q2);
y = l1*sin(q1) + l2*sin(q1 + q2);
J = jacobian([x; y], [q1; q2]); % 2x2 translational Jacobian
f = [fx; fy];
tau = simplify(J.' * f); % generalized torques
disp('Jacobian J(q):');
disp(J);
disp('Generalized torques tau(q,f):');
disp(tau);
% Example numerical evaluation:
l1v = 1.0; l2v = 0.8;
q1v = 0.5; q2v = -0.3;
fxv = 10.0; fyv = 5.0;
Jnum = double(subs(J, {q1,q2,l1,l2}, {q1v,q2v,l1v,l2v}));
taunum = double(subs(tau, {q1,q2,l1,l2,fx,fy}, {q1v,q2v,l1v,l2v,fxv,fyv}));
disp('Numeric J:'); disp(Jnum);
disp('Numeric tau:'); disp(taunum);
% In Simulink, these expressions can be implemented in a MATLAB Function block
% that takes (q1,q2,fx,fy) as inputs and outputs tau1,tau2.
8.5 Wolfram Mathematica
Clear[q1, q2, l1, l2, fx, fy];
x[q1_, q2_, l1_, l2_] := l1*Cos[q1] + l2*Cos[q1 + q2];
y[q1_, q2_, l1_, l2_] := l1*Sin[q1] + l2*Sin[q1 + q2];
J[q1_, q2_, l1_, l2_] :=
D[{x[q1, q2, l1, l2], y[q1, q2, l1, l2]}, {{q1, q2}}];
fVec = {fx, fy};
tau[q1_, q2_, l1_, l2_, fx_, fy_] :=
Simplify[Transpose[J[q1, q2, l1, l2]].fVec];
(* Example numerical evaluation *)
l1v = 1.0; l2v = 0.8;
q1v = 0.5; q2v = -0.3;
fxv = 10.0; fyv = 5.0;
Jnum = J[q1v, q2v, l1v, l2v] // N
taunum = tau[q1v, q2v, l1v, l2v, fxv, fyv] // N
9. Problems and Solutions
Problem 1 (Generalized Force for a Prismatic Joint): A single prismatic joint translates along the x-axis. The generalized coordinate is the extension \( q \) and the joint force along x is \( F \). Show that the generalized force is \( Q = F \).
Solution: A virtual displacement is \( \delta q \) along x. The physical virtual displacement vector is \( \delta \mathbf{p} = [\delta q, 0, 0]^\top \), and the force is \( \mathbf{F} = [F, 0, 0]^\top \). The virtual work is
\[ \delta W = \mathbf{F}^\top \delta \mathbf{p} = F \, \delta q. \]
By definition \( \delta W = Q \, \delta q \), so \( Q = F \). Thus, for a prismatic coordinate aligned with the force direction, the generalized force coincides with the physical force.
Problem 2 (Jacobian Transpose Mapping Proof): Let \( \boldsymbol{w} \in \mathbb{R}^6 \) be a wrench at the end-effector and \( \mathbf{J}(\mathbf{q}) \in \mathbb{R}^{6 \times n} \) the Jacobian relating joint displacements to task-space displacements. Show that the generalized forces are \( \boldsymbol{Q} = \mathbf{J}^\top(\mathbf{q}) \boldsymbol{w} \) by using virtual work.
Solution: By definition, the virtual work of the wrench is
\[ \delta W = \boldsymbol{w}^\top \delta \boldsymbol{x}. \]
Using the kinematic relation \( \delta \boldsymbol{x} = \mathbf{J}(\mathbf{q}) \delta \mathbf{q} \), we obtain
\[ \delta W = \boldsymbol{w}^\top \mathbf{J}(\mathbf{q}) \delta \mathbf{q} = (\mathbf{J}^\top(\mathbf{q}) \boldsymbol{w})^\top \delta \mathbf{q}. \]
On the other hand, by the definition of generalized forces, \( \delta W = \boldsymbol{Q}^\top \delta \mathbf{q} \) for all admissible \( \delta \mathbf{q} \). Because virtual displacements are arbitrary, we must have \( \boldsymbol{Q} = \mathbf{J}^\top(\mathbf{q}) \boldsymbol{w} \). This completes the proof.
Problem 3 (Generalized Force from Potential Energy): Consider a 1R planar arm with generalized coordinate \( q \) measured from the horizontal. The COM is at distance \( l_c \) from the pivot and has mass \( m \). Gravity acts downward with magnitude \( g \). Taking the horizontal line through the pivot as zero potential, show that the gravitational generalized force is \( Q = -m g l_c \cos q \) for this choice of coordinates.
Solution: The height of the COM relative to the horizontal reference is \( h(q) = l_c \sin q \), but measured from the horizontal the potential can be written
\[ V(q) = m g h(q) = m g l_c \sin q. \]
(Note such choices of reference level only modify energy by a constant.) The generalized force is
\[ Q = -\frac{\partial V}{\partial q} = - m g l_c \cos q. \]
If instead we had used a vertical reference, we would obtain the same torque up to shifts in \( V \) by constants, which do not affect generalized forces.
Problem 4 (2R Manipulator Torque Calculation): For the planar 2R manipulator of Section 7 with \( l_1 = 1 \text{ m} \), \( l_2 = 1 \text{ m} \), joint angles \( q_1 = 0 \), \( q_2 = 0 \), and planar end-effector force \( \mathbf{f} = [0, f_y]^\top \), compute the joint torques \( \tau_1, \tau_2 \) explicitly.
Solution: At \( q_1 = q_2 = 0 \), we have
\[ \begin{aligned} x &= l_1 + l_2, \\ y &= 0. \end{aligned} \]
The Jacobian entries specialize to
\[ \begin{aligned} \frac{\partial x}{\partial q_1} &= -l_1 \sin 0 - l_2 \sin 0 = 0, \\ \frac{\partial x}{\partial q_2} &= -l_2 \sin 0 = 0, \\ \frac{\partial y}{\partial q_1} &= l_1 \cos 0 + l_2 \cos 0 = l_1 + l_2, \\ \frac{\partial y}{\partial q_2} &= l_2 \cos 0 = l_2. \end{aligned} \]
With \( l_1 = l_2 = 1 \), the Jacobian is
\[ \mathbf{J}_p(0,0) = \begin{bmatrix} 0 & 0 \\ 2 & 1 \end{bmatrix}. \]
Then
\[ \boldsymbol{\tau} = \mathbf{J}_p^\top(0,0) \mathbf{f} = \begin{bmatrix} 0 & 2 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} 0 \\ f_y \end{bmatrix} = \begin{bmatrix} 2 f_y \\ f_y \end{bmatrix}. \]
Thus \( \tau_1 = 2 f_y \) and \( \tau_2 = f_y \). This matches the physical intuition that, in the straight configuration, the first joint must carry the moment due to both links, while the second joint only carries the distal link.
Problem 5 (Conservative vs Non-conservative Generalized Forces): Suppose a manipulator experiences both gravitational forces, derivable from a potential \( V_g(\mathbf{q}) \), and viscous joint friction torques \( \tau_f = \mathbf{D} \dot{\mathbf{q}} \) with a positive definite damping matrix \( \mathbf{D} \). Explain which part of the generalized force is conservative and which part is not, and write the total generalized force.
Solution: The gravitational generalized forces are conservative, because they can be written as
\[ \boldsymbol{Q}_g(\mathbf{q}) = - \nabla_{\mathbf{q}} V_g(\mathbf{q}). \]
Viscous friction torques \( \tau_f = \mathbf{D} \dot{\mathbf{q}} \) cannot be derived from a potential depending only on \( \mathbf{q} \); they depend on velocities and dissipate energy, so they are non-conservative. The total generalized forces are the sum
\[ \boldsymbol{Q}_\text{total}(\mathbf{q},\dot{\mathbf{q}}) = - \nabla_{\mathbf{q}} V_g(\mathbf{q}) + \mathbf{D} \dot{\mathbf{q}}. \]
Only the first term contributes to a potential energy; the second term introduces dissipation and will enter the dynamics as a damping term rather than as a gradient of a scalar potential.
10. Combined External Wrench and Gravity Compensation
In many applications, joint torques must compensate both for gravity (a conservative effect) and for external wrenches, for example when a robot holds an object against an external load. The following diagram summarizes the combination:
flowchart TD
QCFG["Joint configuration q"] --> GRAV["Compute gravity potential V(q)"]
GRAV --> QG["Compute Q_g = -grad_q V(q)"]
WEXT["External wrench w_ext"] --> JAC["Compute J(q) and Q_ext = J_transpose * w_ext"]
QCFG --> JAC
QG --> SUM["Total generalized force Q_total"]
JAC --> SUM
SUM --> ACT["Send Q_total to joint-level dynamics or controllers"]
11. Summary
In this lesson we formalized generalized forces as the coefficients of virtual work in the space of generalized coordinates. Using the principle of virtual work, we derived the central identity \( \boldsymbol{Q} = \mathbf{J}^\top \boldsymbol{w} \) that maps task-space wrenches to joint-space generalized forces via the Jacobian transpose. We then showed how conservative forces arise from potential energy via gradients, leading to explicit expressions for gravitational torques.
A concrete 2R planar example illustrated both the analytical Jacobian and the numerical computation of joint torques. Implementations in Python, C++, Java, MATLAB/Simulink, and Mathematica demonstrated how these concepts are translated into practical software components for robotics. These generalized forces will directly enter the equations of motion derived in subsequent lessons using Lagrange–Euler and Newton–Euler formulations.
12. References
- Lagrange, J. L. (1788). Mécanique Analytique. Paris: Desaint. (Foundational work on generalized coordinates and generalized forces.)
- d'Alembert, J. (1743). Traité de Dynamique. Paris: David. (Introduces d'Alembert's principle and virtual work for dynamics.)
- Kane, T. R., & Levinson, D. A. (1985). Dynamics of particles and rigid bodies: A systematic approach. Journal of Guidance, Control, and Dynamics, 8(6), 725–735.
- Udwadia, F. E., & Kalaba, R. E. (1992). A new perspective on constrained motion. Proceedings of the Royal Society A, 439(1906), 407–410.
- Featherstone, R. (1983). The calculation of robot dynamics using articulated-body inertias. International Journal of Robotics Research, 2(1), 13–30.
- Park, J., & Bobrow, J. (1994). A recursive algorithm for robot dynamics based on Lie groups. International Journal of Robotics Research, 13(6), 601–617.
- Ortega, R., Spong, M. W., Gomez-Estern, F., & Blankenstein, G. (2002). Stabilization of underactuated mechanical systems via interconnection and damping assignment. IEEE Transactions on Automatic Control, 47(8), 1218–1233.
- Maciejewski, A. A. (1990). Dealing with the ill-conditioned equations of motion for articulated figures. IEEE Computer Graphics and Applications, 10(3), 63–71.