Skip to content

Commit 5118245

Browse files
committed
Update docs
1 parent 16dd8af commit 5118245

22 files changed

+932
-618
lines changed

docs/make.jl

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,19 @@ makedocs(
77
pages = [
88
"Introduction" => "index.md",
99
"Getting Started" => [
10-
"models.md",
10+
"model.md",
1111
"costfunctions.md",
1212
"constraints.md",
13-
"creating_problems.md",
14-
"solving.md"
13+
"creating_problems.md"
1514
],
1615
"Interfaces" => [
1716
"costfunction_interface.md",
18-
"constraint_interface.md",
19-
"solver_interface.md"
17+
"constraint_interface.md"
2018
],
21-
"Documentation" => [
22-
"model_types.md",
23-
"discretization.md",
19+
"API" => [
2420
"cost_api.md",
2521
"constraint_api.md",
26-
"problem.md",
27-
"solvers.md",
28-
"rotations.md"
22+
"problem.md"
2923
]
3024
]
3125
)
@@ -35,6 +29,4 @@ makedocs(
3529
# for more information.
3630
deploydocs(
3731
repo = "github.com/RoboticExplorationLab/TrajectoryOptimization.jl.git",
38-
deploy_config=Documenter.Travis(),
39-
devbranch = "v1.3",
4032
)

docs/old/constraint_api.md

Lines changed: 0 additions & 69 deletions
This file was deleted.

docs/old/constraints.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

docs/src/constraint_api.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
```@meta
2+
CurrentModule = TrajectoryOptimization
3+
```
4+
5+
# Constraints
6+
This page provides details about the various types in TrajectoryOptimization.jl for working
7+
with constraints, as well as the methods defined on those types.
8+
In general, a [`ConstraintList`](@ref) is used to define the constraints, and another
9+
[`AbstractConstraintSet`](@ref), such as an [`ALConstraintSet`](@ref), is instantiated by a
10+
solver to hold the constraint values and Jacobians.
11+
12+
## Constraint List
13+
A [`ConstraintList`](@ref) is used to define a trajectory optimization [`Problem`](@ref) and
14+
only holds basic information about the constraints included in the problem. Although it is
15+
a child of [`AbstractConstraintSet`](@ref) and supports indexing and iteration, it does not
16+
hold any information about constraint values or Jacobians.
17+
```@docs
18+
ConstraintList
19+
add_constraint!
20+
num_constraints
21+
```
22+
23+
## Constraint Sets
24+
A constraint set holding a list of [`ConVal`](@ref)s is generally instantiated by a solver
25+
and holds the constraint definitions, as well as the associated constraint values, Jacobians,
26+
and other constraint-related information required by the solver.
27+
```@docs
28+
AbstractConstraintSet
29+
ALConstraintSet
30+
link_constraints!
31+
```
32+
33+
## Constraint Value type
34+
The [`ConVal`](@ref) type holds all the constraint values and Jacobians for a particular
35+
constraint, and supports different ways of storing those (either as individual matrices/vectors
36+
or as views into a large matrix/vector).
37+
38+
```@docs
39+
ConVal
40+
```
41+
42+
## Implemented Constraints
43+
The following is a list of the constraints currently implemented in TrajectoryOptimization.jl.
44+
Please refer to the docstrings for the individual constraints on details on their constructors,
45+
since each constraint is unique, in general.
46+
47+
List of currently implemented constraints
48+
* [`GoalConstraint`](@ref)
49+
* [`BoundConstraint`](@ref)
50+
* [`CircleConstraint`](@ref)
51+
* [`SphereConstraint`](@ref)
52+
* [`NormConstraint`](@ref)
53+
* [`DynamicsConstraint`](@ref)
54+
* [`IndexedConstraint`](@ref)
55+
56+
```@docs
57+
GoalConstraint
58+
BoundConstraint
59+
CircleConstraint
60+
SphereConstraint
61+
NormConstraint
62+
DynamicsConstraint
63+
IndexedConstraint
64+
```

docs/old/constraint_interface.md renamed to docs/src/constraint_interface.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,36 @@ CurrentModule = TrajectoryOptimization
55
# Constraint Interface
66

77
## Constraint Type
8-
All constraints inherit from `AbstractConstraint{S<:ConstraintSense,W<:ConstraintType,P}`,
9-
where `ConstraintSense` specifies `Inequality` or `Equality`, `ConstraintType` specifies the
10-
"bandedness" of the constraint (will be discussed more later), and `P` is the dimension of
11-
the constraint. This allows the software to easily dispatch over the type of constraint.
12-
Each constraint type represents a vector-valued constraint.
13-
The intention is that each constraint type represent one line in the constraints of
14-
problem definition (where they may be vector or scalar-valued).
15-
8+
All constraints inherit from [`AbstractConstraint`](@ref).
169
TrajectoryOptimization.jl assumes equality constraints are of the form ``g(x) = 0`` and inequality
1710
constraints are of the form ``h(x) \leq 0 ``.
1811

1912
```@docs
2013
AbstractConstraint
2114
ConstraintSense
22-
ConstraintType
2315
```
2416

25-
### Methods
26-
The following methods are defined for all `AbstractConstraint`s
17+
## Evaluating Constraints
18+
The following methods are used to evaluate a constraint:
2719
```@docs
28-
state_dims
29-
control_dims
20+
evaluate
3021
evaluate!
3122
jacobian!
32-
contype
23+
∇jacobian!
24+
```
25+
26+
### Methods
27+
The following methods are defined for all `AbstractConstraint`s
28+
```@docs
29+
state_dim
30+
control_dim
3331
sense
34-
width
32+
widths
3533
upper_bound
3634
lower_bound
3735
is_bound
3836
check_dims
37+
get_inds
3938
```
4039

4140
## Adding a New Constraint
@@ -82,16 +81,12 @@ end
8281

8382
### Constraint Types
8483
The `ConstraintType` defines the "bandedness" of the constraint, or the number of adjacent
85-
state or constraint values needed to calculate the constraint.
84+
state or constraint values needed to calculate the constraint.
8685
```@docs
87-
Stage
88-
State
89-
Control
90-
Coupled
91-
Dynamical
92-
CoupledState
93-
CoupledControl
94-
General
95-
GeneralState
96-
GeneralControl
86+
StageConstraint
87+
StateConstraint
88+
ControlConstraint
89+
CoupledConstraint
90+
CoupledStateConstraint
91+
CoupledControlConstraint
9792
```

docs/src/constraints.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# [3. Creating Constraints](@id constraint_section)
2+
```@meta
3+
CurrentModule = TrajectoryOptimization
4+
```
5+
6+
```@contents
7+
Pages = ["constraints.md"]
8+
```
9+
10+
## Creating Constraint Sets
11+
The easiest way to set up the constraints for your problem is through the [`ConstraintList`](@ref).
12+
This structure simply holds a vector of all the constraints in the trajectory optimization problem.
13+
The easiest way to start is to create an empty [`ConstraintList`](@ref):
14+
```julia
15+
cons = ConstraintList(n,m,N)
16+
```
17+
18+
### Adding Constraints
19+
You can add any constraint (the list of currently implemented constraints is given in the following
20+
section) to the constraint set using the [`add_constraint!`](@ref) method. For example, if we
21+
want to add control limits and an final goal constraint to our problem, we do this by creating
22+
a `ConstraintList` and subsequently adding the constraints:
23+
```julia
24+
# Dimensions of our problem
25+
n,m,N = 4,1,51 # 51 knot points
26+
27+
# Create our list of constraints
28+
cons = ConstraintList(n,m,N)
29+
30+
# Create the goal constraint
31+
xf = [0,π,0,0]
32+
goalcon = GoalConstraint(xf)
33+
add_constraint!(cons, goalcon, N) # add to the last time step
34+
35+
# Create control limits
36+
ubnd = 3
37+
bnd = BoundConstraint(n,m, u_min=-ubnd, u_max=ubnd)
38+
add_constraint!(cons, bnd, 1:N-1) # add to all but the last time step
39+
```
40+
41+
### Defined Constraints
42+
The following constraints are currently defined. See their individual docstrings on details
43+
on how to construct them, since constraint constructors are, in general, unique to the constraint.
44+
45+
* [`GoalConstraint`](@ref)
46+
* [`BoundConstraint`](@ref)
47+
* [`CircleConstraint`](@ref)
48+
* [`SphereConstraint`](@ref)
49+
* [`NormConstraint`](@ref)
50+
* [`IndexedConstraint`](@ref)

docs/old/cost_api.md renamed to docs/src/cost_api.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ CurrentModule = TrajectoryOptimization
55
# Cost Functions and Objectives
66
This page details the functions related to building and evaluating cost functions and objectives.
77

8-
## Quadratic Cost Functions
8+
9+
## Cost Functions
910
```@docs
11+
CostFunction
12+
QuadraticCostFunction
13+
DiagonalCost
1014
QuadraticCost
1115
LQRCost
12-
LQRCostTerminal
13-
LQRObjective
14-
```
15-
16-
## Indexed Cost Functions
17-
```@docs
18-
IndexedCost
16+
is_diag
17+
is_blockdiag
18+
invert!
1919
```
2020

2121
## Adding Cost Functions
@@ -36,19 +36,23 @@ cost3 = cost1 + cost2
3636
# cost3 is equivalent to QuadraticCost(Q1+Q2, R1+R2)
3737
```
3838

39-
## CostExpansion Type
40-
The `CostExpansion` type stores the pieces of the second order Taylor expansion of the cost for the entire trajectory, stored as vectors of Static Vectors or Static Matrices. e.g. to get the Hessian with respect to `x` at knotpoint 5 you would use `E.xx[5]`.
39+
## Objectives
4140
```@docs
42-
CostExpansion
41+
Objective
42+
LQRObjective
43+
get_J
44+
dgrad
45+
dhess
46+
norm_grad
4347
```
4448

45-
## Objective
49+
## Evaluating the Cost
4650
```@docs
47-
Objective
48-
cost(::Objective, Z::Traj)
49-
get_J
50-
cost_gradient
51+
cost
52+
stage_cost
53+
gradient!
54+
hessian!
5155
cost_gradient!
52-
cost_hessian
5356
cost_hessian!
57+
cost_expansion!
5458
```

0 commit comments

Comments
 (0)