Modernize struct and enum style in MuJoCo headers.

PiperOrigin-RevId: 936485706
Change-Id: I31864acc4bd44573127d3d04c6b1a23f9d9c4cbc
This commit is contained in:
Kyle Bayes
2026-06-23 00:47:13 -07:00
committed by Copybara-Service
parent afccd36dd4
commit 0fd7bea973
12 changed files with 463 additions and 548 deletions
+24 -29
View File
@@ -26,15 +26,15 @@
//------------------------------------- Contact ----------------------------------------------------
struct mjPreContact_ { // contact parameters set by narrowphase collision functions
typedef struct mjPreContact_ { // contact parameters set by narrowphase collision functions
mjtNum dist;
mjtNum pos[3];
mjtNum normal[3]; // contact normal of the collision
mjtNum tangent[3]; // first tangent direction
};
typedef struct mjPreContact_ mjPreContact;
} mjPreContact;
struct mjContact_ { // result of collision detection functions
typedef struct mjContact_ { // result of collision detection functions
// contact parameters set by narrowphase collision function
mjtNum dist; // distance between nearest points; neg: penetration
mjtNum pos[3]; // position of contact point: midpoint between geoms
@@ -65,41 +65,37 @@ struct mjContact_ { // result of collision detection functions
// address computed by mj_instantiateContact
int efc_address; // address in efc; -1: not included
};
typedef struct mjContact_ mjContact;
} mjContact;
//---------------------------------- diagnostics ---------------------------------------------------
struct mjWarningStat_ { // warning statistics
int lastinfo; // info from last warning
int number; // how many times was warning raised
};
typedef struct mjWarningStat_ mjWarningStat;
typedef struct mjWarningStat_ { // warning statistics
int lastinfo; // info from last warning
int number; // how many times was warning raised
} mjWarningStat;
struct mjTimerStat_ { // timer statistics
mjtNum duration; // cumulative duration
int number; // how many times was timer called
};
typedef struct mjTimerStat_ mjTimerStat;
typedef struct mjTimerStat_ { // timer statistics
mjtNum duration; // cumulative duration
int number; // how many times was timer called
} mjTimerStat;
struct mjSolverStat_ { // per-iteration solver statistics
mjtNum improvement; // cost reduction, scaled by 1/trace(M(qpos0))
mjtNum gradient; // gradient norm (primal only, scaled)
mjtNum lineslope; // slope in linesearch
int nactive; // number of active constraints
int nchange; // number of constraint state changes
int neval; // number of cost evaluations in line search
int nupdate; // number of Cholesky updates in line search
};
typedef struct mjSolverStat_ mjSolverStat;
typedef struct mjSolverStat_ { // per-iteration solver statistics
mjtNum improvement; // cost reduction, scaled by 1/trace(M(qpos0))
mjtNum gradient; // gradient norm (primal only, scaled)
mjtNum lineslope; // slope in linesearch
int nactive; // number of active constraints
int nchange; // number of constraint state changes
int neval; // number of cost evaluations in line search
int nupdate; // number of Cholesky updates in line search
} mjSolverStat;
//---------------------------------- mjData --------------------------------------------------------
struct mjData_ {
typedef struct mjData_ {
// constant sizes
mjtSize narena; // size of the arena in bytes (inclusive of the stack)
mjtSize nbuffer; // size of main buffer in bytes
@@ -411,8 +407,7 @@ struct mjData_ {
// compilation signature
uint64_t signature; // also held by the mjSpec that compiled the model
};
typedef struct mjData_ mjData;
} mjData;
//---------------------------------- callback function types ---------------------------------------