Lagrangian Reference for Control-Affine Multibody Dynamics

Reference guide for Lagrangian mechanics applied to control-affine multibody systems, bridging classical mechanics and modern control theory.
Author

Dieter Olson

Published

November 28, 2025

Introduction

There are two foundational approaches to mechanics. The Newtonian approach requires identifying all forces acting on a system and applying \(F = ma\) to each body. The Lagrangian approach, by contrast, works with scalar energy functions rather than vector forces. Both approaches yield identical equations of motion, but the Lagrangian method is often simpler for complex multibody systems because energy is a scalar quantity—one need only add numbers rather than resolve vector forces in multiple directions.

The golf swing has many moving parts: a rotating torso, swinging arms, bending shaft, clubhead spinning and translating. Tracking all the forces would be a nightmare. But tracking energy? That’s elegant. And from energy, we can extract everything we need to understand how the system behaves—including the crucial distinction between passive dynamics (what happens by itself) and active control (what the golfer must do).

This reference document summarizes the Lagrangian formulation of multibody mechanical systems and shows how the control-affine structure

\[ \dot{x} = f(x) + G(x)u \]

arises naturally from first principles. It also clarifies how the drift and input components correspond to potential, kinetic, and generalized non-conservative forces, including those associated with a flexible shaft.

Configuration Space and Generalized Coordinates

Let \(q \in \mathbb{R}^n\) denote the generalized coordinates describing the rigid-body configuration of the system (e.g., joint angles, trunk rotation). Let \(x_s \in \mathbb{R}^k\) denote additional generalized coordinates representing shaft deformation modes (e.g., bending, torsion). We define the extended coordinate vector

\[ q_{\mathrm{ext}} = \begin{bmatrix} q \\ x_s \end{bmatrix} \in \mathbb{R}^{n+k}. \]

The corresponding generalized velocities are \(\dot{q}\) and \(\dot{x}_s\), and we collect them in

\[ \dot{q}_{\mathrm{ext}} = \begin{bmatrix} \dot{q} \\ \dot{x}_s \end{bmatrix}. \]

Lagrangian: Kinetic and Potential Energy

The Lagrangian is defined as

\[ \mathcal{L}(q_{\mathrm{ext}},\dot{q}_{\mathrm{ext}}) = T(q_{\mathrm{ext}},\dot{q}_{\mathrm{ext}}) - V(q_{\mathrm{ext}}), \]

where \(T\) is the total kinetic energy and \(V\) is the total potential energy.

For an articulated rigid-body system with flexible shaft modes, the kinetic energy can be written in quadratic form:

\[ T = \frac{1}{2}\dot{q}_{\mathrm{ext}}^\top M_{\mathrm{ext}}(q_{\mathrm{ext}}) \dot{q}_{\mathrm{ext}}, \]

where \(M_{\mathrm{ext}}(q_{\mathrm{ext}})\) is the extended inertia matrix, symmetric and positive definite.

The potential energy includes gravitational and elastic components:

\[ V(q_{\mathrm{ext}}) = V_{\mathrm{grav}}(q) + V_{\mathrm{shaft}}(x_s) + V_{\mathrm{geom}}(q,x_s), \]

where \(V_{\mathrm{shaft}}\) accounts for shaft bending/torsion and \(V_{\mathrm{geom}}\) captures configuration-dependent geometric terms.

Euler–Lagrange Equations With Generalized Forces

The Euler–Lagrange equations for generalized coordinates \(q_{\mathrm{ext}}\) are

\[ \frac{d}{dt}\left(\frac{\partial \mathcal{L}}{\partial \dot{q}_{\mathrm{ext}}}\right) - \frac{\partial \mathcal{L}}{\partial q_{\mathrm{ext}}} = Q_{\mathrm{ext}}, \]

where \(Q_{\mathrm{ext}}\) are the generalized non-conservative forces.

We partition \(Q_{\mathrm{ext}}\) as

\[ Q_{\mathrm{ext}} = \begin{bmatrix} Q_q \\ Q_s \end{bmatrix}, \]

where \(Q_q\) corresponds to torques at the actuated joints and \(Q_s\) corresponds to generalized forces associated with shaft modes. Typically,

\[ Q_q = \tau_{\mathrm{app}} + Q_{q,\mathrm{nc}}, \qquad Q_s = Q_{s,\mathrm{nc}}, \]

with \(\tau_{\mathrm{app}}\) the applied joint torques, and \(Q_{(\cdot),\mathrm{nc}}\) representing additional non-conservative effects such as damping.

Manipulator Form From Lagrange

Expanding the Euler–Lagrange equations yields the standard manipulator form for the extended system:

\[ M_{\mathrm{ext}}(q_{\mathrm{ext}})\ddot{q}_{\mathrm{ext}} + C_{\mathrm{ext}}(q_{\mathrm{ext}},\dot{q}_{\mathrm{ext}})\dot{q}_{\mathrm{ext}} + \mathbf{g}_{\mathrm{ext}}(q_{\mathrm{ext}}) + \tau_{\mathrm{passive,ext}}(q_{\mathrm{ext}},\dot{q}_{\mathrm{ext}}) = Q_{\mathrm{ext}}, \]

