Fix quaternion typos.
PiperOrigin-RevId: 453203844 Change-Id: I7d788c21bb00b7746f941fb2cf755f0b046e35f2
This commit is contained in:
committed by
Copybara-Service
parent
16baac9353
commit
53d3220fcc
@@ -543,7 +543,7 @@ mjtSensor
|
|||||||
mjSENS_ACTUATORFRC, // scalar actuator force
|
mjSENS_ACTUATORFRC, // scalar actuator force
|
||||||
|
|
||||||
// sensors related to ball joints
|
// sensors related to ball joints
|
||||||
mjSENS_BALLQUAT, // 4D ball joint quaterion
|
mjSENS_BALLQUAT, // 4D ball joint quaternion
|
||||||
mjSENS_BALLANGVEL, // 3D ball joint angular velocity
|
mjSENS_BALLANGVEL, // 3D ball joint angular velocity
|
||||||
|
|
||||||
// joint and tendon limit sensors, in constraint space
|
// joint and tendon limit sensors, in constraint space
|
||||||
@@ -3162,7 +3162,7 @@ Numeric constants
|
|||||||
| | | array sizes which we have not fully settled. There may be reasons to increase them in |
|
| | | array sizes which we have not fully settled. There may be reasons to increase them in |
|
||||||
| | | the future, so as to accommodate extra parameters needed for more elaborate |
|
| | | the future, so as to accommodate extra parameters needed for more elaborate |
|
||||||
| | | computations. This is why we maintain them as symbolic constants that can be easily |
|
| | | computations. This is why we maintain them as symbolic constants that can be easily |
|
||||||
| | | changed, as opposed to the array size for representing quaterions for example - which |
|
| | | changed, as opposed to the array size for representing quaternions for example - which |
|
||||||
| | | has no reason to change. |
|
| | | has no reason to change. |
|
||||||
+------------------+--------+----------------------------------------------------------------------------------------+
|
+------------------+--------+----------------------------------------------------------------------------------------+
|
||||||
| mjNDYN | 10 | The maximal number of real-valued parameters used to define the activation dynamics of |
|
| mjNDYN | 10 | The maximal number of real-valued parameters used to define the activation dynamics of |
|
||||||
@@ -4549,7 +4549,7 @@ mj_normalizeQuat
|
|||||||
|
|
||||||
void mj_normalizeQuat(const mjModel* m, mjtNum* qpos);
|
void mj_normalizeQuat(const mjModel* m, mjtNum* qpos);
|
||||||
|
|
||||||
Normalize all quaterions in qpos-type vector.
|
Normalize all quaternions in qpos-type vector.
|
||||||
|
|
||||||
.. _mj_local2Global:
|
.. _mj_local2Global:
|
||||||
|
|
||||||
@@ -6184,7 +6184,7 @@ mju_mat2Quat
|
|||||||
|
|
||||||
void mju_mat2Quat(mjtNum quat[4], const mjtNum mat[9]);
|
void mju_mat2Quat(mjtNum quat[4], const mjtNum mat[9]);
|
||||||
|
|
||||||
Convert 3D rotation matrix to quaterion.
|
Convert 3D rotation matrix to quaternion.
|
||||||
|
|
||||||
.. _mju_derivQuat:
|
.. _mju_derivQuat:
|
||||||
|
|
||||||
@@ -6206,7 +6206,7 @@ mju_quatIntegrate
|
|||||||
|
|
||||||
void mju_quatIntegrate(mjtNum quat[4], const mjtNum vel[3], mjtNum scale);
|
void mju_quatIntegrate(mjtNum quat[4], const mjtNum vel[3], mjtNum scale);
|
||||||
|
|
||||||
Integrate quaterion given 3D angular velocity.
|
Integrate quaternion given 3D angular velocity.
|
||||||
|
|
||||||
.. _mju_quatZ2Vec:
|
.. _mju_quatZ2Vec:
|
||||||
|
|
||||||
|
|||||||
@@ -2783,7 +2783,7 @@ subelements. The file format starts with a header of 4 integers: nvertex, ntexco
|
|||||||
the same as in meshes, and specify the total number of vertices, texture coordinate pairs, and triangle faces in the
|
the same as in meshes, and specify the total number of vertices, texture coordinate pairs, and triangle faces in the
|
||||||
skin. ntexcoord can be zero or equal to nvertex. nbone specifies the number of MuJoCo bodies that will be used as
|
skin. ntexcoord can be zero or equal to nvertex. nbone specifies the number of MuJoCo bodies that will be used as
|
||||||
bones in the skin. The header is followed by the vertex, texcoord and face data, followed by a specification for each
|
bones in the skin. The header is followed by the vertex, texcoord and face data, followed by a specification for each
|
||||||
bone. The bone specification contains the name of the corresponding model body, 3D bind position, 4D bind quaterion,
|
bone. The bone specification contains the name of the corresponding model body, 3D bind position, 4D bind quaternion,
|
||||||
number of vertices influenced by the bone, and the vertex index array and weight array. Body names are represented as
|
number of vertices influenced by the bone, and the vertex index array and weight array. Body names are represented as
|
||||||
fixed-length character arrays and are expected to be 0-terminated. Characters after the first 0 are ignored. The
|
fixed-length character arrays and are expected to be 0-terminated. Characters after the first 0 are ignored. The
|
||||||
contents of the SKN file are:
|
contents of the SKN file are:
|
||||||
@@ -5020,7 +5020,7 @@ bodies whose center of mass is of interest.
|
|||||||
:at:`objname`: :at-val:`string, required`
|
:at:`objname`: :at-val:`string, required`
|
||||||
Name of the MuJoCo object to which the sensor is attached.
|
Name of the MuJoCo object to which the sensor is attached.
|
||||||
:at:`datatype`: :at-val:`[real, positive, axis, quaternion], required`
|
:at:`datatype`: :at-val:`[real, positive, axis, quaternion], required`
|
||||||
The type of output generated by this sensor. "axis" means a unit-length 3D vector. "quat" means a unit quaterion.
|
The type of output generated by this sensor. "axis" means a unit-length 3D vector. "quat" means a unit quaternion.
|
||||||
These need to be declared because when MuJoCo adds noise, it must respect the vector normalization. "real" means a
|
These need to be declared because when MuJoCo adds noise, it must respect the vector normalization. "real" means a
|
||||||
generic array (or scalar) of real values to which noise can be added independently.
|
generic array (or scalar) of real values to which noise can be added independently.
|
||||||
:at:`needstage`: :at-val:`[pos, vel, acc], required`
|
:at:`needstage`: :at-val:`[pos, vel, acc], required`
|
||||||
|
|||||||
+1
-1
@@ -1136,7 +1136,7 @@ the standard convention, we set A_rowadr[r] = r*n. MuJoCo uses sparse matrices i
|
|||||||
To represent 3D orientations and rotations, MuJoCo uses unit quaternions - namely 4D unit vectors arranged as q = (w,
|
To represent 3D orientations and rotations, MuJoCo uses unit quaternions - namely 4D unit vectors arranged as q = (w,
|
||||||
x, y, z). Here (x, y, z) is the rotation axis unit vector scaled by sin(a/2), where a is the rotation angle in
|
x, y, z). Here (x, y, z) is the rotation axis unit vector scaled by sin(a/2), where a is the rotation angle in
|
||||||
radians, and w = cos(a/2). Thus the quaternion corresponding to a null rotation is (1, 0, 0, 0). This is the default
|
radians, and w = cos(a/2). Thus the quaternion corresponding to a null rotation is (1, 0, 0, 0). This is the default
|
||||||
setting of all quaterions in MJCF.
|
setting of all quaternions in MJCF.
|
||||||
|
|
||||||
MuJoCo also uses 6D spatial vectors internally. These are quantities in mjData prefixed with 'c', namely cvel, cacc,
|
MuJoCo also uses 6D spatial vectors internally. These are quantities in mjData prefixed with 'c', namely cvel, cacc,
|
||||||
cdot, etc. They are spatial motion and force vectors that combine a 3D rotational component followed by a 3D
|
cdot, etc. They are spatial motion and force vectors that combine a 3D rotational component followed by a 3D
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ typedef enum mjtSensor_ { // type of sensor
|
|||||||
mjSENS_ACTUATORFRC, // scalar actuator force
|
mjSENS_ACTUATORFRC, // scalar actuator force
|
||||||
|
|
||||||
// sensors related to ball joints
|
// sensors related to ball joints
|
||||||
mjSENS_BALLQUAT, // 4D ball joint quaterion
|
mjSENS_BALLQUAT, // 4D ball joint quaternion
|
||||||
mjSENS_BALLANGVEL, // 3D ball joint angular velocity
|
mjSENS_BALLANGVEL, // 3D ball joint angular velocity
|
||||||
|
|
||||||
// joint and tendon limit sensors, in constraint space
|
// joint and tendon limit sensors, in constraint space
|
||||||
|
|||||||
@@ -437,7 +437,7 @@ MJAPI void mj_differentiatePos(const mjModel* m, mjtNum* qvel, mjtNum dt,
|
|||||||
// Integrate position with given velocity.
|
// Integrate position with given velocity.
|
||||||
MJAPI void mj_integratePos(const mjModel* m, mjtNum* qpos, const mjtNum* qvel, mjtNum dt);
|
MJAPI void mj_integratePos(const mjModel* m, mjtNum* qpos, const mjtNum* qvel, mjtNum dt);
|
||||||
|
|
||||||
// Normalize all quaterions in qpos-type vector.
|
// Normalize all quaternions in qpos-type vector.
|
||||||
MJAPI void mj_normalizeQuat(const mjModel* m, mjtNum* qpos);
|
MJAPI void mj_normalizeQuat(const mjModel* m, mjtNum* qpos);
|
||||||
|
|
||||||
// Map from body local to global Cartesian coordinates.
|
// Map from body local to global Cartesian coordinates.
|
||||||
@@ -956,13 +956,13 @@ MJAPI void mju_subQuat(mjtNum res[3], const mjtNum qa[4], const mjtNum qb[4]);
|
|||||||
// Convert quaternion to 3D rotation matrix.
|
// Convert quaternion to 3D rotation matrix.
|
||||||
MJAPI void mju_quat2Mat(mjtNum res[9], const mjtNum quat[4]);
|
MJAPI void mju_quat2Mat(mjtNum res[9], const mjtNum quat[4]);
|
||||||
|
|
||||||
// Convert 3D rotation matrix to quaterion.
|
// Convert 3D rotation matrix to quaternion.
|
||||||
MJAPI void mju_mat2Quat(mjtNum quat[4], const mjtNum mat[9]);
|
MJAPI void mju_mat2Quat(mjtNum quat[4], const mjtNum mat[9]);
|
||||||
|
|
||||||
// Compute time-derivative of quaternion, given 3D rotational velocity.
|
// Compute time-derivative of quaternion, given 3D rotational velocity.
|
||||||
MJAPI void mju_derivQuat(mjtNum res[4], const mjtNum quat[4], const mjtNum vel[3]);
|
MJAPI void mju_derivQuat(mjtNum res[4], const mjtNum quat[4], const mjtNum vel[3]);
|
||||||
|
|
||||||
// Integrate quaterion given 3D angular velocity.
|
// Integrate quaternion given 3D angular velocity.
|
||||||
MJAPI void mju_quatIntegrate(mjtNum quat[4], const mjtNum vel[3], mjtNum scale);
|
MJAPI void mju_quatIntegrate(mjtNum quat[4], const mjtNum vel[3], mjtNum scale);
|
||||||
|
|
||||||
// Construct quaternion performing rotation from z-axis to given vector.
|
// Construct quaternion performing rotation from z-axis to given vector.
|
||||||
|
|||||||
@@ -2558,7 +2558,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
doc='Normalize all quaterions in qpos-type vector.',
|
doc='Normalize all quaternions in qpos-type vector.',
|
||||||
)),
|
)),
|
||||||
('mj_local2Global',
|
('mj_local2Global',
|
||||||
FunctionDecl(
|
FunctionDecl(
|
||||||
@@ -6049,7 +6049,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
doc='Convert 3D rotation matrix to quaterion.',
|
doc='Convert 3D rotation matrix to quaternion.',
|
||||||
)),
|
)),
|
||||||
('mju_derivQuat',
|
('mju_derivQuat',
|
||||||
FunctionDecl(
|
FunctionDecl(
|
||||||
@@ -6104,7 +6104,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
|||||||
type=ValueType(name='mjtNum'),
|
type=ValueType(name='mjtNum'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
doc='Integrate quaterion given 3D angular velocity.',
|
doc='Integrate quaternion given 3D angular velocity.',
|
||||||
)),
|
)),
|
||||||
('mju_quatZ2Vec',
|
('mju_quatZ2Vec',
|
||||||
FunctionDecl(
|
FunctionDecl(
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void mj_kinematics(const mjModel* m, mjData* d) {
|
|||||||
// normalize all quaternions in qpos
|
// normalize all quaternions in qpos
|
||||||
mj_normalizeQuat(m, d->qpos);
|
mj_normalizeQuat(m, d->qpos);
|
||||||
|
|
||||||
// normalize mocap quaterions
|
// normalize mocap quaternions
|
||||||
for (int i=0; i<m->nmocap; i++) {
|
for (int i=0; i<m->nmocap; i++) {
|
||||||
mju_normalize4(d->mocap_quat+4*i);
|
mju_normalize4(d->mocap_quat+4*i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ static void add_noise(const mjModel* m, mjData* d, mjtStage stage) {
|
|||||||
rnd[0] = mju_standardNormal(rnd+1);
|
rnd[0] = mju_standardNormal(rnd+1);
|
||||||
rnd[2] = mju_standardNormal(rnd+3);
|
rnd[2] = mju_standardNormal(rnd+3);
|
||||||
|
|
||||||
// scale angle, normalize axis, make quaterion
|
// scale angle, normalize axis, make quaternion
|
||||||
rnd[0] *= noise;
|
rnd[0] *= noise;
|
||||||
mju_normalize3(rnd+1);
|
mju_normalize3(rnd+1);
|
||||||
mju_axisAngle2Quat(quat, rnd+1, rnd[0]);
|
mju_axisAngle2Quat(quat, rnd+1, rnd[0]);
|
||||||
|
|||||||
@@ -1199,7 +1199,7 @@ void mj_integratePos(const mjModel* m, mjtNum* qpos, const mjtNum* qvel, mjtNum
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// normalize all quaterions in qpos-type vector
|
// normalize all quaternions in qpos-type vector
|
||||||
void mj_normalizeQuat(const mjModel* m, mjtNum* qpos) {
|
void mj_normalizeQuat(const mjModel* m, mjtNum* qpos) {
|
||||||
// find quaternion fields and normalize
|
// find quaternion fields and normalize
|
||||||
for (int i=0; i<m->njnt; i++) {
|
for (int i=0; i<m->njnt; i++) {
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ void mju_quat2Mat(mjtNum res[9], const mjtNum quat[4]) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// convert 3D rotation matrix to quaterion
|
// convert 3D rotation matrix to quaternion
|
||||||
void mju_mat2Quat(mjtNum quat[4], const mjtNum mat[9]) {
|
void mju_mat2Quat(mjtNum quat[4], const mjtNum mat[9]) {
|
||||||
// q0 largest
|
// q0 largest
|
||||||
if (mat[0]+mat[4]+mat[8]>0) {
|
if (mat[0]+mat[4]+mat[8]>0) {
|
||||||
@@ -214,7 +214,7 @@ void mju_derivQuat(mjtNum res[4], const mjtNum quat[4], const mjtNum vel[3]) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// integrate quaterion given 3D angular velocity
|
// integrate quaternion given 3D angular velocity
|
||||||
void mju_quatIntegrate(mjtNum quat[4], const mjtNum vel[3], mjtNum scale) {
|
void mju_quatIntegrate(mjtNum quat[4], const mjtNum vel[3], mjtNum scale) {
|
||||||
mjtNum angle, tmp[4], qrot[4];
|
mjtNum angle, tmp[4], qrot[4];
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ void mju_quatZ2Vec(mjtNum quat[4], const mjtNum vec[3]) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make quaterion from angle and axis
|
// make quaternion from angle and axis
|
||||||
a = mju_atan2(a, mju_dot3(vn, z));
|
a = mju_atan2(a, mju_dot3(vn, z));
|
||||||
mju_axisAngle2Quat(quat, axis, a);
|
mju_axisAngle2Quat(quat, axis, a);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2548,7 +2548,7 @@ mjModel* mjCModel::Compile(const mjVFS* vfs) {
|
|||||||
throw mjCError(0, "could not create mjData");
|
throw mjCError(0, "could not create mjData");
|
||||||
}
|
}
|
||||||
|
|
||||||
// normalize keyframe quaterions
|
// normalize keyframe quaternions
|
||||||
for (i=0; i<m->nkey; i++) {
|
for (i=0; i<m->nkey; i++) {
|
||||||
mj_normalizeQuat(m, m->key_qpos+i*m->nq);
|
mj_normalizeQuat(m, m->key_qpos+i*m->nq);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user