analytical constraints

class AbstractConstraintBase : public std::enable_shared_from_this<AbstractConstraintBase>

Generic interface for kinematic constraints.

Subclassed by jiminy::AbstractConstraintTpl< SphereConstraint >, jiminy::AbstractConstraintTpl< JointConstraint >, jiminy::AbstractConstraintTpl< DistanceConstraint >, jiminy::AbstractConstraintTpl< WheelConstraint >, jiminy::AbstractConstraintTpl< FrameConstraint >, jiminy::AbstractConstraintTpl< T >

Public Functions

explicit AbstractConstraintBase() = default
virtual ~AbstractConstraintBase()
virtual void reset(const Eigen::VectorXd &q, const Eigen::VectorXd &v) = 0

Refresh the internal buffers and proxies.

Remark

This method is not intended to be called manually. The Robot to which the constraint is added is taking care of it when its own reset method is called.

void enable()
void disable()
bool getIsEnabled() const
void setBaumgartePositionGain(double kp)
double getBaumgartePositionGain() const
void setBaumgarteVelocityGain(double kd)
double getBaumgarteVelocityGain() const
void setBaumgarteFreq(double freq)
double getBaumgarteFreq() const

Natural frequency of critically damping position/velocity error correction.

virtual void computeJacobianAndDrift(const Eigen::VectorXd &q, const Eigen::VectorXd &v) = 0

Compute the jacobian and drift of the constraint.

Note

To avoid redundant computations, it assumes that computeJointJacobians and framesForwardKinematics has already been called on model->pinocchioModel_.

Parameters:
  • q[in] Current joint position.

  • v[in] Current joint velocity.

virtual const std::string &getType() const = 0
uint64_t getDim() const

Dimension of the constraint.

const Eigen::MatrixXd &getJacobian() const

Jacobian of the constraint.

const Eigen::VectorXd &getDrift() const

Drift of the constraint.

Public Members

Eigen::VectorXd lambda_ = {}

Lambda multipliers.

class JointConstraint : public jiminy::AbstractConstraintTpl<JointConstraint>

Public Functions

inline auto shared_from_this()
explicit JointConstraint(const std::string &jointName) noexcept
Parameters:

jointName[in] Name of the joint.

virtual ~JointConstraint() = default
const std::string &getJointName() const noexcept
pinocchio::JointIndex getJointIndex() const noexcept
void setReferenceConfiguration(const Eigen::VectorXd &configurationRef) noexcept
const Eigen::VectorXd &getReferenceConfiguration() const noexcept
void setRotationDir(bool isReversed) noexcept
bool getRotationDir() noexcept
virtual void reset(const Eigen::VectorXd &q, const Eigen::VectorXd &v) final override

Refresh the internal buffers and proxies.

Remark

This method is not intended to be called manually. The Robot to which the constraint is added is taking care of it when its own reset method is called.

virtual void computeJacobianAndDrift(const Eigen::VectorXd &q, const Eigen::VectorXd &v) final override

Compute the jacobian and drift of the constraint.

Note

To avoid redundant computations, it assumes that computeJointJacobians and framesForwardKinematics has already been called on model->pinocchioModel_.

Parameters:
  • q[in] Current joint position.

  • v[in] Current joint velocity.

class FrameConstraint : public jiminy::AbstractConstraintTpl<FrameConstraint>

This class implements the constraint for fixing a given frame wrt world.

Public Functions

inline auto shared_from_this()
explicit FrameConstraint(const std::string &frameName, const std::array<bool, 6> &maskDoFs = {true, true, true, true, true, true}) noexcept
Parameters:

frameName[in] Name of the frame on which the constraint is to be applied.

virtual ~FrameConstraint() = default
const std::string &getFrameName() const noexcept
pinocchio::FrameIndex getFrameIndex() const noexcept
const std::vector<uint32_t> &getDofsFixed() const noexcept
void setReferenceTransform(const pinocchio::SE3 &transformRef) noexcept
const pinocchio::SE3 &getReferenceTransform() const noexcept
void setNormal(const Eigen::Vector3d &normal) noexcept
const Eigen::Matrix3d &getLocalFrame() const noexcept
virtual void reset(const Eigen::VectorXd &q, const Eigen::VectorXd &v) final override

Refresh the internal buffers and proxies.

Remark

This method is not intended to be called manually. The Robot to which the constraint is added is taking care of it when its own reset method is called.

virtual void computeJacobianAndDrift(const Eigen::VectorXd &q, const Eigen::VectorXd &v) final override

Compute the jacobian and drift of the constraint.

Note

