Coder Social home page Coder Social logo

pydy / pydy-tutorial-human-standing Goto Github PK

View Code? Open in Web Editor NEW
158.0 18.0 70.0 3.61 MB

PyDy tutorial materials for MASB 2014, PYCON 2014, and SciPy 2014/2015.

Home Page: http://pydy.org

Python 10.53% Batchfile 0.01% Jupyter Notebook 89.46%
dynamics biomechanics python engineering multibody-dynamics simulation

pydy-tutorial-human-standing's People

Contributors

campanawanna avatar chrisdembia avatar gilbertgede avatar huaweiwang avatar jbm950 avatar jcrist avatar moorepants avatar remcmurry avatar tarzzz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pydy-tutorial-human-standing's Issues

Kinematics Notebook

20 mins

This should do all the symbolic kinematics needed for the EoM generation.

  • Create working notebook.
  • Polish

Ask Aaron to make a new SymPy release

Get Aaron to make a new SymPy release with updates from us by about February 20th or so. We've got several patches in master, especially for notebook printing.

Problem definition notebook

5 min

Should give a complete description of the inverted pendulum, all variables, etc.

  • Really nice figure of problem.
  • Create notebook.
  • Polish.

Intro to PyDy notebook

This will include:

  • sympy.physics.mechanics (reference frames, vectors)
  • code gen + odeint
  • pydy viz

This can possible be combined with #13 and we can explain dynamics with some pydy commands.

Create USB sticks for PYCON

We need backups ready in case downloads don't work.

The USB stick(s) should contain:

  • 32 and 64 bit Anaconda installer for Windows, Mac, and Linux.
  • SymPy 0.7.5 source code.
  • pydy-code-gen 0.1.0 source code.
  • pydy-viz 0.1.0 source code.
  • Mathjax

We also need installation instructions for the USB stick as they will have to use either: python setup.py install or pip install -e /path/to/package.

There will be USB sticks available at PyCon. We need to get them either the nigh of April 8th or early the first thing on the 9th.

Rename repository

@pydy/pydy-developers I'd like to rename this repo to something like pydy-standing-tutorial and then continue to use branches and tags for the various versions that we give at different places with the HEAD of master being the most generic version.

Any suggestions on names for the repo? Is this fine?

Github will redirect (maybe indefinitely) so it shouldn't break links.

Get PyDy.org back online!

