Skip to content

Commit 11f1da0

Browse files
yuvaltassacopybara-github
authored andcommitted
Migrate types in mjs structs.
PiperOrigin-RevId: 942546629 Change-Id: I46f2b24b53a43361fdc67dc32f2af1c0ce8b1de8
1 parent 315bcfb commit 11f1da0

15 files changed

Lines changed: 339 additions & 311 deletions

File tree

doc/includes/references.h

Lines changed: 59 additions & 59 deletions
Large diffs are not rendered by default.

include/mujoco/mjspec.h

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,23 @@ typedef enum mjtGeomInertia { // type of inertia inference
6363
} mjtGeomInertia;
6464

6565

66-
typedef enum mjtMeshInertia { // type of mesh inertia
67-
mjMESH_INERTIA_CONVEX = 0, // convex mesh inertia
68-
mjMESH_INERTIA_EXACT, // exact mesh inertia
69-
mjMESH_INERTIA_LEGACY, // legacy mesh inertia
70-
mjMESH_INERTIA_SHELL // shell mesh inertia
66+
typedef enum mjtMeshInertia { // type of mesh inertia
67+
mjMESH_INERTIA_CONVEX = 0, // convex mesh inertia
68+
mjMESH_INERTIA_EXACT, // exact mesh inertia
69+
mjMESH_INERTIA_LEGACY, // legacy mesh inertia
70+
mjMESH_INERTIA_SHELL // shell mesh inertia
7171
} mjtMeshInertia;
7272

7373

74-
typedef enum mjtMeshBuiltin { // type of built-in procedural mesh
75-
mjMESH_BUILTIN_NONE = 0, // no built-in mesh
76-
mjMESH_BUILTIN_SPHERE, // sphere
77-
mjMESH_BUILTIN_HEMISPHERE, // hemisphere
78-
mjMESH_BUILTIN_CONE, // cone
79-
mjMESH_BUILTIN_SUPERSPHERE, // supersphere
80-
mjMESH_BUILTIN_SUPERTORUS, // supertorus
81-
mjMESH_BUILTIN_WEDGE, // wedge
82-
mjMESH_BUILTIN_PLATE, // plate
74+
typedef enum mjtMeshBuiltin { // type of built-in procedural mesh
75+
mjMESH_BUILTIN_NONE = 0, // no built-in mesh
76+
mjMESH_BUILTIN_SPHERE, // sphere
77+
mjMESH_BUILTIN_HEMISPHERE, // hemisphere
78+
mjMESH_BUILTIN_CONE, // cone
79+
mjMESH_BUILTIN_SUPERSPHERE, // supersphere
80+
mjMESH_BUILTIN_SUPERTORUS, // supertorus
81+
mjMESH_BUILTIN_WEDGE, // wedge
82+
mjMESH_BUILTIN_PLATE, // plate
8383
} mjtMeshBuiltin;
8484

8585

@@ -128,13 +128,13 @@ typedef enum mjtOrientation { // type of orientation specifier
128128
mjORIENTATION_EULER, // Euler angles
129129
} mjtOrientation;
130130

131-
typedef enum mjtConflict { // conflict resolution for attach
132-
mjCONFLICT_WARNING = 0, // keep parent, warn on conflict
133-
mjCONFLICT_MERGE, // merge: min/max/error per field
134-
mjCONFLICT_ERROR, // error on any conflict
131+
typedef enum mjtConflict { // conflict resolution for attach
132+
mjCONFLICT_WARNING = 0, // keep parent, warn on conflict
133+
mjCONFLICT_MERGE, // merge: min/max/error per field
134+
mjCONFLICT_ERROR, // error on any conflict
135135
} mjtConflict;
136136

137-
typedef enum mjtCTimer { // compiler timing categories
137+
typedef enum mjtCTimer { // compiler timing categories
138138
// top-level timers (wall-clock)
139139
mjCTIMER_TOTAL = 0, // total compile time
140140
mjCTIMER_ASSETS, // asset compilation
@@ -161,22 +161,22 @@ typedef struct mjsElement_ { // element type, do not modify
161161

162162

163163
typedef struct mjsCompiler_ { // compiler options
164-
mjtByte autolimits; // infer "limited" attribute based on range
164+
mjtBool autolimits; // infer "limited" attribute based on range
165165
double boundmass; // enforce minimum body mass
166166
double boundinertia; // enforce minimum body diagonal inertia
167167
double settotalmass; // rescale masses and inertias; <=0: ignore
168-
mjtByte balanceinertia; // automatically impose A + B >= C rule
169-
mjtByte fitaabb; // meshfit to aabb instead of inertia box
170-
mjtByte degree; // angles in radians or degrees
168+
mjtBool balanceinertia; // automatically impose A + B >= C rule
169+
mjtBool fitaabb; // meshfit to aabb instead of inertia box
170+
mjtBool degree; // angles in radians or degrees
171171
char eulerseq[3]; // sequence for euler rotations
172-
mjtByte discardvisual; // discard visual geoms in parser
173-
mjtByte usethread; // use multiple threads to speed up compiler
174-
mjtByte fusestatic; // fuse static bodies with parent
175-
int inertiafromgeom; // use geom inertias (mjtInertiaFromGeom)
172+
mjtBool discardvisual; // discard visual geoms in parser
173+
mjtBool usethread; // use multiple threads to speed up compiler
174+
mjtBool fusestatic; // fuse static bodies with parent
175+
mjtInertiaFromGeom inertiafromgeom; // use geom inertias
176176
int inertiagrouprange[2]; // range of geom groups used to compute inertia
177-
mjtByte saveinertial; // save explicit inertial clause for all bodies to XML
178-
int alignfree; // align free joints with inertial frame
179-
int conflict; // conflict resolution for attach (mjtConflict)
177+
mjtBool saveinertial; // save explicit inertial clause for all bodies to XML
178+
mjtBool alignfree; // align free joints with inertial frame
179+
mjtConflict conflict; // conflict resolution for attach
180180
mjLROpt LRopt; // options for lengthrange computation
181181
mjString* meshdir; // mesh and hfield directory
182182
mjString* texturedir; // texture directory
@@ -204,7 +204,7 @@ typedef struct mjSpec_ { // model specification
204204

205205
// compiler data
206206
mjsCompiler compiler; // compiler options
207-
mjtByte strippath; // automatically strip paths from mesh files
207+
mjtBool strippath; // automatically strip paths from mesh files
208208

209209
// engine data
210210
mjOption option; // physics options
@@ -233,7 +233,7 @@ typedef struct mjSpec_ { // model specification
233233
mjString* modelfiledir; // path to model file
234234

235235
// other
236-
mjtByte hasImplicitPluginElem; // already encountered an implicit plugin sensor/actuator
236+
mjtBool hasImplicitPluginElem; // already encountered an implicit plugin sensor/actuator
237237

238238
// authored tracking bitmasks for mjModel structs
239239
mjsAuthored authored;
@@ -253,7 +253,7 @@ typedef struct mjsPlugin_ { // plugin specification
253253
mjsElement* element; // element type
254254
mjString* name; // instance name
255255
mjString* plugin_name; // plugin name
256-
mjtByte active; // is the plugin active
256+
mjtBool active; // is the plugin active
257257
mjString* info; // message appended to compiler errors
258258
} mjsPlugin;
259259

@@ -276,12 +276,12 @@ typedef struct mjsBody_ { // body specification
276276
double fullinertia[6]; // non-axis-aligned inertia matrix
277277

278278
// other
279-
mjtByte mocap; // is this a mocap body
279+
mjtBool mocap; // is this a mocap body
280280
double gravcomp; // gravity compensation
281281
mjtSleepPolicy sleep; // sleep policy
282282
mjtByte simple; // simple body optimization (0: false, 1: auto)
283283
mjDoubleVec* userdata; // user data
284-
mjtByte explicitinertial; // whether to save the body with explicit inertial clause
284+
mjtBool explicitinertial; // whether to save the body with explicit inertial clause
285285
mjsPlugin plugin; // passive force plugin
286286
mjString* info; // message appended to compiler errors
287287
} mjsBody;
@@ -305,20 +305,20 @@ typedef struct mjsJoint_ { // joint specification
305305
double pos[3]; // anchor position
306306
double axis[3]; // joint axis
307307
double ref; // value at reference configuration: qpos0
308-
int align; // align free joint with body com (mjtAlignFree)
308+
mjtAlignFree align; // align free joint with body com
309309

310310
// stiffness
311311
double stiffness[mjNPOLY+1]; // stiffness coefficients
312312
double springref; // spring reference value: qpos_spring
313313
double springdamper[2]; // timeconst, dampratio
314314

315315
// limits
316-
int limited; // does joint have limits (mjtLimited)
316+
mjtLimited limited; // does joint have limits
317317
double range[2]; // joint limits
318318
double margin; // margin value for joint limit detection
319319
mjtNum solref_limit[mjNREF]; // solver reference: joint limits
320320
mjtNum solimp_limit[mjNIMP]; // solver impedance: joint limits
321-
int actfrclimited; // are actuator forces on joint limited (mjtLimited)
321+
mjtLimited actfrclimited; // are actuator forces on joint limited
322322
double actfrcrange[2]; // actuator force limits
323323

324324
// dof properties
@@ -330,7 +330,7 @@ typedef struct mjsJoint_ { // joint specification
330330

331331
// other
332332
int group; // group
333-
mjtByte actgravcomp; // is gravcomp force applied via actuators
333+
mjtBool actgravcomp; // is gravcomp force applied via actuators
334334
mjDoubleVec* userdata; // user data
335335
mjString* info; // message appended to compiler errors
336336
} mjsJoint;
@@ -444,10 +444,10 @@ typedef struct mjsLight_ { // light specification
444444
mjString* targetbody; // target body for targeting
445445

446446
// intrinsics
447-
mjtByte active; // is light active
447+
mjtBool active; // is light active
448448
mjtLightType type; // type of light
449449
mjString* texture; // texture name for image lights
450-
mjtByte castshadow; // does light cast shadows
450+
mjtBool castshadow; // does light cast shadows
451451
float bulbradius; // bulb radius, for soft shadows
452452
float intensity; // intensity, in candelas
453453
float range; // range of effectiveness
@@ -459,7 +459,7 @@ typedef struct mjsLight_ { // light specification
459459
float specular[3]; // specular color
460460

461461
// other
462-
mjString* info; // message appended to compiler errorsx
462+
mjString* info; // message appended to compiler errors
463463
} mjsLight;
464464

465465

@@ -482,9 +482,9 @@ typedef struct mjsFlex_ { // flex specification
482482
int dim; // element dimensionality
483483
double radius; // radius around primitive element
484484
double size[3]; // vertex bounding box half sizes in qpos0
485-
mjtByte internal; // enable internal collisions
486-
mjtByte flatskin; // render flex skin with flat shading
487-
int selfcollide; // mode for flex self collision
485+
mjtBool internal; // enable internal collisions
486+
mjtBool flatskin; // render flex skin with flat shading
487+
mjtFlexSelf selfcollide; // mode for flex self collision
488488
int passive; // mode for passive collisions
489489
int activelayers; // number of active element layers in 3D
490490
int group; // group for visualization
@@ -522,8 +522,8 @@ typedef struct mjsMesh_ { // mesh specification
522522
double refquat[4]; // reference orientation
523523
double scale[3]; // rescale mesh
524524
mjtMeshInertia inertia; // inertia type (convex, legacy, exact, shell)
525-
mjtByte smoothnormal; // do not exclude large-angle faces from normals
526-
mjtByte needsdf; // compute sdf from mesh
525+
mjtBool smoothnormal; // do not exclude large-angle faces from normals
526+
mjtBool needsdf; // compute sdf from mesh
527527
int maxhullvert; // maximum vertex count for the convex hull
528528
mjFloatVec* uservert; // user vertex data
529529
mjFloatVec* usernormal; // user normal data
@@ -582,8 +582,8 @@ typedef struct mjsTexture_ { // texture specification
582582
mjtColorSpace colorspace; // colorspace
583583

584584
// method 1: builtin
585-
int builtin; // builtin type (mjtBuiltin)
586-
int mark; // mark type (mjtMark)
585+
mjtBuiltin builtin; // builtin type
586+
mjtMark mark; // mark type
587587
double rgb1[3]; // first color for builtin
588588
double rgb2[3]; // second color for builtin
589589
double markrgb[3]; // mark color
@@ -605,8 +605,8 @@ typedef struct mjsTexture_ { // texture specification
605605
mjByteVec* data; // texture data
606606

607607
// flip options
608-
mjtByte hflip; // horizontal flip
609-
mjtByte vflip; // vertical flip
608+
mjtBool hflip; // horizontal flip
609+
mjtBool vflip; // vertical flip
610610

611611
// other
612612
mjString* info; // message appended to compiler errors
@@ -616,7 +616,7 @@ typedef struct mjsTexture_ { // texture specification
616616
typedef struct mjsMaterial_ { // material specification
617617
mjsElement* element; // element type
618618
mjStringVec* textures; // names of textures (empty: none)
619-
mjtByte texuniform; // make texture cube uniform
619+
mjtBool texuniform; // make texture cube uniform
620620
float texrepeat[2]; // texture repetition for 2D mapping
621621
float emission; // emission
622622
float specular; // specular
@@ -658,7 +658,7 @@ typedef struct mjsEquality_ { // equality specification
658658
mjsElement* element; // element type
659659
mjtEq type; // constraint type
660660
double data[mjNEQDATA]; // type-dependent data
661-
mjtByte active; // is equality initially active
661+
mjtBool active; // is equality initially active
662662
mjString* name1; // name of object 1
663663
mjString* name2; // name of object 2
664664
mjtObj objtype; // type of both objects
@@ -681,8 +681,8 @@ typedef struct mjsTendon_ { // tendon specification
681681
double armature; // inertia associated with tendon velocity
682682

683683
// length range
684-
int limited; // does tendon have limits (mjtLimited)
685-
int actfrclimited; // does tendon have actuator force limits
684+
mjtLimited limited; // does tendon have limits
685+
mjtLimited actfrclimited; // does tendon have actuator force limits
686686
double range[2]; // length limits
687687
double actfrcrange[2]; // actuator force limits
688688
double margin; // margin value for tendon limit detection
@@ -721,7 +721,7 @@ typedef struct mjsActuator_ { // actuator specification
721721
mjtDyn dyntype; // dynamics type
722722
double dynprm[mjNDYN]; // dynamics parameters
723723
int actdim; // number of activation variables
724-
mjtByte actearly; // apply next activations to qfrc
724+
mjtBool actearly; // apply next activations to qfrc
725725

726726
// transmission
727727
mjtTrn trntype; // transmission type
@@ -736,11 +736,11 @@ typedef struct mjsActuator_ { // actuator specification
736736
double armature; // armature inertia
737737

738738
// input/output clamping
739-
int ctrllimited; // are control limits defined (mjtLimited)
739+
mjtLimited ctrllimited; // are control limits defined
740740
double ctrlrange[2]; // control range
741-
int forcelimited; // are force limits defined (mjtLimited)
741+
mjtLimited forcelimited; // are force limits defined
742742
double forcerange[2]; // force range
743-
int actlimited; // are activation limits defined (mjtLimited)
743+
mjtLimited actlimited; // are activation limits defined
744744
double actrange[2]; // activation range
745745

746746
// other

0 commit comments

Comments
 (0)