Class PositionBasedRigidBodyDynamics
Defined in File PositionBasedRigidBodyDynamics.h
Class Documentation
-
class PositionBasedRigidBodyDynamics
Public Static Functions
-
static bool init_BallJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, const Vector3r &jointPosition, Eigen::Matrix<Real, 3, 4, Eigen::DontAlign> &jointInfo)
Initialize ball joint and return info which is required by the solver step.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
jointPosition – position of ball joint
jointInfo – Stores the local and global positions of the connector points. The first two columns store the local connectors in body 0 and 1, respectively, while the last two columns contain the global connector positions which have to be updated in each simulation step by calling update_BallJoint()
.
The joint info contains the following columns:
0: connector in body 0 (local)
1: connector in body 1 (local)
2: connector in body 0 (global)
3: connector in body 1 (global)
-
static bool update_BallJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, Eigen::Matrix<Real, 3, 4, Eigen::DontAlign> &ballJointInfo)
Update ball joint info which is required by the solver step. The ball joint info must be generated in the initialization process of the model by calling the function init_BallJoint(). This method should be called once per simulation step before executing the solver.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
ballJointInfo – ball joint information which should be updated
-
static bool solve_BallJoint(const Real invMass0, const Vector3r &x0, const Matrix3r &inertiaInverseW0, const Quaternionr &q0, const Real invMass1, const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Eigen::Matrix<Real, 3, 4, Eigen::DontAlign> &ballJointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1)
Perform a solver step for a ball joint which links two rigid bodies. A ball joint removes three translational degrees of freedom between the bodies. The ball joint info must be generated in the initialization process of the model by calling the function init_BallJoint() and updated each time the bodies change their state by update_BallJoint()
.
More information can be found in:
[7]- Parameters
invMass0 – inverse mass of first body
x0 – center of mass of first body
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
q0 – rotation of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
q1 – rotation of second body
ballJointInfo – Ball joint information which is required by the solver. This information must be generated in the beginning by calling init_BallJoint() and updated each time the bodies change their state by update_BallJoint().
corr_x0 – position correction of center of mass of first body
corr_q0 – rotation correction of first body
corr_x1 – position correction of center of mass of second body
corr_q1 – rotation correction of second body
-
static bool init_BallOnLineJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, const Vector3r &position, const Vector3r &direction, Eigen::Matrix<Real, 3, 10, Eigen::DontAlign> &jointInfo)
Initialize ball-on-line-joint and return information which is required by the solver step.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
position – position of joint
direction – direction of line
jointInfo – Stores the local and global positions of the connector points. The first two columns store the local connectors in body 0 and 1, respectively. The next three columns contain a coordinate system for the constraint correction (a full coordinate system where the x-axis is the slider axis) in local coordinates. The last five columns contain the global connector positions and the constraint coordinate system in world space which have to be updated in each simulation step by calling update_BallOnLineJoint()
.
The joint info contains the following columns:
0: connector in body 0 (local)
1: connector in body 1 (local)
2-4: coordinate system of body 0 (local)
5: connector in body 0 (global)
6: connector in body 1 (global)
7-9: coordinate system of body 0 (global)
-
static bool update_BallOnLineJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, Eigen::Matrix<Real, 3, 10, Eigen::DontAlign> &jointInfo)
Update ball-on-line-joint information which is required by the solver step. The ball-on-line-joint info must be generated in the initialization process of the model by calling the function init_BallOnLineJoint(). This method should be called once per simulation step before executing the solver.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
jointInfo – ball-on-line-joint information which should be updated
-
static bool solve_BallOnLineJoint(const Real invMass0, const Vector3r &x0, const Matrix3r &inertiaInverseW0, const Quaternionr &q0, const Real invMass1, const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Eigen::Matrix<Real, 3, 10, Eigen::DontAlign> &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1)
Perform a solver step for a ball-on-line-joint which links two rigid bodies. A ball-on-line-joint removes two translational degrees of freedom between the bodies. The joint info must be generated in the initialization process of the model by calling the function init_BallOnLineJoint() and updated each time the bodies change their state by update_BallOnLineJoint()
.
More information can be found in:
[7]- Parameters
invMass0 – inverse mass of first body
x0 – center of mass of first body
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
q0 – rotation of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
q1 – rotation of second body
jointInfo – Ball joint information which is required by the solver. This information must be generated in the beginning by calling init_BallJoint() and updated each time the bodies change their state by update_BallJoint().
corr_x0 – position correction of center of mass of first body
corr_q0 – rotation correction of first body
corr_x1 – position correction of center of mass of second body
corr_q1 – rotation correction of second body
-
static bool init_HingeJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, const Vector3r &hingeJointPosition, const Vector3r &hingeJointAxis, Eigen::Matrix<Real, 4, 7, Eigen::DontAlign> &hingeJointInfo)
Initialize hinge joint and return info which is required by the solver step.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
hingeJointPosition – position of hinge joint
hingeJointAxis – axis of hinge joint
hingeJointInfo –
Stores the local and global positions of the connector points. The joint info contains the following columns:
0-1: projection matrix Pr for the rotational part
2: connector in body 0 (local)
3: connector in body 1 (local)
4: connector in body 0 (global)
5: connector in body 1 (global)
6: hinge axis in body 0 (local) used for rendering
The joint info stores first the info of the first body (the connector point and a full coordinate system where the x-axis is the hinge axis) and then the info of the second body (the connector point and the hinge axis). The info must be updated in each simulation step by calling
update_HingeJoint().
-
static bool update_HingeJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, Eigen::Matrix<Real, 4, 7, Eigen::DontAlign> &hingeJointInfo)
Update hinge joint info which is required by the solver step. The joint info must be generated in the initialization process of the model by calling the function init_HingeJoint(). This method should be called once per simulation step before executing the solver.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
hingeJointInfo – hinge joint information which should be updated
-
static bool solve_HingeJoint(const Real invMass0, const Vector3r &x0, const Matrix3r &inertiaInverseW0, const Quaternionr &q0, const Real invMass1, const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Eigen::Matrix<Real, 4, 7, Eigen::DontAlign> &hingeJointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1)
Perform a solver step for a hinge joint which links two rigid bodies. A hinge joint removes three translational and two rotational degrees of freedom between the bodies. The hinge joint info must be generated in the initialization process of the model by calling the function init_HingeJoint() and updated each time the bodies change their state by update_HingeJoint()
.
More information can be found in:
[7]- Parameters
invMass0 – inverse mass of first body
x0 – center of mass of first body
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
q0 – rotation of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
q1 – rotation of second body
hingeJointInfo – Hinge joint information which is required by the solver. This information must be generated in the beginning by calling init_HingeJoint() and updated each time the bodies change their state by update_HingeJoint().
corr_x0 – position correction of center of mass of first body
corr_q0 – rotation correction of first body
corr_x1 – position correction of center of mass of second body
corr_q1 – rotation correction of second body
-
static bool init_UniversalJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, const Vector3r &jointPosition, const Vector3r &jointAxis0, const Vector3r &jointAxis1, Eigen::Matrix<Real, 3, 8, Eigen::DontAlign> &jointInfo)
Initialize universal joint and return info which is required by the solver step.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
jointPosition – position of universal joint
jointAxis0 – first axis of universal joint
jointAxis1 – second axis of universal joint
jointInfo –
Stores the local and global positions of the connector points. The joint info contains the following columns:
0: connector in body 0 (local)
1: connector in body 1 (local)
2: constraint axis 0 in body 0 (local)
3: constraint axis 1 in body 1 (local)
4: connector in body 0 (global)
5: connector in body 1 (global)
6: constraint axis 0 in body 0 (global)
7: constraint axis 1 in body 1 (global)
The info must be updated in each simulation step by calling
update_UniversalJoint().
-
static bool update_UniversalJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, Eigen::Matrix<Real, 3, 8, Eigen::DontAlign> &jointInfo)
Update universal joint info which is required by the solver step. The joint info must be generated in the initializatgion process of the model by calling the function init_UniversalJoint(). This method should be called once per simulation step before executing the solver.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
jointInfo – universal joint information which should be updated
-
static bool solve_UniversalJoint(const Real invMass0, const Vector3r &x0, const Matrix3r &inertiaInverseW0, const Quaternionr &q0, const Real invMass1, const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Eigen::Matrix<Real, 3, 8, Eigen::DontAlign> &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1)
Perform a solver step for a universal joint which links two rigid bodies. A universal joint removes three translational and one rotational degree of freedom between the bodies. The universal joint info must be generated in the initialization process of the model by calling the function init_UniversalJoint() and updated each time the bodies change their state by update_UniversalJoint()
.
More information can be found in:
[7]- Parameters
invMass0 – inverse mass of first body
x0 – center of mass of first body
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
q0 – rotation of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
q1 – rotation of second body
jointInfo – Universal joint information which is required by the solver. This information must be generated in the beginning by calling init_UniversalJoint() and updated each time the bodies change their state by update_UniversalJoint().
corr_x0 – position correction of center of mass of first body
corr_q0 – rotation correction of first body
corr_x1 – position correction of center of mass of second body
corr_q1 – rotation correction of second body
-
static bool init_SliderJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, const Vector3r &sliderJointAxis, Eigen::Matrix<Real, 4, 6, Eigen::DontAlign> &jointInfo)
Initialize slider joint and return info which is required by the solver step.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
sliderJointAxis – axis of slider joint
jointInfo –
Stores the local and global positions of the connector points. The joint info contains the following columns:
jointInfo contains
0: coordinate system in body 0, where the x-axis is the slider axis (local)
1: coordinate system in body 0, where the x-axis is the slider axis (global)
2: 2D vector d = P * (x0 - x1), where P projects the vector onto a plane perpendicular to the slider axis
3-5: projection matrix Pr for the rotational part
The info must be updated in each simulation step by calling update_SliderJoint().
-
static bool update_SliderJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, Eigen::Matrix<Real, 4, 6, Eigen::DontAlign> &jointInfo)
Update slider joint info which is required by the solver step. The joint info must be generated in the initialization process of the model by calling the function init_SliderJoint(). This method should be called once per simulation step before executing the solver.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
jointInfo – slider joint information which should be updated
-
static bool solve_SliderJoint(const Real invMass0, const Vector3r &x0, const Matrix3r &inertiaInverseW0, const Quaternionr &q0, const Real invMass1, const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Eigen::Matrix<Real, 4, 6, Eigen::DontAlign> &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1)
Perform a solver step for a slider joint which links two rigid bodies. A slider joint removes two translational and three rotational degrees of freedom between the bodies. The slider joint info must be generated in the initialization process of the model by calling the function init_SliderJoint() and updated each time the bodies change their state by update_SliderJoint()
.
More information can be found in:
[7]- Parameters
invMass0 – inverse mass of first body
x0 – center of mass of first body
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
q0 – rotation of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
q1 – rotation of second body
jointInfo – Slider joint information which is required by the solver. This information must be generated in the beginning by calling init_SliderJoint() and updated each time the bodies change their state by update_SliderJoint().
corr_x0 – position correction of center of mass of first body
corr_q0 – rotation correction of first body
corr_x1 – position correction of center of mass of second body
corr_q1 – rotation correction of second body
-
static bool init_TargetPositionMotorSliderJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, const Vector3r &sliderJointAxis, Eigen::Matrix<Real, 4, 6, Eigen::DontAlign> &jointInfo)
Initialize a motor slider joint which is able to enforce a target position and return info which is required by the solver step.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
sliderJointAxis – axis of slider joint
jointInfo –
Stores the local and global positions of the connector points. The joint info contains the following columns:
0: slider axis in body 0 (local)
1: slider axis in body 0 (global)
2: distance vector d = (x0 - x1)
3-5: projection matrix Pr for the rotational part
The info must be updated in each simulation step by calling
update_TargetPositionMotorSliderJoint().
-
static bool update_TargetPositionMotorSliderJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, Eigen::Matrix<Real, 4, 6, Eigen::DontAlign> &jointInfo)
Update motor slider joint info which is required by the solver step. The joint info must be generated in the initialization process of the model by calling the function init_TargetPositionMotorSliderJoint(). This method should be called once per simulation step before executing the solver.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
jointInfo – slider joint information which should be updated
-
static bool solve_TargetPositionMotorSliderJoint(const Real invMass0, const Vector3r &x0, const Matrix3r &inertiaInverseW0, const Quaternionr &q0, const Real invMass1, const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Real targetPosition, const Eigen::Matrix<Real, 4, 6, Eigen::DontAlign> &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1)
Perform a solver step for a motor slider joint which links two rigid bodies. A motor slider joint removes two translational and three rotational degrees of freedom between the bodies. Moreover, a target position can be enforced on the remaining translation axis. The motor slider joint info must be generated in the initialization process of the model by calling the function init_TargetPositionMotorSliderJoint() and updated each time the bodies change their state by update_TargetPositionMotorSliderJoint()
.
More information can be found in:
[7]- Parameters
invMass0 – inverse mass of first body
x0 – center of mass of first body
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
q0 – rotation of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
q1 – rotation of second body
targetPosition – target position of the servo motor
jointInfo – Motor slider joint information which is required by the solver. This information must be generated in the beginning by calling init_TargetPositionMotorSliderJoint() and updated each time the bodies change their state by update_TargetPositionMotorSliderJoint().
corr_x0 – position correction of center of mass of first body
corr_q0 – rotation correction of first body
corr_x1 – position correction of center of mass of second body
corr_q1 – rotation correction of second body
-
static bool init_TargetVelocityMotorSliderJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, const Vector3r &sliderJointAxis, Eigen::Matrix<Real, 4, 6, Eigen::DontAlign> &jointInfo)
Initialize a motor slider joint which is able to enforce a target velocity and return info which is required by the solver step.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
sliderJointAxis – axis of slider joint
jointInfo –
Stores the local and global positions of the connector points. The joint info contains the following columns:
0: coordinate system in body 0, where the x-axis is the slider axis (local)
1: coordinate system in body 0, where the x-axis is the slider axis (global)
2: 2D vector d = P * (x0 - x1), where P projects the vector onto a plane perpendicular to the slider axis
3-5: projection matrix Pr for the rotational part
The info must be updated in each simulation step by calling
update_TargetVelocityMotorSliderJoint().
-
static bool update_TargetVelocityMotorSliderJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, Eigen::Matrix<Real, 4, 6, Eigen::DontAlign> &jointInfo)
Update motor slider joint info which is required by the solver step. The joint info must be generated in the initialization process of the model by calling the function init_TargetVelocityMotorSliderJoint(). This method should be called once per simulation step before executing the solver.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
jointInfo – slider joint information which should be updated
-
static bool solve_TargetVelocityMotorSliderJoint(const Real invMass0, const Vector3r &x0, const Matrix3r &inertiaInverseW0, const Quaternionr &q0, const Real invMass1, const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Eigen::Matrix<Real, 4, 6, Eigen::DontAlign> &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1)
Perform a solver step for a motor slider joint which links two rigid bodies. A motor slider joint removes two translational and three rotational degrees of freedom between the bodies. Moreover, a target velocity can be enforced on the remaining translation axis. The motor slider joint info must be generated in the initialization process of the model by calling the function init_TargetVelocityMotorSliderJoint() and updated each time the bodies change their state by update_TargetVelocityMotorSliderJoint()
.
More information can be found in:
[7]- Parameters
invMass0 – inverse mass of first body
x0 – center of mass of first body
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
q0 – rotation of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
q1 – rotation of second body
jointInfo – Motor slider joint information which is required by the solver. This information must be generated in the beginning by calling init_TargetVelocityMotorSliderJoint() and updated each time the bodies change their state by update_TargetVelocityMotorSliderJoint().
corr_x0 – position correction of center of mass of first body
corr_q0 – rotation correction of first body
corr_x1 – position correction of center of mass of second body
corr_q1 – rotation correction of second body
-
static bool velocitySolve_TargetVelocityMotorSliderJoint(const Real invMass0, const Vector3r &x0, const Vector3r &v0, const Matrix3r &inertiaInverseW0, const Quaternionr &q0, const Vector3r &omega0, const Real invMass1, const Vector3r &x1, const Vector3r &v1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Vector3r &omega1, const Real targetVelocity, const Eigen::Matrix<Real, 4, 6, Eigen::DontAlign> &jointInfo, Vector3r &corr_v0, Vector3r &corr_omega0, Vector3r &corr_v1, Vector3r &corr_omega1)
Perform a velocity solver step for a motor slider joint which links two rigid bodies. A motor slider joint removes two translational and three rotational degrees of freedom between the bodies. Moreover, a target velocity can be enforced on the remaining translation axis. The motor slider joint info must be generated in the initialization process of the model by calling the function init_TargetVelocityMotorSliderJoint() and updated each time the bodies change their state by update_TargetVelocityMotorSliderJoint()
.
More information can be found in:
[7]- Parameters
invMass0 – inverse mass of first body
x0 – center of mass of first body
v0 – velocity of body 0
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
q0 – rotation of first body
omega0 – angular velocity of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
v1 – velocity of body 1
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
q1 – rotation of second body
omega1 – angular velocity of second body
targetVelocity – target velocity of the motor
jointInfo – Motor slider joint information which is required by the solver. This information must be generated in the beginning by calling init_TargetVelocityMotorSliderJoint() and updated each time the bodies change their state by update_TargetVelocityMotorSliderJoint().
corr_v0 – velocity correction of first body
corr_omega0 – angular velocity correction of first body
corr_v1 – velocity correction of second body
corr_omega1 – angular velocity correction of second body
-
static bool init_TargetAngleMotorHingeJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, const Vector3r &hingeJointPosition, const Vector3r &hingeJointAxis, Eigen::Matrix<Real, 4, 8, Eigen::DontAlign> &jointInfo)
Initialize a motor hinge joint which is able to enforce a target angle and return info which is required by the solver step.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
hingeJointPosition – position of hinge joint
hingeJointAxis – axis of hinge joint
jointInfo –
Stores the local and global positions of the connector points. The joint info contains the following columns:
0-2: projection matrix Pr for the rotational part
3: connector in body 0 (local)
4: connector in body 1 (local)
5: connector in body 0 (global)
6: connector in body 1 (global)
7: hinge axis in body 0 (local) used for rendering
The info must be updated in each simulation step by calling
update_TargetAngleMotorHingeJoint().
-
static bool update_TargetAngleMotorHingeJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, Eigen::Matrix<Real, 4, 8, Eigen::DontAlign> &jointInfo)
Update motor hinge joint info which is required by the solver step. The joint info must be generated in the initialization process of the model by calling the function init_TargetAngleMotorHingeJoint(). This method should be called once per simulation step before executing the solver.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
jointInfo – motor hinge joint information which should be updated
-
static bool solve_TargetAngleMotorHingeJoint(const Real invMass0, const Vector3r &x0, const Matrix3r &inertiaInverseW0, const Quaternionr &q0, const Real invMass1, const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Real targetAngle, const Eigen::Matrix<Real, 4, 8, Eigen::DontAlign> &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1)
Perform a solver step for a motor hinge joint which links two rigid bodies. A motor hinge joint removes three translational and two rotational degrees of freedom between the bodies. Moreover, a target angle can be enforced on the remaining rotation axis. The motor hinge joint info must be generated in the initialization process of the model by calling the function init_TargetAngleMotorHingeJoint() and updated each time the bodies change their state by update_TargetAngleMotorHingeJoint()
.
More information can be found in:
[7]- Parameters
invMass0 – inverse mass of first body
x0 – center of mass of first body
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
q0 – rotation of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
q1 – rotation of second body
targetAngle – target angle of the servo motor
jointInfo – Motor hinge joint information which is required by the solver. This information must be generated in the beginning by calling init_TargetAngleMotorHingeJoint() and updated each time the bodies change their state by update_TargetAngleMotorHingeJoint().
corr_x0 – position correction of center of mass of first body
corr_q0 – rotation correction of first body
corr_x1 – position correction of center of mass of second body
corr_q1 – rotation correction of second body
-
static bool init_TargetVelocityMotorHingeJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, const Vector3r &hingeJointPosition, const Vector3r &hingeJointAxis, Eigen::Matrix<Real, 4, 8, Eigen::DontAlign> &jointInfo)
Initialize a motor hinge joint which is able to enforce a target velocity and return info which is required by the solver step.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
hingeJointPosition – position of hinge joint
hingeJointAxis – axis of hinge joint
jointInfo –
Stores the local and global positions of the connector points. The joint info contains the following columns:
0-1: projection matrix Pr for the rotational part
2: connector in body 0 (local)
3: connector in body 1 (local)
4: connector in body 0 (global)
5: connector in body 1 (global)
6: hinge axis in body 0 (local)
7: hinge axis in body 0 (global)
The info must be updated in each simulation step by calling update_TargetVelocityMotorHingeJoint().
-
static bool update_TargetVelocityMotorHingeJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, Eigen::Matrix<Real, 4, 8, Eigen::DontAlign> &jointInfo)
Update motor hinge joint info which is required by the solver step. The joint info must be generated in the initialization process of the model by calling the function init_TargetVelocityMotorHingeJoint(). This method should be called once per simulation step before executing the solver.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
jointInfo – motor hinge joint information which should be updated
-
static bool solve_TargetVelocityMotorHingeJoint(const Real invMass0, const Vector3r &x0, const Matrix3r &inertiaInverseW0, const Quaternionr &q0, const Real invMass1, const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Eigen::Matrix<Real, 4, 8, Eigen::DontAlign> &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1)
Perform a solver step for a motor hinge joint which links two rigid bodies. A motor hinge joint removes three translational and two rotational degrees of freedom between the bodies. Moreover, a target velocity can be enforced on the remaining rotation axis by calling the function velocitySolve_TargetVelocityMotorHingeJoint(). The motor hinge joint info must be generated in the initialization process of the model by calling the function init_TargetVelocityMotorHingeJoint() and updated each time the bodies change their state by update_TargetVelocityMotorHingeJoint()
.
More information can be found in:
[7]- Parameters
invMass0 – inverse mass of first body
x0 – center of mass of first body
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
q0 – rotation of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
q1 – rotation of second body
jointInfo – Motor hinge joint information which is required by the solver. This information must be generated in the beginning by calling init_TargetVelocityMotorHingeJoint() and updated each time the bodies change their state by update_TargetVelocityMotorHingeJoint().
corr_x0 – position correction of center of mass of first body
corr_q0 – rotation correction of first body
corr_x1 – position correction of center of mass of second body
corr_q1 – rotation correction of second body
-
static bool velocitySolve_TargetVelocityMotorHingeJoint(const Real invMass0, const Vector3r &x0, const Vector3r &v0, const Matrix3r &inertiaInverseW0, const Vector3r &omega0, const Real invMass1, const Vector3r &x1, const Vector3r &v1, const Matrix3r &inertiaInverseW1, const Vector3r &omega1, const Real targetAngularVelocity, const Eigen::Matrix<Real, 4, 8, Eigen::DontAlign> &jointInfo, Vector3r &corr_v0, Vector3r &corr_omega0, Vector3r &corr_v1, Vector3r &corr_omega1)
Perform a velocity solver step for a motor hinge joint which links two rigid bodies. A motor hinge joint removes three translational and two rotational degrees of freedom between the bodies. Moreover, a target velocity can be enforced on the remaining rotation axis. The motor hinge joint info must be generated in the initialization process of the model by calling the function init_TargetVelocityMotorHingeJoint() and updated each time the bodies change their state by update_TargetVelocityMotorHingeJoint()
.
More information can be found in:
[7]- Parameters
invMass0 – inverse mass of first body
x0 – center of mass of first body
v0 – velocity of body 0
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
omega0 – angular velocity of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
v1 – velocity of body 1
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
omega1 – angular velocity of second body
targetAngularVelocity – target angular velocity of the motor
jointInfo – Motor hinge joint information which is required by the solver. This information must be generated in the beginning by calling init_TargetVelocityMotorHingeJoint() and updated each time the bodies change their state by update_TargetVelocityMotorHingeJoint().
corr_v0 – velocity correction of first body
corr_omega0 – angular velocity correction of first body
corr_v1 – velocity correction of second body
corr_omega1 – angular velocity correction of second body
-
static bool init_RigidBodyParticleBallJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, Eigen::Matrix<Real, 3, 2, Eigen::DontAlign> &jointInfo)
Initialize ball joint between a rigid body and a particle at the position of the particle and return info which is required by the solver step.
- Parameters
x0 – center of mass of the rigid body
q0 – rotation of the rigid body body
x1 – position of the particle
jointInfo – Stores the local and global position of the connector point in the rigid body. The info must be updated in each simulation step by calling update_RigidBodyParticleBallJoint()
.
The joint info contains the following columns:
0: connector in rigid body (local)
1: connector in rigid body (global)
-
static bool update_RigidBodyParticleBallJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, Eigen::Matrix<Real, 3, 2, Eigen::DontAlign> &jointInfo)
Update joint info which is required by the solver step. The joint info must be generated in the initialization process of the model by calling the function init_RigidBodyParticleBallJoint(). This method should be called once per simulation step before executing the solver.
- Parameters
x0 – center of mass of the rigid body
q0 – rotation of the rigid body body
x1 – position of the particle
jointInfo – ball joint information which should be updated
-
static bool solve_RigidBodyParticleBallJoint(const Real invMass0, const Vector3r &x0, const Matrix3r &inertiaInverseW0, const Quaternionr &q0, const Real invMass1, const Vector3r &x1, const Eigen::Matrix<Real, 3, 2, Eigen::DontAlign> &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1)
Perform a solver step for a ball joint which links a rigid body and a particle. The joint info must be generated in the initialization process of the model by calling the function init_RigidBodyParticleBallJoint() and updated each time the rigid body changes its state by update_RigidBodyParticleBallJoint()
.
More information can be found in:
[7]- Parameters
invMass0 – inverse mass of rigid body
x0 – center of mass of rigid body
inertiaInverseW0 – inverse inertia tensor in world coordinates of rigid body
q0 – rotation of rigid body
invMass1 – inverse mass of particle
x1 – position of particle
jointInfo – Joint information which is required by the solver. This information must be generated in the beginning by calling init_RigidBodyParticleBallJoint() and updated each time the rigid body changes its state by update_RigidBodyParticleBallJoint().
corr_x0 – position correction of the center of mass of the rigid body
corr_q0 – rotation correction of the rigid body
corr_x1 – position correction of the particle
-
static bool init_RigidBodyContactConstraint(const Real invMass0, const Vector3r &x0, const Vector3r &v0, const Matrix3r &inertiaInverseW0, const Quaternionr &q0, const Vector3r &omega0, const Real invMass1, const Vector3r &x1, const Vector3r &v1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Vector3r &omega1, const Vector3r &cp0, const Vector3r &cp1, const Vector3r &normal, const Real restitutionCoeff, Eigen::Matrix<Real, 3, 5, Eigen::DontAlign> &constraintInfo)
Initialize contact between two rigid bodies and return info which is required by the solver step.
- Parameters
invMass0 – inverse mass of rigid body
x0 – center of mass of first body
v0 – velocity of body 0
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
q0 – rotation of first body
omega0 – angular velocity of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
v1 – velocity of body 1
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
q1 – rotation of second body
omega1 – angular velocity of second body
cp0 – contact point of body 0
cp1 – contact point of body 1
normal – contact normal in body 1
restitutionCoeff – coefficient of restitution
constraintInfo –
Stores the local and global position of the contact points and the contact normal.
The joint info contains the following columns:
0: connector in body 0 (global)
1: connector in body 1 (global)
2: contact normal in body 1 (global)
3: contact tangent (global)
0,4: 1.0 / normal^T * K * normal
1,4: maximal impulse in tangent direction
2,4: goal velocity in normal direction after collision
-
static bool velocitySolve_RigidBodyContactConstraint(const Real invMass0, const Vector3r &x0, const Vector3r &v0, const Matrix3r &inertiaInverseW0, const Vector3r &omega0, const Real invMass1, const Vector3r &x1, const Vector3r &v1, const Matrix3r &inertiaInverseW1, const Vector3r &omega1, const Real stiffness, const Real frictionCoeff, Real &sum_impulses, Eigen::Matrix<Real, 3, 5, Eigen::DontAlign> &constraintInfo, Vector3r &corr_v0, Vector3r &corr_omega0, Vector3r &corr_v1, Vector3r &corr_omega1)
Perform a solver step for a contact constraint between two rigid bodies. A contact constraint handles collisions and resting contacts between the bodies. The contact info must be generated in each time step.
- Parameters
invMass0 – inverse mass of rigid body
x0 – center of mass of first body
v0 – velocity of body 0
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
omega0 – angular velocity of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
v1 – velocity of body 1
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
omega1 – angular velocity of second body
stiffness – stiffness parameter of penalty impulse
frictionCoeff – friction coefficient
sum_impulses – sum of all correction impulses in normal direction
constraintInfo – information which is required by the solver. This information must be generated in the beginning by calling init_RigidBodyContactConstraint().
corr_v0 – velocity correction of first body
corr_omega0 – angular velocity correction of first body
corr_v1 – velocity correction of second body
corr_omega1 – angular velocity correction of second body
-
static bool init_ParticleRigidBodyContactConstraint(const Real invMass0, const Vector3r &x0, const Vector3r &v0, const Real invMass1, const Vector3r &x1, const Vector3r &v1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Vector3r &omega1, const Vector3r &cp0, const Vector3r &cp1, const Vector3r &normal, const Real restitutionCoeff, Eigen::Matrix<Real, 3, 5, Eigen::DontAlign> &constraintInfo)
Initialize contact between a rigid body and a particle and return info which is required by the solver step.
- Parameters
invMass0 – inverse mass of rigid body
x0 – center of mass of first body
v0 – velocity of body 0
invMass1 – inverse mass of second body
x1 – center of mass of second body
v1 – velocity of body 1
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
q1 – rotation of second body
omega1 – angular velocity of second body
cp0 – contact point of body 0
cp1 – contact point of body 1
normal – contact normal in body 1
restitutionCoeff – coefficient of restitution
constraintInfo –
Stores the local and global position of the contact points and the contact normal.
The joint info contains the following columns:
0: connector in body 0 (global)
1: connector in body 1 (global)
2: contact normal in body 1 (global)
3: contact tangent (global)
0,4: 1.0 / normal^T * K * normal
1,4: maximal impulse in tangent direction
2,4: goal velocity in normal direction after collision
-
static bool velocitySolve_ParticleRigidBodyContactConstraint(const Real invMass0, const Vector3r &x0, const Vector3r &v0, const Real invMass1, const Vector3r &x1, const Vector3r &v1, const Matrix3r &inertiaInverseW1, const Vector3r &omega1, const Real stiffness, const Real frictionCoeff, Real &sum_impulses, Eigen::Matrix<Real, 3, 5, Eigen::DontAlign> &constraintInfo, Vector3r &corr_v0, Vector3r &corr_v1, Vector3r &corr_omega1)
Perform a solver step for a contact constraint between a rigid body and a particle. A contact constraint handles collisions and resting contacts between the bodies. The contact info must be generated in each time step.
- Parameters
invMass0 – inverse mass of rigid body
x0 – center of mass of first body
v0 – velocity of body 0
invMass1 – inverse mass of second body
x1 – center of mass of second body
v1 – velocity of body 1
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
omega1 – angular velocity of second body
stiffness – stiffness parameter of penalty impulse
frictionCoeff – friction coefficient
sum_impulses – sum of all correction impulses in normal direction
constraintInfo – information which is required by the solver. This information must be generated in the beginning by calling init_RigidBodyContactConstraint().
corr_v0 – velocity correction of first body
corr_v1 – velocity correction of second body
corr_omega1 – angular velocity correction of second body
-
static bool init_DistanceJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, const Vector3r &pos0, const Vector3r &pos1, Eigen::Matrix<Real, 3, 4, Eigen::DontAlign> &jointInfo)
Initialize distance joint and return info which is required by the solver step.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
jointPosition – position of distance joint
jointInfo – Stores the local and global positions of the connector points. The first two columns store the local connectors in body 0 and 1, respectively, while the last two columns contain the global connector positions which have to be updated in each simulation step by calling update_DistanceJoint()
.
The joint info contains the following columns:
0: connector in body 0 (local)
1: connector in body 1 (local)
2: connector in body 0 (global)
3: connector in body 1 (global)
-
static bool update_DistanceJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, Eigen::Matrix<Real, 3, 4, Eigen::DontAlign> &jointInfo)
Update distance joint info which is required by the solver step. The distance joint info must be generated in the initialization process of the model by calling the function init_DistanceJoint(). This method should be called once per simulation step before executing the solver.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
jointInfo – joint information which should be updated
-
static bool solve_DistanceJoint(const Real invMass0, const Vector3r &x0, const Matrix3r &inertiaInverseW0, const Quaternionr &q0, const Real invMass1, const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Real stiffness, const Real restLength, const Real dt, const Eigen::Matrix<Real, 3, 4, Eigen::DontAlign> &jointInfo, Real &lambda, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1)
Perform a solver step for a distance joint which links two rigid bodies. A distance joint removes one translational degrees of freedom between the bodies. When setting a stiffness value which is not zero, we get an implicit spring. The distance joint info must be generated in the initialization process of the model by calling the function init_DistanceJoint() and updated each time the bodies change their state by update_DistanceJoint()
.
More information can be found in:
[7]- Parameters
invMass0 – inverse mass of first body
x0 – center of mass of first body
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
q0 – rotation of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
q1 – rotation of second body
stiffness – Stiffness of the constraint. 0 means it is totally stiff and we get a distance joint otherwise we get an implicit spring.
restLength – Rest length of the joint.
dt – Time step size (required for XPBD when simulating a spring)
jointInfo – Joint information which is required by the solver. This information must be generated in the beginning by calling init_DistanceJoint() and updated each time the bodies change their state by update_DistanceJoint().
lambda – Lagrange multiplier (required for XPBD). Must be 0 in the first iteration.
corr_x0 – position correction of center of mass of first body
corr_q0 – rotation correction of first body
corr_x1 – position correction of center of mass of second body
corr_q1 – rotation correction of second body
-
static bool init_DamperJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, const Vector3r &direction, Eigen::Matrix<Real, 4, 6, Eigen::DontAlign> &jointInfo)
Initialize a motor slider joint which is able to enforce a target position and return info which is required by the solver step.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
sliderJointPosition – position of slider joint
sliderJointAxis – axis of slider joint
jointInfo –
Stores the local and global positions of the connector points. The joint info contains the following columns:
0: coordinate system in body 0, where the x-axis is the slider axis (local)
1: coordinate system in body 0, where the x-axis is the slider axis (global)
2: 3D vector d = R^T * (x0 - x1), where R is a rotation matrix with the slider axis as first column
3-5: projection matrix Pr for the rotational part
The info must be updated in each simulation step by calling
update_TargetPositionMotorSliderJoint().
-
static bool update_DamperJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, Eigen::Matrix<Real, 4, 6, Eigen::DontAlign> &jointInfo)
Update motor slider joint info which is required by the solver step. The joint info must be generated in the initialization process of the model by calling the function init_TargetPositionMotorSliderJoint(). This method should be called once per simulation step before executing the solver.
- Parameters
x0 – center of mass of first body
q0 – rotation of first body
x1 – center of mass of second body
q1 – rotation of second body
jointInfo – slider joint information which should be updated
-
static bool solve_DamperJoint(const Real invMass0, const Vector3r &x0, const Matrix3r &inertiaInverseW0, const Quaternionr &q0, const Real invMass1, const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Real stiffness, const Real dt, const Eigen::Matrix<Real, 4, 6, Eigen::DontAlign> &jointInfo, Real &lambda, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1)
Perform a solver step for a motor slider joint which links two rigid bodies. A motor slider joint removes two translational and three rotational degrees of freedom between the bodies. Moreover, a target position can be enforced on the remaining translation axis. The motor slider joint info must be generated in the initialization process of the model by calling the function init_TargetPositionMotorSliderJoint() and updated each time the bodies change their state by update_TargetPositionMotorSliderJoint()
.
More information can be found in:
[7]- Parameters
invMass0 – inverse mass of first body
x0 – center of mass of first body
inertiaInverseW0 – inverse inertia tensor in world coordinates of first body
q0 – rotation of first body
invMass1 – inverse mass of second body
x1 – center of mass of second body
inertiaInverseW1 – inverse inertia tensor in world coordinates of second body
q1 – rotation of second body
targetPosition – target position of the servo motor
jointInfo – Motor slider joint information which is required by the solver. This information must be generated in the beginning by calling init_TargetPositionMotorSliderJoint() and updated each time the bodies change their state by update_TargetPositionMotorSliderJoint().
corr_x0 – position correction of center of mass of first body
corr_q0 – rotation correction of first body
corr_x1 – position correction of center of mass of second body
corr_q1 – rotation correction of second body
-
static bool init_BallJoint(const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, const Vector3r &jointPosition, Eigen::Matrix<Real, 3, 4, Eigen::DontAlign> &jointInfo)