Simulation
Index
RigidBodyDynamics.OdeIntegrators.ButcherTableauRigidBodyDynamics.OdeIntegrators.ExpandingStorageRigidBodyDynamics.OdeIntegrators.MuntheKaasIntegratorRigidBodyDynamics.OdeIntegrators.MuntheKaasIntegratorRigidBodyDynamics.OdeIntegrators.OdeResultsSinkRigidBodyDynamics.OdeIntegrators.RingBufferStorageBase.stepRigidBodyDynamics.OdeIntegrators.integrateRigidBodyDynamics.OdeIntegrators.runge_kutta_4RigidBodyDynamics.simulate
Basic simulation
RigidBodyDynamics.simulate — Function.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.
Lower level ODE integration interface
type ExpandingStorage{T} <: RigidBodyDynamics.OdeIntegrators.OdeResultsSinkAn OdeResultsSink that stores the state at each integration time step in Vectors that may expand.
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).
Create a MuntheKaasIntegrator given:
a callable
dynamics!(vd, t, state)that updates the joint acceleration vectorvdat timetand in statestate;a
ButcherTableautableau, specifying the integrator coefficients;an
OdeResultsSinksinkwhich processes the results of the integration procedure at each time step.
abstract OdeResultsSinkDoes '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.
type RingBufferStorage{T} <: RigidBodyDynamics.OdeIntegrators.OdeResultsSinkAn OdeResultsSink that stores the state at each integration time step in a ring buffer.
Base.step — Method.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 tov;global_coordinates!(state, q0, ϕ), sets global coordinates in state based on local coordinatesϕcentered around global coordinatesq0;local_coordinates!(state, ϕ, ϕd, q0), converts state's global configurationqand velocityvto local coordinates centered around global coordinatesq0.
integrate(integrator, state0, finalTime, Δt; maxRealtimeRate)
Integrate dynamics from the initial state state0 at time $0$ to finalTime using step size Δt.
runge_kutta_4(scalartype)
Return the Butcher tableau for the standard fourth order Runge-Kutta integrator.
immutable ButcherTableau{N, T<:Number, L}