Simulation
Index
RigidBodyDynamics.OdeIntegrators.ButcherTableau
RigidBodyDynamics.OdeIntegrators.ExpandingStorage
RigidBodyDynamics.OdeIntegrators.MuntheKaasIntegrator
RigidBodyDynamics.OdeIntegrators.MuntheKaasIntegrator
RigidBodyDynamics.OdeIntegrators.OdeResultsSink
RigidBodyDynamics.OdeIntegrators.RingBufferStorage
Base.step
RigidBodyDynamics.OdeIntegrators.integrate
RigidBodyDynamics.OdeIntegrators.runge_kutta_4
RigidBodyDynamics.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 Vector
s 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.OdeResultsSink
An 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 vectorvd
at timet
and in statestate
;a
ButcherTableau
tableau
, specifying the integrator coefficients;an
OdeResultsSink
sink
which processes the results of the integration procedure at each time step.
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.
type RingBufferStorage{T} <: RigidBodyDynamics.OdeIntegrators.OdeResultsSink
An 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 configurationq
and velocityv
to 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}