26 assert (joint_id > 0);
31 model.
v_J[joint_id].wx() = qdot[model.
mJoints[joint_id].q_index];
36 model.
v_J[joint_id].wy() = qdot[model.
mJoints[joint_id].q_index];
41 model.
v_J[joint_id].wz() = qdot[model.
mJoints[joint_id].q_index];
47 model.
v_J[joint_id].set(model.
S[joint_id] * qdot[model.
mJoints[joint_id].q_index]);
59 model.
v_J[joint_id].set(
SpatialVector(omega[0], omega[1], omega[2], 0., 0., 0.));
63 double q0 = q[model.
mJoints[joint_id].q_index];
64 double q1 = q[model.
mJoints[joint_id].q_index + 1];
65 double q2 = q[model.
mJoints[joint_id].q_index + 2];
74 model.
X_J[joint_id].E =
Matrix3d(c0 * c1, s0 * c1, -s1, c0 * s1 * s2 - s0 * c2, s0 * s1 * s2 + c0 * c2, c1 * s2, c0 * s1 * c2 + s0 * s2, s0 * s1 * c2 - c0 * s2, c1 * c2);
85 double qdot0 = qdot[model.
mJoints[joint_id].q_index];
86 double qdot1 = qdot[model.
mJoints[joint_id].q_index + 1];
87 double qdot2 = qdot[model.
mJoints[joint_id].q_index + 2];
93 model.
multdof3_S_o[joint_id](1, 0) = -s1 * s2 * qdot1 + c1 * c2 * qdot2;
95 model.
multdof3_S_o[joint_id](2, 0) = -s1 * c2 * qdot1 - c1 * s2 * qdot2;
102 double q0 = q[model.
mJoints[joint_id].q_index];
103 double q1 = q[model.
mJoints[joint_id].q_index + 1];
104 double q2 = q[model.
mJoints[joint_id].q_index + 2];
113 model.
X_J[joint_id].E =
Matrix3d(c2 * c1, s2 * c0 + c2 * s1 * s0, s2 * s0 - c2 * s1 * c0, -s2 * c1, c2 * c0 - s2 * s1 * s0, c2 * s0 + s2 * s1 * c0, s1, -c1 * s0, c1 * c0);
124 double qdot0 = qdot[model.
mJoints[joint_id].q_index];
125 double qdot1 = qdot[model.
mJoints[joint_id].q_index + 1];
126 double qdot2 = qdot[model.
mJoints[joint_id].q_index + 2];
131 model.
multdof3_S_o[joint_id](0, 0) = -s2 * c1 * qdot2 - c2 * s1 * qdot1;
132 model.
multdof3_S_o[joint_id](1, 0) = -c2 * c1 * qdot2 + s2 * s1 * qdot1;
141 double q0 = q[model.
mJoints[joint_id].q_index];
142 double q1 = q[model.
mJoints[joint_id].q_index + 1];
143 double q2 = q[model.
mJoints[joint_id].q_index + 2];
152 model.
X_J[joint_id].E =
Matrix3d(c2 * c0 + s2 * s1 * s0, s2 * c1, -c2 * s0 + s2 * s1 * c0, -s2 * c0 + c2 * s1 * s0, c2 * c1, s2 * s0 + c2 * s1 * c0, c1 * s0, -s1, c1 * c0);
163 double qdot0 = qdot[model.
mJoints[joint_id].q_index];
164 double qdot1 = qdot[model.
mJoints[joint_id].q_index + 1];
165 double qdot2 = qdot[model.
mJoints[joint_id].q_index + 2];
167 model.
multdof3_S_o[joint_id](0, 0) = c2 * c1 * qdot2 - s2 * s1 * qdot1;
169 model.
multdof3_S_o[joint_id](1, 0) = -s2 * c1 * qdot2 - c2 * s1 * qdot1;
180 double q0 = q[model.
mJoints[joint_id].q_index];
181 double q1 = q[model.
mJoints[joint_id].q_index + 1];
182 double q2 = q[model.
mJoints[joint_id].q_index + 2];
184 model.
X_J[joint_id].E = Matrix3d::Identity();
191 double qdot0 = qdot[model.
mJoints[joint_id].q_index];
192 double qdot1 = qdot[model.
mJoints[joint_id].q_index + 1];
193 double qdot2 = qdot[model.
mJoints[joint_id].q_index + 2];
197 model.
c_J[joint_id].set(0., 0., 0., 0., 0., 0.);
203 custom_joint->
jcalc(model, joint_id, q, qdot);
207 std::cerr <<
"Error: invalid joint type " << model.
mJoints[joint_id].mJointType <<
" at id " << joint_id << std::endl;
211 model.
bodyFrames[joint_id]->setTransformFromParent(model.
X_J[joint_id] * model.
X_T[joint_id]);
218 assert (joint_id > 0);
245 assert (joint_id > 0);
250 model.
S[joint_id] = model.
mJoints[joint_id].mJointAxes[0];
255 model.
S[joint_id] = model.
mJoints[joint_id].mJointAxes[0];
260 model.
S[joint_id] = model.
mJoints[joint_id].mJointAxes[0];
264 model.
X_J[joint_id] =
jcalc_XJ(model, joint_id, q);
266 model.
S[joint_id] = model.
mJoints[joint_id].mJointAxes[0];
280 double q0 = q[model.
mJoints[joint_id].q_index];
281 double q1 = q[model.
mJoints[joint_id].q_index + 1];
282 double q2 = q[model.
mJoints[joint_id].q_index + 2];
291 model.
X_J[joint_id] =
SpatialTransform(
Matrix3d(c0 * c1, s0 * c1, -s1, c0 * s1 * s2 - s0 * c2, s0 * s1 * s2 + c0 * c2, c1 * s2, c0 * s1 * c2 + s0 * s2, s0 * s1 * c2 - c0 * s2, c1 * c2),
Vector3d(0., 0., 0.));
306 double q0 = q[model.
mJoints[joint_id].q_index];
307 double q1 = q[model.
mJoints[joint_id].q_index + 1];
308 double q2 = q[model.
mJoints[joint_id].q_index + 2];
317 model.
X_J[joint_id] =
SpatialTransform(
Matrix3d(c2 * c1, s2 * c0 + c2 * s1 * s0, s2 * s0 - c2 * s1 * c0, -s2 * c1, c2 * c0 - s2 * s1 * s0, c2 * s0 + s2 * s1 * c0, s1, -c1 * s0, c1 * c0),
Vector3d(0., 0., 0.));
332 double q0 = q[model.
mJoints[joint_id].q_index];
333 double q1 = q[model.
mJoints[joint_id].q_index + 1];
334 double q2 = q[model.
mJoints[joint_id].q_index + 2];
343 model.
X_J[joint_id] =
SpatialTransform(
Matrix3d(c2 * c0 + s2 * s1 * s0, s2 * c1, -c2 * s0 + s2 * s1 * c0, -s2 * c0 + c2 * s1 * s0, c2 * c1, s2 * s0 + c2 * s1 * c0, c1 * s0, -s1, c1 * c0),
Vector3d(0., 0., 0.));
358 double q0 = q[model.
mJoints[joint_id].q_index];
359 double q1 = q[model.
mJoints[joint_id].q_index + 1];
360 double q2 = q[model.
mJoints[joint_id].q_index + 2];
379 std::cerr <<
"Error: invalid joint type!" << std::endl;
383 model.
bodyFrames[joint_id]->setTransformFromParent(model.
X_J[joint_id] * model.
X_T[joint_id]);
std::vector< Joint > mJoints
All joints.
3 DoF joint that uses Euler ZYX convention (faster than emulated
std::vector< Math::SpatialVector > c_J
Math::Quaternion GetQuaternion(unsigned int i, const Math::VectorNd &Q) const
Gets the quaternion for body i (only valid if body i is connected by a JointTypeSpherical joint) ...
User defined joints of varying size.
CustomJoint is a struct used to create a joint with user defined parameters. This is accomplished by ...
SpatialTransform Xroty(const double &yrot)
Get transform with zero translation and pure rotation about y axis.
SpatialTransform Xtrans(const Vector3d &r)
Get pure translation transform.
void jcalc(Model &model, unsigned int joint_id, const Math::VectorNd &q, const Math::VectorNd &qdot)
Computes all variables for a joint model and updates the body frame as well as the body's center of m...
virtual void jcalc_X_lambda_S(Model &model, unsigned int joint_id, const Math::VectorNd &q)=0
std::vector< ReferenceFramePtr > bodyFrames
virtual void jcalc(Model &model, unsigned int joint_id, const Math::VectorNd &q, const Math::VectorNd &qdot)=0
SpatialTransform Xrotz(const double &zrot)
Get transform with zero translation and pure rotation about z axis.
std::vector< Math::Matrix63 > multdof3_S_o
unsigned int custom_joint_index
Describes a joint relative to the predecessor body.
3 DoF joint that uses Euler XYZ convention (faster than emulated
Math::SpatialTransform jcalc_XJ(Model &model, unsigned int joint_id, const Math::VectorNd &q)
SpatialTransform Xrotx(const double &xrot)
Get transform with zero translation and pure rotation about x axis.
std::vector< CustomJoint * > mCustomJoints
Contains all information about the rigid body model.
void jcalc_X_lambda_S(Model &model, unsigned int joint_id, const Math::VectorNd &q)
std::vector< Math::Matrix63 > multdof3_S
Motion subspace for joints with 3 degrees of freedom.
3 DoF joint using Quaternions for joint positional variables and
std::vector< Math::SpatialTransform > X_J
static Matrix3d toMatrix(const Quaternion &q)
Convert quaternion to rotation matrix.
Namespace for all structures of the RobotDynamics library.
std::vector< Math::SpatialTransform > X_T
Transformations from the parent body to the frame of the joint.
SpatialTransform Xrot(double angle_rad, const Vector3d &axis)
Get spatial transform from angle and axis.
3 DoF joint that uses Euler YXZ convention (faster than emulated