Drake
Drake C++ Documentation
GcsTrajectoryOptimization::Subgraph Class Referencefinal

Detailed Description

A Subgraph is a subset of the larger graph.

It is defined by a set of regions and edges between them based on intersection. From an API standpoint, a Subgraph is useful to define a multi-modal motion planning problem. Further, it allows different constraints and objects to be added to different subgraphs. Note that the the GraphOfConvexSets does not differentiate between subgraphs and can't be mixed with other instances of GcsTrajectoryOptimization.

#include <drake/planning/trajectory_optimization/gcs_trajectory_optimization.h>

Public Member Functions

 ~Subgraph ()
 
const std::string & name () const
 Returns the name of the subgraph. More...
 
int order () const
 Returns the order of the Bézier trajectory within the region. More...
 
int size () const
 Returns the number of vertices in the subgraph. More...
 
const std::vector< geometry::optimization::GraphOfConvexSets::Vertex * > & Vertices ()
 Returns constant reference to a vector of mutable pointers to the vertices stored in the subgraph. More...
 
std::vector< const geometry::optimization::GraphOfConvexSets::Vertex * > Vertices () const
 Returns pointers to the vertices stored in the subgraph. More...
 
const geometry::optimization::ConvexSetsregions () const
 Returns the regions associated with this subgraph before the CartesianProduct. More...
 
void AddTimeCost (double weight=1.0)
 Adds a minimum time cost to all regions in the subgraph. More...
 
void AddPathLengthCost (const Eigen::MatrixXd &weight_matrix)
 Adds multiple L2Norm Costs on the upper bound of the path length. More...
 
void AddPathLengthCost (double weight=1.0)
 Adds multiple L2Norm Costs on the upper bound of the path length. More...
 
void AddVelocityBounds (const Eigen::Ref< const Eigen::VectorXd > &lb, const Eigen::Ref< const Eigen::VectorXd > &ub)
 Adds a linear velocity constraint to the subgraph lb ≤ q̇(t) ≤ ub. More...
 
void AddPathContinuityConstraints (int continuity_order)
 Enforces derivative continuity constraints on the subgraph. More...
 
Does not allow copy, move, or assignment
 Subgraph (const Subgraph &)=delete
 
Subgraphoperator= (const Subgraph &)=delete
 
 Subgraph (Subgraph &&)=delete
 
Subgraphoperator= (Subgraph &&)=delete
 

Friends

class GcsTrajectoryOptimization
 

Constructor & Destructor Documentation

◆ Subgraph() [1/2]

Subgraph ( const Subgraph )
delete

◆ Subgraph() [2/2]

Subgraph ( Subgraph &&  )
delete

◆ ~Subgraph()

~Subgraph ( )

Member Function Documentation

◆ AddPathContinuityConstraints()

void AddPathContinuityConstraints ( int  continuity_order)

Enforces derivative continuity constraints on the subgraph.

Parameters
continuity_orderis the order of the continuity constraint.

Note that the constraints are on the control points of the derivatives of r(s) and not q(t). This may result in discontinuities of the trajectory return by SolvePath() since the r(s) will get rescaled by the duration h to yield q(t). NormalizeSegmentTimes() will return r(s) with valid continuity.

Exceptions
std::exceptionif the continuity order is not equal or less than the order the subgraphs.
std::exceptionif the continuity order is less than one since path continuity is enforced by default.

◆ AddPathLengthCost() [1/2]

void AddPathLengthCost ( const Eigen::MatrixXd &  weight_matrix)

Adds multiple L2Norm Costs on the upper bound of the path length.

Since we cannot directly compute the path length of a Bézier curve, we minimize the upper bound of the path integral by minimizing the sum of distances between control points. For Bézier curves, this is equivalent to the sum of the L2Norm of the derivative control points of the curve divided by the order.

Parameters
weight_matrixis the relative weight of each component for the cost. The diagonal of the matrix is the weight for each dimension. The off-diagonal elements are the weight for the cross terms, which can be used to penalize diagonal movement.
Precondition
weight_matrix must be of size num_positions() x num_positions().

◆ AddPathLengthCost() [2/2]

void AddPathLengthCost ( double  weight = 1.0)

Adds multiple L2Norm Costs on the upper bound of the path length.

We upper bound the trajectory length by the sum of the distances between control points. For Bézier curves, this is equivalent to the sum of the L2Norm of the derivative control points of the curve divided by the order.

Parameters
weightis the relative weight of the cost.

◆ AddTimeCost()

void AddTimeCost ( double  weight = 1.0)

Adds a minimum time cost to all regions in the subgraph.

The cost is the sum of the time scaling variables.

Parameters
weightis the relative weight of the cost.

◆ AddVelocityBounds()

void AddVelocityBounds ( const Eigen::Ref< const Eigen::VectorXd > &  lb,
const Eigen::Ref< const Eigen::VectorXd > &  ub 
)

Adds a linear velocity constraint to the subgraph lb ≤ q̇(t) ≤ ub.

Parameters
lbis the lower bound of the velocity.
ubis the upper bound of the velocity.
Exceptions
std::exceptionif subgraph order is zero, since the velocity is defined as the derivative of the Bézier curve.
std::exceptionif lb or ub are not of size num_positions().

◆ name()

const std::string& name ( ) const

Returns the name of the subgraph.

◆ operator=() [1/2]

Subgraph& operator= ( Subgraph &&  )
delete

◆ operator=() [2/2]

Subgraph& operator= ( const Subgraph )
delete

◆ order()

int order ( ) const

Returns the order of the Bézier trajectory within the region.

◆ regions()

const geometry::optimization::ConvexSets& regions ( ) const

Returns the regions associated with this subgraph before the CartesianProduct.

◆ size()

int size ( ) const

Returns the number of vertices in the subgraph.

◆ Vertices() [1/2]

const std::vector<geometry::optimization::GraphOfConvexSets::Vertex*>& Vertices ( )

Returns constant reference to a vector of mutable pointers to the vertices stored in the subgraph.

The order of the vertices is the same as the order the regions were added.

◆ Vertices() [2/2]

std::vector<const geometry::optimization::GraphOfConvexSets::Vertex*> Vertices ( ) const

Returns pointers to the vertices stored in the subgraph.

The order of the vertices is the same as the order the regions were added.

Friends And Related Function Documentation

◆ GcsTrajectoryOptimization

friend class GcsTrajectoryOptimization
friend

The documentation for this class was generated from the following file: