Drake
GeneralizedConstraintForceEvaluator Class Referenceabstract

This evaluator computes the generalized constraint force Jᵀλ ∈ ℝ ᴺᵛ, where Nᵥ is the size of the generalized velocities. More...

#include <drake/systems/trajectory_optimization/generalized_constraint_force_evaluator.h>

Public Member Functions

 GeneralizedConstraintForceEvaluator (const RigidBodyTree< double > &tree, int num_vars, int lambda_size)
 Constructor. More...
 
 ~GeneralizedConstraintForceEvaluator () override
 
int non_lambda_size () const
 Getter for the size of non_lambda part in the evaluator variables. More...
 
int lambda_size () const
 Getter for lambda_size. More...
 
const RigidBodyTree< double > * tree () const
 Getter for the tree. More...
 
template<typename DerivedNonLambda , typename DerivedLambda >
std::enable_if< is_eigen_vector_of< DerivedNonLambda, typename DerivedLambda::Scalar >::value &&is_eigen_vector< DerivedLambda >::value, VectorX< typename DerivedLambda::Scalar > >::type ComposeEvalInputVector (const Eigen::MatrixBase< DerivedNonLambda > &non_lambda, const Eigen::MatrixBase< DerivedLambda > &lambda) const
 Compose the input x to the Eval function, given λ and the part of x that is not in λ. More...
 
template<typename Derived >
auto GetLambdaFromEvalInputVector (const Eigen::MatrixBase< Derived > &x) const
 Get the non-lambda part from the eval input vector. More...
 
template<typename Derived >
auto GetNonLambdaFromEvalInputVector (const Eigen::MatrixBase< Derived > &x) const
 Get the lambda part from the eval input vector. More...
 
- Public Member Functions inherited from EvaluatorBase
virtual ~EvaluatorBase ()
 
void Eval (const Eigen::Ref< const Eigen::VectorXd > &x, Eigen::VectorXd *y) const
 Evaluates the expression with a scalar type of double. More...
 
void Eval (const Eigen::Ref< const AutoDiffVecXd > &x, AutoDiffVecXd *y) const
 Evaluates the expression with a scalar type of AutoDiffXd. More...
 
void Eval (const Eigen::Ref< const VectorX< symbolic::Variable >> &x, VectorX< symbolic::Expression > *y) const
 Evaluates the expression with a scalar type of symbolic::Expression. More...
 
void set_description (const std::string &description)
 Set a human-friendly description for the evaluator. More...
 
const std::string & get_description () const
 Getter for a human-friendly description for the evaluator. More...
 
int num_vars () const
 Getter for the number of variables, namely the number of rows in x, as used in Eval(x, y). More...
 
int num_outputs () const
 Getter for the number of outputs, namely the number of rows in y, as used in Eval(x, y). More...
 
 EvaluatorBase (const EvaluatorBase &)=delete
 
EvaluatorBaseoperator= (const EvaluatorBase &)=delete
 
 EvaluatorBase (EvaluatorBase &&)=delete
 
EvaluatorBaseoperator= (EvaluatorBase &&)=delete
 

Protected Member Functions

void DoEval (const Eigen::Ref< const Eigen::VectorXd > &x, Eigen::VectorXd *y) const override
 Implements expression evaluation for scalar type double. More...
 
void DoEval (const Eigen::Ref< const AutoDiffVecXd > &x, AutoDiffVecXd *y) const override
 Implements expression evaluation for scalar type AutoDiffXd. More...
 
void DoEval (const Eigen::Ref< const VectorX< symbolic::Variable >> &, VectorX< symbolic::Expression > *) const override
 Implements expression evaluation for scalar type symbolic::Expression. More...
 
template<typename DerivedX , typename DerivedY >
std::enable_if< std::is_same< typename DerivedX::Scalar, typename DerivedY::Scalar >::value &&is_eigen_vector< DerivedX >::value &&is_eigen_vector< DerivedY >::value >::type DoEvalGeneric (const Eigen::MatrixBase< DerivedX > &x, Eigen::MatrixBase< DerivedY > *y) const
 
virtual Eigen::MatrixXd EvalConstraintJacobian (const Eigen::Ref< const Eigen::VectorXd > &x) const =0
 
virtual MatrixX< AutoDiffXdEvalConstraintJacobian (const Eigen::Ref< const AutoDiffVecXd > &x) const =0
 
- Protected Member Functions inherited from EvaluatorBase
 EvaluatorBase (int num_outputs, int num_vars, const std::string &description="")
 Constructs a evaluator. More...
 
void set_num_outputs (int num_outputs)
 

Detailed Description

