Skip to content

melund/pydy-tutorial-pycon-2014

 
 

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 and then a slightly modified version will be given as "Dynamics and Control with Python" at PYCON on April 9th, 2014 in Montreal.

Register for the PYCON tutorial here:

https://us.pycon.org/2014/

We will cover these main topics:

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

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

License

All materials herein are licensed under Create Commons Attribution 4.0.

Example Problem

The tutorial will work 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:

image

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.

Then in a terminal (Anaconda CMD prompt on Windows) upgrade to SymPy 0.7.5 by typing and executing:

pip install --upgrade sympy

Then install PyDy with:

pip install pydy

Note that this tutorial only runs on Python 2.7.

MathJax

These notebooks make use of the MathJax javascript library to render and display mathematics. By default IPython loads MathJax from a CDN, however, because of potentially questionable internet access at pycon we recommend you install MathJax locally. To do so simply start an ipython session in a terminal and run the following command:

from IPython.external import mathjax
mathjax.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-viz#113 for more details.

Advanced SciPy Stack Installation

There are many methods to installing the SciPy Stack. If you know what you are doing then feel free to install relatively recent versions of NumPy (>= 1.6), SciPy (>= 0.9), matplotlib (>= 0.10), and IPython (>=0.13) however you like. Keep in mind that the tutorial will be tested to work with the versions provided in Anaconda 1.9 (Python 2.7.6), SymPy 0.7.5, and PyDy 0.1.0. You can find various instructions for installing the SciPy stack on the SciPy website.

Use

Download the latest zipped tutorial materials from:

http://tinyurl.com/pycon-pydy-tutorial

and then extract the zip file. Open a terminal window in the notebooks directory and type:

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.

About

PyDy tutorial materials for MASB 2014 and PYCON 2014.

Resources

Stars

Watchers

Forks

Packages

No packages published