- Define the gap function with the signature
gap(q::AbstractArray, u::AbstractArray)
return gap, force_matrix
- Define the dynamics function with the signature
dynamics(q::AbstractArray, u::VecAbstractArraytor)
return M, h
- If there are bilateral constraints, define the holonomic constraint functions and their derivatives (Jacobian and Jacobian_dot).
loop(q::AbstractArray), jac(q::AbstractArray), jacdot(q::AbstractArray, u::AbstractArray)
return ϕ, J, Jdot
- If there are electrical components these can be modeled using the extradynamics function (see the magnetic levitation example and the associated description file ).
extradynamics(extra_state::AbstractArray, q::AbstractArray, u::AbstractArray)\
- Initialize the system by providing the gap and dynamics functions, and the initial conditions (for holonomic constraints, provide them, too).
bouncing_ball = Integrator(gap, dynamics, qA, uA; Δt=1e-3)
sc_ball = Integrator(gap, dynamics, loop, jac, jacdot, q0, u0; Δt=1e-3)
maglev = Integrator(gap, dynamics, q0, u0, extra_state0); Δt=1e-3)
- Integrate the system until final_time
integrate(bouncing_ball, final_time)
Examples are provided within the examples folder.