Problem
Definition
TrajectoryOptimization.Problem
— Typestruct Problem{Q<:QuadratureRule, T<:AbstractFloat}
Trajectory Optimization Problem. Contains the full definition of a trajectory optimization problem, including:
- dynamics model (
Model
) - objective (
Objective
) - constraints (
ConstraintSet
) - initial and final states
- Primal variables (state and control trajectories)
- Discretization information: knot points (
N
), time step (dt
), and total time (tf
)
Constructors:
Problem(model, obj, constraints, x0, xf, Z, N, tf) # defaults to RK3 integration
Problem{Q}(model, obj, constraints, x0, xf, Z, N, tf) where Q<:QuadratureRule
Problem(model, obj, xf, tf; x0, constraints, N, X0, U0, dt, integration)
Problem{Q}(prob::Problem) # change integration
where Z
is a trajectory (Vector of KnotPoint
s)
Arguments
model
: Dynamics model. Can be eitherDiscrete
orContinuous
obj
: ObjectiveX0
: Initial state trajectory. If omitted it will be initialized with NaNs, to be later overwritten by the solver.U0
: Initial control trajectory. If omitted it will be initialized with zeros.x0
: Initial state. Defaults to zeros.xf
: Final state. Defaults to zeros.dt
: Time steptf
: Final time. Set to zero to specify a time penalized problem.N
: Number of knot points. Defaults to 51, unless specified bydt
andtf
.integration
: One of the defined integration types to discretize the continuous dynamics model.
Both X0
and U0
can be either a Matrix
or a Vector{Vector}
, but must be the same. At least 2 of dt
, tf
, and N
need to be specified (or just 1 of dt
and tf
).
Methods
TrajectoryOptimization.change_integration
— Functionchange_integration(prob::Problem, Q<:QuadratureRule)
Change dynamics integration for the problem
TrajectoryOptimization.initial_controls!
— Methodinitial_controls!(::Union{Problem,AbstractSolver}, U0::Vector{<:AbstractVector})
initial_controls!(::Union{Problem,AbstractSolver}, U0::AbstractMatrx)
Copy the control trajectory
TrajectoryOptimization.initial_states!
— Methodinitial_states!(::Union{Problem,AbstractSolver}, X0::Vector{<:AbstractVector})
initial_states!(::Union{Problem,AbstractSolver}, X0::AbstractMatrix)
Copy the state trajectory
Base.size
— Methodsize(prob::Problem) -> Tuple
Get number of states, controls, and knot points
Base.copy
— MethodCopy the problem
TrajectoryOptimization.integration
— Methodintegration(::Problem)
integration(::DynamicsConstraint)
Get the integration rule
TrajectoryOptimization.states
— Methodstates(::Problem)
states(::AbstractSolver)
states(::Traj)
Get the state trajectory
TrajectoryOptimization.controls
— Methodcontrols(::Problem)
controls(::AbstractSolver)
controls(::Traj)
Get the control trajectory