Fix type errors in compiler and tests.

In preparation for a float32 build of MuJoCo.

PiperOrigin-RevId: 644407674
Change-Id: I60069f0f865ef89fbf613f5a2ca0c336cc63461e
This commit is contained in:
Yuval Tassa
2024-06-18 09:11:39 -07:00
committed by Copybara-Service
parent c8cc2d51b0
commit 8e2f830fd2
21 changed files with 715 additions and 506 deletions
+27 -15
View File
@@ -41,15 +41,23 @@ void mjuu_setvec(float* dest, const double x, const double y, const double z);
// set 2D vector
void mjuu_setvec(double* dest, const double x, const double y);
// copy double array
void mjuu_copyvec(double* dest, const double* src, const int n);
// copy real-valued vector
template <class T1, class T2>
void mjuu_copyvec(T1* dest, const T2* src, int n) {
for (int i=0; i<n; i++) {
dest[i] = (T1)src[i];
}
}
// copy float array
void mjuu_copyvec(float* dest, const float* src, const int n);
// add to double array
void mjuu_addtovec(double* dest, const double* src, const int n);
// zero array
void mjuu_zerovec(double* dest, const int n);
// zero float array
void mjuu_zerovec(float* dest, const int n);
// dot-product in 3D
double mjuu_dot3(const double* a, const double* b);
@@ -62,6 +70,7 @@ double mjuu_L1(const double* a, const double* b, int n);
// normalize vector to unit length, return previous length
// if norm(vec)<mjEPS, return 0 and do not change vector
double mjuu_normvec(double* vec, const int n);
float mjuu_normvec(float* vec, const int n);
// convert quaternion to rotation matrix
void mjuu_quat2mat(double* res, const double* quat);
@@ -69,9 +78,12 @@ void mjuu_quat2mat(double* res, const double* quat);
// multiply two unit quaternions
void mjuu_mulquat(double* res, const double* qa, const double* qb);
// multiply vector by matrix, 3-by-3
// multiply matrix by vector, 3-by-3
void mjuu_mulvecmat(double* res, const double* vec, const double* mat);
// multiply transposed matrix by vector, 3-by-3
void mjuu_mulvecmatT(double* res, const double* vec, const double* mat);
// compute res = R * M * R'
void mjuu_mulRMRT(double* res, const double* R, const double* M);
@@ -127,19 +139,19 @@ void mjuu_offcenter(double* res, const double mass, const double* vec);
// compute viscosity coefficients from mass and inertia
void mjuu_visccoef(double* visccoef, double mass, const double* inertia, double scl=1);
// rotate vector by quaternion
void mjuu_rotVecQuat(double res[3], const double vec[3], const double quat[4]);
// update moving frame along a discrete curve or initialize it, returns edge length
// inputs:
// normal - normal vector computed by a previous call to the function
// edge - edge vector (non-unit tangent vector)
// tprv - unit tangent vector of previous body
// tnxt - unit tangent vector of next body
// first - 1 if the frame requires initialization
// outputs:
// quat - frame orientation
// normal - unit normal vector
double mju_updateFrame(double quat[4], double normal[3], const double edge[3],
double mjuu_updateFrame(double quat[4], double normal[3], const double edge[3],
const double tprv[3], const double tnxt[3], int first);
// eigenvalue decomposition of symmetric 3x3 matrix
int mjuu_eig3(double eigval[3], double eigvec[9], double quat[4], const double mat[9]);
// transform vector by pose
void mjuu_trnVecPose(double res[3], const double pos[3], const double quat[4], const double vec[3]);
// strip path from filename
std::string mjuu_strippath(std::string filename);