internal::kinematics::TransformConstraint class

Class representing a constraint (full or partial) on a transform between a given frame and the absolute frame.

The constraint can be of the following type, where we indicate with $A$ the absolute (world) frame and with $C$ the constrained frame.

Full Transform constraint: the transform ${}^A H_C$ is constrained to a given constant value. Rotation Constraint: the rotation ${}^A R_C$ is constrained to a given constant value. Position Constraint: the linear position ${}^A o_C$ is constrained to a given constant value.

Public types

enum TransformConstraintType { TransformConstraintTypePosition, TransformConstraintTypeRotation, TransformConstraintTypeFullTransform }
Type of the trasform constraint.

Public static functions

static auto positionConstraint(const std::string& frameName, const iDynTree::Position& position, const double posWeight = 1.0) -> TransformConstraint
create a position constraint for the specified frame
static auto rotationConstraint(const std::string& frameName, const iDynTree::Rotation& rotation, const double rotWeight = 1.0) -> TransformConstraint
create an orientation constraint for the specified frame
static auto fullTransformConstraint(const std::string& constrainedFrameName, const iDynTree::Position& position, const iDynTree::Rotation& rotation, const double posWeight = 1.0, const double rotWeight = 1.0) -> TransformConstraint
create a full Transform constraint for the specified frame
static auto fullTransformConstraint(const std::string& constrainedFrameName, const iDynTree::Transform& transform, const double posWeight = 1.0, const double rotWeight = 1.0) -> TransformConstraint
create a full Transform constraint for the specified frame

Public functions

auto getSize() const -> unsigned
return the size of the constraint identified by this Constrained
auto getType() const -> TransformConstraint::TransformConstraintType
auto hasPositionConstraint() const -> bool
auto hasRotationConstraint() const -> bool
auto getPosition() const -> const iDynTree::Position&
void setPosition(const iDynTree::Position& newPos)
auto getRotation() const -> const iDynTree::Rotation&
void setRotation(const iDynTree::Rotation& newRot)
auto getTransform() const -> const iDynTree::Transform&
auto getFrameName() const -> const std::string&
auto getPositionWeight() const -> const double
void setPositionWeight(const double newPosWeight)
auto getRotationWeight() const -> const double
void setRotationWeight(const double newRotWeight)
void setTargetResolutionMode(enum iDynTree::InverseKinematicsTreatTargetAsConstraint mode)
auto targetResolutionMode() const -> enum iDynTree::InverseKinematicsTreatTargetAsConstraint
void setActive(const bool isActive)
auto isActive() const -> bool

Enum documentation

enum internal::kinematics::TransformConstraint::TransformConstraintType

Type of the trasform constraint.

Enumerators
TransformConstraintTypePosition

The trasform is related only to the position component (origin of the frame)

TransformConstraintTypeRotation

The trasform is related only to the orientation component

TransformConstraintTypeFullTransform

The full trasform is considered

Function documentation

static TransformConstraint internal::kinematics::TransformConstraint::positionConstraint(const std::string& frameName, const iDynTree::Position& position, const double posWeight = 1.0)

create a position constraint for the specified frame

Parameters
frameName
position the position to be considered as constraint for the frame
posWeight the weight of the position cost if the position is associated with a cost
Returns a newly created TransformConstraint object

Is the constraint active or not?

static TransformConstraint internal::kinematics::TransformConstraint::rotationConstraint(const std::string& frameName, const iDynTree::Rotation& rotation, const double rotWeight = 1.0)

create an orientation constraint for the specified frame

Parameters
frameName
rotation the rotation to be considered as constraint for the frame
rotWeight the weight of the rotation cost if the rotation is associated with a cost
Returns a newly created Transform object

static TransformConstraint internal::kinematics::TransformConstraint::fullTransformConstraint(const std::string& constrainedFrameName, const iDynTree::Position& position, const iDynTree::Rotation& rotation, const double posWeight = 1.0, const double rotWeight = 1.0)

