diff --git a/docs/src/problem.md b/docs/src/problem.md index de0f9605..1ba260a0 100644 --- a/docs/src/problem.md +++ b/docs/src/problem.md @@ -20,6 +20,7 @@ Problem cost(::Problem) states(::Problem) controls(::Problem) +horizonlength get_objective get_constraints get_model diff --git a/src/TrajectoryOptimization.jl b/src/TrajectoryOptimization.jl index 4103b394..4f15977e 100644 --- a/src/TrajectoryOptimization.jl +++ b/src/TrajectoryOptimization.jl @@ -55,6 +55,7 @@ export # methods get_objective, get_constraints, get_model, + horizonlength, state_dim, # from RobotDynamics control_dim # from RobotDynamics diff --git a/src/problem.jl b/src/problem.jl index 6d73ade9..7de3b06a 100644 --- a/src/problem.jl +++ b/src/problem.jl @@ -143,6 +143,14 @@ RD.dims(prob::Problem, i::Integer) = RD.dims(prob.model[i])..., prob.N RD.state_dim(prob::Problem, k::Integer) = state_dim(prob.model[k]) RD.control_dim(prob::Problem, k::Integer) = control_dim(prob.model[k]) +""" + horizonlength(prob::Problem) + +Number of knot points in the time horizon, i.e. the length of the sampled +state and control trajectories. +""" +horizonlength(prob::Problem) = prob.N + import Base.size @deprecate size(prob::Problem) dims(prob)