Change MuJoCo engine source code function-spacing convention from 3 blank lines to 2
PiperOrigin-RevId: 813754244 Change-Id: I6836e41c3b021cb727e922c25c60f629b9814c93
This commit is contained in:
committed by
Copybara-Service
parent
c439628f82
commit
edbdb5195c
@@ -135,7 +135,6 @@ static inline int mj_stateElemSize(const mjModel* m, mjtState sig) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// return pointer to a single state element
|
||||
static inline mjtNum* mj_stateElemPtr(const mjModel* m, mjData* d, mjtState sig) {
|
||||
switch (sig) {
|
||||
@@ -158,13 +157,11 @@ static inline mjtNum* mj_stateElemPtr(const mjModel* m, mjData* d, mjtState sig)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static inline const mjtNum* mj_stateElemConstPtr(const mjModel* m, const mjData* d, mjtState sig) {
|
||||
return mj_stateElemPtr(m, (mjData*) d, sig); // discard const qualifier from d
|
||||
}
|
||||
|
||||
|
||||
|
||||
// get size of state signature
|
||||
int mj_stateSize(const mjModel* m, unsigned int sig) {
|
||||
if (sig >= (1<<mjNSTATE)) {
|
||||
@@ -183,7 +180,6 @@ int mj_stateSize(const mjModel* m, unsigned int sig) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// get state
|
||||
void mj_getState(const mjModel* m, const mjData* d, mjtNum* state, unsigned int sig) {
|
||||
if (sig >= (1<<mjNSTATE)) {
|
||||
@@ -215,7 +211,6 @@ void mj_getState(const mjModel* m, const mjData* d, mjtNum* state, unsigned int
|
||||
}
|
||||
|
||||
|
||||
|
||||
// set state
|
||||
void mj_setState(const mjModel* m, mjData* d, const mjtNum* state, unsigned int sig) {
|
||||
if (sig >= (1<<mjNSTATE)) {
|
||||
@@ -247,7 +242,6 @@ void mj_setState(const mjModel* m, mjData* d, const mjtNum* state, unsigned int
|
||||
}
|
||||
|
||||
|
||||
|
||||
// copy current state to the k-th model keyframe
|
||||
void mj_setKeyframe(mjModel* m, const mjData* d, int k) {
|
||||
// check keyframe index
|
||||
@@ -269,7 +263,6 @@ void mj_setKeyframe(mjModel* m, const mjData* d, int k) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------- inertia functions -----------------------------------------------------
|
||||
|
||||
// convert sparse inertia matrix M into full matrix
|
||||
@@ -289,14 +282,12 @@ void mj_fullM(const mjModel* m, mjtNum* dst, const mjtNum* M) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// multiply vector by inertia matrix
|
||||
void mj_mulM(const mjModel* m, const mjData* d, mjtNum* res, const mjtNum* vec) {
|
||||
mju_mulSymVecSparse(res, d->M, vec, m->nv, m->M_rownnz, m->M_rowadr, m->M_colind);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// multiply vector by M^(1/2)
|
||||
void mj_mulM2(const mjModel* m, const mjData* d, mjtNum* res, const mjtNum* vec) {
|
||||
int nv = m->nv;
|
||||
@@ -324,7 +315,6 @@ void mj_mulM2(const mjModel* m, const mjData* d, mjtNum* res, const mjtNum* vec)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// add inertia matrix to destination matrix
|
||||
// destination can be sparse or dense when all int* are NULL
|
||||
void mj_addM(const mjModel* m, mjData* d, mjtNum* dst,
|
||||
@@ -350,7 +340,6 @@ void mj_addM(const mjModel* m, mjData* d, mjtNum* dst,
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------- perturbations ---------------------------------------------------------
|
||||
|
||||
// add Cartesian force and torque to qfrc_target
|
||||
@@ -412,7 +401,6 @@ void mj_applyFT(const mjModel* m, mjData* d,
|
||||
}
|
||||
|
||||
|
||||
|
||||
// accumulate xfrc_applied in qfrc
|
||||
void mj_xfrcAccumulate(const mjModel* m, mjData* d, mjtNum* qfrc) {
|
||||
for (int i=1; i < m->nbody; i++) {
|
||||
@@ -424,7 +412,6 @@ void mj_xfrcAccumulate(const mjModel* m, mjData* d, mjtNum* qfrc) {
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------- miscellaneous ---------------------------------------------------------
|
||||
|
||||
// returns the smallest distance between two geoms (using nativeccd)
|
||||
@@ -456,7 +443,6 @@ static mjtNum mj_geomDistanceCCD(const mjModel* m, const mjData* d, int g1, int
|
||||
}
|
||||
|
||||
|
||||
|
||||
// returns the smallest distance between two geoms
|
||||
mjtNum mj_geomDistance(const mjModel* m, const mjData* d, int geom1, int geom2, mjtNum distmax,
|
||||
mjtNum fromto[6]) {
|
||||
@@ -509,7 +495,6 @@ mjtNum mj_geomDistance(const mjModel* m, const mjData* d, int geom1, int geom2,
|
||||
}
|
||||
|
||||
|
||||
|
||||
// compute velocity by finite-differencing two positions
|
||||
void mj_differentiatePos(const mjModel* m, mjtNum* qvel, mjtNum dt,
|
||||
const mjtNum* qpos1, const mjtNum* qpos2) {
|
||||
@@ -544,7 +529,6 @@ void mj_differentiatePos(const mjModel* m, mjtNum* qvel, mjtNum dt,
|
||||
}
|
||||
|
||||
|
||||
|
||||
// integrate qpos with given qvel
|
||||
void mj_integratePos(const mjModel* m, mjtNum* qpos, const mjtNum* qvel, mjtNum dt) {
|
||||
// loop over joints
|
||||
@@ -579,7 +563,6 @@ void mj_integratePos(const mjModel* m, mjtNum* qpos, const mjtNum* qvel, mjtNum
|
||||
}
|
||||
|
||||
|
||||
|
||||
// normalize all quaternions in qpos-type vector
|
||||
void mj_normalizeQuat(const mjModel* m, mjtNum* qpos) {
|
||||
// find quaternion fields and normalize
|
||||
@@ -591,7 +574,6 @@ void mj_normalizeQuat(const mjModel* m, mjtNum* qpos) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// return 1 if actuator i is disabled, 0 otherwise
|
||||
int mj_actuatorDisabled(const mjModel* m, int i) {
|
||||
int group = m->actuator_group[i];
|
||||
@@ -614,7 +596,6 @@ mjtNum mj_getTotalmass(const mjModel* m) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// scale all body masses and inertias to achieve specified total mass
|
||||
void mj_setTotalmass(mjModel* m, mjtNum newmass) {
|
||||
// compute scale factor, avoid zeros
|
||||
@@ -632,14 +613,12 @@ void mj_setTotalmass(mjModel* m, mjtNum newmass) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// version number
|
||||
int mj_version(void) {
|
||||
return mjVERSION;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// current version of MuJoCo as a null-terminated string
|
||||
const char* mj_versionString(void) {
|
||||
static const char versionstring[] = mjVERSIONSTRING;
|
||||
@@ -647,7 +626,6 @@ const char* mj_versionString(void) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// return total size of data in a contact sensor bitfield specification
|
||||
int mju_condataSize(int dataspec) {
|
||||
int size = 0;
|
||||
|
||||
Reference in New Issue
Block a user