where: - \(M_{\mathrm{ext}}(q_{\mathrm{ext}})\) is the extended inertia matrix,

  • \(C_{\mathrm{ext}}(q_{\mathrm{ext}},\dot{q}_{\mathrm{ext}})\dot{q}_{\mathrm{ext}}\) contains Coriolis and centrifugal terms,

  • \(\mathbf{g}_{\mathrm{ext}}(q_{\mathrm{ext}}) = \nabla_{q_{\mathrm{ext}}} V\) contains gravitational and elastic contributions (the gradient of the potential with respect to the extended generalized coordinates),

  • \(\tau_{\mathrm{passive,ext}}\) gathers additional modeled passive effects (e.g. damping).

For actuated joints with input \(u \in \mathbb{R}^m\), we express

\[ Q_{\mathrm{ext}} = \begin{bmatrix} B u + Q_{q,\mathrm{nc}} \\ Q_{s,\mathrm{nc}} \end{bmatrix}, \]

where \(B\) maps inputs to generalized joint torques.

Drift and Input Decomposition

We define the extended drift generalized forces as

\[ \tau_{\mathrm{drift,ext}}(q_{\mathrm{ext}},\dot{q}_{\mathrm{ext}}) = - \left[ C_{\mathrm{ext}}(q_{\mathrm{ext}},\dot{q}_{\mathrm{ext}})\dot{q}_{\mathrm{ext}} + \mathbf{g}_{\mathrm{ext}}(q_{\mathrm{ext}}) + \tau_{\mathrm{passive,ext}}(q_{\mathrm{ext}},\dot{q}_{\mathrm{ext}}) - Q_{\mathrm{ext,noninput}} \right], \]

where \(Q_{\mathrm{ext,noninput}}\) groups non-input generalized forces (e.g., certain non-conservative terms). The input generalized forces are

\[ \tau_{\mathrm{input,ext}} = \begin{bmatrix} B u \\ 0 \end{bmatrix}. \]

Then the extended equation of motion becomes

\[ M_{\mathrm{ext}}(q_{\mathrm{ext}})\ddot{q}_{\mathrm{ext}} = \tau_{\mathrm{drift,ext}}(q_{\mathrm{ext}},\dot{q}_{\mathrm{ext}}) + \tau_{\mathrm{input,ext}}. \]

First-Order State Form and Control-Affine Structure

Define the extended state

\[ x = \begin{bmatrix} q_{\mathrm{ext}} \\ \dot{q}_{\mathrm{ext}} \end{bmatrix}, \]

and write

\[ \dot{x} = \begin{bmatrix} \dot{q}_{\mathrm{ext}} \\ M_{\mathrm{ext}}^{-1}(q_{\mathrm{ext}}) \tau_{\mathrm{drift,ext}}(q_{\mathrm{ext}},\dot{q}_{\mathrm{ext}}) \end{bmatrix} + \begin{bmatrix} 0 \\ M_{\mathrm{ext}}^{-1}(q_{\mathrm{ext}}) \begin{bmatrix} B \\ 0 \end{bmatrix} \end{bmatrix} u. \]

Define

\[ f(x) = \begin{bmatrix} \dot{q}_{\mathrm{ext}} \\ M_{\mathrm{ext}}^{-1}(q_{\mathrm{ext}}) \tau_{\mathrm{drift,ext}}(q_{\mathrm{ext}},\dot{q}_{\mathrm{ext}}) \end{bmatrix}, \qquad G(x) = \begin{bmatrix} 0 \\ M_{\mathrm{ext}}^{-1}(q_{\mathrm{ext}}) \begin{bmatrix} B \\ 0 \end{bmatrix} \end{bmatrix}. \]

Then

\[ \dot{x} = f(x) + G(x)u, \]

which is exactly the control-affine structure used throughout the main text.

Role of Gravity and Flexible Shaft in Lagrangian Terms

In the Lagrangian framework, gravity arises as part of the potential energy \(V_{\mathrm{grav}}(q)\), and hence appears in the gravity/elastic vector \(\mathbf{g}_{\mathrm{ext}}(q_{\mathrm{ext}}) = \nabla_{q_{\mathrm{ext}}} V\). Shaft elasticity is included in \(V_{\mathrm{shaft}}(x_s)\), and any associated non-conservative terms (e.g. shaft damping) appear in \(\tau_{\mathrm{passive,ext}}\). Both gravity and shaft contributions enter the drift term \(f(x)\) (via \(\tau_{\mathrm{drift,ext}}\)) and do not modify the linear dependence on \(u\). Note this gravity vector \(\mathbf{g}_{\mathrm{ext}}\) is distinct from the control input matrix \(G(x)\) defined above: gravity is part of the passive drift, never the actuation map.

Connection to ZTCF Family and ZVCF

