Back to project journal

PROJECT NOTES / MULTI-BODY DYNAMICS & CONTROL

Constrained 5-Link Dynamics & Inverse Control

Differential-algebraic equations of motion (DAEs), inverse dynamics force balance, closed-loop joint PID tracking, and Baumgarte numerical stabilization.

Animated simulation of a constrained 5-link closed-chain robotic manipulator
Natural Dynamics: 10-second unactuated motion under gravity with ideal holonomic constraints.
Animated simulation of a constrained 5-link closed-chain robotic manipulator
Inverse Dynamics Replay: 4-second feedforward torque validation at joint P34.
Animated simulation of a constrained 5-link closed-chain robotic manipulator
Closed-Loop PID Control: 4-second perturbation rejection and setpoint hold.
Closed-Loop Multi-Body DAEs
29×29 KKT Inverse Dynamics Solve
Baumgarte Constraint Stabilization
Closed-Loop PID Joint Regulation
12-Chapter Theoretical Monograph

DYNAMICS SIMULATION / CLOSED-LOOP MECHANISMS

Closed-Loop Multi-Body Dynamics, Inverse Control, and Numerical Stabilization

Closed kinematic chains arise frequently in parallel robotics, industrial linkages, and biomechanical exoskeletons. Because loop-closure equations introduce algebraic constraints alongside differential equations of motion, simulating a 5-link closed-loop mechanism requires specialized numerical integration to eliminate constraint drift, model inverse actuator efforts, and ensure stable closed-loop trajectory tracking.

Colab Executable68 Cells Verified • 0 Errors

Google Colab Interactive Research Notebook (68 Executed Cells)

A complete, self-contained multi-body dynamics research pipeline in Python. Features symbolic Lagrangian derivation, Baumgarte stabilization, a 29×29 KKT augmented inverse dynamics block solver, and closed-loop PID trajectory regulation.

Phase 1: Cells 00–24

Holonomic Kinematic Manifold & SymPy Derivations

Defines Cartesian generalized coordinates q ∈ ℝ¹⁵ for 5 rigid links subjected to 13 holonomic pin and ground constraints Φ(q)=0 (yielding 2 independent DOFs). Evaluates the 13×15 constraint Jacobian J=∂Φ/∂q, quadratic acceleration bias γ(q,q̇)=J̇q̇, and Baumgarte feedback stabilization (ζ_B=1.0, ω_B=20.0 rad/s) to prevent numerical drift.

Phase 2: Cells 25–38

Forward DAE Time Integration & Hamiltonian Energy Audits

Integrates the unactuated multi-body system under gravity using SciPy's adaptive solve_ivp (RK45, rtol=1e-9, atol=1e-11). Continuously audits total mechanical energy E(t) = T(t) + V(t) to guarantee Hamiltonian consistency across 10 seconds of motion, producing high-resolution Matplotlib animation frames.

Phase 3: Cells 39–56

29×29 KKT Inverse Dynamics & Feedforward Torque Replay

Formulates active actuation at revolute joint P34 (link 3 relative to grounded base link 4) with actuator mapping B₃₄ = J₃₄ᵀ ∈ ℝ¹⁵ˣ¹. Constructs and solves an augmented 29×29 KKT block linear system for both the continuous feedforward motor torque τ₃₄(t) and all 13 pin reaction multipliers λ(t). Verifies trajectory execution through forward simulation replay with zero kinematic divergence.

Phase 4: Cells 57–68

Closed-Loop PID Setpoint Regulation & Disturbance Rejection

Implements a fixed-setpoint joint PID controller with anti-windup (Kp=200 N·m/rad, Ki=10 N·m/(rad·s), Kd=60 N·m·s/rad, saturation limit ±100 N·m). Injects an initial rate perturbation of 0.15 rad/s projected onto the constraint tangent space, verifying asymptotic disturbance rejection within 1.5 seconds while maintaining sub-millimeter constraint tolerances.

Colabconstrained_five_link_dynamics.ipynb
Colab
[38]Cell Target #388ed077: 29×29 Augmented KKT Inverse Dynamics & Baumgarte Stabilization
Python 3 (SymPy / SciPy)Scrollable Cell
# Generalized constrained Euler-Lagrange DAE:
#   M(q) * q_ddot + J(q)^T * lambda = Q_g(q) + B(q)*u
# Baumgarte constraint acceleration stabilization:
#   gamma_stab = gamma(q, q_dot) + 2*alpha_B*Phi_dot + (beta_B^2)*Phi

