Skip to content

Commit 107b565

Browse files
committed
Add horizonlength
1 parent 9535ff2 commit 107b565

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

docs/src/problem.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Problem
2020
cost(::Problem)
2121
states(::Problem)
2222
controls(::Problem)
23+
horizonlength
2324
get_objective
2425
get_constraints
2526
get_model

src/TrajectoryOptimization.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export # methods
5555
get_objective,
5656
get_constraints,
5757
get_model,
58+
horizonlength,
5859
state_dim, # from RobotDynamics
5960
control_dim # from RobotDynamics
6061

src/problem.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@ RD.dims(prob::Problem, i::Integer) = RD.dims(prob.model[i])..., prob.N
143143
RD.state_dim(prob::Problem, k::Integer) = state_dim(prob.model[k])
144144
RD.control_dim(prob::Problem, k::Integer) = control_dim(prob.model[k])
145145

146+
"""
147+
horizonlength(prob::Problem)
148+
149+
Number of knot points in the time horizon, i.e. the length of the sampled
150+
state and control trajectories.
151+
"""
152+
horizonlength(prob::Problem) = prob.N
153+
146154
import Base.size
147155
@deprecate size(prob::Problem) dims(prob)
148156

0 commit comments

Comments
 (0)