From the Lagrangian viewpoint:

  • ZTCF corresponds to the trajectory obtained by setting \(u = 0\) in the Euler–Lagrange equations and integrating forward from the actual initial condition, so that \[ M_{\mathrm{ext}}\ddot{q}_{\mathrm{ext}} = \tau_{\mathrm{drift,ext}}, \] and the motion is governed solely by the drift.

  • ZVCF evaluates the drift at zero velocity (\(\dot{q}_{\mathrm{ext}} = 0\)): the velocity-dependent terms (Coriolis, centrifugal, damping) vanish and the remaining generalized forces are the configuration-dependent passive loads \(\mathbf{g}_{\mathrm{ext}}(q_{\mathrm{ext}}) = \nabla_{q_{\mathrm{ext}}} V\) (gravity \(g(q)\) plus elastic restoring forces). It is the configuration-only slice of the drift, \(\tau_{\mathrm{ZVCF}} = \tau_{\mathrm{drift}} - \tau_{\mathrm{vel.drift}}\), and contains no input contribution — in particular it is not \(\tau_{\mathrm{input,ext}} = [B u;\, 0]\). It is a pointwise diagnostic, not a trajectory. Thus the Lagrangian formulation supports the same drift–input decomposition and counterfactual constructions as the Newton–Euler and screw-theoretic formulations.

Summary

The Lagrangian formalism provides a principled route from kinetic and potential energy to the manipulator equations, and from there to the control-affine state-space representation. Drift dynamics collect all velocity-dependent, gravitational, and elastic effects, including those of a flexible shaft, while inputs enter linearly via the actuator mapping. This alignment with the control-affine structure underpins the theoretical framework developed in the main body of the work.

Limitations

Warning

The Lagrangian approach, while mathematically elegant, operates under several restrictive assumptions:

  1. Assumes holonomic constraints only (no rolling without slipping): The framework assumes all constraints can be written as algebraic relations between coordinates (\(\Phi(q) = 0\)). Non-holonomic constraints—such as rolling contact (wheel rolling without slipping on the ground) or knife-edge constraints—cannot be directly incorporated into the standard Lagrangian formulation. Foot-ground interaction during the golf swing is approximated as a holonomic contact, but the actual rolling and sticking of the shoe sole involves non-holonomic effects.

  2. Dissipative forces (friction, damping) require Rayleigh dissipation function extension: The classical Lagrangian formulation (kinetic minus potential energy) cannot directly represent velocity-proportional damping. Adding this requires the Rayleigh dissipation function, which extends the framework but introduces additional phenomenological terms that must be separately identified. Muscle damping, joint friction, and air resistance all require this extension, meaning the “pure” Lagrangian elegance is compromised.

  3. Electromagnetic and thermodynamic couplings excluded: The Lagrangian mechanics framework applies to mechanical systems. Muscle activation involves neural signaling and biochemical processes—energy transduction from ATP to mechanical work. These thermodynamic and electromechanical couplings are outside the scope of classical mechanics. Any heat dissipation, muscle efficiency losses, or fatigue-induced stiffness changes cannot be captured within the purely mechanical Lagrangian description.

<div class="laymans-terms-inner">
  <p class="laymans-terms-intro">
    This article explains a mathematical "shortcut" used to describe complex golf swings by tracking energy instead of forces.
  </p>

  <div class="laymans-item">
    <h3>The Energy Shortcut (Lagrangian)</h3>
    <p>Calculating how a golfer moves by tracking every single force (gravity, muscle, tension) is incredibly messy. This method instead tracks "Energy" (speed and height) to get the same result much faster.</p>
    <div class="analogy">
Think of it like: Tracking a budget. Instead of counting every single penny that changes hands in a store (Newton’s forces), you just look at the register’s balance at the start and end of the day (Lagrangian energy). You get the same answer—how much money was made—but with way less counting.
</div>

  <div class="laymans-item">
    <h3>Natural Drift vs. Active Input</h3>
    <p>We split the swing into two parts: what happens naturally because of momentum and gravity ("Drift"), and what happens because you pull with your muscles ("Input").</p>
    <div class="analogy">
Think of it like: Riding a bicycle downhill. The “Drift” is the bike speeding up just because of the slope and your current speed. The “Input” is you deciding to pedal harder. Your total speed is the combination of the hill’s pull plus your leg power.
</div>

  <div class="laymans-item">
    <h3>The "Volume Knob" Rule</h3>
    <p>This math proves that your muscle effort adds directly to the swing's motion without getting twisted up. If you double your effort, you get double the "push" from that muscle.</p>
    <div class="analogy">
Think of it like: A volume knob on a stereo. Turning the knob doesn’t change the song or the lyrics; it just makes the output louder or softer. Similarly, your muscles just “turn up the volume” on the forces acting on the club.
</div>

  <div class="key-takeaway">
    <strong>Key Takeaway:</strong> By looking at energy instead of forces, we can mathematically prove that a golf swing is just a mix of "natural momentum" plus "muscle effort" added together.
  </div>
</div>