Module: MJEquality

class MJEquality : public MJObject<mjsEquality>
#include <MJEquality.h>

Represents a MuJoCo equality constraint.

This class provides functionality to manage an equality constraint in MuJoCo, allowing the constraint to be activated or deactivated as needed.

Subclassed by MJSingleJointEquality

Public Functions

inline MJEquality(mjsEquality *mjsequality, MJSpec &spec)

Constructs an MJEquality object with a given equality constraint.

Parameters:
  • mjsequality – Pointer to the MuJoCo equality constraint.

  • spec – Reference to the MJSpec object where this equality is defined.

void setActive(bool active)

Sets the active state of the equality constraint.

Parameters:

active – Boolean indicating whether the constraint should be active.

Protected Attributes

MJSpec &spec

Reference to the object where this equality is defined.

class MJSingleJointEquality : public MJEquality
#include <MJEquality.h>

Represents an equality constraint applied to a 1-degree-of-freedom joint.

This equality can be used to enforce a specific state on said joint.

For revolute joints, this is the angle (in radians) of the joint with respect to its zero-pose.

For linear joints, this is the displacement (in meters) of the joint with respect to its zero-pose.

Public Functions

void setJointOffsetConstraint(double val)

Sets the value that the state of the joint should have.

Parameters:

val – The value to apply to the joint constraint.

inline MJEquality(mjsEquality *mjsequality, MJSpec &spec)

Constructs an MJEquality object with a given equality constraint.

Parameters:
  • mjsequality – Pointer to the MuJoCo equality constraint.

  • spec – Reference to the MJSpec object where this equality is defined.