Aikido
aikido::constraint::DifferentiableSubspace Class Reference

A differentiable constraint applied only on a subspace of a CompoundState. More...

#include <aikido/constraint/DifferentiableSubspace.hpp>

Inheritance diagram for aikido::constraint::DifferentiableSubspace:
aikido::constraint::Differentiable

Public Member Functions

 DifferentiableSubspace (std::shared_ptr< const statespace::CartesianProduct > _stateSpace, DifferentiablePtr _constraint, std::size_t _index)
 Apply _constraint to the i-th subspace of _stateSpace. More...
 
virtual ~DifferentiableSubspace ()=default
 
statespace::ConstStateSpacePtr getStateSpace () const override
 Gets the StateSpace that this constraint operates on. More...
 
std::vector< ConstraintTypegetConstraintTypes () const override
 Returns a vector of constraints' types, i-th element correspoinding to the type of i-th constraint. More...
 
std::size_t getConstraintDimension () const override
 Size of constraints. More...
 
void getValue (const statespace::StateSpace::State *_s, Eigen::VectorXd &_out) const override
 Get the value of constraints at _s. More...
 
void getJacobian (const statespace::StateSpace::State *_s, Eigen::MatrixXd &_out) const override
 Get the jacobian of constraints evaluated at _s, expressed in the frame each state space is expressed in). More...
 
void getValueAndJacobian (const statespace::StateSpace::State *_s, Eigen::VectorXd &_val, Eigen::MatrixXd &_jac) const override
 Get both Value and Jacobian. More...
 
- Public Member Functions inherited from aikido::constraint::Differentiable
virtual ~Differentiable ()=default
 Destructor. More...
 

Private Attributes

std::shared_ptr< const statespace::CartesianProductmStateSpace
 
DifferentiablePtr mConstraint
 
std::size_t mIndex
 

Detailed Description

A differentiable constraint applied only on a subspace of a CompoundState.

Constructor & Destructor Documentation

◆ DifferentiableSubspace()

aikido::constraint::DifferentiableSubspace::DifferentiableSubspace ( std::shared_ptr< const statespace::CartesianProduct _stateSpace,
DifferentiablePtr  _constraint,
std::size_t  _index 
)

Apply _constraint to the i-th subspace of _stateSpace.

Parameters
_stateSpaceCartesianProduct.
_constraintConstraint being applied.
_indexSubspace of _stateSpace to apply _constraint.

◆ ~DifferentiableSubspace()

virtual aikido::constraint::DifferentiableSubspace::~DifferentiableSubspace ( )
virtualdefault

Member Function Documentation

◆ getConstraintDimension()

std::size_t aikido::constraint::DifferentiableSubspace::getConstraintDimension ( ) const
overridevirtual

Size of constraints.

Implements aikido::constraint::Differentiable.

◆ getConstraintTypes()

std::vector<ConstraintType> aikido::constraint::DifferentiableSubspace::getConstraintTypes ( ) const
overridevirtual

Returns a vector of constraints' types, i-th element correspoinding to the type of i-th constraint.

Implements aikido::constraint::Differentiable.

◆ getJacobian()

void aikido::constraint::DifferentiableSubspace::getJacobian ( const statespace::StateSpace::State _s,
Eigen::MatrixXd &  _out 
) const
overridevirtual

Get the jacobian of constraints evaluated at _s, expressed in the frame each state space is expressed in).

Parameters
_sState to be evaluated at.
[out]_outJacobian matrix. The dimension should be the following: SO3 StateSpace : m x 3 SO2 : m x 1 SE2 : m x 3 SE3 : m x 6 Rn : m x n CartesianProduct: m x k (k = sum of all state jacobian cols) If Matrix of incorrect dimension is given, false will be returned.

Implements aikido::constraint::Differentiable.

◆ getStateSpace()

statespace::ConstStateSpacePtr aikido::constraint::DifferentiableSubspace::getStateSpace ( ) const
overridevirtual

Gets the StateSpace that this constraint operates on.

Implements aikido::constraint::Differentiable.

◆ getValue()

void aikido::constraint::DifferentiableSubspace::getValue ( const statespace::StateSpace::State _s,
Eigen::VectorXd &  _out 
) const
overridevirtual

Get the value of constraints at _s.

Should be 0 to satisfy equality constraints. Should be <=0 to satisfy inequality constraints.

Parameters
_sState to be evaluated at.
[out]_outVector to store the value. Length should match the number of constraints.

Implements aikido::constraint::Differentiable.

◆ getValueAndJacobian()

void aikido::constraint::DifferentiableSubspace::getValueAndJacobian ( const statespace::StateSpace::State _s,
Eigen::VectorXd &  _val,
Eigen::MatrixXd &  _jac 
) const
overridevirtual

Get both Value and Jacobian.

Parameters
_sState to be evaluated.
[out]_valValue of constraints.
[out]_jacJacoiban of constraints.

Reimplemented from aikido::constraint::Differentiable.

Member Data Documentation

◆ mConstraint

DifferentiablePtr aikido::constraint::DifferentiableSubspace::mConstraint
private

◆ mIndex

std::size_t aikido::constraint::DifferentiableSubspace::mIndex
private

◆ mStateSpace

std::shared_ptr<const statespace::CartesianProduct> aikido::constraint::DifferentiableSubspace::mStateSpace
private