Simulation

Simulation

Index

Basic simulation

simulate(state0, final_time; Δt)

Basic Mechanism simulation: integrate the state from time $0$ to final_time 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 RigidBodyDynamics.OdeIntegrators.MuntheKaasIntegrator for a lower level interface with more options.

source

Lower level ODE integration interface

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
struct ButcherTableau{N, T, L}

A Butcher tableau.

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
type ExpandingStorage{T} <: RigidBodyDynamics.OdeIntegrators.OdeResultsSink

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

source
integrate(integrator, state0, final_time, Δt; max_realtime_rate)

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

source
runge_kutta_4(scalartype)

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

source
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;

  • additional_state(state), returns the vector of additional states;

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

  • set_additional_state!(state, s), sets vector of additional states to s;

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

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

source