Skip to content

Commit

Permalink
Add horizonlength
Browse files Browse the repository at this point in the history
  • Loading branch information
bjack205 committed Apr 9, 2022
1 parent 9535ff2 commit 107b565
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/src/problem.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Problem
cost(::Problem)
states(::Problem)
controls(::Problem)
horizonlength
get_objective
get_constraints
get_model
Expand Down
1 change: 1 addition & 0 deletions src/TrajectoryOptimization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export # methods
get_objective,
get_constraints,
get_model,
horizonlength,
state_dim, # from RobotDynamics
control_dim # from RobotDynamics

Expand Down
8 changes: 8 additions & 0 deletions src/problem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 107b565

Please sign in to comment.