Impulse-based dynamics: A simple and fast way to simulate contacts and constraints

So far, I’ve mostly been working on rotational mechanics – multibody models where each mass only has one rotational degree of freedom and two state variables (angle and angular velocity). Every now and then, I use some commercially available tools to simulate more complex 2d and 3d models – often being surprised by how slow simulation is. At the same time, I’ve been wondering a lot:

  • how I’d actually model these problems by hand – especially when additional boundary conditions and/or contacts are involved.
  • why some video games seem to be able to include complex dynamics with detailed contact and collisions involved, simulating in real time (while commercial multibody simulation often takes hours to calculate a few seconds of dynamic behavior).

An important answer to these questions is the topic of impulse-based dynamics. I stumbled upon it in some amazing literature from Prof. Jan Bender (see http://www.interactive-graphics.de/) and so far I’ve been experimenting a bit with the method myself. This post today features a small and practical introduction to modelling boundary conditions in impulse-based mechanics.

Continue reading

Advertisements

How to solve differential equations on an arduino with the runge-kutta method

This is just a small update on my experiments with the Arduino. I implemented the runge-kutta-method for solving a multibody system a few weeks ago. So this is a working implementation of the standard 4th-order runge-kutta ODE (ordinary differential equations) solver for the arduino platform, something I haven’t seen elsewhere.

(Note: If you are just looking for the arduino sketch, you’ll find a link at the end of this blog post. If you are wondering about related questions or have trouble adopting it to your needs, please leave a comment. Also see this post on how numerical integration of differential equations works.
Update in August 2016: See also my new post on achievable simulation rates with an Arduino Uno/Nano and Due)

My main goal was to get a better grip on simulation speeds. Why is my simulation so slow? is a question I’m really thinking about a lot. Since I wasn’t able to find a good example of an arduino sketch for ODE solving online, this may be interesting anyway.

Continue reading

Programming advice for an engineer: Get an Arduino

Until the beginning of this year, I’ve only been coding in Matlab, GNU Octave and a few other comparable high-level 4th generation programming languages. I’ve long wanted to learn a more basic programming language which allows smaller and faster programs (more on this in another post). Basically, I wanted an answer to the question:

I’m an engineer and want to learn about programming. What can I do to get started?

It turns out one of the best answers is this: Get an Arduino.

Continue reading

Viewing friction in dynamics as a hybrid system

It’s been almost a year since I wrote my post on how to model friction in a dynamic multibody system. Since then, I’ve reconsidered my ideas from the post a few times and finally found out that there’s a theory called “hybrid systems” that intersects with the problems described there.

Continue reading

Getting started

This is an experiment that has been bugging me for quite a while.

Every now and then I run into some applied mechanics problem and try to figure out how to solve it. Usually after a few minutes of trying, I also decide to google it and often I find no solution to my question (but usually a lot of helpful hints and good advice).

These are usually quite basic questions I’m considering, like:

  • how can I implement coulomb friction in a 1d mechanics model with consideration of stick and slip states?
  • my multibody model is getting quite complex with lots of reused code. The code would probably look a lot cleaner and simpler if masses and couplings are implemented as objects. How can this be done?

Both example questions are actually quite simple problems which are probably solved many times. Searching for a good solution is fun for me and I usually learn a lot along the way. So this is the idea of this blog: to write about simple problems with multibody dynamics and suggest possible solutions to them – and then see what happens.

Continue reading