Aikido
aikido::constraint::uniform::RBoxConstraint< N > Class Template Reference

A BoxConstraint on RealVectorStates. More...

#include <aikido/constraint/uniform/RnBoxConstraint.hpp>

Inheritance diagram for aikido::constraint::uniform::RBoxConstraint< N >:
aikido::constraint::Differentiable aikido::constraint::Projectable aikido::constraint::Sampleable aikido::constraint::Testable

Public Types

using VectorNd = Eigen::Matrix< double, N, 1 >
 

Public Member Functions

 RBoxConstraint (std::shared_ptr< const statespace::R< N >> _space, std::unique_ptr< common::RNG > _rng, const VectorNd &_lowerLimits, const VectorNd &_upperLimits)
 Constructor. More...
 
statespace::ConstStateSpacePtr getStateSpace () const override
 Gets the StateSpace that this constraint operates on. More...
 
std::size_t getConstraintDimension () const override
 Size of constraints. More...
 
std::vector< constraint::ConstraintTypegetConstraintTypes () const override
 Returns a vector of constraints' types, i-th element correspoinding to the type of i-th constraint. More...
 
bool isSatisfied (const statespace::StateSpace::State *state, TestableOutcome *outcome=nullptr) const override
 Returns true if state satisfies this constraint. More...
 
std::unique_ptr< TestableOutcomecreateOutcome () const override
 Return an instance of DefaultTestableOutcome, since this class doesn't have a more specialized TestableOutcome derivative assigned to it. More...
 
bool project (const statespace::StateSpace::State *_s, statespace::StateSpace::State *_out) const override
 Projection _s to _out. 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...
 
std::unique_ptr< constraint::SampleGeneratorcreateSampleGenerator () const override
 Creates a SampleGenerator for sampling from this constraint. More...
 
auto getLowerLimits () const -> const VectorNd &
 Returns lower limits of this constraint. More...
 
auto getUpperLimits () const -> const VectorNd &
 Returns upper limits of this constraint. More...
 
- Public Member Functions inherited from aikido::constraint::Differentiable
virtual ~Differentiable ()=default
 Destructor. More...
 
virtual void getValueAndJacobian (const statespace::StateSpace::State *_s, Eigen::VectorXd &_val, Eigen::MatrixXd &_jac) const
 Get both Value and Jacobian. More...
 
- Public Member Functions inherited from aikido::constraint::Projectable
virtual ~Projectable ()=default
 
virtual bool project (statespace::StateSpace::State *_s) const
 Performs an in-place projection. More...
 
- Public Member Functions inherited from aikido::constraint::Sampleable
virtual ~Sampleable ()=default
 
- Public Member Functions inherited from aikido::constraint::Testable
virtual ~Testable ()=default
 

Private Attributes

std::shared_ptr< const statespace::R< N > > mSpace
 
std::unique_ptr< common::RNGmRng
 
VectorNd mLowerLimits
 
VectorNd mUpperLimits
 

Detailed Description

template<int N>
class aikido::constraint::uniform::RBoxConstraint< N >

A BoxConstraint on RealVectorStates.

For each dimension, this constraint has lowerLimit and upperLimit.

Member Typedef Documentation

◆ VectorNd

template<int N>
using aikido::constraint::uniform::RBoxConstraint< N >::VectorNd = Eigen::Matrix<double, N, 1>

Constructor & Destructor Documentation

◆ RBoxConstraint()

template<int N>
aikido::constraint::uniform::RBoxConstraint< N >::RBoxConstraint ( std::shared_ptr< const statespace::R< N >>  _space,
std::unique_ptr< common::RNG _rng,
const VectorNd _lowerLimits,
const VectorNd _upperLimits 
)

Constructor.

Parameters
_spaceSpace in which this constraint operates.
_rngRandom number generator to be used for sampling.
_lowerLimitsLower limits on the states. The length of this vector should match the dimension of _space.
_upperLimitsUpper limits. The length of this vector should match the dimension of _space.

Member Function Documentation

◆ createOutcome()

template<int N>
std::unique_ptr< TestableOutcome > aikido::constraint::uniform::RBoxConstraint< N >::createOutcome
overridevirtual

Return an instance of DefaultTestableOutcome, since this class doesn't have a more specialized TestableOutcome derivative assigned to it.

Implements aikido::constraint::Testable.

◆ createSampleGenerator()

template<int N>
std::unique_ptr< constraint::SampleGenerator > aikido::constraint::uniform::RBoxConstraint< N >::createSampleGenerator ( ) const
overridevirtual

Creates a SampleGenerator for sampling from this constraint.

Implements aikido::constraint::Sampleable.

◆ getConstraintDimension()

template<int N>
std::size_t aikido::constraint::uniform::RBoxConstraint< N >::getConstraintDimension ( ) const
overridevirtual

Size of constraints.

Implements aikido::constraint::Differentiable.

◆ getConstraintTypes()

template<int N>
std::vector< ConstraintType > aikido::constraint::uniform::RBoxConstraint< N >::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()

template<int N>
void aikido::constraint::uniform::RBoxConstraint< N >::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.

◆ getLowerLimits()

template<int N>
auto aikido::constraint::uniform::RBoxConstraint< N >::getLowerLimits

Returns lower limits of this constraint.

◆ getStateSpace()

template<int N>
statespace::ConstStateSpacePtr aikido::constraint::uniform::RBoxConstraint< N >::getStateSpace ( ) const
overridevirtual

Gets the StateSpace that this constraint operates on.

Implements aikido::constraint::Differentiable.

◆ getUpperLimits()

template<int N>
auto aikido::constraint::uniform::RBoxConstraint< N >::getUpperLimits

Returns upper limits of this constraint.

◆ getValue()

template<int N>
void aikido::constraint::uniform::RBoxConstraint< N >::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.

◆ isSatisfied()

template<int N>
bool aikido::constraint::uniform::RBoxConstraint< N >::isSatisfied ( const statespace::StateSpace::State _state,
TestableOutcome outcome = nullptr 
) const
overridevirtual

Returns true if state satisfies this constraint.

Parameters
[in]_stategiven state to test.
[in]outcomepointer to TestableOutcome derivative instance that method will populate with useful information. Each derivative class of Testable may expect outcome to be a different derivative class of TestableOutcome (this casting and population is done under the hood). If this argument is missing, it is ignored.

Implements aikido::constraint::Testable.

◆ project()

template<int N>
bool aikido::constraint::uniform::RBoxConstraint< N >::project ( const statespace::StateSpace::State _s,
statespace::StateSpace::State _out 
) const
overridevirtual

Projection _s to _out.

Returns false if projection cannot be done.

Parameters
_sstate to be projected.
_outresulting projection.

Implements aikido::constraint::Projectable.

Member Data Documentation

◆ mLowerLimits

template<int N>
VectorNd aikido::constraint::uniform::RBoxConstraint< N >::mLowerLimits
private

◆ mRng

template<int N>
std::unique_ptr<common::RNG> aikido::constraint::uniform::RBoxConstraint< N >::mRng
private

◆ mSpace

template<int N>
std::shared_ptr<const statespace::R<N> > aikido::constraint::uniform::RBoxConstraint< N >::mSpace
private

◆ mUpperLimits

template<int N>
VectorNd aikido::constraint::uniform::RBoxConstraint< N >::mUpperLimits
private