To avoid redundant computations, it assumes that computeJointJacobians and framesForwardKinematics has already been called on model->pinocchioModel_.

Parameters:
  • q[in] Current joint position.

  • v[in] Current joint velocity.

class DistanceConstraint : public jiminy::AbstractConstraintTpl<DistanceConstraint>

Public Functions

inline auto shared_from_this()
explicit DistanceConstraint(const std::string &firstFrameName, const std::string &secondFrameName) noexcept
virtual ~DistanceConstraint() = default
const std::array<std::string, 2> &getFramesNames() const noexcept
const std::array<pinocchio::FrameIndex, 2> &getFrameIndices() const noexcept
void setReferenceDistance(double distanceRef)
double getReferenceDistance() const noexcept
virtual void reset(const Eigen::VectorXd &q, const Eigen::VectorXd &v) final override

Refresh the internal buffers and proxies.

Remark

This method is not intended to be called manually. The Robot to which the constraint is added is taking care of it when its own reset method is called.

virtual void computeJacobianAndDrift(const Eigen::VectorXd &q, const Eigen::VectorXd &v) final override

Compute the jacobian and drift of the constraint.

Note

To avoid redundant computations, it assumes that computeJointJacobians and framesForwardKinematics has already been called on model->pinocchioModel_.

Parameters:
  • q[in] Current joint position.

  • v[in] Current joint velocity.

class SphereConstraint : public jiminy::AbstractConstraintTpl<SphereConstraint>

Class constraining a sphere to roll without slipping on a flat plane.

Given a frame to represent the sphere center, this class constrains it to move like it were rolling without slipping on a flat (not necessarily level) surface.

Public Functions

inline auto shared_from_this()
SphereConstraint(const std::string &frameName, double sphereRadius, const Eigen::Vector3d &groundNormal = Eigen::Vector3d::UnitZ()) noexcept
Parameters:
  • frameName[in] Name of the frame representing the center of the sphere.

  • sphereRadius[in] Radius of the sphere (in m).

  • groundNormal[in] Normal to the ground in the world as a unit vector.

virtual ~SphereConstraint() = default
const std::string &getFrameName() const noexcept
pinocchio::FrameIndex getFrameIndex() const noexcept
void setReferenceTransform(const pinocchio::SE3 &transformRef) noexcept
const pinocchio::SE3 &getReferenceTransform() const noexcept
virtual void reset(const Eigen::VectorXd&, const Eigen::VectorXd&) final override

Refresh the internal buffers and proxies.

Remark

This method is not intended to be called manually. The Robot to which the constraint is added is taking care of it when its own reset method is called.

virtual void computeJacobianAndDrift(const Eigen::VectorXd &q, const Eigen::VectorXd &v) final override

Compute the jacobian and drift of the constraint.

Note

To avoid redundant computations, it assumes that computeJointJacobians and framesForwardKinematics has already been called on model->pinocchioModel_.

Parameters:
  • q[in] Current joint position.

  • v[in] Current joint velocity.

class WheelConstraint : public jiminy::AbstractConstraintTpl<WheelConstraint>

Class constraining a wheel to roll without slipping on a flat plane.

Given a frame to represent the wheel center, this class constrains it to move like it were rolling without slipping on a flat (not necessarily level) surface.

Public Functions

inline auto shared_from_this()
WheelConstraint(const std::string &frameName, double wheelRadius, const Eigen::Vector3d &groundNormal, const Eigen::Vector3d &wheelAxis) noexcept
Parameters:
  • frameName[in] Name of the frame representing the center of the wheel.

  • wheelRadius[in] Radius of the wheel (in m).

  • groundNormal[in] Normal to the ground in world frame as a unit vector.

  • wheelAxis[in] Axis of the wheel, in the local frame.

virtual ~WheelConstraint() = default
const std::string &getFrameName() const noexcept
pinocchio::FrameIndex getFrameIndex() const noexcept
void setReferenceTransform(const pinocchio::SE3 &transformRef) noexcept
const pinocchio::SE3 &getReferenceTransform() const noexcept
virtual void reset(const Eigen::VectorXd&, const Eigen::VectorXd&) final override

Refresh the internal buffers and proxies.

Remark

This method is not intended to be called manually. The Robot to which the constraint is added is taking care of it when its own reset method is called.

virtual void computeJacobianAndDrift(const Eigen::VectorXd &q, const Eigen::VectorXd &v) final override

Compute the jacobian and drift of the constraint.

Note

To avoid redundant computations, it assumes that computeJointJacobians and framesForwardKinematics has already been called on model->pinocchioModel_.

Parameters:
  • q[in] Current joint position.

  • v[in] Current joint velocity.