# Problem

## Definition

TrajectoryOptimization.ProblemType
Problem{T}

Trajectory Optimization Problem. Contains the full definition of a trajectory optimization problem, including:

• dynamics model (RD.DiscreteDynamics)
• objective (Objective)
• constraints (ConstraintList)
• 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)
Problem(model, obj, x0, tf; [xf, constraints, N, X0, U0, dt, integration])

where Z is a [RobotDynamics.SampledTrajectory].

Arguments

• model: A DiscreteDynamics model. If a ContinuousDynamics model is provided, it will be converted to a DiscretizedDynamics model via the integrator specified by the integration keyword argument.
• obj: Objective
• X0: 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
• xf: Final state. Defaults to zeros.
• dt: Time step. Can be either a vector of length N-1 or a positive real number.
• tf: Final time. Set to zero.
• N: Number of knot points. Uses the length of the objective.
• 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{<:AbstractVector}.

source

## Methods

### Getters

TrajectoryOptimization.get_modelFunction
get_model(prob::Problem)

Get the dynamics models used at each time step. Returns Vector{RobotDynamics.DiscreteDynamics}.

source
get_model(prob::Problem, k::Integer)

Get the dynamics model at time step k.

source
RobotDynamics.gettimesFunction
gettimes(Z)

Get a vector of times for the entire trajectory.

gettimes(::Problem)

Get the times for all the knot points in the problem.

source

### Setters

TrajectoryOptimization.set_goal_state!Function
set_goal_state!(prob::Problem, xf::AbstractVector; objective=true, constraint=true)

Change the goal state. If the appropriate flags are true, it will also modify a GoalConstraint and the objective, assuming it's an LQRObjective.

source

### Other

RobotDynamics.rollout!Function
rollout!(::Problem)

Simulate the dynamics forward from the initial condition x0 using the controls in the trajectory Z. If a problem is passed in, Z = prob.Z, model = prob.model, and x0 = prob.x0.

source