(either fix Luke's server or create a new site with github pages + sphinx, for example, and move content over).

  • Fix Luke's server issues.
  • Upload spam free content.

Quick overview of rigid body dynamics notebook

15 min

  • Vectors, Reference Frames
  • Rotations, direction cosine matrices
  • mass, mass center, Inertia
  • Position, Velocity, Acceleration
  • Forces, Moments
  • Equations of Motion
  • Ordinary differential equations
  • Add in some sympy mechanics commands.

Equations of Motion Notebook

10 min

Use Kanesmethod, but maybe can should Lagranges too. Talk about relationship to dp/dt = F and dH/dt = T.

  • Create working notebook
  • Polish

Installation instructions

We need to write up the installation instructions. There are of course many ways to do this. These are the two methods that I'd like to have in place, because I think it will be the easiest for folks new to Python:

  • Anaconda based install (default) [this can be from the web or form a USB stick we have at PyCon)
  • Note in installation instructions that you must use python 2.7

Optional

  • Install from OS package manager and then update SymPy and install PyDy with pip. This will give us "old" versions of numpy/scipy though. Can do a PPA install. There are also the new pip whl files that may install numpy and scipy from binary format.
  • Is it possible to install our own packages to sagemath cloud or wakari.io? If so, these would probably work in all cases except for PyDyViz. This would require solid interet connection, but could be a backup.
  • Have USB's with virutal box instances with all software installed. User must have virutal box installed.

Sign up for gitter

Aaron said he'll be on gitter during our tutorials to give help if needed.

n07_simulation.ipynb

I am getting this error on n07_simulation.ipynb, n08_simulation.ipynb and n09_simulation.ipynb:

right_hand_side(x0, 0.0, args)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-25-a7cae5bebf3b> in <module>()
----> 1 right_hand_side(x0, 0.0, args)

/gpfs/home/kirk/anaconda/envs/robotics/lib/python2.7/site-packages/pydy-0.2.1-py2.7.egg/pydy/codegen/code.pyc in evaluate_ode(x, t, args)
    471         # computation time.
    472 
--> 473         segmented = [np.array([args['constants'][c] for c in constants]),
    474                      x[:len(coordinates)],
    475                      x[len(coordinates):]]

IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
conda list
# packages in environment at /gpfs/home/kirk/anaconda/envs/robotics:
#
basemap                   1.0.7                np19py27_0  
cairo                     1.12.2                        2  
cython                    0.21                     py27_0  
dateutil                  2.1                      py27_2  
freetype                  2.4.10                        0  
geos                      3.3.3                         0  
ipython                   2.2.0                    py27_0  
ipython-notebook          2.2.0                    py27_0  
jinja2                    2.7.3                    py27_1  
libpng                    1.5.13                        1  
libsodium                 0.4.5                         0  
markupsafe                0.23                     py27_0  
matplotlib                1.4.0                np19py27_0  
nose                      1.3.4                    py27_0  
numpy                     1.9.0                    py27_0  
openssl                   1.0.1h                        1  
pandas                    0.14.1               np19py27_0  
pixman                    0.26.2                        0  
py2cairo                  1.10.0                   py27_1  
pyparsing                 2.0.1                    py27_0  
pyqt                      4.10.4                   py27_0  
python                    2.7.8                         1  
pytz                      2014.7                   py27_0  
pyzmq                     14.3.1                   py27_0  
qt                        4.8.5                         0  
readline                  6.2                           2  
requests                  2.4.3                    py27_0  
scipy                     0.14.0               np19py27_0  
setuptools                5.8                      py27_0  
sip                       4.15.5                   py27_0  
six                       1.8.0                    py27_0  
sqlite                    3.8.4.1                       0  
ssl_match_hostname        3.4.0.2                  py27_0  
sympy                     0.7.5                    py27_0  
system                    5.8                           1  
theano                    0.6.0                np19py27_0  
tk                        8.5.15                        0  
tornado                   4.0.2                    py27_0  
zeromq                    4.0.4                         0  
zlib                      1.2.7                         0  

Control Notebook

use the kane's method linearize command or even do it manually with diff(). Then use scipy.linalg.continuous_are to get the optimal gain matrix (full state feedback). We can give them starting values for R and Q and then they can adjust.

Simulate with the feedback function and then visualize.

  • Create working notebook

Update content on PyDy.org

We need a little polishing on the website. Would be nice to have a general cleanup. We will share the url to all potential users.

Feedback from practice tutorial

  • The repetitive exercises get old quick (Jason's dumb idea...)
  • It would be nice to have more exploratory exercises.
  • Add in passive joint stiffnesses and damping so that the model doesn't flop around.
  • Maybe make some more cylinders so that the viz looks more human.
  • Only do the two link pendulum instead of three.
  • If time at end, let everyone try to create the one link pendulum on their own.
  • Give more time for Python intro at MASB.
  • No need to split kinematics notebook between Obinna and Jason, Obinna will do the whole thing next time.
  • Kinematics notebook took 40 minutes instead of 25.
  • We finished in 3 hours but by skipping all the repetive exercises.
  • Writing the controller function at the end was a good exercise that wasn't repetitive.
  • Add more time for the Python intro for MASB (an maybe less time for PyCon).
  • May need a simpler problem for PyCon if the audience is varied.
  • Feel free to jump in further and faster for MASB instead of going over the basics in dynamics.
  • Make initial values in the simulation realistic values (make knee bend correct way, etc).
  • Explain about objects early on so people know that captial letter functions create objects that have methods and attributes.
  • We should ask at the beginning what people know: dynamics, programming, etc to get a feel about what we can skip and what we can't.

Possible better exercises:

  • Play around with simulation parameters (constants, initial conditions) to get different simulations.
  • Explore different controllers: reduced K matrix, play with Q and R weightings.
  • Create a nose for the person in the visualization.

Decide on a problem idea

I'm not sure if this is the best place to discuss the project idea, but I wanted to share ideas somewhere.

I like the 2d 2dof arm idea, especially considering that @moorepants will be giving that biomechanics tutorial. It's extendable, and maybe for the tutorial, it'd be good to have it all set up so people can continue adding on to a base model. Also, @moorepants has a N-link inverted pendulum balancing notebook already. So they could start with the cursive, then naturally add more links and do that balancing, or then in the biomechanics session, you could add muscles maybe. You could add helical springs and dampers to the joints and then model a long chain (a kid on a swing). I guess there's only a little time, so maybe people would only have time for the cursive.

Anyway, the audience sounds like they might have broad interests, and so the 2d arm makes sense, because it allows so many different extensions.

Make the first PyDy release.

Make a PyDy package that includes sympy.physics.mechanics, pydy-viz, and pydy-code-gen.

Release to PyPi and ensure it installs in Anaconda based environments (at least, can check more too) on all three main OS's.

See https://github.com/PythonDynamics/PyDy, ideally this will pip install everything that is needed. We will need to make 0.1.0 releases of pydy-viz and pydy-code-gen too.

Update for PyDy 0.3.0

Main changes:

  • Visualizations now embed into the notebook.
  • Make sure check_env.py works for the new software.
  • Update calls to Scene so that they only use the display_ipython method.

Simulation Notebook

use pydy-code-gen to generate numeric right hand side, odeint, + matplotlib plot of state trajectories

specify realistic numerical parameters and the initial conditions.

  • Create working notebook
  • Polish

Adjust the tutorial based on the previous feedback

Some things:

  1. We likely don't need to go over the intro to Python notebook at SciPy. I think only one or two people really needed that.
  2. We need to make sure to break up the talking with exercises more. Maybe every 10-15 minutes there should be a small exercise, even if it is just a multiple choice question.

Create Python Intro Notebooks

These will be the first notebooks. Should be short and sweet, showing just enough Python, NumPy, SciPy, SymPy, and IPython needed to do our examples. These should not include anything from sympy.physics.mechanics as that intro will come later.

  • {10 min} Intro to Python and IPython notebook (only shown at ASB)
  • {10 min} Intro to basic NumPy + SciPy odeint + basic matplotlib plotting
  • {10 min} Intro to SymPy
  • Polish

Visualization Notebook

Setup shapes and viz frames.

We should stick to the basic mapping of rigidbody to vizframe and single shape. keep it simple.

  • Create working notebook
  • Fix colors to match the diagram.
  • Polish
  • Hide exercise solutions.

IPython notebook requires CDN connection to Mathjax

I just remembered that internet is required for rendering latex in the notebook. This could be an issue if we have internet connectivity issues.

We could recommend installing mathjax and pointing ipython to it locally, but that is a pain.

The virutalbox install option can have local mathjax easy enough.

This shouldn't be an issue on the Akron machines either, I don't expect internet connectivity issues at the university.

Update the viewing branch

@tarzzz created this PR #56 that needs to be updated so that we can allow people to view the inputs and outputs of the notebooks. I'm curious to know if the visualization can be embedded so that they display on nbviewer (that would be awesome!). We still need to keep the master branch with all the outputs hidden.

Kinetics Notebook

15 mins

All forces: joint torques and gravity

  • Create working notebook
  • Polish

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.