A_kkt = np.block([
    [M_matrix(q),       J_jacobian(q).T],
    [J_jacobian(q),     np.zeros((13, 13))]
])  # Augmented Block Matrix: (29 x 29)

rhs = np.concatenate([
    Q_gravity(q) + B_actuator(q) @ u_tau,
    -gamma_accel(q, q_dot) - 2 * alpha_B * Phi_dot - (beta_B**2) * Phi_pos
])

# Direct factorization for accelerations & reaction forces
sol = np.linalg.solve(A_kkt, rhs)
q_ddot, reaction_lambdas = sol[:15], sol[15:]
Execution Output
Passed
[KKT System]Solved 29x29 linear block system (det = 4.8219e+14)
[Baumgarte]Max constraint drift |Φ(q)| = 4.18e-09 m (Tolerance: 1.0e-06 m)
[Hamiltonian]Energy drift ΔE / E₀ = 1.12e-07 over 10.0s simulation
Target Cell #388ed077 successfully verified.
Direct browser iframe embedding is restricted by Google's X-Frame-Options security policy. Launch the live notebook in Google Colab to execute, edit, and inspect all 68 cells in Google Cloud.
01

Holonomic constraints & Jacobian (q ∈ ℝ¹⁵, J ∈ ℝ¹³ˣ¹⁵)

Models Cartesian generalized coordinates ordered by body (x₁, y₁, θ₁, ..., x₅, y₅, θ₅) with holonomic loop-closure and ground constraints Φ(q)=0. The constraint Jacobian J=∂Φ/∂q (13×15) projects the system onto two regular local degrees of freedom.

02

DAE formulation & reaction multipliers (λ ∈ ℝ¹³)

Solves the coupled constrained acceleration system M q̈ + Jᵀλ = Q_g(q) + Q_ext + B(q)u with differentiated acceleration constraints J q̈ + γ(q, q̇) = 0, computing both generalized accelerations and ideal internal pin reaction forces λ ∈ ℝ¹³.

03

29×29 KKT Inverse dynamics & closed-loop PID control

Extends from natural unactuated dynamics to active inverse control: solves the force balance B(q_d)u - Jᵀλ = M q̈_d - Q_g - Q_ext to synthesize feedforward joint torques, paired with closed-loop PID feedback (Kp=200, Ki=10, Kd=60) to reject perturbations and guarantee trajectory convergence.

04

Baumgarte stabilization & Hamiltonian energy conservation

Standard numerical integration causes geometric constraints to drift over time. Baumgarte feedback stabilization (ζ_B=1.0, ω_B=20.0 rad/s) guarantees pin-closure and ground-pose consistency, while Hamiltonian energy audits verify conservative dynamics in continuous time.

Documentation & Scientific Monograph

Complete Mathematical Monograph (12 Chapters)

Comprehensive scientific monograph written in LaTeX (MiKTeX), detailing the complete Lagrangian equations of motion, symbolic DAE formulation, Baumgarte numerical stabilization, adaptive RK45 integration, and double-pendulum benchmark validation.

Constrained 5-Link Dynamics: Analytical Formulation & Control (main.pdf)

Loading document viewer...

LaTeX Research Monograph • 12 Chapters • Numerical Dynamics & Control

System Specifications & Theoretical Framework

Kinematic Chain
Planar 5-bar closed kinematic chain with dual grounded base anchors (2 DOFs)
Coordinate System
Cartesian body coordinates q ∈ ℝ¹⁵ subjected to 13 holonomic constraints Φ(q)=0
Dynamics Formulation
Constrained Euler-Lagrange DAEs with Lagrange reaction multipliers λ ∈ ℝ¹³
Inverse Dynamics
29×29 augmented KKT block system for joint P34 actuator torque and reaction forces
Control Schemes
Gravity-driven free response, feedforward inverse dynamics, and closed-loop joint PID
Numerical Solvers
SciPy solve_ivp (RK45) with Baumgarte constraint stabilization (ζ_B=1.0, ω_B=20.0 rad/s)
Notebook Architecture
68 executed cells with SymPy symbolic derivations and Matplotlib animation renderers
Documentation
12-chapter comprehensive monograph in LaTeX (MiKTeX), validation against double pendulum benchmark

Significance for Robotics & Advanced Mechanical Systems

Demonstrates end-to-end multi-body engineering: from symbolic Lagrangian mechanics and constraint manifolds to numerical simulation, inverse dynamics control, and academic monograph publication.