This package serves two purposes:
-
To extend the interfaces defined in
DifferentialDynamicsModels.jl
to linear time-invariant systems of the form and 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} <: DifferentialDynamics
is the main type exported by this package. The type parametersDx
andDu
denote 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})
. ThoughLinearDynamics
supports arbitrary values forA
,B
, andc
, this package also exports the convenience constructorsDoubleIntegatorDynamics(D::Int)
,TripleIntegatorDynamics(D::Int)
, andNIntegratorDynamics(N::Int, D::Int)
whereD
is the spatial dimension (e.g.,DoubleIntegatorDynamics(3)
will model a point mass in three dimensions under controlled acceleration).LinearQuadraticSteering
is 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 resultingSteeringBVP
instance 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 SymPy
orimport 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 modelf
about the statex
and controlu
; returns aLinearDynamics
.linearize(f::DifferentialDynamics, x, u::StepControl)
โ linearization of the discrete time model produced by integratingf
starting from the statex
and applying the zero-order hold control intervalu
(constant controlu.u
over 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 integratingf
starting from the statex
and applying the first-order hold control intervalu
(control linearly interpolated fromu.u0
tou.uf
over durationu.t
); returns aFirstOrderHoldLinearization
. This linearization is exact (up to numerical error) iff isa LinearDynamics
.