Drake
Drake C++ Documentation
RobotClearance Class Reference

Detailed Description

A summary of the clearance – a collection of distance measurements – between the robot and everything in the world.

This data can be used to define collision avoidance strategies.

Conceptually, this class represents a table:

| body index R | body index O | type | ϕᴼ(R) | Jq_ϕᴼ(R) |
| :----------: | :----------: | :--: | :---: | :------: |
|      ...     |      ...     |  ..  |  ...  |    ...   |

Member functions return each column of the table as an ordered collection. The iᵗʰ entry in each collection belongs to the iᵗʰ row.

Each row characterizes the relationship between a particular robot body (annotated as body R) and some "other" body (annotated as body O) in the model. That other body O may be part of the robot or the environment.

  • body index R is the BodyIndex of body R.
  • body index O is the BodyIndex of body O.
  • type implies the type of body O. Given that we know body R is a robot body, type indicates that body O is also a robot body with the value RobotCollisionType::kSelfCollision or an environment body with the value RobotCollisionType::kEnvironmentCollision. For a correct implementation of CollisionChecker, it will never be RobotCollisionType::kEnvironmentAndSelfCollision.
  • ϕᴼ(R) is the signed distance function of the other body O evaluated on body R. The reported distance is offset by the padding value for the body pair recorded in the CollisionChecker. It is the minimum padded distance between bodies O and R. A point on the padded surface of body O would report a distance of zero. Points inside that boundary report negative distance and points outside have positive distance.
  • Jqᵣ_ϕᴼ(R) is the Jacobian of ϕᴼ(R) with respect to the robot configuration vector qᵣ. The Jacobian is the derivative as observed in the world frame.
    • The vector qᵣ will be a subset of the plant's full configuration q when there are floating bodies or joints in the plant other than the robot. The Jacobian is only taken with respect to the robot.
    • The jacobians() matrix has plant.num_positions() columns and the column order matches up with the full plant.GetPositions() order. The columns associated with non-robot joints will be zero.

Several important notes:

  • A single robot body index can appear many times as there may be many measured distances between that robot body and other bodies in the model.
  • A row may contain a zero-valued Jacobian Jqᵣ_ϕᴼ(R). Appropriately filtering collisions will cull most of these Jacobians. But depending on the structure of the robot and its representative collision geometry, it is still possible to evaluate the Jacobian at a configuration that represents a local optimum (zero-valued Jacobian).

#include <drake/planning/robot_clearance.h>

Public Member Functions

 RobotClearance (int num_positions)
 Creates an empty clearance with size() == 0 and num_positions as given. More...
 
 ~RobotClearance ()
 
int size () const
 
int num_positions () const
 
const std::vector< multibody::BodyIndex > & robot_indices () const
 
const std::vector< multibody::BodyIndex > & other_indices () const
 
const std::vector< RobotCollisionType > & collision_types () const
 
Eigen::Map< const Eigen::VectorXd > distances () const
 
auto jacobians () const
 
auto mutable_jacobians ()
 (Advanced) The mutable flavor of jacobians(). More...
 
void Reserve (int size)
 Ensures this object has storage for at least size rows. More...
 
void Append (multibody::BodyIndex robot_index, multibody::BodyIndex other_index, RobotCollisionType collision_type, double distance, const Eigen::Ref< const Eigen::RowVectorXd > &jacobian)
 Appends one measurement to this table. More...
 
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 RobotClearance (const RobotClearance &)=default
 
RobotClearanceoperator= (const RobotClearance &)=default
 
 RobotClearance (RobotClearance &&)=default
 
RobotClearanceoperator= (RobotClearance &&)=default
 

Constructor & Destructor Documentation

◆ RobotClearance() [1/3]

RobotClearance ( const RobotClearance )
default

◆ RobotClearance() [2/3]

RobotClearance ( RobotClearance &&  )
default

◆ RobotClearance() [3/3]

RobotClearance ( int  num_positions)
explicit

Creates an empty clearance with size() == 0 and num_positions as given.

◆ ~RobotClearance()

Member Function Documentation

◆ Append()

void Append ( multibody::BodyIndex  robot_index,
multibody::BodyIndex  other_index,
RobotCollisionType  collision_type,
double  distance,
const Eigen::Ref< const Eigen::RowVectorXd > &  jacobian 
)

Appends one measurement to this table.

◆ collision_types()

const std::vector<RobotCollisionType>& collision_types ( ) const
Returns
the vector of body collision types.

◆ distances()

Eigen::Map<const Eigen::VectorXd> distances ( ) const
Returns
the vector of distances (ϕᴼ(R)).

◆ jacobians()

auto jacobians ( ) const
Returns
the vector of distance Jacobians (Jqᵣ_ϕᴼ(R)); the return type is a readonly Eigen::Map with size() rows and num_positions() columns.

◆ mutable_jacobians()

auto mutable_jacobians ( )

(Advanced) The mutable flavor of jacobians().

◆ num_positions()

int num_positions ( ) const
Returns
the number of positions (i.e., columns) in jacobians().

◆ operator=() [1/2]

RobotClearance& operator= ( const RobotClearance )
default

◆ operator=() [2/2]

RobotClearance& operator= ( RobotClearance &&  )
default

◆ other_indices()

const std::vector<multibody::BodyIndex>& other_indices ( ) const
Returns
the vector of other body indices.

◆ Reserve()

void Reserve ( int  size)

Ensures this object has storage for at least size rows.

◆ robot_indices()

const std::vector<multibody::BodyIndex>& robot_indices ( ) const
Returns
the vector of robot body indices.

◆ size()

int size ( ) const
Returns
the number of distance measurements (rows in the table).

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