This evaluator computes the generalized constraint force Jᵀλ ∈ ℝ ᴺᵛ, where Nᵥ is the size of the generalized velocities.

The Jacobian J may or may not depend on generalized position q and/or other variables.

Constructor & Destructor Documentation

◆ GeneralizedConstraintForceEvaluator()

GeneralizedConstraintForceEvaluator ( const RigidBodyTree< double > &  tree,
int  num_vars,
int  lambda_size 
)

Constructor.

Parameters
treeNote tree is aliased for the lifetime of of this object.
num_varsNumber of variables, including λ.
lambda_sizeλ is a lambda_size x 1 vector.
Note
the Jᵀλ ∈ ℝ ᴺᵛ, where Nᵥ is the size of the generalized velocities. So the size of the output vector is always Nᵥ. To evaluate Jᵀλ, it may or may not depend on variables such as contact force λ, generalized position q, or some additional variables, so the size of the input variable to this evaluator should be specified by the user.

◆ ~GeneralizedConstraintForceEvaluator()

Member Function Documentation

◆ ComposeEvalInputVector()

std::enable_if< is_eigen_vector_of<DerivedNonLambda, typename DerivedLambda::Scalar>::value && is_eigen_vector<DerivedLambda>::value, VectorX<typename DerivedLambda::Scalar> >::type ComposeEvalInputVector ( const Eigen::MatrixBase< DerivedNonLambda > &  non_lambda,
const Eigen::MatrixBase< DerivedLambda > &  lambda 
) const
inline

Compose the input x to the Eval function, given λ and the part of x that is not in λ.

This is a helper function, so that the user does not need to remember which part of x corresponds to λ, and which part corresponds to non-λ.

◆ DoEval() [1/3]

void DoEval ( const Eigen::Ref< const Eigen::VectorXd > &  x,
Eigen::VectorXd *  y 
) const
overrideprotectedvirtual

Implements expression evaluation for scalar type double.

Parameters
xInput vector.
yOutput vector.
Precondition
x must be of size num_vars x 1.
Postcondition
y will be of size num_outputs x 1.

Implements EvaluatorBase.

◆ DoEval() [2/3]

void DoEval ( const Eigen::Ref< const AutoDiffVecXd > &  x,
AutoDiffVecXd y 
) const
overrideprotectedvirtual

Implements expression evaluation for scalar type AutoDiffXd.

Parameters
xInput vector.
yOutput vector.
Precondition
x must be of size num_vars x 1.
Postcondition
y will be of size num_outputs x 1.

Implements EvaluatorBase.

◆ DoEval() [3/3]

void DoEval ( const Eigen::Ref< const VectorX< symbolic::Variable >> &  x,
VectorX< symbolic::Expression > *  y 
) const
inlineoverrideprotectedvirtual

Implements expression evaluation for scalar type symbolic::Expression.

Parameters
[in]xInput vector.
[out]yOutput vector.
Precondition
x must be of size num_vars x 1.
Postcondition
y will be of size num_outputs x 1.

Implements EvaluatorBase.

◆ DoEvalGeneric()

std::enable_if<std::is_same<typename DerivedX::Scalar, typename DerivedY::Scalar>::value && is_eigen_vector<DerivedX>::value && is_eigen_vector<DerivedY>::value>::type DoEvalGeneric ( const Eigen::MatrixBase< DerivedX > &  x,
Eigen::MatrixBase< DerivedY > *  y 
) const
inlineprotected

◆ EvalConstraintJacobian() [1/2]

virtual Eigen::MatrixXd EvalConstraintJacobian ( const Eigen::Ref< const Eigen::VectorXd > &  x) const
protectedpure virtual

◆ EvalConstraintJacobian() [2/2]

virtual MatrixX<AutoDiffXd> EvalConstraintJacobian ( const Eigen::Ref< const AutoDiffVecXd > &  x) const
protectedpure virtual

◆ GetLambdaFromEvalInputVector()

auto GetLambdaFromEvalInputVector ( const Eigen::MatrixBase< Derived > &  x) const
inline

Get the non-lambda part from the eval input vector.

◆ GetNonLambdaFromEvalInputVector()

auto GetNonLambdaFromEvalInputVector ( const Eigen::MatrixBase< Derived > &  x) const
inline

Get the lambda part from the eval input vector.

◆ lambda_size()

int lambda_size ( ) const
inline

Getter for lambda_size.

◆ non_lambda_size()

int non_lambda_size ( ) const
inline

Getter for the size of non_lambda part in the evaluator variables.

◆ tree()

const RigidBodyTree<double>* tree ( ) const
inline

Getter for the tree.


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