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:
Yuval Tassa
2025-10-01 07:57:17 -07:00
committed by Copybara-Service
parent c439628f82
commit edbdb5195c
36 changed files with 8 additions and 651 deletions
-29
View File
@@ -33,7 +33,6 @@
//------------------------- derivatives of spatial algebra -----------------------------------------
// derivatives of cross product, Da and Db are 3x3
static void mjd_cross(const mjtNum a[3], const mjtNum b[3],
mjtNum* restrict Da, mjtNum* restrict Db) {
@@ -61,7 +60,6 @@ static void mjd_cross(const mjtNum a[3], const mjtNum b[3],
}
// derivative of mju_crossMotion w.r.t velocity
static void mjd_crossMotion_vel(mjtNum D[36], const mjtNum v[6]) {
mju_zero(D, 36);
@@ -98,7 +96,6 @@ static void mjd_crossMotion_vel(mjtNum D[36], const mjtNum v[6]) {
}
// derivative of mju_crossForce w.r.t. velocity
static void mjd_crossForce_vel(mjtNum D[36], const mjtNum f[6]) {
mju_zero(D, 36);
@@ -135,7 +132,6 @@ static void mjd_crossForce_vel(mjtNum D[36], const mjtNum f[6]) {
}
// derivative of mju_crossForce w.r.t. force
static void mjd_crossForce_frc(mjtNum D[36], const mjtNum vel[6]) {
mju_zero(D, 36);
@@ -172,7 +168,6 @@ static void mjd_crossForce_frc(mjtNum D[36], const mjtNum vel[6]) {
}
// derivative of mju_mulInertVec w.r.t vel
static void mjd_mulInertVec_vel(mjtNum D[36], const mjtNum i[10]) {
mju_zero(D, 36);
@@ -215,7 +210,6 @@ static void mjd_mulInertVec_vel(mjtNum D[36], const mjtNum i[10]) {
}
// derivative of mju_subQuat w.r.t inputs
void mjd_subQuat(const mjtNum qa[4], const mjtNum qb[4], mjtNum Da[9], mjtNum Db[9]) {
// no outputs, quick return
@@ -262,7 +256,6 @@ void mjd_subQuat(const mjtNum qa[4], const mjtNum qb[4], mjtNum Da[9], mjtNum Db
}
// derivative of mju_quatIntegrate w.r.t scaled velocity
// reference: https://arxiv.org/abs/1711.02508, Eq. 183
void mjd_quatIntegrate(const mjtNum vel[3], mjtNum scale,
@@ -320,7 +313,6 @@ void mjd_quatIntegrate(const mjtNum vel[3], mjtNum scale,
}
//------------------------- dense derivatives of component functions -------------------------------
// no longer used, except in tests
@@ -388,7 +380,6 @@ static void mjd_comVel_vel_dense(const mjModel* m, mjData* d, mjtNum* Dcvel, mjt
}
// subtract (d qfrc_bias / d qvel) from qDeriv (dense version)
void mjd_rne_vel_dense(const mjModel* m, mjData* d) {
int nv = m->nv, nbody = m->nbody;
@@ -469,7 +460,6 @@ void mjd_rne_vel_dense(const mjModel* m, mjData* d) {
}
//------------------------- sparse derivatives of component functions ------------------------------
// internal sparse format: dense body/dof x sparse dof x 6 (inner size is 6)
@@ -496,7 +486,6 @@ static void copyFromParent(const mjModel* m, mjData* d, mjtNum* mat, int n) {
}
// add sparse B-row to parent, all overlapping nonzeros
static void addToParent(const mjModel* m, mjData* d, mjtNum* mat, int n) {
// return if this is world or parent is world
@@ -530,7 +519,6 @@ static void addToParent(const mjModel* m, mjData* d, mjtNum* mat, int n) {
}
// derivative of cvel, cdof_dot w.r.t qvel
static void mjd_comVel_vel(const mjModel* m, mjData* d, mjtNum* Dcvel, mjtNum* Dcdofdot) {
int nv = m->nv, nbody = m->nbody;
@@ -599,7 +587,6 @@ static void mjd_comVel_vel(const mjModel* m, mjData* d, mjtNum* Dcvel, mjtNum* D
}
// subtract d qfrc_bias / d qvel from qDeriv
static void mjd_rne_vel(const mjModel* m, mjData* d) {
int nv = m->nv, nbody = m->nbody;
@@ -686,7 +673,6 @@ static void mjd_rne_vel(const mjModel* m, mjData* d) {
}
//--------------------- utility functions for (d force / d vel) Jacobians --------------------------
// add J'*B*J to qDeriv
@@ -724,7 +710,6 @@ static void addJTBJ(const mjModel* m, mjData* d, const mjtNum* J, const mjtNum*
}
// add J'*B*J to qDeriv, sparse version
static void addJTBJSparse(
const mjModel* m, mjData* d, const mjtNum* J,
@@ -758,7 +743,6 @@ static void addJTBJSparse(
}
//----------------------------- derivatives of actuator forces -------------------------------------
// derivative of mju_muscleGain w.r.t velocity
@@ -810,7 +794,6 @@ static mjtNum mjd_muscleGain_vel(mjtNum len, mjtNum vel, const mjtNum lengthrang
}
// add (d qfrc_actuator / d qvel) to qDeriv
void mjd_actuator_vel(const mjModel* m, mjData* d) {
int nu = m->nu;
@@ -870,7 +853,6 @@ void mjd_actuator_vel(const mjModel* m, mjData* d) {
}
//----------------- utilities for ellipsoid-based fluid force derivatives --------------------------
static inline mjtNum pow2(const mjtNum val) {
@@ -878,7 +860,6 @@ static inline mjtNum pow2(const mjtNum val) {
}
static inline mjtNum ellipsoid_max_moment(const mjtNum size[3], const int dir) {
const mjtNum d0 = size[dir];
const mjtNum d1 = size[(dir+1) % 3];
@@ -887,7 +868,6 @@ static inline mjtNum ellipsoid_max_moment(const mjtNum size[3], const int dir) {
}
// add 3x3 matrix D to one of the four quadrants of the 6x6 matrix B
// row_quad and col_quad should be either 0 or 1 (not checked)
static void addToQuadrant(mjtNum* restrict B, const mjtNum D[9], int col_quad, int row_quad) {
@@ -904,7 +884,6 @@ static void addToQuadrant(mjtNum* restrict B, const mjtNum D[9], int col_quad, i
}
//----------------- components of ellipsoid-based fluid force derivatives --------------------------
// forces due to fluid mass moving with the body, B is 6x6
@@ -952,7 +931,6 @@ static void mjd_addedMassForces(
}
// torque due to motion in the fluid, D is 3x3
static inline void mjd_viscous_torque(
mjtNum* restrict D, const mjtNum lvel[6], const mjtNum fluid_density,
@@ -1006,7 +984,6 @@ static inline void mjd_viscous_torque(
}
// drag due to motion in the fluid, D is 3x3
static inline void mjd_viscous_drag(
mjtNum* restrict D, const mjtNum lvel[6], const mjtNum fluid_density,
@@ -1074,7 +1051,6 @@ static inline void mjd_viscous_drag(
}
// Kutta lift due to motion in the fluid, D is 3x3
static inline void mjd_kutta_lift(
mjtNum* restrict D, const mjtNum lvel[6], const mjtNum fluid_density,
@@ -1128,7 +1104,6 @@ static inline void mjd_kutta_lift(
}
// Magnus force due to motion in the fluid, B is 6x6
static inline void mjd_magnus_force(
mjtNum* restrict B, const mjtNum lvel[6], const mjtNum fluid_density,
@@ -1156,7 +1131,6 @@ static inline void mjd_magnus_force(
}
//----------------- fluid force derivatives, ellipsoid and inertia-box models ----------------------
// fluid forces based on ellipsoid approximation
@@ -1264,7 +1238,6 @@ void mjd_ellipsoidFluid(const mjModel* m, mjData* d, int bodyid) {
}
// fluid forces based on inertia-box approximation
void mjd_inertiaBoxFluid(const mjModel* m, mjData* d, int i) {
mj_markStack(d);
@@ -1419,7 +1392,6 @@ void mjd_inertiaBoxFluid(const mjModel* m, mjData* d, int i) {
}
//------------------------- derivatives of passive forces ------------------------------------------
// add (d qfrc_passive / d qvel) to qDeriv
@@ -1508,7 +1480,6 @@ void mjd_passive_vel(const mjModel* m, mjData* d) {
}
//------------------------- main entry points ------------------------------------------------------
// analytical derivative of smooth forces w.r.t velocities: