Simulation

Index

Basic simulation

simulate(state0, finalTime; Δt)

Basic Mechanism simulation: integrate the state from time $0$ to finalTime starting from the initial state state0. Return a Vector of times, as well as Vectors of configuration vectors and velocity vectors at these times.

Uses MuntheKaasIntegrator. See MuntheKaasIntegrator for a lower level interface with more options.

source

Lower level ODE integration interface

type ExpandingStorage{T} <: RigidBodyDynamics.OdeIntegrators.OdeResultsSink

An OdeResultsSink that stores the state at each integration time step in Vectors that may expand.

source

A Lie-group-aware ODE integrator.

MuntheKaasIntegrator is used to properly integrate the dynamics of globally parameterized rigid joints (Duindam, Port-Based Modeling and Control for Efficient Bipedal Walking Robots, 2006, Definition 2.9). Global parameterizations of e.g. $SO(3)$ are needed to avoid singularities, but this leads to the problem that the tangent space no longer has the same dimension as the ambient space of the global parameterization. A Munthe-Kaas integrator solves this problem by converting back and forth between local and global coordinates at every integration time step.

The idea is to do the dynamics and compute the stages of the integration scheme in terms of local coordinates centered around the global parameterization of the configuration at the end of the previous time step (e.g. exponential coordinates), combine the stages into a new set of local coordinates as usual for Runge-Kutta methods, and then convert the local coordinates back to global coordinates.

From Iserles et al., 'Lie-group methods' (2000).

Another useful reference is Park and Chung, 'Geometric Integration on Euclidean Group with Application to Articulated Multibody Systems' (2005).

source

Create a MuntheKaasIntegrator given:

  • a callable dynamics!(vd, t, state) that updates the joint acceleration vector vd at time t and in state state;

  • a ButcherTableau tableau, specifying the integrator coefficients;

  • an OdeResultsSink sink which processes the results of the integration procedure at each time step.

source
abstract OdeResultsSink

Does 'something' with the results of an ODE integration (e.g. storing results, visualizing, etc.). Subtypes must implement:

  • initialize(sink, state): called with the initial state when integration begins.

  • process(sink, t, state): called at every integration time step with the current state and time.

source
type RingBufferStorage{T} <: RigidBodyDynamics.OdeIntegrators.OdeResultsSink

An OdeResultsSink that stores the state at each integration time step in a ring buffer.

source
Base.stepMethod.
step(integrator, t, state, Δt)

Take a single integration step.

state must be of a type for which the following functions are defined:

  • configuration(state), returns the configuration vector in global coordinates;

  • velocity(state), returns the velocity vector;

  • set_velocity!(state, v), sets velocity vector to v;

  • global_coordinates!(state, q0, ϕ), sets global coordinates in state based on local coordinates ϕ centered around global coordinates q0;

  • local_coordinates!(state, ϕ, ϕd, q0), converts state's global configuration q and velocity v to local coordinates centered around global coordinates q0.

source
integrate(integrator, state0, finalTime, Δt; maxRealtimeRate)

Integrate dynamics from the initial state state0 at time $0$ to finalTime using step size Δt.

source
runge_kutta_4(scalartype)

Return the Butcher tableau for the standard fourth order Runge-Kutta integrator.

source
immutable ButcherTableau{N, T<:Number, L}

A Butcher tableau.

source