StateCache
RigidBodyDynamics.StateCache
— Typestruct StateCache{M, JointCollection} <: RigidBodyDynamics.AbstractTypeDict
A container that manages the creation and storage of MechanismState
objects of various scalar types, associated with a given Mechanism
.
A StateCache
can be used to write generic functions that use MechanismState
objects, while avoiding overhead due to the construction of a new MechanismState
with a given scalar type every time the function is called.
Examples
julia> mechanism = rand_tree_mechanism(Float64, Revolute{Float64}, Prismatic{Float64}, QuaternionFloating{Float64});
julia> cache = StateCache(mechanism)
StateCache{…}
julia> state32 = cache[Float32]
MechanismState{Float32, Float64, Float64, …}(…)
julia> cache[Float32] === state32
true
julia> cache[Float64]
MechanismState{Float64, Float64, Float64, …}(…)
RigidBodyDynamics.DynamicsResultCache
— Typestruct DynamicsResultCache{M} <: RigidBodyDynamics.AbstractTypeDict
A container that manages the creation and storage of DynamicsResult
objects of various scalar types, associated with a given Mechanism
. Similar to StateCache
.
RigidBodyDynamics.SegmentedVectorCache
— Typestruct SegmentedVectorCache{K, KeyRange<:AbstractUnitRange{K}} <: RigidBodyDynamics.AbstractTypeDict
A container that manages the creation and storage of heterogeneously typed SegmentedVector
objects. Similar to StateCache
.