3. Creating Constraints

Creating Constraint Sets

The easiest way to set up the constraints for your problem is through the ConstraintSet. This structure simply holds a vector of all the constraints in the trajectory optimization problem. The easiest way to start is to create an empty ConstraintSet:

conSet = ConstraintSet(n,m,N)

Adding Constraints

You can add any constraint (the list of currently implemented constraints is given in the following section) to the constraint set using the following method:

TrajectoryOptimization.add_constraint!Function
add_constraint!(conSet, conVal::ConstraintVals, idx=-1)
add_constraint!(conSet, con::AbstractConstraint, inds::UnitRange, idx=-1)

Add a constraint to the constraint set. You can directly add a ConstraintVals type, but when adding a normal AbstractConstraint you must specify the range of knotpoints to which the constraint applies.

The optional idx argument allows you to specify exactly where in the vector of constraints you'd like the constraint to be added. The ordering will effect the order in which the constraint appears in concatenated vectors of constraint values (that show up in direct methods), potentially effecting the band structure of the resultant Jacobian. See solvers for more details.

source

Defined Constraints

The following constraints are currently defined. See thier individual docstrings on details on how to construct them, since constraint constructors are, in general, unique to the constraint.