Chapter 20: Advanced Topics and Research Frontiers in Modeling
Lesson 2: Model Reduction for High-DOF Systems
This lesson develops mathematically rigorous techniques for reducing the order of high-DOF robot models while preserving key kinematic and dynamic behavior. We focus on coordinate partitioning, modal reduction, balanced truncation, and data-driven (PCA/POD-style) approaches, and provide multi-language implementations suitable for large manipulators, humanoids, and multi-body robots.
1. Motivation and General Formulation
Consider an \( n \)-DOF robot with generalized coordinates \( \mathbf{q}\in\mathbb{R}^n \). Neglecting constraints for the moment, previous chapters showed that its dynamics can be written as
\[ \mathbf{M}(\mathbf{q}) \ddot{\mathbf{q}} + \mathbf{C}(\mathbf{q},\dot{\mathbf{q}})\dot{\mathbf{q}} + \mathbf{g}(\mathbf{q}) = \boldsymbol{\tau}, \]
with \( \mathbf{M}(\mathbf{q}) \) symmetric positive definite, \( \mathbf{C}(\mathbf{q},\dot{\mathbf{q}}) \) capturing Coriolis and centrifugal effects, and \( \mathbf{g}(\mathbf{q}) \) gravity. Introducing the state \( \mathbf{x} = \begin{bmatrix} \mathbf{q} \\ \dot{\mathbf{q}} \end{bmatrix} \in \mathbb{R}^{2n} \), the dynamics define a nonlinear system
\[ \dot{\mathbf{x}} = \mathbf{f}(\mathbf{x},\boldsymbol{\tau}). \]
For high-DOF systems (e.g., humanoids, soft/flexible robots, multi-fingered hands), simulation, optimization, and identification with the full model can be expensive. Model reduction seeks a lower-dimensional state \( \mathbf{z}\in\mathbb{R}^r \), with \( r \ll 2n \), and a projection \( \mathbf{x} \approx \mathbf{T}\mathbf{z} \), such that
\[ \dot{\mathbf{z}} = \mathbf{f}_r(\mathbf{z},\boldsymbol{\tau}), \quad \mathbf{y} = \mathbf{h}_r(\mathbf{z}) \]
approximates the original input-output behavior for signals of interest. The matrix \( \mathbf{T}\in\mathbb{R}^{2n\times r} \) is called a reduction basis or projection matrix.
At a high level, model reduction for robots follows the conceptual pipeline:
flowchart TD
A["Full robot model: M(q), C(q,qdot), g(q)"] --> B["Choose operating regime: trajectories / equilibrium"]
B --> C["Build representation: linearization or data snapshots"]
C --> D["Compute reduction basis T (modes, balancing, PCA)"]
D --> E["Project dynamics to reduced coords z"]
E --> F["Validate vs full model (errors, energy, task-space outputs)"]
In the rest of this lesson we derive specific constructions for \( \mathbf{T} \) and the associated reduced dynamics.
2. Coordinate Partitioning and Schur-Complement Reduction
A natural strategy in robotics is to partition coordinates into dominant and secondary DOFs. Write \( \mathbf{q} = \begin{bmatrix} \mathbf{q}_a \\ \mathbf{q}_b \end{bmatrix} \) with \( \mathbf{q}_a\in\mathbb{R}^{n_a} \) representing DOFs that dominate the task (e.g., arm joints) and \( \mathbf{q}_b\in\mathbb{R}^{n_b} \) secondary DOFs (e.g., small compliance, fingers), such that \( n_a + n_b = n \).
Linearizing around an operating point \( (\mathbf{q}_0,\dot{\mathbf{q}}_0,\boldsymbol{\tau}_0) \) for small perturbations \( \delta\mathbf{q},\delta\dot{\mathbf{q}},\delta\boldsymbol{\tau} \), we obtain a second-order linear model
\[ \mathbf{M}_0 \, \delta\ddot{\mathbf{q}} + \mathbf{D}_0 \, \delta\dot{\mathbf{q}} + \mathbf{K}_0 \, \delta\mathbf{q} = \delta\boldsymbol{\tau}, \]
where \( \mathbf{M}_0 = \mathbf{M}(\mathbf{q}_0) \) and \( \mathbf{D}_0,\mathbf{K}_0 \) are damping and stiffness matrices obtained from local linearization. Partitioning,
\[ \mathbf{M}_0 = \begin{bmatrix} \mathbf{M}_{aa} & \mathbf{M}_{ab} \\ \mathbf{M}_{ba} & \mathbf{M}_{bb} \end{bmatrix},\quad \delta\mathbf{q} = \begin{bmatrix} \delta\mathbf{q}_a \\ \delta\mathbf{q}_b \end{bmatrix},\quad \delta\boldsymbol{\tau} = \begin{bmatrix} \delta\boldsymbol{\tau}_a \\ \delta\boldsymbol{\tau}_b \end{bmatrix}, \]
and analogously for \( \mathbf{D}_0,\mathbf{K}_0 \), the equations of motion become
\[ \begin{aligned} \mathbf{M}_{aa}\delta\ddot{\mathbf{q}}_a + \mathbf{M}_{ab}\delta\ddot{\mathbf{q}}_b + \cdots &= \delta\boldsymbol{\tau}_a, \\ \mathbf{M}_{ba}\delta\ddot{\mathbf{q}}_a + \mathbf{M}_{bb}\delta\ddot{\mathbf{q}}_b + \cdots &= \delta\boldsymbol{\tau}_b. \end{aligned} \]
If the secondary coordinates \( \mathbf{q}_b \) are heavily damped or weakly excited, a common approximation is to assume that their dynamics are quasi-static:
\[ \mathbf{M}_{ba}\delta\ddot{\mathbf{q}}_a + \mathbf{M}_{bb}\delta\ddot{\mathbf{q}}_b + \cdots \approx \mathbf{0}. \]
Solving this (and the corresponding stiffness/damping contributions) for \( \delta\ddot{\mathbf{q}}_b \) and substituting back into the first block row yields an effective dynamics for \( \delta\mathbf{q}_a \). In the simplest purely inertia-based case, one obtains the Schur-complement inertia
\[ \mathbf{M}_{\text{eff}} = \mathbf{M}_{aa} - \mathbf{M}_{ab}\mathbf{M}_{bb}^{-1}\mathbf{M}_{ba}, \]
defining a reduced-order model in the coordinates \( \mathbf{q}_a \). This is an example of a coordinate-partitioning reduction, which is widely used for robots with a clear separation between primary DOFs and compliant/ weakly-controlled DOFs.
3. Modal Reduction for Linearized Robot Dynamics
For small oscillations around a static configuration \( \mathbf{q}_0 \), with \( \dot{\mathbf{q}}_0 = \mathbf{0} \) and constant torque \( \boldsymbol{\tau}_0 \) balancing gravity, the linearized second-order dynamics (neglecting damping) are
\[ \mathbf{M}_0 \, \delta\ddot{\mathbf{q}} + \mathbf{K}_0 \, \delta\mathbf{q} = \delta\boldsymbol{\tau}, \]
with stiffness \( \mathbf{K}_0 = \left.\frac{\partial\mathbf{g}}{\partial\mathbf{q}}\right|_{\mathbf{q}_0} \). Modal reduction constructs a basis from the vibration modes, i.e. solutions of the generalized eigenproblem
\[ \mathbf{K}_0 \boldsymbol{\phi}_i = \omega_i^2 \mathbf{M}_0 \boldsymbol{\phi}_i, \quad i = 1,\dots,n, \]
where \( \omega_i \) are natural frequencies and \( \boldsymbol{\phi}_i \) mode shapes. Choosing \( \mathbf{\Phi} = [\boldsymbol{\phi}_1,\dots,\boldsymbol{\phi}_n] \) and mass-normalizing the modes so that \( \mathbf{\Phi}^\top \mathbf{M}_0 \mathbf{\Phi} = \mathbf{I} \), we introduce generalized modal coordinates \( \boldsymbol{\eta} \) via
\[ \delta\mathbf{q} = \mathbf{\Phi} \boldsymbol{\eta}. \]
In modal coordinates, the dynamics decouple into
\[ \ddot{\boldsymbol{\eta}} + \boldsymbol{\Omega}^2 \boldsymbol{\eta} = \mathbf{\Phi}^\top \delta\boldsymbol{\tau}, \quad \boldsymbol{\Omega}^2 = \operatorname{diag}(\omega_1^2,\dots,\omega_n^2), \]
if \( \mathbf{K}_0 \) is symmetric. Low-frequency modes (small \( \omega_i \)) often dominate large-scale motion, while high-frequency modes correspond to local flexibility.
A reduced model is obtained by retaining only the \( r \) most relevant modes:
\[ \mathbf{\Phi}_r = \begin{bmatrix} \boldsymbol{\phi}_1 & \dots & \boldsymbol{\phi}_r \end{bmatrix}, \quad \delta\mathbf{q} \approx \mathbf{\Phi}_r \boldsymbol{\eta}_r, \]
leading to reduced matrices
\[ \mathbf{M}_r = \mathbf{\Phi}_r^\top \mathbf{M}_0 \mathbf{\Phi}_r,\quad \mathbf{K}_r = \mathbf{\Phi}_r^\top \mathbf{K}_0 \mathbf{\Phi}_r,\quad \mathbf{B}_r = \mathbf{\Phi}_r^\top \mathbf{B}, \]
where \( \mathbf{B} \) is the original input mapping matrix. For mass-normalized modes, \( \mathbf{M}_r = \mathbf{I}_r \). This approach underlies many flexible-link and floating-base robot approximations.
4. Balanced Truncation for Linearized Robot Models
Around a stable operating point, the nonlinear robot dynamics can be linearized as
\[ \delta\dot{\mathbf{x}} = \mathbf{A}\,\delta\mathbf{x} + \mathbf{B}\,\delta\boldsymbol{\tau}, \quad \delta\mathbf{y} = \mathbf{C}\,\delta\mathbf{x}, \]
where \( \mathbf{x} = [\mathbf{q}^\top,\dot{\mathbf{q}}^\top]^\top \). Balanced truncation is a systematic method to reduce such linear systems by identifying states that are simultaneously weakly controllable and weakly observable.
For a stable \( \mathbf{A} \), the controllability and observability Gramians \( \mathbf{P},\mathbf{Q} \) solve Lyapunov equations
\[ \mathbf{A}\mathbf{P} + \mathbf{P}\mathbf{A}^\top + \mathbf{B}\mathbf{B}^\top = \mathbf{0},\quad \mathbf{A}^\top\mathbf{Q} + \mathbf{Q}\mathbf{A} + \mathbf{C}^\top\mathbf{C} = \mathbf{0}. \]
A state transformation \( \mathbf{x} = \mathbf{T}\mathbf{z} \) is called balancing if it makes the Gramians equal and diagonal:
\[ \mathbf{T}^{-1}\mathbf{P}(\mathbf{T}^{-1})^\top = \mathbf{T}^\top \mathbf{Q}\mathbf{T} = \boldsymbol{\Sigma} = \operatorname{diag}(\sigma_1,\dots,\sigma_{2n}), \]
where \( \sigma_1 \geq \dots \geq \sigma_{2n} \geq 0 \) are called Hankel singular values. Keeping only the first \( r \) balanced coordinates yields a reduced model with guaranteed error bound
\[ \| G - G_r \|_{\infty} \leq 2 \sum_{i=r+1}^{2n} \sigma_i, \]
where \( G \) and \( G_r \) are the transfer functions of the full and reduced systems. In practice, for robot models, balanced truncation is applied to linearized models obtained, for example, via previous chapters' Lagrange or Newton–Euler formulations and control-oriented linearization tools.
5. Data-Driven PCA / POD Reduction for Joint Trajectories
An alternative to analytically derived modes is data-driven reduction, where we use simulated or measured joint trajectories to construct a low-dimensional subspace that captures most of the observed motion. Let \( \mathbf{q}(t_k)\in\mathbb{R}^n \), \( k=1,\dots,K \), be samples along representative trajectories. Form the snapshot matrix
\[ \mathbf{Q} = \begin{bmatrix} \mathbf{q}(t_1)^\top \\ \vdots \\ \mathbf{q}(t_K)^\top \end{bmatrix} \in \mathbb{R}^{K\times n}, \]
subtract the mean \( \bar{\mathbf{q}} = \frac{1}{K}\sum_k \mathbf{q}(t_k) \), and compute its singular value decomposition (SVD):
\[ \mathbf{Q}_c = \mathbf{Q} - \mathbf{1}\bar{\mathbf{q}}^\top = \mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^\top. \]
The right singular vectors in \( \mathbf{V} \) are principal directions in joint space. Choosing \( \mathbf{V}_r \), the first \( r \) columns, we project
\[ \mathbf{q}(t) \approx \bar{\mathbf{q}} + \mathbf{V}_r \mathbf{z}(t), \quad \mathbf{z}(t)\in\mathbb{R}^r. \]
The energy fraction captured by the first \( r \) modes is
\[ \mathcal{E}_r = \frac{\sum_{i=1}^r \sigma_i^2}{ \sum_{i=1}^n \sigma_i^2}, \]
where \( \sigma_i \) are diagonal entries of \( \boldsymbol{\Sigma} \). A typical threshold is \( \mathcal{E}_r \approx 0.95 \) or higher.
The overall PCA/POD-based reduction workflow is:
flowchart TD
A["Simulate / record joint trajectories q(t)"] --> B["Build snapshot matrix Q"]
B --> C["Center data and compute SVD: Qc = U Sigma V^T"]
C --> D["Choose r by energy threshold"]
D --> E["Define reduced coordinates z = V_r^T (q - q_bar)"]
E --> F["Project dynamics / learn reduced model in z space"]
6. Python Lab — PCA-Based Reduction with Robot Libraries
In Python, common robotics modeling libraries include
pinocchio and the Python version of
roboticstoolbox. Below is a schematic example that: (i)
uses a generic robot model (e.g. via pinocchio) to generate
trajectories; (ii) performs PCA on joint trajectories; (iii) defines
projection and reconstruction operators.
import numpy as np
# Suppose we have a function simulate_robot that returns joint trajectories
# using, for example, pinocchio or roboticstoolbox.
# q_traj: shape (K, n), each row is q(t_k).
def simulate_robot(num_samples=1000):
# Placeholder: in practice, call your dynamics integrator here.
# For illustration, make a correlated random trajectory.
n = 12 # e.g. 12-DOF arm
t = np.linspace(0.0, 10.0, num_samples)
base_signals = np.stack([
np.sin(0.5 * t),
np.cos(0.3 * t),
np.sin(0.8 * t + 0.5),
np.cos(0.2 * t + 1.0)
], axis=1) # (K, 4)
W = np.random.randn(4, n) # mixing matrix
q_traj = base_signals @ W # (K, n)
return q_traj
q_traj = simulate_robot(num_samples=2000) # (K, n)
K, n = q_traj.shape
# 1) Center data
q_mean = np.mean(q_traj, axis=0, keepdims=True) # (1, n)
Qc = q_traj - q_mean # (K, n)
# 2) SVD
U, S, Vt = np.linalg.svd(Qc, full_matrices=False)
# S: (min(K,n),), Vt: (n, n)
# 3) Choose reduced dimension r by energy threshold
energy = np.cumsum(S**2) / np.sum(S**2)
r = int(np.searchsorted(energy, 0.99) + 1) # smallest r with 99% energy
V_r = Vt[:r, :].T # (n, r) basis as columns
print(f"Full dimension n = {n}, reduced r = {r}")
def project(q):
"""
Project joint configuration q (n,) to reduced coords z (r,).
"""
q = np.asarray(q).reshape(1, -1)
return (q - q_mean) @ V_r # (1, r)
def reconstruct(z):
"""
Reconstruct joint configuration from reduced coords z.
"""
z = np.asarray(z).reshape(1, -1)
return q_mean + z @ V_r.T
# Example: take a sample from the trajectory and project/reconstruct
sample_q = q_traj[100]
z = project(sample_q)
q_rec = reconstruct(z).ravel()
print("Projection error norm:",
np.linalg.norm(sample_q - q_rec))
In practice, you would couple project and
reconstruct with a reduced-order dynamics model in
\( \mathbf{z} \)-space, either obtained by projection
of a linearized model or by direct regression of
\( \dot{\mathbf{z}} \) from data.
7. C++ Implementation Sketch (Eigen + RBDL/Pinocchio)
In C++, popular rigid-body dynamics libraries for robotics include
RBDL and Pinocchio, typically coupled with
Eigen for linear algebra. The following sketch shows how to
compute a PCA basis for joint trajectories:
#include <Eigen/Dense>
#include <vector>
#include <iostream>
// Suppose you have an interface that logs joint configurations
// from your RBDL / Pinocchio simulations into an Eigen::MatrixXd.
Eigen::MatrixXd collectJointTrajectories(int K, int n);
struct PCABasis {
Eigen::VectorXd q_mean; // (n)
Eigen::MatrixXd V_r; // (n, r)
};
PCABasis computePCA(const Eigen::MatrixXd& Q, double energy_threshold = 0.99) {
const int K = Q.rows();
const int n = Q.cols();
Eigen::VectorXd q_mean = Q.colwise().mean(); // (n)
Eigen::MatrixXd Qc = Q.rowwise() - q_mean.transpose(); // center
// SVD: Qc = U * S * V.transpose()
Eigen::JacobiSVD<Eigen::MatrixXd> svd(
Qc, Eigen::ComputeThinU | Eigen::ComputeThinV);
Eigen::VectorXd S = svd.singularValues(); // (min(K,n))
Eigen::MatrixXd V = svd.matrixV(); // (n, n)
// Compute energy and choose r
Eigen::VectorXd S2 = S.array().square();
double total = S2.sum();
double cum = 0.0;
int r = 0;
for (int i = 0; i < S2.size(); ++i) {
cum += S2(i);
if (cum / total >= energy_threshold) {
r = i + 1;
break;
}
}
if (r == 0) r = S2.size();
Eigen::MatrixXd V_r = V.leftCols(r); // (n, r)
PCABasis basis;
basis.q_mean = q_mean;
basis.V_r = V_r;
return basis;
}
// Projection and reconstruction helpers
Eigen::VectorXd project(const Eigen::VectorXd& q, const PCABasis& basis) {
// z = V_r^T (q - q_mean)
return basis.V_r.transpose() * (q - basis.q_mean);
}
Eigen::VectorXd reconstruct(const Eigen::VectorXd& z, const PCABasis& basis) {
// q = q_mean + V_r z
return basis.q_mean + basis.V_r * z;
}
int main() {
int K = 2000;
int n = 12;
Eigen::MatrixXd Q = collectJointTrajectories(K, n);
PCABasis basis = computePCA(Q, 0.99);
std::cout << "Reduced dimension r = "
<< basis.V_r.cols() << std::endl;
// Example projection of a sample configuration:
Eigen::VectorXd q = Q.row(100).transpose();
Eigen::VectorXd z = project(q, basis);
Eigen::VectorXd q_rec = reconstruct(z, basis);
std::cout << "Reconstruction error norm = "
<< (q - q_rec).norm() << std::endl;
return 0;
}
The reduced coordinates z can be used together with reduced
dynamics matrices obtained from modal or balanced truncation applied to
linearized models generated by RBDL/Pinocchio.
8. Java Implementation Sketch (EJML)
Java does not have as many mainstream robotics dynamics libraries as C++
or MATLAB, but linear algebra is well supported by libraries such as
EJML. One can interface Java to simulators (e.g., through
middleware) and then perform PCA in Java:
import org.ejml.data.DMatrixRMaj;
import org.ejml.dense.row.CommonOps_DDRM;
import org.ejml.dense.row.decomposition.svd.SingularOps_DDRM;
import org.ejml.dense.row.decomposition.svd.SvdImplicitQrDecompose_DDRM;
public class RobotPCA {
public static class PCABasis {
public DMatrixRMaj qMean; // (1 x n)
public DMatrixRMaj V_r; // (n x r)
}
public static PCABasis computePCA(DMatrixRMaj Q, double energyThreshold) {
int K = Q.numRows;
int n = Q.numCols;
// Compute column-wise mean
DMatrixRMaj qMean = new DMatrixRMaj(1, n);
for (int j = 0; j < n; ++j) {
double sum = 0.0;
for (int i = 0; i < K; ++i) {
sum += Q.get(i, j);
}
qMean.set(0, j, sum / K);
}
// Center data: Qc = Q - 1 * qMean
DMatrixRMaj Qc = Q.copy();
for (int i = 0; i < K; ++i) {
for (int j = 0; j < n; ++j) {
Qc.set(i, j, Qc.get(i, j) - qMean.get(0, j));
}
}
// SVD: Qc = U * S * V^T
SvdImplicitQrDecompose_DDRM svd =
new SvdImplicitQrDecompose_DDRM(true, true, false, false);
svd.decompose(Qc);
DMatrixRMaj U = svd.getU(null, false);
DMatrixRMaj W = svd.getW(null);
DMatrixRMaj Vt = svd.getV(null, true);
int m = W.numRows;
double total = 0.0;
double[] s2 = new double[m];
for (int i = 0; i < m; ++i) {
double s = W.get(i, i);
s2[i] = s * s;
total += s2[i];
}
double cum = 0.0;
int r = 0;
for (int i = 0; i < m; ++i) {
cum += s2[i];
if (cum / total >= energyThreshold) {
r = i + 1;
break;
}
}
if (r == 0) r = m;
// V_r is first r columns of V (V is transpose of Vt)
DMatrixRMaj V = new DMatrixRMaj(n, n);
CommonOps_DDRM.transpose(Vt, V);
DMatrixRMaj V_r = new DMatrixRMaj(n, r);
CommonOps_DDRM.extract(V, 0, n, 0, r, V_r, 0, 0);
PCABasis basis = new PCABasis();
basis.qMean = qMean;
basis.V_r = V_r;
return basis;
}
}
The reduced basis V_r can be used in Java-based
optimization or simulation environments to approximate high-DOF robot
models.
9. MATLAB / Simulink Model Reduction for Robots
MATLAB provides powerful support for robotics through the
Robotics System Toolbox and for model reduction through the
Control System Toolbox. A typical workflow is:
-
Construct the robot model using
rigidBodyTreeor import from URDF. -
Linearize the dynamics around a configuration using
linearizeorlinearizeon a Simulink model. -
Apply
balreal,modred, orreduceto obtain a reduced-order state-space model.
% Example: linearize a rigidBodyTree dynamics around configuration q0
robot = importrobot('my_robot.urdf');
robot.DataFormat = 'row';
q0 = homeConfiguration(robot);
dq0 = zeros(size(q0));
tau0 = zeros(size(q0));
% Build state-space from manipulator equations (symbolic or numeric)
% For illustration, suppose we have functions:
% [M, C, g] = manipulatorDynamics(robot, q0, dq0);
[M0, C0, g0] = manipulatorDynamics(robot, q0, dq0);
n = numel(q0);
A = [zeros(n) eye(n);
-M0 \ (d_g_dq(robot, q0)) -M0 \ C0];
B = [zeros(n);
M0 \ eye(n)];
C = eye(2*n); % full-state output
D = zeros(2*n, n);
G = ss(A, B, C, D);
% Balanced realization and truncation
[Gb, ~, T, Ti] = balreal(G); % balanced realization
% Use model order selection tool or Hankel singular values
hsv = hsvd(Gb);
r = find(cumsum(hsv) / sum(hsv) >= 0.99, 1); % retain 99% energy
Gr = modred(Gb, r+1:2*n, 'truncate'); % reduced-order model
% Simulink: you can use linearize on your Simulink robot model block,
% then apply the same balreal/modred steps to the resulting ss object.
In Simulink, the same reduced model can be deployed as an
State-Space block, replacing a large nonlinear plant when
approximate yet fast simulation is required.
10. Wolfram Mathematica Implementation
Wolfram Mathematica can symbolically derive robot equations of motion
(e.g., via DSolve, D, and custom Lagrangian
code) and then perform model reduction using state-space tools such as
StateSpaceModel,
BalancedStateSpaceRealization, and
StateSpaceModelReduce.
(* Example: linearized state-space and balanced truncation *)
(* Suppose q, dq are n-dimensional vectors, tau is input, and we have
symbolic or numerical matrices M0, K0, C0 from earlier derivations. *)
n = 6; (* e.g. 6-DOF arm *)
M0 = (* ... inertia matrix ... *);
K0 = (* ... stiffness matrix ... *);
C0 = (* ... damping matrix ... *);
A = ArrayFlatten[{
{ConstantArray[0, {n, n}], IdentityMatrix[n]},
{-LinearSolve[M0, K0], -LinearSolve[M0, C0]}
}];
B = ArrayFlatten[{
{ConstantArray[0, {n, n}]},
{LinearSolve[M0, IdentityMatrix[n]]}
}];
Cmat = IdentityMatrix[2 n];
Dmat = ConstantArray[0, {2 n, n}];
G = StateSpaceModel[{A, B, Cmat, Dmat}];
(* Balanced realization *)
{Gb, T} = BalancedStateSpaceRealization[G];
(* Hankel singular values *)
hsv = HankelSingularValues[Gb];
r = First @ FirstPosition[
Accumulate[hsv] / Total[hsv] /. {x_ /; x >= 0.99 -> True, _ -> False},
True, {Length[hsv]}
];
Gr = StateSpaceModelReduce[Gb, r];
(* Gr is a reduced-order state-space model that can be used
in further analysis or simulation. *)
Mathematica is particularly useful when symbolic structure (e.g., dependence on parameters in the inertia matrix) is important for understanding the effect of model reduction analytically.
11. Problems and Solutions
Problem 1 (Modal Reduction Derivation): Let \( \mathbf{M}_0,\mathbf{K}_0\in\mathbb{R}^{n\times n} \) be symmetric positive definite mass and stiffness matrices for a linearized robot model \( \mathbf{M}_0\ddot{\mathbf{q}} + \mathbf{K}_0\mathbf{q} = \boldsymbol{\tau} \). Suppose \( \mathbf{\Phi} \) is the matrix of generalized eigenvectors satisfying \( \mathbf{K}_0\mathbf{\Phi} = \mathbf{M}_0\mathbf{\Phi}\boldsymbol{\Omega}^2 \) and \( \mathbf{\Phi}^\top\mathbf{M}_0\mathbf{\Phi} = \mathbf{I} \). Show that in modal coordinates \( \boldsymbol{\eta} \) defined by \( \mathbf{q} = \mathbf{\Phi}\boldsymbol{\eta} \), the equations of motion become \( \ddot{\boldsymbol{\eta}} + \boldsymbol{\Omega}^2\boldsymbol{\eta} = \mathbf{\Phi}^\top\boldsymbol{\tau} \).
Solution:
Substitute \( \mathbf{q} = \mathbf{\Phi}\boldsymbol{\eta} \) into the dynamics: \( \dot{\mathbf{q}} = \mathbf{\Phi}\dot{\boldsymbol{\eta}} \), \( \ddot{\mathbf{q}} = \mathbf{\Phi}\ddot{\boldsymbol{\eta}} \). Then
\[ \mathbf{M}_0 \mathbf{\Phi}\ddot{\boldsymbol{\eta}} + \mathbf{K}_0 \mathbf{\Phi}\boldsymbol{\eta} = \boldsymbol{\tau}. \]
Pre-multiplying by \( \mathbf{\Phi}^\top \) and using \( \mathbf{\Phi}^\top \mathbf{M}_0 \mathbf{\Phi} = \mathbf{I} \) and \( \mathbf{K}_0\mathbf{\Phi} = \mathbf{M}_0\mathbf{\Phi}\boldsymbol{\Omega}^2 \) yields
\[ \ddot{\boldsymbol{\eta}} + \boldsymbol{\Omega}^2 \boldsymbol{\eta} = \mathbf{\Phi}^\top \boldsymbol{\tau}, \]
which proves the decoupled modal equations.
Problem 2 (Schur Complement for Partitioned Inertia): Consider the linear second-order system \( \mathbf{M}_0\ddot{\mathbf{q}} + \mathbf{K}_0\mathbf{q} = \boldsymbol{\tau} \) with partitioning \( \mathbf{q}^\top = [\mathbf{q}_a^\top,\mathbf{q}_b^\top] \) and similarly for \( \boldsymbol{\tau} \). Assume \( \mathbf{K}_0 = \mathbf{0} \) for simplicity and approximate \( \ddot{\mathbf{q}}_b \approx \mathbf{0} \). Show that the dynamics in \( \mathbf{q}_a \) can be written with effective mass matrix \( \mathbf{M}_{\text{eff}} = \mathbf{M}_{aa} - \mathbf{M}_{ab}\mathbf{M}_{bb}^{-1}\mathbf{M}_{ba} \).
Solution:
The partitioned equations are
\[ \begin{aligned} \mathbf{M}_{aa}\ddot{\mathbf{q}}_a + \mathbf{M}_{ab}\ddot{\mathbf{q}}_b &= \boldsymbol{\tau}_a, \\ \mathbf{M}_{ba}\ddot{\mathbf{q}}_a + \mathbf{M}_{bb}\ddot{\mathbf{q}}_b &= \boldsymbol{\tau}_b. \end{aligned} \]
Approximating \( \ddot{\mathbf{q}}_b \approx \mathbf{0} \) gives from the second equation \( \mathbf{M}_{ba}\ddot{\mathbf{q}}_a \approx \boldsymbol{\tau}_b \). For the case \( \boldsymbol{\tau}_b = \mathbf{0} \) (no actuation on \( \mathbf{q}_b \)), we obtain \( \mathbf{M}_{ba}\ddot{\mathbf{q}}_a \approx \mathbf{0} \), which yields \( \ddot{\mathbf{q}}_b \approx -\mathbf{M}_{bb}^{-1}\mathbf{M}_{ba}\ddot{\mathbf{q}}_a \) when the approximation is refined to include small nonzero \( \ddot{\mathbf{q}}_b \). Substituting this into the first equation gives
\[ \left(\mathbf{M}_{aa} - \mathbf{M}_{ab}\mathbf{M}_{bb}^{-1}\mathbf{M}_{ba}\right) \ddot{\mathbf{q}}_a \approx \boldsymbol{\tau}_a, \]
which is the claimed effective mass matrix.
Problem 3 (Balanced Truncation Error Bound): A linearized robot model has Hankel singular values \( \sigma_1 \geq \dots \geq \sigma_{2n} \). Suppose we retain \( r \) states, yielding a reduced model \( G_r \). Show that the standard \( \mathcal{H}_\infty \) error bound \( \|G - G_r\|_\infty \leq 2\sum_{i=r+1}^{2n}\sigma_i \) implies that if \( \sum_{i=r+1}^{2n}\sigma_i \leq \varepsilon \), then \( \|G - G_r\|_\infty \leq 2\varepsilon \).
Solution:
The statement follows directly from substitution. The general theorem of balanced truncation states that \( \|G - G_r\|_\infty \leq 2\sum_{i=r+1}^{2n}\sigma_i \). If \( \sum_{i=r+1}^{2n}\sigma_i \leq \varepsilon \), then \( \|G - G_r\|_\infty \leq 2\varepsilon \), which means the worst-case gain of the model reduction error is bounded by \( 2\varepsilon \).
Problem 4 (PCA Energy Criterion): For a robot with \( n=10 \) joints, PCA on joint trajectories yields singular values \( \sigma_i \) with squared values \( \sigma_i^2 \) proportional to \( \{40, 20, 15, 10, 5, 3, 3, 2, 1, 1\} \). What is the smallest \( r \) such that \( \mathcal{E}_r \geq 0.95 \)?
Solution:
The total energy is \( 40 + 20 + 15 + 10 + 5 + 3 + 3 + 2 + 1 + 1 = 100 \). The cumulative sums are \( 40, 60, 75, 85, 90, 93, 96, 98, 99, 100 \). The corresponding energy fractions are \( 0.40, 0.60, 0.75, 0.85, 0.90, 0.93, 0.96, 0.98, 0.99, 1.0 \). The smallest \( r \) with \( \mathcal{E}_r \geq 0.95 \) is \( r = 7 \), since the 7th cumulative fraction is \( 0.96 \).
Problem 5 (POD-Based Reduced Dynamics Ansatz): Let \( \mathbf{q}(t) \approx \bar{\mathbf{q}} + \mathbf{V}_r\mathbf{z}(t) \) be a POD/PCA reduced representation with orthonormal columns in \( \mathbf{V}_r \). Show that substituting this ansatz into the full second-order dynamics \( \mathbf{M}(\mathbf{q})\ddot{\mathbf{q}} + \mathbf{C}(\mathbf{q},\dot{\mathbf{q}})\dot{\mathbf{q}} + \mathbf{g}(\mathbf{q}) = \boldsymbol{\tau} \) and projecting with \( \mathbf{V}_r^\top \) yields a reduced-order system in \( \mathbf{z},\dot{\mathbf{z}} \).
Solution:
We have \( \dot{\mathbf{q}} = \mathbf{V}_r\dot{\mathbf{z}} \) and \( \ddot{\mathbf{q}} = \mathbf{V}_r\ddot{\mathbf{z}} \) because \( \bar{\mathbf{q}} \) is constant. Substituting into the dynamics gives
\[ \mathbf{M}(\bar{\mathbf{q}} + \mathbf{V}_r\mathbf{z}) \mathbf{V}_r\ddot{\mathbf{z}} + \mathbf{C}(\bar{\mathbf{q}} + \mathbf{V}_r\mathbf{z}, \mathbf{V}_r\dot{\mathbf{z}}) \mathbf{V}_r\dot{\mathbf{z}} + \mathbf{g}(\bar{\mathbf{q}} + \mathbf{V}_r\mathbf{z}) = \boldsymbol{\tau}. \]
Pre-multiplying by \( \mathbf{V}_r^\top \) yields
\[ \mathbf{M}_r(\mathbf{z})\ddot{\mathbf{z}} + \mathbf{C}_r(\mathbf{z},\dot{\mathbf{z}})\dot{\mathbf{z}} + \mathbf{g}_r(\mathbf{z}) = \boldsymbol{\tau}_r, \]
where \( \mathbf{M}_r(\mathbf{z}) = \mathbf{V}_r^\top \mathbf{M}(\bar{\mathbf{q}} + \mathbf{V}_r\mathbf{z})\mathbf{V}_r \), and similarly for \( \mathbf{C}_r,\mathbf{g}_r \). Thus, the POD ansatz plus Galerkin projection yields a reduced-order robot model in \( \mathbf{z} \).
12. Summary
In this lesson we introduced several complementary approaches to model reduction for high-DOF robotic systems. Coordinate partitioning and Schur complements exploit structural separations between dominant and secondary DOFs. Modal reduction uses eigenstructure of linearized dynamics to retain low-frequency or otherwise important vibration modes. Balanced truncation provides control-theoretic guarantees by balancing controllability and observability. Finally, data-driven PCA/POD constructs reduced coordinates directly from trajectories.
We illustrated how these methods can be implemented in Python (with
robotics libraries such as pinocchio), C++ (with Eigen and
RBDL/Pinocchio), Java (with EJML), MATLAB/Simulink (via
rigidBodyTree and balreal/modred), and Wolfram
Mathematica (via StateSpaceModelReduce). These tools enable
efficient simulation and analysis of complex robots while retaining key
dynamic features relevant for control and planning.
13. References
- Craig, R.R., & Bampton, M.C.C. (1968). Coupling of substructures for dynamic analyses. AIAA Journal, 6(7), 1313–1319.
- Moore, B.C. (1981). Principal component analysis in linear systems: Controllability, observability, and model reduction. IEEE Transactions on Automatic Control, 26(1), 17–32.
- Glover, K. (1984). All optimal Hankel-norm approximations of linear multivariable systems and their L∞ error bounds. International Journal of Control, 39(6), 1115–1193.
- Antoulas, A.C., Sorensen, D.C., & Gugercin, S. (2001). A survey of model reduction methods for large-scale systems. Contemporary Mathematics, 280, 193–219.
- Antoulas, A.C. (2005). Approximation of Large-Scale Dynamical Systems. SIAM, Philadelphia.
- Kerschen, G., Golinval, J.-C., Vakakis, A.F., & Bergman, L.A. (2005). The method of proper orthogonal decomposition for dynamical characterization and order reduction of mechanical systems: An overview. Nonlinear Dynamics, 41(1–3), 147–169.
- Meyer, C.D., & Srinivasan, B. (1996). Balancing and model reduction for second-order systems. IEEE Transactions on Automatic Control, 41(11), 1632–1644.
- Benner, P., Mehrmann, V., & Sorensen, D.C. (Eds.). (2005). Dimension Reduction of Large-Scale Systems. Springer Lecture Notes in Computational Science and Engineering.
- Shabana, A.A. (1989). Flexible multibody dynamics: Review of past and recent developments. Multibody System Dynamics, various contributions.
- Rowley, C.W. (2005). Model reduction for fluids using balanced proper orthogonal decomposition. International Journal of Bifurcation and Chaos, 15(3), 997–1013.