Introduction

What You Will Learn

  • How to formulate the equations of motion for a set of interacting rigid bodies, i.e. a multibody system.

  • How to manage and incorporate kinematic constraints.

  • How to simulate a multibody system.

  • How to visualize the motion of a multibody system in 2D and 3D.

  • How to interpret the behavior of multibody systems.

Prerequisites

  • Linear algebra

  • Vector calculus

  • Calculus based physics

  • Statics

  • Dynamics

  • Introductory numerical methods

  • Introductory scientific computing

Purpose

The goal of this text is to help you learn multibody dynamics via a mixture of computation and traditional mathematical presentation. Most existing textbooks on the subject are either purely mathematical and problems are solved by pencil and paper or there are computational elements that are tacked on rather than integrated. I hope to weave the two much more fluidly here so that you can learn the principles of multibody dynamics through computing.

This text is less about teaching deep theory in multibody dynamics and more about application and doing. After following the text and practicing, you should be able to correctly model, simulate, and visualize multibody dynamic systems so that you can use them as a tool to answer scientific questions and solve engineering problems.

Choice of dynamics formalism

To teach multibody dynamics, one must choose a formalism for notation and deriving the equations of motion. There are numerous methods for doing so, from Newton and Euler’s to Lagrange and Hamilton’s to Jain and Featherstone’s. Here I use an approach primarily derived from Thomas R. Kane and David Levinson in their 1985 book “Dynamics, Theory and Application” [Kane1985]. The notation offers a precise way to track all of the nuances in multibody dynamics bookkeeping and a realization of the equations of motion that obviates having to introduce virtual motion concepts and that handles kinematic constraints without the need of Lagrange multipliers.

Choice of programming language

With the goal of teaching through computation, it means I need to also choose a programming language. There are many programming languages well suited to multibody dynamics computation, but I select Python for several reasons: 1) Python is open source and freely available for use, 2) Python is currently one, if not the, most popular programming language in the world, 3) the scientific libraries available in Python are voluminous and widely used in academia and industry, and 4) Python has SymPy which provides a foundation for computer aided-algebra and calculus.

History

The primary presentation of multibody dynamics in this text is based on the presentation I and my fellow graduate students received in the graduate Multibody Dynamics course taught by Mont Hubbard and the late Fidelis O. Eke at the University of California, Davis in the early 2000’s. Profs. Hubbard and Eke taught the course from the late 80s or early 90s until they retired in 2013 (Prof. Hubbard) and 2016 (Prof. Eke). The 10-week course was based on Thomas R. Kane’s and David A. Levinson’s 1985 book “Dynamics, Theory and Application” and followed the book and companion computational materials closely. Prof. Eke was a PhD student of Thomas R. Kane at Stanford and Prof. Hubbard adopted Prof. Kane’s approach to dynamics after moving to UC Davis from Stanford [1]. I helped with Prof. Eke’s 2015 course and taught the course in 2017 and 2019 at UC Davis and this text is a continuation of the notes and materials I developed based on Profs. Hubbard and Eke’s notes and materials which now includes some elements of TU Delft’s past multibody dynamics course.

When I took the UC Davis course in 2006 as a graduate student, I naively decided to derive and analyze the nonlinear and linear Carvallo-Whipple bicycle model [Meijaard2007] as my course project [2]. Fortunately, another student visiting from Aachen University, Thomas Engelhardt, also choose the same model and his success finally helped me squash the bugs in my formulation. Luke Peterson, Gilbert Gede, and Angadh Nanjangud subsequently joined Hubbard and Eke’s labs and with Luke’s lead we were sucked into the world of open source scientific software. At that time, Python’s use by scientists and engineers began to gain traction and we fortunately jumped on the bandwagon. We had become quite frustrated with the black box approach of the commercial software tools most engineers used at that time, this included the tool Autolev that was developed by Kane’s collaborators for the automation of multibody dynamics modeling. To remedy this frustration, Luke wrote the first version of PyDy as a Google Summer of Code participant in 2009. Gilbert followed him by implementing a new version as SymPy Mechanics in 2011 also as a Google Summer of Code participant. We use Gilbert’s, now modified and extended, implementation in this text. Combined with the power of SymPy and Jupyter Notebooks (IPython Notebooks back then), SymPy Mechanics provides a computational tool that is especially helpful for learning and teaching multibody dynamics. It is also equally useful for advanced modeling in research and industry.

I have stewarded and developed the software as well as taught and researched with it over the last decade with the help of a long list of contributors. This text is a presentation of the methods and lessons learned from over the years of doing multibody dynamics with open source Python software tools.

Acknowledgements

Wouter Wolfslag contributed the “Equations of Motion with the Lagrange Method” chapter, “Alternatives for Representing Orientation” section, and reviewed updates for version 0.2. Peter Stahlecker and Jan Heinen provided page-by-page review of the text while drafting version 0.1. Peter did the same for version 0.2. Arthur Ryman contributed edits to the first version. Their feedback has helped improve the text in many ways. We also thank the students of TU Delft’s Multibody Dynamics course who test the materials while learning.

These are the primary contributors to the SymPy Mechanics software presented in the text, in approximate order of first contribution:

  • Dr. Luke Peterson, 2009

  • Dr. Gilbert Gede, 2011

  • Dr. Angadh Nanjangud, 2012

  • Tarun Gaba, 2013

  • Oliver Lee, 2013

  • Dr. Chris Dembia, 2013

  • Jim Crist, 2014

  • Sahil Shekhawat, 2015

  • James McMillan, 2016

  • Nikhil Pappu, 2018

  • Sudeep Sidhu, 2020

  • Abhinav Kamath, 2020

  • Timo Stienstra, 2022

  • Dr. Sam Brockie, 2023

SymPy Mechanics is built on top of SymPy, whose 1000+ contributors have also greatly helped SymPy Mechanics be what it is. Furthermore, the software sits on the top of a large ecosystem of open source software written by thousands and thousands of contributors who we owe for the solid foundation.

Tools Behind the Book

I write the contents in plain text using the reStructuredText markup language for processing by Sphinx. The mathematics are rendered with MathJax in the HTML version. I use the Jupyter Sphinx extension which executes the code in each chapter as if it were a Jupyter notebook and embeds the Jupyter generated outputs into the resulting HTML page. The extension also converts each chapter into a Python script and Jupyter notebook for download. I use the Material Sphinx Theme and sphinx-togglebutton for the dropdown information boxes. I host the source for the book on Github, where I use Github Actions to build the website and push it to a Github Pages host using ghp-import. I use Github’s issue tracker and pull request tools to manage tasks and changes. The figures are drawn with a Wacom One tablet and the Xournal++ application.