This package serves two purposes:
-
To extend the interfaces defined in
DifferentialDynamicsModels.jlto linear time-invariant systems of the formand implement fast solutions to two-point boundary value problems with these dynamics (provided they are controllable), minimizing the mixed time/control effort criterion
(where
is symmetric positive definite).
LinearDynamics{Dx,Du} <: DifferentialDynamicsis the main type exported by this package. The type parametersDxandDudenote the state and control dimension respectively. Statically sized arrays are used in this package for their performance benefits; the type constructor requires arguments of the formLinearDynamics(A::StaticMatrix{Dx,Dx}, B::StaticMatrix{Dx,Du}, c::StaticVector{Du}). ThoughLinearDynamicssupports arbitrary values forA,B, andc, this package also exports the convenience constructorsDoubleIntegatorDynamics(D::Int),TripleIntegatorDynamics(D::Int), andNIntegratorDynamics(N::Int, D::Int)whereDis the spatial dimension (e.g.,DoubleIntegatorDynamics(3)will model a point mass in three dimensions under controlled acceleration).LinearQuadraticSteeringis a type alias for a particular parameterization ofSteeringBVP:Depending on whetherconst LinearQuadraticSteering{Dx,Du,Cache} = SteeringBVP{<:LinearDynamics{Dx,Du},<:TimePlusQuadraticControl{Du},EmptySteeringConstraints,Cache}
SteeringBVP(f::LinearDynamics, j::TimePlusQuadraticControl)is called with the keyword argumentcompile=Val(true)orcompile=Val(false)(the default), the resultingSteeringBVPinstance may contain a cache of optimal control functions/quantities symbolically computed using SymPy.jl. Compilation greatly reduces BVP computation time (useful if you need to solve millions or even billions of steering problems, as in sampling-based robot motion planning) but introduces a large initial overhead (i.e., stick tocompile=Val(false)if you only need to solve a few instances of a particular steering setup). Note that for BVP compilation the user must firstusing SymPyorimport SymPy.
-
To implement functions for dynamics linearization, leveraging automatic differentiation provided by ForwardDiff.jl. In particular this package provides linearization of continuous-time systems as well as linearization of the corresponding discrete-time systems arising from zero-order hold or first-order hold input.
linearize(f::DifferentialDynamics, x, u)โ linearization of a differential dynamics modelfabout the statexand controlu; returns aLinearDynamics.linearize(f::DifferentialDynamics, x, u::StepControl)โ linearization of the discrete time model produced by integratingfstarting from the statexand applying the zero-order hold control intervalu(constant controlu.uover durationu.t); returns aZeroOrderHoldLinearization. This linearization is exact (up to numerical error) iff isa LinearDynamics.linearize(f::DifferentialDynamics, x, u::RampControl)โ linearization of the discrete time model produced by integratingfstarting from the statexand applying the first-order hold control intervalu(control linearly interpolated fromu.u0tou.ufover durationu.t); returns aFirstOrderHoldLinearization. This linearization is exact (up to numerical error) iff isa LinearDynamics.