Skip to content

pydy/pydy-tutorial-human-standing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This is the material for a tutorial on analyzing multibody dynamics with scientific Python tools. It was first given as "Simulation and Control of Biomechanical Systems with Python" at the Midwest American Society of Biomechanics Regional meeting on March 4th, 2014 in Akron, Ohio. Modified versions have subsequently been given at PYCON2014, SCIPY2014, SCIPY2015, and SCIPY 2016.

The tutorial covers these main topics:

  • Symbolic derivation of equations of motion for multibody systems.
  • Numerical simulation of the resulting system.
  • 3D visualization of the motion of the system.
  • Optimal feedback control for stabilization.

The attendees will be exposed to various functionality of these Python tools:

The tutorial can be run locally or through the Binder service:

Videos

License

All materials herein are licensed under Create Commons Attribution 4.0.

Versions

A new version of the tutorial is typically created each time the tutorial is given to incorporate feedback from the attendees and for software updates. These versions can be downloaded from:

https://github.com/pydy/pydy-tutorial-human-standing/releases

Example Problem

The tutorial will go through the PyDy workflow in small steps. At the end the students should have a working 3-link 2D inverted pendulum model of a human that can be used for balancing studies. The free body diagram of the model is shown below:

notebooks/figures/human_balance_diagram.png

Installation

Python Packages

To run these notebooks the SciPy Stack is required. To obtain the needed packages, we are recommending users install the Anaconda Scientific Python Distribution which contains most of the necessary software and eases cross platform installation. You should install Anaconda to your home directory. The installation directory can simply be deleted when the tutorial is over if you no longer want the files.

First, download and install Anaconda for your operating system. After Anaconda is installed, update various packages to the latest versions by issuing this command in a terminal:

$ conda update numpy scipy sympy matplotlib notebook ipywidgets

Now install the latest PyDy with:

$ conda install -c conda-forge pydy

MathJax

This is only required if you want to run the tutorial without internet access.

These notebooks make use of the MathJax javascript library to render and display mathematics. By default IPython loads MathJax from the internet (i.e. from a CDN), however, because of potentially questionable internet access at the conference we recommend you install MathJax locally. To do so, type the following in a terminal:

$ conda install mathjax

Web Browser

If you want to see the 3D visualizations you must use a WebGL compliant browser. Visit http://get.webgl.org/ to see if your current browser supports WebGL. If not, you will need to upgrade or install another browser. Visit http://caniuse.com/webgl to choose a suitable browser. We've only confirmed the following:

Linux

Latest versions of Firefox and Chrome work.

Mac OSX

Latest version Firefox works.

Windows

Latest version of Chrome works and IE 11 works.

We know that some OS browser combinations do not work. See pydy/pydy#36 for more details.

Download the tutorial

Either download the latest zipped tutorial materials from:

https://github.com/pydy/pydy-tutorial-human-standing/archive/master.zip

Or download the specific release for your conference from:

https://github.com/pydy/pydy-tutorial-human-standing/releases

and then extract the zip file.

Use

From the terminal, navigate to the extracted tutorial directory, for example:

$ cd /home/username/pydy-tutorial-human-standing

Check the environment

To make sure your software environment is correctly setup, run the check_env.py script in a terminal with:

$ python check_env.py

If no errors are returned, then you've correctly installed the software and can run the tutorial. If errors appear, then install or upgrade the software as needed.

Open a terminal window in the notebooks directory and type:

$ cd notebooks
$ ipython notebook

Your web browser should open and you see a list of all the notebooks and can click to open them and execute.

Notebooks

These are the notebooks for the tutorial.