Cost Function Interface

All cost functions are required to define the following methods

n = state_dim(cost)
m = control_dim(cost)
J = stage_cost(cost, x, u)
J = stage_cost(cost, xN)
Qx,Qu = gradient(cost, x, u)
Qxx,Quu,Qux = hessian(cost, x, u)

and inherit from CostFunction. They then inherit the following methods:

TrajectoryOptimization.stage_costMethod
stage_cost(cost::CostFunction, z::KnotPoint) -> Any

Evaluate the cost at a knot point, and automatically handle terminal knot point, multiplying by dt as necessary.

source
Missing docstring.

Missing docstring for cost_gradient(::CostFunction, ::KnotPoint). Check Documenter's build log for details.

Missing docstring.

Missing docstring for cost_hessian(::CostFunction, ::KnotPoint). Check Documenter's build log for details.

Objective Interface

The objective interface is very simple. After inheriting from AbstractObjective, define the following methods:

Base.length(::NewObjective)       # number of knot points
get_J(::NewObjective)             # return vector of costs at each knot point
cost!(::NewObjective, Z::Traj)    # calculate the cost at each knot point and store in get_J(::NewSolver)
cost_expansion!(E::CostExpansion, obj::NewObjective, Z::Traj)

And inherits the single method

cost(::NewObjective, Z::Traj)

that simply returns the summed cost.