create a full Transform constraint for the specified frame

Parameters
constrainedFrameName the name of the constrained frame, i.e. C
position the position to be considered as constraint for the frame
rotation the rotation to be considered as constraint for the frame
posWeight the weight of the position cost if the position is associated with a cost
rotWeight the weight of the rotation cost if the rotation is associated with a cost
Returns a newly created Transform object

Equivalent to

iDynTree::Transform transform(rotation, position);
fullTransformConstraint(frameName, transform);

static TransformConstraint internal::kinematics::TransformConstraint::fullTransformConstraint(const std::string& constrainedFrameName, const iDynTree::Transform& transform, const double posWeight = 1.0, const double rotWeight = 1.0)

create a full Transform constraint for the specified frame

Parameters
constrainedFrameName the name of the constrained frame, i.e. C
transform the transform to be considered as constraint for the frame
posWeight the weight of the position cost if the position is associated with a cost
rotWeight the weight of the rotation cost if the rotation is associated with a cost
Returns a newly created Transform object

Equivalent to fullTransformConstraint(frameName, transform.getPosition(), transform.getRotation());

unsigned internal::kinematics::TransformConstraint::getSize() const

return the size of the constraint identified by this Constrained

Returns size of the constraint

TransformConstraint::TransformConstraintType internal::kinematics::TransformConstraint::getType() const

Returns the transform type

return the current type of TransformConstraint

bool internal::kinematics::TransformConstraint::hasPositionConstraint() const

Returns true if the TransformConstraint has a component in the position part. False otherwise

Return if the current TransformConstraint has a position constraint

bool internal::kinematics::TransformConstraint::hasRotationConstraint() const

Returns true if the TransformConstraint has a component in the rotation part. False otherwise

Return if the current TransformConstraint has a rotation constraint

const iDynTree::Position& internal::kinematics::TransformConstraint::getPosition() const

Returns the transform position component

Return the position component of the current constrained value of the Transform.

void internal::kinematics::TransformConstraint::setPosition(const iDynTree::Position& newPos)

Set the position component of the current constrained value of the Transform.

const iDynTree::Rotation& internal::kinematics::TransformConstraint::getRotation() const

Returns the transform rotation component

Return the rotation component of the current constrained value of the Transform.

void internal::kinematics::TransformConstraint::setRotation(const iDynTree::Rotation& newRot)

Set the rotation component of the current constrained value of the Transform.

const iDynTree::Transform& internal::kinematics::TransformConstraint::getTransform() const

Returns the transform

Return the current constrained value of the Transform.

const std::string& internal::kinematics::TransformConstraint::getFrameName() const

Returns the transform frame name

Return the name of the constrained frame

const double internal::kinematics::TransformConstraint::getPositionWeight() const

Returns the weight for the position

Return the weight for the position

void internal::kinematics::TransformConstraint::setPositionWeight(const double newPosWeight)

Set the weight for the position

const double internal::kinematics::TransformConstraint::getRotationWeight() const

Returns the weight for the rotation

Return the weight for the rotation

void internal::kinematics::TransformConstraint::setRotationWeight(const double newRotWeight)

Set the weight for the position

void internal::kinematics::TransformConstraint::setTargetResolutionMode(enum iDynTree::InverseKinematicsTreatTargetAsConstraint mode)

Parameters
mode how to treat the targets

Set how targets should be considered in the optimization problem i.e. as soft or hard constraints

enum iDynTree::InverseKinematicsTreatTargetAsConstraint internal::kinematics::TransformConstraint::targetResolutionMode() const

Returns the current rotation parametrization

Return the current rotation parametrization used by the solver

void internal::kinematics::TransformConstraint::setActive(const bool isActive)

Set if the task is active or not

bool internal::kinematics::TransformConstraint::isActive() const

Get if the task is active or not