Originally written to support MotionPlanning.jl, this package contains a core set of abstractions for working with dynamical systems of the form , where
and
represent the state and control input of the system, respectively. This package is not intended to be a substitute for more comprehensive/domain-specific packages (e.g., DynamicalSystems.jl, RigidBodyDynamics.jl, or DifferentialEquations.jl); instead it aims to be as lightweight as possible while offering an extensible framework for operations on state/control trajectories relevant to robot trajectory planning.
DifferentialDynamicsModels.jl exports the following types:
DifferentialDynamics— abstract type representing thein
. Instances of concrete subtypes should be callable, i.e., implement
(::MyDynamics)(x, u). Examples include:SingleIntegratorDynamics{N}defined in this package. Implements the dynamics. The type parameter
Ndenotes the state and control dimension.LinearDynamics{Dx,Du}defined in LinearDynamicsModels.jl. Implements the dynamics. The type parameters
DxandDudenote the state and control dimension respectively.SimpleCarDynamics{Dv,Dκ}defined in SimpleCarModels.jl. Implements unicycle dynamics extended byDvandDκintegrators in the speed and curvature controls respectively.BicycleModeldefined in Pigeon.jl. Implements a single-track (i.e., "bicycle") vehicle model for use in QP-based model predictive control.
ControlInterval— abstract type representing a control function defined over a time interval. Concrete subtypes include:StepControl(a.k.a.ZeroOrderHoldControl) — constant control input over a time interval.RampControl(a.k.a.FirstOrderHoldControl) — linear interpolation between two control inputs over a time interval.BVPControl— a wrapper around state/control trajectory functions produced, e.g., by an external boundary value problem solver.
CostFunctional- abstract type representing an objective for optimal control. Concrete subtypes include:Time— trajectory duration.
TimePlusQuadraticControl— mixed time/control effort penalty.
SteeringBVP{D<:DifferentialDynamics,C<:CostFunctional,SC<:SteeringConstraints,SD<:SteeringCache}— concrete type that serves as a container that both defines a two-point boundary value problem (i.e., "steering problem" connecting two states in robot motion planning parlance) and provides the means to solve it. Instances should be callable, i.e., users should define(::SteeringBVP{MyDynamics,MyCostFunctional,MySteeringConstraints,MySteeringCache})returning a named tuple(cost=..., controls=...), leveraging Julia's multiple-dispatch on theSteeringBVPtype parameters to select the right implementation. Examples include:GeometricSteering—SingleIntegratorDynamicswith aTimeoptimization objective andBoundedControlNormcontrol constraint (equivalent to optimizing Euclidean arc length).LinearQuadraticSteering—LinearDynamicswith aTimePlusQuadraticControloptimization objective and no control constraints.DubinsSteeringandReedsSheppSteering— minimum arc length Dubins and Reeds-Shepp steering for a simple car with minimum turning radius.
DifferentialDynamicsModels.jl defines the following functions that can and should be extended by dependent packages if applicable:
state_dim(::DifferentialDynamics)— dimension of the state.
control_dim(::DifferentialDynamics)— dimension of the control input.
duration(controls)— length of the time interval over whichcontrolsis defined;controlsmay be a singleControlIntervalor an iterable container (e.g., aVector) ofControlIntervals.propagate(f::DifferentialDynamics, x::State, controls, ts)— propagates the dynamics ODEfstarting fromxto return a state or sequence of states at timests.controlsmay be a singleControlIntervalor an iterable ofControlIntervals.tsmay be a singleNumber, an iterable ofNumbers, or not be included as an argument at all, in which case it defaults toduration(controls).waypoints(f::DifferentialDynamics, x::State, controls, dt_or_N)— similar topropagatebut returns equally spaced states (in time) along the controlled trajectory.dt_or_Nmay be anAbstractFloator anInt, corresponding to a desired spacingdtor a desired total number of waypointsN.instantaneous_control(controls, ts)— similar topropagatebut returns the control input instead of the state atts.
Performance-oriented users may note that the last three functions allocate and return Vectors in the case that ts is an iterable; this package also defines the Propagate and InstantaneousControl iterators constructed in the same ways that their function counterparts are called (waypoints_itr also exists, and returns a Propagate iterator).