Migrate types in mjs structs.

PiperOrigin-RevId: 942546629
Change-Id: I46f2b24b53a43361fdc67dc32f2af1c0ce8b1de8
This commit is contained in:
Yuval Tassa
2026-07-04 11:27:00 -07:00
committed by Copybara-Service
parent 315bcfbf3a
commit 11f1da0c44
15 changed files with 339 additions and 311 deletions
+59 -59
View File
@@ -1476,21 +1476,21 @@ typedef enum mjtGeomInertia { // type of inertia inference
mjINERTIA_VOLUME = 0, // mass distributed in the volume mjINERTIA_VOLUME = 0, // mass distributed in the volume
mjINERTIA_SHELL, // mass distributed on the surface mjINERTIA_SHELL, // mass distributed on the surface
} mjtGeomInertia; } mjtGeomInertia;
typedef enum mjtMeshInertia { // type of mesh inertia typedef enum mjtMeshInertia { // type of mesh inertia
mjMESH_INERTIA_CONVEX = 0, // convex mesh inertia mjMESH_INERTIA_CONVEX = 0, // convex mesh inertia
mjMESH_INERTIA_EXACT, // exact mesh inertia mjMESH_INERTIA_EXACT, // exact mesh inertia
mjMESH_INERTIA_LEGACY, // legacy mesh inertia mjMESH_INERTIA_LEGACY, // legacy mesh inertia
mjMESH_INERTIA_SHELL // shell mesh inertia mjMESH_INERTIA_SHELL // shell mesh inertia
} mjtMeshInertia; } mjtMeshInertia;
typedef enum mjtMeshBuiltin { // type of built-in procedural mesh typedef enum mjtMeshBuiltin { // type of built-in procedural mesh
mjMESH_BUILTIN_NONE = 0, // no built-in mesh mjMESH_BUILTIN_NONE = 0, // no built-in mesh
mjMESH_BUILTIN_SPHERE, // sphere mjMESH_BUILTIN_SPHERE, // sphere
mjMESH_BUILTIN_HEMISPHERE, // hemisphere mjMESH_BUILTIN_HEMISPHERE, // hemisphere
mjMESH_BUILTIN_CONE, // cone mjMESH_BUILTIN_CONE, // cone
mjMESH_BUILTIN_SUPERSPHERE, // supersphere mjMESH_BUILTIN_SUPERSPHERE, // supersphere
mjMESH_BUILTIN_SUPERTORUS, // supertorus mjMESH_BUILTIN_SUPERTORUS, // supertorus
mjMESH_BUILTIN_WEDGE, // wedge mjMESH_BUILTIN_WEDGE, // wedge
mjMESH_BUILTIN_PLATE, // plate mjMESH_BUILTIN_PLATE, // plate
} mjtMeshBuiltin; } mjtMeshBuiltin;
typedef enum mjtBuiltin { // type of built-in procedural texture typedef enum mjtBuiltin { // type of built-in procedural texture
mjBUILTIN_NONE = 0, // no built-in texture mjBUILTIN_NONE = 0, // no built-in texture
@@ -1526,12 +1526,12 @@ typedef enum mjtOrientation { // type of orientation specifier
mjORIENTATION_ZAXIS, // z axis (minimal rotation) mjORIENTATION_ZAXIS, // z axis (minimal rotation)
mjORIENTATION_EULER, // Euler angles mjORIENTATION_EULER, // Euler angles
} mjtOrientation; } mjtOrientation;
typedef enum mjtConflict { // conflict resolution for attach typedef enum mjtConflict { // conflict resolution for attach
mjCONFLICT_WARNING = 0, // keep parent, warn on conflict mjCONFLICT_WARNING = 0, // keep parent, warn on conflict
mjCONFLICT_MERGE, // merge: min/max/error per field mjCONFLICT_MERGE, // merge: min/max/error per field
mjCONFLICT_ERROR, // error on any conflict mjCONFLICT_ERROR, // error on any conflict
} mjtConflict; } mjtConflict;
typedef enum mjtCTimer { // compiler timing categories typedef enum mjtCTimer { // compiler timing categories
// top-level timers (wall-clock) // top-level timers (wall-clock)
mjCTIMER_TOTAL = 0, // total compile time mjCTIMER_TOTAL = 0, // total compile time
mjCTIMER_ASSETS, // asset compilation mjCTIMER_ASSETS, // asset compilation
@@ -1552,22 +1552,22 @@ typedef struct mjsElement_ { // element type, do not modify
uint64_t signature; // compilation signature uint64_t signature; // compilation signature
} mjsElement; } mjsElement;
typedef struct mjsCompiler_ { // compiler options typedef struct mjsCompiler_ { // compiler options
mjtByte autolimits; // infer "limited" attribute based on range mjtBool autolimits; // infer "limited" attribute based on range
double boundmass; // enforce minimum body mass double boundmass; // enforce minimum body mass
double boundinertia; // enforce minimum body diagonal inertia double boundinertia; // enforce minimum body diagonal inertia
double settotalmass; // rescale masses and inertias; <=0: ignore double settotalmass; // rescale masses and inertias; <=0: ignore
mjtByte balanceinertia; // automatically impose A + B >= C rule mjtBool balanceinertia; // automatically impose A + B >= C rule
mjtByte fitaabb; // meshfit to aabb instead of inertia box mjtBool fitaabb; // meshfit to aabb instead of inertia box
mjtByte degree; // angles in radians or degrees mjtBool degree; // angles in radians or degrees
char eulerseq[3]; // sequence for euler rotations char eulerseq[3]; // sequence for euler rotations
mjtByte discardvisual; // discard visual geoms in parser mjtBool discardvisual; // discard visual geoms in parser
mjtByte usethread; // use multiple threads to speed up compiler mjtBool usethread; // use multiple threads to speed up compiler
mjtByte fusestatic; // fuse static bodies with parent mjtBool fusestatic; // fuse static bodies with parent
int inertiafromgeom; // use geom inertias (mjtInertiaFromGeom) mjtInertiaFromGeom inertiafromgeom; // use geom inertias
int inertiagrouprange[2]; // range of geom groups used to compute inertia int inertiagrouprange[2]; // range of geom groups used to compute inertia
mjtByte saveinertial; // save explicit inertial clause for all bodies to XML mjtBool saveinertial; // save explicit inertial clause for all bodies to XML
int alignfree; // align free joints with inertial frame mjtBool alignfree; // align free joints with inertial frame
int conflict; // conflict resolution for attach (mjtConflict) mjtConflict conflict; // conflict resolution for attach
mjLROpt LRopt; // options for lengthrange computation mjLROpt LRopt; // options for lengthrange computation
mjString* meshdir; // mesh and hfield directory mjString* meshdir; // mesh and hfield directory
mjString* texturedir; // texture directory mjString* texturedir; // texture directory
@@ -1591,7 +1591,7 @@ typedef struct mjSpec_ { // model specification
// compiler data // compiler data
mjsCompiler compiler; // compiler options mjsCompiler compiler; // compiler options
mjtByte strippath; // automatically strip paths from mesh files mjtBool strippath; // automatically strip paths from mesh files
// engine data // engine data
mjOption option; // physics options mjOption option; // physics options
@@ -1620,7 +1620,7 @@ typedef struct mjSpec_ { // model specification
mjString* modelfiledir; // path to model file mjString* modelfiledir; // path to model file
// other // other
mjtByte hasImplicitPluginElem; // already encountered an implicit plugin sensor/actuator mjtBool hasImplicitPluginElem; // already encountered an implicit plugin sensor/actuator
// authored tracking bitmasks for mjModel structs // authored tracking bitmasks for mjModel structs
mjsAuthored authored; mjsAuthored authored;
@@ -1636,7 +1636,7 @@ typedef struct mjsPlugin_ { // plugin specification
mjsElement* element; // element type mjsElement* element; // element type
mjString* name; // instance name mjString* name; // instance name
mjString* plugin_name; // plugin name mjString* plugin_name; // plugin name
mjtByte active; // is the plugin active mjtBool active; // is the plugin active
mjString* info; // message appended to compiler errors mjString* info; // message appended to compiler errors
} mjsPlugin; } mjsPlugin;
typedef struct mjsBody_ { // body specification typedef struct mjsBody_ { // body specification
@@ -1657,12 +1657,12 @@ typedef struct mjsBody_ { // body specification
double fullinertia[6]; // non-axis-aligned inertia matrix double fullinertia[6]; // non-axis-aligned inertia matrix
// other // other
mjtByte mocap; // is this a mocap body mjtBool mocap; // is this a mocap body
double gravcomp; // gravity compensation double gravcomp; // gravity compensation
mjtSleepPolicy sleep; // sleep policy mjtSleepPolicy sleep; // sleep policy
mjtByte simple; // simple body optimization (0: false, 1: auto) mjtByte simple; // simple body optimization (0: false, 1: auto)
mjDoubleVec* userdata; // user data mjDoubleVec* userdata; // user data
mjtByte explicitinertial; // whether to save the body with explicit inertial clause mjtBool explicitinertial; // whether to save the body with explicit inertial clause
mjsPlugin plugin; // passive force plugin mjsPlugin plugin; // passive force plugin
mjString* info; // message appended to compiler errors mjString* info; // message appended to compiler errors
} mjsBody; } mjsBody;
@@ -1682,7 +1682,7 @@ typedef struct mjsJoint_ { // joint specification
double pos[3]; // anchor position double pos[3]; // anchor position
double axis[3]; // joint axis double axis[3]; // joint axis
double ref; // value at reference configuration: qpos0 double ref; // value at reference configuration: qpos0
int align; // align free joint with body com (mjtAlignFree) mjtAlignFree align; // align free joint with body com
// stiffness // stiffness
double stiffness[mjNPOLY+1]; // stiffness coefficients double stiffness[mjNPOLY+1]; // stiffness coefficients
@@ -1690,12 +1690,12 @@ typedef struct mjsJoint_ { // joint specification
double springdamper[2]; // timeconst, dampratio double springdamper[2]; // timeconst, dampratio
// limits // limits
int limited; // does joint have limits (mjtLimited) mjtLimited limited; // does joint have limits
double range[2]; // joint limits double range[2]; // joint limits
double margin; // margin value for joint limit detection double margin; // margin value for joint limit detection
mjtNum solref_limit[mjNREF]; // solver reference: joint limits mjtNum solref_limit[mjNREF]; // solver reference: joint limits
mjtNum solimp_limit[mjNIMP]; // solver impedance: joint limits mjtNum solimp_limit[mjNIMP]; // solver impedance: joint limits
int actfrclimited; // are actuator forces on joint limited (mjtLimited) mjtLimited actfrclimited; // are actuator forces on joint limited
double actfrcrange[2]; // actuator force limits double actfrcrange[2]; // actuator force limits
// dof properties // dof properties
@@ -1707,7 +1707,7 @@ typedef struct mjsJoint_ { // joint specification
// other // other
int group; // group int group; // group
mjtByte actgravcomp; // is gravcomp force applied via actuators mjtBool actgravcomp; // is gravcomp force applied via actuators
mjDoubleVec* userdata; // user data mjDoubleVec* userdata; // user data
mjString* info; // message appended to compiler errors mjString* info; // message appended to compiler errors
} mjsJoint; } mjsJoint;
@@ -1813,10 +1813,10 @@ typedef struct mjsLight_ { // light specification
mjString* targetbody; // target body for targeting mjString* targetbody; // target body for targeting
// intrinsics // intrinsics
mjtByte active; // is light active mjtBool active; // is light active
mjtLightType type; // type of light mjtLightType type; // type of light
mjString* texture; // texture name for image lights mjString* texture; // texture name for image lights
mjtByte castshadow; // does light cast shadows mjtBool castshadow; // does light cast shadows
float bulbradius; // bulb radius, for soft shadows float bulbradius; // bulb radius, for soft shadows
float intensity; // intensity, in candelas float intensity; // intensity, in candelas
float range; // range of effectiveness float range; // range of effectiveness
@@ -1828,7 +1828,7 @@ typedef struct mjsLight_ { // light specification
float specular[3]; // specular color float specular[3]; // specular color
// other // other
mjString* info; // message appended to compiler errorsx mjString* info; // message appended to compiler errors
} mjsLight; } mjsLight;
typedef struct mjsFlex_ { // flex specification typedef struct mjsFlex_ { // flex specification
mjsElement* element; // element type mjsElement* element; // element type
@@ -1849,9 +1849,9 @@ typedef struct mjsFlex_ { // flex specification
int dim; // element dimensionality int dim; // element dimensionality
double radius; // radius around primitive element double radius; // radius around primitive element
double size[3]; // vertex bounding box half sizes in qpos0 double size[3]; // vertex bounding box half sizes in qpos0
mjtByte internal; // enable internal collisions mjtBool internal; // enable internal collisions
mjtByte flatskin; // render flex skin with flat shading mjtBool flatskin; // render flex skin with flat shading
int selfcollide; // mode for flex self collision mjtFlexSelf selfcollide; // mode for flex self collision
int passive; // mode for passive collisions int passive; // mode for passive collisions
int activelayers; // number of active element layers in 3D int activelayers; // number of active element layers in 3D
int group; // group for visualization int group; // group for visualization
@@ -1887,8 +1887,8 @@ typedef struct mjsMesh_ { // mesh specification
double refquat[4]; // reference orientation double refquat[4]; // reference orientation
double scale[3]; // rescale mesh double scale[3]; // rescale mesh
mjtMeshInertia inertia; // inertia type (convex, legacy, exact, shell) mjtMeshInertia inertia; // inertia type (convex, legacy, exact, shell)
mjtByte smoothnormal; // do not exclude large-angle faces from normals mjtBool smoothnormal; // do not exclude large-angle faces from normals
mjtByte needsdf; // compute sdf from mesh mjtBool needsdf; // compute sdf from mesh
int maxhullvert; // maximum vertex count for the convex hull int maxhullvert; // maximum vertex count for the convex hull
mjFloatVec* uservert; // user vertex data mjFloatVec* uservert; // user vertex data
mjFloatVec* usernormal; // user normal data mjFloatVec* usernormal; // user normal data
@@ -1940,8 +1940,8 @@ typedef struct mjsTexture_ { // texture specification
mjtColorSpace colorspace; // colorspace mjtColorSpace colorspace; // colorspace
// method 1: builtin // method 1: builtin
int builtin; // builtin type (mjtBuiltin) mjtBuiltin builtin; // builtin type
int mark; // mark type (mjtMark) mjtMark mark; // mark type
double rgb1[3]; // first color for builtin double rgb1[3]; // first color for builtin
double rgb2[3]; // second color for builtin double rgb2[3]; // second color for builtin
double markrgb[3]; // mark color double markrgb[3]; // mark color
@@ -1963,8 +1963,8 @@ typedef struct mjsTexture_ { // texture specification
mjByteVec* data; // texture data mjByteVec* data; // texture data
// flip options // flip options
mjtByte hflip; // horizontal flip mjtBool hflip; // horizontal flip
mjtByte vflip; // vertical flip mjtBool vflip; // vertical flip
// other // other
mjString* info; // message appended to compiler errors mjString* info; // message appended to compiler errors
@@ -1972,7 +1972,7 @@ typedef struct mjsTexture_ { // texture specification
typedef struct mjsMaterial_ { // material specification typedef struct mjsMaterial_ { // material specification
mjsElement* element; // element type mjsElement* element; // element type
mjStringVec* textures; // names of textures (empty: none) mjStringVec* textures; // names of textures (empty: none)
mjtByte texuniform; // make texture cube uniform mjtBool texuniform; // make texture cube uniform
float texrepeat[2]; // texture repetition for 2D mapping float texrepeat[2]; // texture repetition for 2D mapping
float emission; // emission float emission; // emission
float specular; // specular float specular; // specular
@@ -2008,7 +2008,7 @@ typedef struct mjsEquality_ { // equality specification
mjsElement* element; // element type mjsElement* element; // element type
mjtEq type; // constraint type mjtEq type; // constraint type
double data[mjNEQDATA]; // type-dependent data double data[mjNEQDATA]; // type-dependent data
mjtByte active; // is equality initially active mjtBool active; // is equality initially active
mjString* name1; // name of object 1 mjString* name1; // name of object 1
mjString* name2; // name of object 2 mjString* name2; // name of object 2
mjtObj objtype; // type of both objects mjtObj objtype; // type of both objects
@@ -2029,8 +2029,8 @@ typedef struct mjsTendon_ { // tendon specification
double armature; // inertia associated with tendon velocity double armature; // inertia associated with tendon velocity
// length range // length range
int limited; // does tendon have limits (mjtLimited) mjtLimited limited; // does tendon have limits
int actfrclimited; // does tendon have actuator force limits mjtLimited actfrclimited; // does tendon have actuator force limits
double range[2]; // length limits double range[2]; // length limits
double actfrcrange[2]; // actuator force limits double actfrcrange[2]; // actuator force limits
double margin; // margin value for tendon limit detection double margin; // margin value for tendon limit detection
@@ -2065,7 +2065,7 @@ typedef struct mjsActuator_ { // actuator specification
mjtDyn dyntype; // dynamics type mjtDyn dyntype; // dynamics type
double dynprm[mjNDYN]; // dynamics parameters double dynprm[mjNDYN]; // dynamics parameters
int actdim; // number of activation variables int actdim; // number of activation variables
mjtByte actearly; // apply next activations to qfrc mjtBool actearly; // apply next activations to qfrc
// transmission // transmission
mjtTrn trntype; // transmission type mjtTrn trntype; // transmission type
@@ -2080,11 +2080,11 @@ typedef struct mjsActuator_ { // actuator specification
double armature; // armature inertia double armature; // armature inertia
// input/output clamping // input/output clamping
int ctrllimited; // are control limits defined (mjtLimited) mjtLimited ctrllimited; // are control limits defined
double ctrlrange[2]; // control range double ctrlrange[2]; // control range
int forcelimited; // are force limits defined (mjtLimited) mjtLimited forcelimited; // are force limits defined
double forcerange[2]; // force range double forcerange[2]; // force range
int actlimited; // are activation limits defined (mjtLimited) mjtLimited actlimited; // are activation limits defined
double actrange[2]; // activation range double actrange[2]; // activation range
// other // other
+59 -59
View File
@@ -63,23 +63,23 @@ typedef enum mjtGeomInertia { // type of inertia inference
} mjtGeomInertia; } mjtGeomInertia;
typedef enum mjtMeshInertia { // type of mesh inertia typedef enum mjtMeshInertia { // type of mesh inertia
mjMESH_INERTIA_CONVEX = 0, // convex mesh inertia mjMESH_INERTIA_CONVEX = 0, // convex mesh inertia
mjMESH_INERTIA_EXACT, // exact mesh inertia mjMESH_INERTIA_EXACT, // exact mesh inertia
mjMESH_INERTIA_LEGACY, // legacy mesh inertia mjMESH_INERTIA_LEGACY, // legacy mesh inertia
mjMESH_INERTIA_SHELL // shell mesh inertia mjMESH_INERTIA_SHELL // shell mesh inertia
} mjtMeshInertia; } mjtMeshInertia;
typedef enum mjtMeshBuiltin { // type of built-in procedural mesh typedef enum mjtMeshBuiltin { // type of built-in procedural mesh
mjMESH_BUILTIN_NONE = 0, // no built-in mesh mjMESH_BUILTIN_NONE = 0, // no built-in mesh
mjMESH_BUILTIN_SPHERE, // sphere mjMESH_BUILTIN_SPHERE, // sphere
mjMESH_BUILTIN_HEMISPHERE, // hemisphere mjMESH_BUILTIN_HEMISPHERE, // hemisphere
mjMESH_BUILTIN_CONE, // cone mjMESH_BUILTIN_CONE, // cone
mjMESH_BUILTIN_SUPERSPHERE, // supersphere mjMESH_BUILTIN_SUPERSPHERE, // supersphere
mjMESH_BUILTIN_SUPERTORUS, // supertorus mjMESH_BUILTIN_SUPERTORUS, // supertorus
mjMESH_BUILTIN_WEDGE, // wedge mjMESH_BUILTIN_WEDGE, // wedge
mjMESH_BUILTIN_PLATE, // plate mjMESH_BUILTIN_PLATE, // plate
} mjtMeshBuiltin; } mjtMeshBuiltin;
@@ -128,13 +128,13 @@ typedef enum mjtOrientation { // type of orientation specifier
mjORIENTATION_EULER, // Euler angles mjORIENTATION_EULER, // Euler angles
} mjtOrientation; } mjtOrientation;
typedef enum mjtConflict { // conflict resolution for attach typedef enum mjtConflict { // conflict resolution for attach
mjCONFLICT_WARNING = 0, // keep parent, warn on conflict mjCONFLICT_WARNING = 0, // keep parent, warn on conflict
mjCONFLICT_MERGE, // merge: min/max/error per field mjCONFLICT_MERGE, // merge: min/max/error per field
mjCONFLICT_ERROR, // error on any conflict mjCONFLICT_ERROR, // error on any conflict
} mjtConflict; } mjtConflict;
typedef enum mjtCTimer { // compiler timing categories typedef enum mjtCTimer { // compiler timing categories
// top-level timers (wall-clock) // top-level timers (wall-clock)
mjCTIMER_TOTAL = 0, // total compile time mjCTIMER_TOTAL = 0, // total compile time
mjCTIMER_ASSETS, // asset compilation mjCTIMER_ASSETS, // asset compilation
@@ -161,22 +161,22 @@ typedef struct mjsElement_ { // element type, do not modify
typedef struct mjsCompiler_ { // compiler options typedef struct mjsCompiler_ { // compiler options
mjtByte autolimits; // infer "limited" attribute based on range mjtBool autolimits; // infer "limited" attribute based on range
double boundmass; // enforce minimum body mass double boundmass; // enforce minimum body mass
double boundinertia; // enforce minimum body diagonal inertia double boundinertia; // enforce minimum body diagonal inertia
double settotalmass; // rescale masses and inertias; <=0: ignore double settotalmass; // rescale masses and inertias; <=0: ignore
mjtByte balanceinertia; // automatically impose A + B >= C rule mjtBool balanceinertia; // automatically impose A + B >= C rule
mjtByte fitaabb; // meshfit to aabb instead of inertia box mjtBool fitaabb; // meshfit to aabb instead of inertia box
mjtByte degree; // angles in radians or degrees mjtBool degree; // angles in radians or degrees
char eulerseq[3]; // sequence for euler rotations char eulerseq[3]; // sequence for euler rotations
mjtByte discardvisual; // discard visual geoms in parser mjtBool discardvisual; // discard visual geoms in parser
mjtByte usethread; // use multiple threads to speed up compiler mjtBool usethread; // use multiple threads to speed up compiler
mjtByte fusestatic; // fuse static bodies with parent mjtBool fusestatic; // fuse static bodies with parent
int inertiafromgeom; // use geom inertias (mjtInertiaFromGeom) mjtInertiaFromGeom inertiafromgeom; // use geom inertias
int inertiagrouprange[2]; // range of geom groups used to compute inertia int inertiagrouprange[2]; // range of geom groups used to compute inertia
mjtByte saveinertial; // save explicit inertial clause for all bodies to XML mjtBool saveinertial; // save explicit inertial clause for all bodies to XML
int alignfree; // align free joints with inertial frame mjtBool alignfree; // align free joints with inertial frame
int conflict; // conflict resolution for attach (mjtConflict) mjtConflict conflict; // conflict resolution for attach
mjLROpt LRopt; // options for lengthrange computation mjLROpt LRopt; // options for lengthrange computation
mjString* meshdir; // mesh and hfield directory mjString* meshdir; // mesh and hfield directory
mjString* texturedir; // texture directory mjString* texturedir; // texture directory
@@ -204,7 +204,7 @@ typedef struct mjSpec_ { // model specification
// compiler data // compiler data
mjsCompiler compiler; // compiler options mjsCompiler compiler; // compiler options
mjtByte strippath; // automatically strip paths from mesh files mjtBool strippath; // automatically strip paths from mesh files
// engine data // engine data
mjOption option; // physics options mjOption option; // physics options
@@ -233,7 +233,7 @@ typedef struct mjSpec_ { // model specification
mjString* modelfiledir; // path to model file mjString* modelfiledir; // path to model file
// other // other
mjtByte hasImplicitPluginElem; // already encountered an implicit plugin sensor/actuator mjtBool hasImplicitPluginElem; // already encountered an implicit plugin sensor/actuator
// authored tracking bitmasks for mjModel structs // authored tracking bitmasks for mjModel structs
mjsAuthored authored; mjsAuthored authored;
@@ -253,7 +253,7 @@ typedef struct mjsPlugin_ { // plugin specification
mjsElement* element; // element type mjsElement* element; // element type
mjString* name; // instance name mjString* name; // instance name
mjString* plugin_name; // plugin name mjString* plugin_name; // plugin name
mjtByte active; // is the plugin active mjtBool active; // is the plugin active
mjString* info; // message appended to compiler errors mjString* info; // message appended to compiler errors
} mjsPlugin; } mjsPlugin;
@@ -276,12 +276,12 @@ typedef struct mjsBody_ { // body specification
double fullinertia[6]; // non-axis-aligned inertia matrix double fullinertia[6]; // non-axis-aligned inertia matrix
// other // other
mjtByte mocap; // is this a mocap body mjtBool mocap; // is this a mocap body
double gravcomp; // gravity compensation double gravcomp; // gravity compensation
mjtSleepPolicy sleep; // sleep policy mjtSleepPolicy sleep; // sleep policy
mjtByte simple; // simple body optimization (0: false, 1: auto) mjtByte simple; // simple body optimization (0: false, 1: auto)
mjDoubleVec* userdata; // user data mjDoubleVec* userdata; // user data
mjtByte explicitinertial; // whether to save the body with explicit inertial clause mjtBool explicitinertial; // whether to save the body with explicit inertial clause
mjsPlugin plugin; // passive force plugin mjsPlugin plugin; // passive force plugin
mjString* info; // message appended to compiler errors mjString* info; // message appended to compiler errors
} mjsBody; } mjsBody;
@@ -305,7 +305,7 @@ typedef struct mjsJoint_ { // joint specification
double pos[3]; // anchor position double pos[3]; // anchor position
double axis[3]; // joint axis double axis[3]; // joint axis
double ref; // value at reference configuration: qpos0 double ref; // value at reference configuration: qpos0
int align; // align free joint with body com (mjtAlignFree) mjtAlignFree align; // align free joint with body com
// stiffness // stiffness
double stiffness[mjNPOLY+1]; // stiffness coefficients double stiffness[mjNPOLY+1]; // stiffness coefficients
@@ -313,12 +313,12 @@ typedef struct mjsJoint_ { // joint specification
double springdamper[2]; // timeconst, dampratio double springdamper[2]; // timeconst, dampratio
// limits // limits
int limited; // does joint have limits (mjtLimited) mjtLimited limited; // does joint have limits
double range[2]; // joint limits double range[2]; // joint limits
double margin; // margin value for joint limit detection double margin; // margin value for joint limit detection
mjtNum solref_limit[mjNREF]; // solver reference: joint limits mjtNum solref_limit[mjNREF]; // solver reference: joint limits
mjtNum solimp_limit[mjNIMP]; // solver impedance: joint limits mjtNum solimp_limit[mjNIMP]; // solver impedance: joint limits
int actfrclimited; // are actuator forces on joint limited (mjtLimited) mjtLimited actfrclimited; // are actuator forces on joint limited
double actfrcrange[2]; // actuator force limits double actfrcrange[2]; // actuator force limits
// dof properties // dof properties
@@ -330,7 +330,7 @@ typedef struct mjsJoint_ { // joint specification
// other // other
int group; // group int group; // group
mjtByte actgravcomp; // is gravcomp force applied via actuators mjtBool actgravcomp; // is gravcomp force applied via actuators
mjDoubleVec* userdata; // user data mjDoubleVec* userdata; // user data
mjString* info; // message appended to compiler errors mjString* info; // message appended to compiler errors
} mjsJoint; } mjsJoint;
@@ -444,10 +444,10 @@ typedef struct mjsLight_ { // light specification
mjString* targetbody; // target body for targeting mjString* targetbody; // target body for targeting
// intrinsics // intrinsics
mjtByte active; // is light active mjtBool active; // is light active
mjtLightType type; // type of light mjtLightType type; // type of light
mjString* texture; // texture name for image lights mjString* texture; // texture name for image lights
mjtByte castshadow; // does light cast shadows mjtBool castshadow; // does light cast shadows
float bulbradius; // bulb radius, for soft shadows float bulbradius; // bulb radius, for soft shadows
float intensity; // intensity, in candelas float intensity; // intensity, in candelas
float range; // range of effectiveness float range; // range of effectiveness
@@ -459,7 +459,7 @@ typedef struct mjsLight_ { // light specification
float specular[3]; // specular color float specular[3]; // specular color
// other // other
mjString* info; // message appended to compiler errorsx mjString* info; // message appended to compiler errors
} mjsLight; } mjsLight;
@@ -482,9 +482,9 @@ typedef struct mjsFlex_ { // flex specification
int dim; // element dimensionality int dim; // element dimensionality
double radius; // radius around primitive element double radius; // radius around primitive element
double size[3]; // vertex bounding box half sizes in qpos0 double size[3]; // vertex bounding box half sizes in qpos0
mjtByte internal; // enable internal collisions mjtBool internal; // enable internal collisions
mjtByte flatskin; // render flex skin with flat shading mjtBool flatskin; // render flex skin with flat shading
int selfcollide; // mode for flex self collision mjtFlexSelf selfcollide; // mode for flex self collision
int passive; // mode for passive collisions int passive; // mode for passive collisions
int activelayers; // number of active element layers in 3D int activelayers; // number of active element layers in 3D
int group; // group for visualization int group; // group for visualization
@@ -522,8 +522,8 @@ typedef struct mjsMesh_ { // mesh specification
double refquat[4]; // reference orientation double refquat[4]; // reference orientation
double scale[3]; // rescale mesh double scale[3]; // rescale mesh
mjtMeshInertia inertia; // inertia type (convex, legacy, exact, shell) mjtMeshInertia inertia; // inertia type (convex, legacy, exact, shell)
mjtByte smoothnormal; // do not exclude large-angle faces from normals mjtBool smoothnormal; // do not exclude large-angle faces from normals
mjtByte needsdf; // compute sdf from mesh mjtBool needsdf; // compute sdf from mesh
int maxhullvert; // maximum vertex count for the convex hull int maxhullvert; // maximum vertex count for the convex hull
mjFloatVec* uservert; // user vertex data mjFloatVec* uservert; // user vertex data
mjFloatVec* usernormal; // user normal data mjFloatVec* usernormal; // user normal data
@@ -582,8 +582,8 @@ typedef struct mjsTexture_ { // texture specification
mjtColorSpace colorspace; // colorspace mjtColorSpace colorspace; // colorspace
// method 1: builtin // method 1: builtin
int builtin; // builtin type (mjtBuiltin) mjtBuiltin builtin; // builtin type
int mark; // mark type (mjtMark) mjtMark mark; // mark type
double rgb1[3]; // first color for builtin double rgb1[3]; // first color for builtin
double rgb2[3]; // second color for builtin double rgb2[3]; // second color for builtin
double markrgb[3]; // mark color double markrgb[3]; // mark color
@@ -605,8 +605,8 @@ typedef struct mjsTexture_ { // texture specification
mjByteVec* data; // texture data mjByteVec* data; // texture data
// flip options // flip options
mjtByte hflip; // horizontal flip mjtBool hflip; // horizontal flip
mjtByte vflip; // vertical flip mjtBool vflip; // vertical flip
// other // other
mjString* info; // message appended to compiler errors mjString* info; // message appended to compiler errors
@@ -616,7 +616,7 @@ typedef struct mjsTexture_ { // texture specification
typedef struct mjsMaterial_ { // material specification typedef struct mjsMaterial_ { // material specification
mjsElement* element; // element type mjsElement* element; // element type
mjStringVec* textures; // names of textures (empty: none) mjStringVec* textures; // names of textures (empty: none)
mjtByte texuniform; // make texture cube uniform mjtBool texuniform; // make texture cube uniform
float texrepeat[2]; // texture repetition for 2D mapping float texrepeat[2]; // texture repetition for 2D mapping
float emission; // emission float emission; // emission
float specular; // specular float specular; // specular
@@ -658,7 +658,7 @@ typedef struct mjsEquality_ { // equality specification
mjsElement* element; // element type mjsElement* element; // element type
mjtEq type; // constraint type mjtEq type; // constraint type
double data[mjNEQDATA]; // type-dependent data double data[mjNEQDATA]; // type-dependent data
mjtByte active; // is equality initially active mjtBool active; // is equality initially active
mjString* name1; // name of object 1 mjString* name1; // name of object 1
mjString* name2; // name of object 2 mjString* name2; // name of object 2
mjtObj objtype; // type of both objects mjtObj objtype; // type of both objects
@@ -681,8 +681,8 @@ typedef struct mjsTendon_ { // tendon specification
double armature; // inertia associated with tendon velocity double armature; // inertia associated with tendon velocity
// length range // length range
int limited; // does tendon have limits (mjtLimited) mjtLimited limited; // does tendon have limits
int actfrclimited; // does tendon have actuator force limits mjtLimited actfrclimited; // does tendon have actuator force limits
double range[2]; // length limits double range[2]; // length limits
double actfrcrange[2]; // actuator force limits double actfrcrange[2]; // actuator force limits
double margin; // margin value for tendon limit detection double margin; // margin value for tendon limit detection
@@ -721,7 +721,7 @@ typedef struct mjsActuator_ { // actuator specification
mjtDyn dyntype; // dynamics type mjtDyn dyntype; // dynamics type
double dynprm[mjNDYN]; // dynamics parameters double dynprm[mjNDYN]; // dynamics parameters
int actdim; // number of activation variables int actdim; // number of activation variables
mjtByte actearly; // apply next activations to qfrc mjtBool actearly; // apply next activations to qfrc
// transmission // transmission
mjtTrn trntype; // transmission type mjtTrn trntype; // transmission type
@@ -736,11 +736,11 @@ typedef struct mjsActuator_ { // actuator specification
double armature; // armature inertia double armature; // armature inertia
// input/output clamping // input/output clamping
int ctrllimited; // are control limits defined (mjtLimited) mjtLimited ctrllimited; // are control limits defined
double ctrlrange[2]; // control range double ctrlrange[2]; // control range
int forcelimited; // are force limits defined (mjtLimited) mjtLimited forcelimited; // are force limits defined
double forcerange[2]; // force range double forcerange[2]; // force range
int actlimited; // are activation limits defined (mjtLimited) mjtLimited actlimited; // are activation limits defined
double actrange[2]; // activation range double actrange[2]; // activation range
// other // other
+49 -49
View File
@@ -25,27 +25,27 @@
//-------------------------------- mjsCompiler ----------------------------------------------------- //-------------------------------- mjsCompiler -----------------------------------------------------
#define MJSCOMPILER_FIELDS \ #define MJSCOMPILER_FIELDS \
X(mjtByte, autolimits, 1) \ X(mjtBool, autolimits, 1) \
X(double, boundmass, 1) \ X(double, boundmass, 1) \
X(double, boundinertia, 1) \ X(double, boundinertia, 1) \
X(double, settotalmass, 1) \ X(double, settotalmass, 1) \
X(mjtByte, balanceinertia, 1) \ X(mjtBool, balanceinertia, 1) \
X(mjtByte, fitaabb, 1) \ X(mjtBool, fitaabb, 1) \
X(mjtByte, degree, 1) \ X(mjtBool, degree, 1) \
XVEC(char, eulerseq, 3) \ XVEC(char, eulerseq, 3) \
X(mjtByte, discardvisual, 1) \ X(mjtBool, discardvisual, 1) \
X(mjtByte, usethread, 1) \ X(mjtBool, usethread, 1) \
X(mjtByte, fusestatic, 1) \ X(mjtBool, fusestatic, 1) \
X(int, inertiafromgeom, 1) \ X(mjtInertiaFromGeom, inertiafromgeom, 1) \
XVEC(int, inertiagrouprange, 2) \ XVEC(int, inertiagrouprange, 2) \
X(mjtByte, saveinertial, 1) \ X(mjtBool, saveinertial, 1) \
X(int, alignfree, 1) \ X(mjtBool, alignfree, 1) \
X(int, conflict, 1) \ X(mjtConflict, conflict, 1) \
X(mjLROpt, LRopt, 1) \ X(mjLROpt, LRopt, 1) \
X(mjString*, meshdir, 1) \ X(mjString*, meshdir, 1) \
X(mjString*, texturedir, 1) \ X(mjString*, texturedir, 1) \
X(uint64_t, authored, 1) X(uint64_t, authored, 1)
//-------------------------------- mjSpec ---------------------------------------------------------- //-------------------------------- mjSpec ----------------------------------------------------------
@@ -53,7 +53,7 @@
X( mjsElement*, element, 1 ) \ X( mjsElement*, element, 1 ) \
X( mjString*, modelname, 1 ) \ X( mjString*, modelname, 1 ) \
X( mjsCompiler, compiler, 1 ) \ X( mjsCompiler, compiler, 1 ) \
X( mjtByte, strippath, 1 ) \ X( mjtBool, strippath, 1 ) \
X( mjOption, option, 1 ) \ X( mjOption, option, 1 ) \
X( mjVisual, visual, 1 ) \ X( mjVisual, visual, 1 ) \
X( mjStatistic, stat, 1 ) \ X( mjStatistic, stat, 1 ) \
@@ -74,7 +74,7 @@
X( mjtSize, nstack, 1 ) \ X( mjtSize, nstack, 1 ) \
X( mjString*, comment, 1 ) \ X( mjString*, comment, 1 ) \
X( mjString*, modelfiledir, 1 ) \ X( mjString*, modelfiledir, 1 ) \
X( mjtByte, hasImplicitPluginElem, 1 ) X( mjtBool, hasImplicitPluginElem, 1 )
//-------------------------------- mjsOrientation -------------------------------------------------- //-------------------------------- mjsOrientation --------------------------------------------------
@@ -93,7 +93,7 @@
X( mjsElement*, element, 1 ) \ X( mjsElement*, element, 1 ) \
X( mjString*, name, 1 ) \ X( mjString*, name, 1 ) \
X( mjString*, plugin_name, 1 ) \ X( mjString*, plugin_name, 1 ) \
X( mjtByte, active, 1 ) \ X( mjtBool, active, 1 ) \
X( mjString*, info, 1 ) X( mjString*, info, 1 )
@@ -111,12 +111,12 @@
XVEC( double, inertia, 3 ) \ XVEC( double, inertia, 3 ) \
X ( mjsOrientation, ialt, 1 ) \ X ( mjsOrientation, ialt, 1 ) \
XVEC( double, fullinertia, 6 ) \ XVEC( double, fullinertia, 6 ) \
X ( mjtByte, mocap, 1 ) \ X ( mjtBool, mocap, 1 ) \
X ( double, gravcomp, 1 ) \ X ( double, gravcomp, 1 ) \
X ( mjtSleepPolicy, sleep, 1 ) \ X ( mjtSleepPolicy, sleep, 1 ) \
X ( mjtByte, simple, 1 ) \ X ( mjtByte, simple, 1 ) \
X ( mjDoubleVec*, userdata, 1 ) \ X ( mjDoubleVec*, userdata, 1 ) \
X ( mjtByte, explicitinertial, 1 ) \ X ( mjtBool, explicitinertial, 1 ) \
X ( mjsPlugin, plugin, 1 ) \ X ( mjsPlugin, plugin, 1 ) \
X ( mjString*, info, 1 ) X ( mjString*, info, 1 )
@@ -140,16 +140,16 @@
XVEC( double, pos, 3 ) \ XVEC( double, pos, 3 ) \
XVEC( double, axis, 3 ) \ XVEC( double, axis, 3 ) \
X ( double, ref, 1 ) \ X ( double, ref, 1 ) \
X ( int, align, 1 ) \ X ( mjtAlignFree, align, 1 ) \
XVEC( double, stiffness, mjNPOLY+1 ) \ XVEC( double, stiffness, mjNPOLY+1 ) \
X ( double, springref, 1 ) \ X ( double, springref, 1 ) \
XVEC( double, springdamper, 2 ) \ XVEC( double, springdamper, 2 ) \
X ( int, limited, 1 ) \ X ( mjtLimited, limited, 1 ) \
XVEC( double, range, 2 ) \ XVEC( double, range, 2 ) \
X ( double, margin, 1 ) \ X ( double, margin, 1 ) \
XVEC( mjtNum, solref_limit, mjNREF ) \ XVEC( mjtNum, solref_limit, mjNREF ) \
XVEC( mjtNum, solimp_limit, mjNIMP ) \ XVEC( mjtNum, solimp_limit, mjNIMP ) \
X ( int, actfrclimited, 1 ) \ X ( mjtLimited, actfrclimited, 1 ) \
XVEC( double, actfrcrange, 2 ) \ XVEC( double, actfrcrange, 2 ) \
X ( double, armature, 1 ) \ X ( double, armature, 1 ) \
XVEC( double, damping, mjNPOLY+1 ) \ XVEC( double, damping, mjNPOLY+1 ) \
@@ -157,7 +157,7 @@
XVEC( mjtNum, solref_friction, mjNREF ) \ XVEC( mjtNum, solref_friction, mjNREF ) \
XVEC( mjtNum, solimp_friction, mjNIMP ) \ XVEC( mjtNum, solimp_friction, mjNIMP ) \
X ( int, group, 1 ) \ X ( int, group, 1 ) \
X ( mjtByte, actgravcomp, 1 ) \ X ( mjtBool, actgravcomp, 1 ) \
X ( mjDoubleVec*, userdata, 1 ) \ X ( mjDoubleVec*, userdata, 1 ) \
X ( mjString*, info, 1 ) X ( mjString*, info, 1 )
@@ -247,10 +247,10 @@
XVEC( double, dir, 3 ) \ XVEC( double, dir, 3 ) \
X ( mjtCamLight, mode, 1 ) \ X ( mjtCamLight, mode, 1 ) \
X ( mjString*, targetbody, 1 ) \ X ( mjString*, targetbody, 1 ) \
X ( mjtByte, active, 1 ) \ X ( mjtBool, active, 1 ) \
X ( mjtLightType, type, 1 ) \ X ( mjtLightType, type, 1 ) \
X ( mjString*, texture, 1 ) \ X ( mjString*, texture, 1 ) \
X ( mjtByte, castshadow, 1 ) \ X ( mjtBool, castshadow, 1 ) \
X ( float, bulbradius, 1 ) \ X ( float, bulbradius, 1 ) \
X ( float, intensity, 1 ) \ X ( float, intensity, 1 ) \
X ( float, range, 1 ) \ X ( float, range, 1 ) \
@@ -280,9 +280,9 @@
X ( int, dim, 1 ) \ X ( int, dim, 1 ) \
X ( double, radius, 1 ) \ X ( double, radius, 1 ) \
XVEC( double, size, 3 ) \ XVEC( double, size, 3 ) \
X ( mjtByte, internal, 1 ) \ X ( mjtBool, internal, 1 ) \
X ( mjtByte, flatskin, 1 ) \ X ( mjtBool, flatskin, 1 ) \
X ( int, selfcollide, 1 ) \ X ( mjtFlexSelf, selfcollide, 1 ) \
X ( int, passive, 1 ) \ X ( int, passive, 1 ) \
X ( int, activelayers, 1 ) \ X ( int, activelayers, 1 ) \
X ( int, group, 1 ) \ X ( int, group, 1 ) \
@@ -317,8 +317,8 @@
XVEC( double, refquat, 4 ) \ XVEC( double, refquat, 4 ) \
XVEC( double, scale, 3 ) \ XVEC( double, scale, 3 ) \
X ( mjtMeshInertia, inertia, 1 ) \ X ( mjtMeshInertia, inertia, 1 ) \
X ( mjtByte, smoothnormal, 1 ) \ X ( mjtBool, smoothnormal, 1 ) \
X ( mjtByte, needsdf, 1 ) \ X ( mjtBool, needsdf, 1 ) \
X ( int, maxhullvert, 1 ) \ X ( int, maxhullvert, 1 ) \
X ( mjFloatVec*, uservert, 1 ) \ X ( mjFloatVec*, uservert, 1 ) \
X ( mjFloatVec*, usernormal, 1 ) \ X ( mjFloatVec*, usernormal, 1 ) \
@@ -371,8 +371,8 @@
X ( mjsElement*, element, 1 ) \ X ( mjsElement*, element, 1 ) \
X ( mjtTexture, type, 1 ) \ X ( mjtTexture, type, 1 ) \
X ( mjtColorSpace, colorspace, 1 ) \ X ( mjtColorSpace, colorspace, 1 ) \
X ( int, builtin, 1 ) \ X ( mjtBuiltin, builtin, 1 ) \
X ( int, mark, 1 ) \ X ( mjtMark, mark, 1 ) \
XVEC( double, rgb1, 3 ) \ XVEC( double, rgb1, 3 ) \
XVEC( double, rgb2, 3 ) \ XVEC( double, rgb2, 3 ) \
XVEC( double, markrgb, 3 ) \ XVEC( double, markrgb, 3 ) \
@@ -386,8 +386,8 @@
XVEC( char, gridlayout, 12 ) \ XVEC( char, gridlayout, 12 ) \
X ( mjStringVec*, cubefiles, 1 ) \ X ( mjStringVec*, cubefiles, 1 ) \
X ( mjByteVec*, data, 1 ) \ X ( mjByteVec*, data, 1 ) \
X ( mjtByte, hflip, 1 ) \ X ( mjtBool, hflip, 1 ) \
X ( mjtByte, vflip, 1 ) \ X ( mjtBool, vflip, 1 ) \
X ( mjString*, info, 1 ) X ( mjString*, info, 1 )
@@ -396,7 +396,7 @@
#define MJSMATERIAL_FIELDS \ #define MJSMATERIAL_FIELDS \
X ( mjsElement*, element, 1 ) \ X ( mjsElement*, element, 1 ) \
X ( mjStringVec*, textures, 1 ) \ X ( mjStringVec*, textures, 1 ) \
X ( mjtByte, texuniform, 1 ) \ X ( mjtBool, texuniform, 1 ) \
XVEC( float, texrepeat, 2 ) \ XVEC( float, texrepeat, 2 ) \
X ( float, emission, 1 ) \ X ( float, emission, 1 ) \
X ( float, specular, 1 ) \ X ( float, specular, 1 ) \
@@ -439,7 +439,7 @@
X ( mjsElement*, element, 1 ) \ X ( mjsElement*, element, 1 ) \
X ( mjtEq, type, 1 ) \ X ( mjtEq, type, 1 ) \
XVEC( double, data, mjNEQDATA ) \ XVEC( double, data, mjNEQDATA ) \
X ( mjtByte, active, 1 ) \ X ( mjtBool, active, 1 ) \
X ( mjString*, name1, 1 ) \ X ( mjString*, name1, 1 ) \
X ( mjString*, name2, 1 ) \ X ( mjString*, name2, 1 ) \
X ( mjtObj, objtype, 1 ) \ X ( mjtObj, objtype, 1 ) \
@@ -459,8 +459,8 @@
XVEC( mjtNum, solref_friction, mjNREF ) \ XVEC( mjtNum, solref_friction, mjNREF ) \
XVEC( mjtNum, solimp_friction, mjNIMP ) \ XVEC( mjtNum, solimp_friction, mjNIMP ) \
X ( double, armature, 1 ) \ X ( double, armature, 1 ) \
X ( int, limited, 1 ) \ X ( mjtLimited, limited, 1 ) \
X ( int, actfrclimited, 1 ) \ X ( mjtLimited, actfrclimited, 1 ) \
XVEC( double, range, 2 ) \ XVEC( double, range, 2 ) \
XVEC( double, actfrcrange, 2 ) \ XVEC( double, actfrcrange, 2 ) \
X ( double, margin, 1 ) \ X ( double, margin, 1 ) \
@@ -493,7 +493,7 @@
X ( mjtDyn, dyntype, 1 ) \ X ( mjtDyn, dyntype, 1 ) \
XVEC( double, dynprm, mjNDYN ) \ XVEC( double, dynprm, mjNDYN ) \
X ( int, actdim, 1 ) \ X ( int, actdim, 1 ) \
X ( mjtByte, actearly, 1 ) \ X ( mjtBool, actearly, 1 ) \
X ( mjtTrn, trntype, 1 ) \ X ( mjtTrn, trntype, 1 ) \
XVEC( double, gear, 6 ) \ XVEC( double, gear, 6 ) \
X ( mjString*, target, 1 ) \ X ( mjString*, target, 1 ) \
@@ -504,11 +504,11 @@
X ( double, inheritrange, 1 ) \ X ( double, inheritrange, 1 ) \
XVEC( double, damping, mjNPOLY+1 ) \ XVEC( double, damping, mjNPOLY+1 ) \
X ( double, armature, 1 ) \ X ( double, armature, 1 ) \
X ( int, ctrllimited, 1 ) \ X ( mjtLimited, ctrllimited, 1 ) \
XVEC( double, ctrlrange, 2 ) \ XVEC( double, ctrlrange, 2 ) \
X ( int, forcelimited, 1 ) \ X ( mjtLimited, forcelimited, 1 ) \
XVEC( double, forcerange, 2 ) \ XVEC( double, forcerange, 2 ) \
X ( int, actlimited, 1 ) \ X ( mjtLimited, actlimited, 1 ) \
XVEC( double, actrange, 2 ) \ XVEC( double, actrange, 2 ) \
X ( int, group, 1 ) \ X ( int, group, 1 ) \
X ( int, nsample, 1 ) \ X ( int, nsample, 1 ) \
+1 -1
View File
@@ -1426,7 +1426,7 @@ void ParseMjcPhysicsActuator(mjSpec* spec,
auto setLimitedField = [](mjsActuator* mj_act, auto setLimitedField = [](mjsActuator* mj_act,
const pxr::UsdAttribute& usd_attribute, const pxr::UsdAttribute& usd_attribute,
int* mj_limited_field) { mjtLimited* mj_limited_field) {
if (usd_attribute.HasAuthoredValue()) { if (usd_attribute.HasAuthoredValue()) {
pxr::TfToken limited; pxr::TfToken limited;
usd_attribute.Get(&limited); usd_attribute.Get(&limited);
@@ -304,6 +304,8 @@ def _resolve_type_name(raw_name):
return C_TO_CS_TYPE[name] return C_TO_CS_TYPE[name]
if name in _STRUCT_NAME_OVERRIDES: if name in _STRUCT_NAME_OVERRIDES:
return _STRUCT_NAME_OVERRIDES[name] return _STRUCT_NAME_OVERRIDES[name]
if name in introspect_enums.ENUMS:
return name
if name.endswith('_'): if name.endswith('_'):
return name return name
return name + '_' return name + '_'
@@ -19,6 +19,7 @@ from collections.abc import Sequence
from absl import app from absl import app
from introspect import ast_nodes from introspect import ast_nodes
from introspect import enums
from introspect import structs from introspect import structs
@@ -96,6 +97,7 @@ def _value_binding_code(
fulltype = fulltype.replace('mjVisual', 'raw::MjVisual') fulltype = fulltype.replace('mjVisual', 'raw::MjVisual')
fulltype = fulltype.replace('mjStatistic', 'raw::MjStatistic') fulltype = fulltype.replace('mjStatistic', 'raw::MjStatistic')
element = '' element = ''
is_enum = field.name in enums.ENUMS
if field.name == 'mjsPlugin': if field.name == 'mjsPlugin':
setter = f"""[]({rawclassname}& self, {fulltype} {varname}) {{ setter = f"""[]({rawclassname}& self, {fulltype} {varname}) {{
@@ -104,6 +106,10 @@ def _value_binding_code(
self.{fullvarname}.active = {varname}.active; self.{fullvarname}.active = {varname}.active;
if (self.{fullvarname}.info && {varname}.info) *self.{fullvarname}.info = *{varname}.info; if (self.{fullvarname}.info && {varname}.info) *self.{fullvarname}.info = *{varname}.info;
}}""" }}"""
elif is_enum:
setter = f"""[]({rawclassname}& self, int {varname}) {{
self.{fullvarname}{element} = static_cast<{field.name}>({varname}){element};
}}"""
else: else:
setter = f"""[]({rawclassname}& self, {fulltype} {varname}) {{ setter = f"""[]({rawclassname}& self, {fulltype} {varname}) {{
self.{fullvarname}{element} = {varname}{element}; self.{fullvarname}{element} = {varname}{element};
@@ -111,13 +117,13 @@ def _value_binding_code(
def_property_args = ( def_property_args = (
f'"{varname}"', f'"{varname}"',
f"""[]({rawclassname}& self) -> {fulltype} {{ f"""[]({rawclassname}& self) -> {field.name if is_enum else fulltype} {{
return self.{fullvarname}; return self.{fullvarname};
}}""", }}""",
setter, setter,
) )
if field.name not in SCALAR_TYPES: if field.name not in SCALAR_TYPES and not is_enum:
def_property_args += ('py::return_value_policy::reference_internal',) def_property_args += ('py::return_value_policy::reference_internal',)
return f'{classname}.def_property({",".join(def_property_args)});' return f'{classname}.def_property({",".join(def_property_args)});'
+51 -51
View File
@@ -6890,7 +6890,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
fields=( fields=(
StructFieldDecl( StructFieldDecl(
name='autolimits', name='autolimits',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='infer "limited" attribute based on range', doc='infer "limited" attribute based on range',
), ),
StructFieldDecl( StructFieldDecl(
@@ -6910,17 +6910,17 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='balanceinertia', name='balanceinertia',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='automatically impose A + B >= C rule', doc='automatically impose A + B >= C rule',
), ),
StructFieldDecl( StructFieldDecl(
name='fitaabb', name='fitaabb',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='meshfit to aabb instead of inertia box', doc='meshfit to aabb instead of inertia box',
), ),
StructFieldDecl( StructFieldDecl(
name='degree', name='degree',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='angles in radians or degrees', doc='angles in radians or degrees',
), ),
StructFieldDecl( StructFieldDecl(
@@ -6933,23 +6933,23 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='discardvisual', name='discardvisual',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='discard visual geoms in parser', doc='discard visual geoms in parser',
), ),
StructFieldDecl( StructFieldDecl(
name='usethread', name='usethread',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='use multiple threads to speed up compiler', doc='use multiple threads to speed up compiler',
), ),
StructFieldDecl( StructFieldDecl(
name='fusestatic', name='fusestatic',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='fuse static bodies with parent', doc='fuse static bodies with parent',
), ),
StructFieldDecl( StructFieldDecl(
name='inertiafromgeom', name='inertiafromgeom',
type=ValueType(name='int'), type=ValueType(name='mjtInertiaFromGeom'),
doc='use geom inertias (mjtInertiaFromGeom)', doc='use geom inertias',
), ),
StructFieldDecl( StructFieldDecl(
name='inertiagrouprange', name='inertiagrouprange',
@@ -6961,18 +6961,18 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='saveinertial', name='saveinertial',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='save explicit inertial clause for all bodies to XML', doc='save explicit inertial clause for all bodies to XML',
), ),
StructFieldDecl( StructFieldDecl(
name='alignfree', name='alignfree',
type=ValueType(name='int'), type=ValueType(name='mjtBool'),
doc='align free joints with inertial frame', doc='align free joints with inertial frame',
), ),
StructFieldDecl( StructFieldDecl(
name='conflict', name='conflict',
type=ValueType(name='int'), type=ValueType(name='mjtConflict'),
doc='conflict resolution for attach (mjtConflict)', doc='conflict resolution for attach',
), ),
StructFieldDecl( StructFieldDecl(
name='LRopt', name='LRopt',
@@ -7083,7 +7083,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='strippath', name='strippath',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='automatically strip paths from mesh files', doc='automatically strip paths from mesh files',
), ),
StructFieldDecl( StructFieldDecl(
@@ -7192,7 +7192,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='hasImplicitPluginElem', name='hasImplicitPluginElem',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='already encountered an implicit plugin sensor/actuator', doc='already encountered an implicit plugin sensor/actuator',
), ),
StructFieldDecl( StructFieldDecl(
@@ -7274,7 +7274,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='active', name='active',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='is the plugin active', doc='is the plugin active',
), ),
StructFieldDecl( StructFieldDecl(
@@ -7370,7 +7370,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='mocap', name='mocap',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='is this a mocap body', doc='is this a mocap body',
), ),
StructFieldDecl( StructFieldDecl(
@@ -7397,7 +7397,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='explicitinertial', name='explicitinertial',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='whether to save the body with explicit inertial clause', doc='whether to save the body with explicit inertial clause',
), ),
StructFieldDecl( StructFieldDecl(
@@ -7503,8 +7503,8 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='align', name='align',
type=ValueType(name='int'), type=ValueType(name='mjtAlignFree'),
doc='align free joint with body com (mjtAlignFree)', doc='align free joint with body com',
), ),
StructFieldDecl( StructFieldDecl(
name='stiffness', name='stiffness',
@@ -7529,8 +7529,8 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='limited', name='limited',
type=ValueType(name='int'), type=ValueType(name='mjtLimited'),
doc='does joint have limits (mjtLimited)', doc='does joint have limits',
), ),
StructFieldDecl( StructFieldDecl(
name='range', name='range',
@@ -7563,8 +7563,8 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='actfrclimited', name='actfrclimited',
type=ValueType(name='int'), type=ValueType(name='mjtLimited'),
doc='are actuator forces on joint limited (mjtLimited)', doc='are actuator forces on joint limited',
), ),
StructFieldDecl( StructFieldDecl(
name='actfrcrange', name='actfrcrange',
@@ -7615,7 +7615,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='actgravcomp', name='actgravcomp',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='is gravcomp force applied via actuators', doc='is gravcomp force applied via actuators',
), ),
StructFieldDecl( StructFieldDecl(
@@ -8104,7 +8104,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='active', name='active',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='is light active', doc='is light active',
), ),
StructFieldDecl( StructFieldDecl(
@@ -8121,7 +8121,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='castshadow', name='castshadow',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='does light cast shadows', doc='does light cast shadows',
), ),
StructFieldDecl( StructFieldDecl(
@@ -8186,7 +8186,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
type=PointerType( type=PointerType(
inner_type=ValueType(name='mjString'), inner_type=ValueType(name='mjString'),
), ),
doc='message appended to compiler errorsx', doc='message appended to compiler errors',
), ),
), ),
)), )),
@@ -8281,17 +8281,17 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='internal', name='internal',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='enable internal collisions', doc='enable internal collisions',
), ),
StructFieldDecl( StructFieldDecl(
name='flatskin', name='flatskin',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='render flex skin with flat shading', doc='render flex skin with flat shading',
), ),
StructFieldDecl( StructFieldDecl(
name='selfcollide', name='selfcollide',
type=ValueType(name='int'), type=ValueType(name='mjtFlexSelf'),
doc='mode for flex self collision', doc='mode for flex self collision',
), ),
StructFieldDecl( StructFieldDecl(
@@ -8487,12 +8487,12 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='smoothnormal', name='smoothnormal',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='do not exclude large-angle faces from normals', doc='do not exclude large-angle faces from normals',
), ),
StructFieldDecl( StructFieldDecl(
name='needsdf', name='needsdf',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='compute sdf from mesh', doc='compute sdf from mesh',
), ),
StructFieldDecl( StructFieldDecl(
@@ -8761,13 +8761,13 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='builtin', name='builtin',
type=ValueType(name='int'), type=ValueType(name='mjtBuiltin'),
doc='builtin type (mjtBuiltin)', doc='builtin type',
), ),
StructFieldDecl( StructFieldDecl(
name='mark', name='mark',
type=ValueType(name='int'), type=ValueType(name='mjtMark'),
doc='mark type (mjtMark)', doc='mark type',
), ),
StructFieldDecl( StructFieldDecl(
name='rgb1', name='rgb1',
@@ -8859,12 +8859,12 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='hflip', name='hflip',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='horizontal flip', doc='horizontal flip',
), ),
StructFieldDecl( StructFieldDecl(
name='vflip', name='vflip',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='vertical flip', doc='vertical flip',
), ),
StructFieldDecl( StructFieldDecl(
@@ -8897,7 +8897,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='texuniform', name='texuniform',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='make texture cube uniform', doc='make texture cube uniform',
), ),
StructFieldDecl( StructFieldDecl(
@@ -9099,7 +9099,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='active', name='active',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='is equality initially active', doc='is equality initially active',
), ),
StructFieldDecl( StructFieldDecl(
@@ -9210,12 +9210,12 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='limited', name='limited',
type=ValueType(name='int'), type=ValueType(name='mjtLimited'),
doc='does tendon have limits (mjtLimited)', doc='does tendon have limits',
), ),
StructFieldDecl( StructFieldDecl(
name='actfrclimited', name='actfrclimited',
type=ValueType(name='int'), type=ValueType(name='mjtLimited'),
doc='does tendon have actuator force limits', doc='does tendon have actuator force limits',
), ),
StructFieldDecl( StructFieldDecl(
@@ -9380,7 +9380,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='actearly', name='actearly',
type=ValueType(name='mjtByte'), type=ValueType(name='mjtBool'),
doc='apply next activations to qfrc', doc='apply next activations to qfrc',
), ),
StructFieldDecl( StructFieldDecl(
@@ -9450,8 +9450,8 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='ctrllimited', name='ctrllimited',
type=ValueType(name='int'), type=ValueType(name='mjtLimited'),
doc='are control limits defined (mjtLimited)', doc='are control limits defined',
), ),
StructFieldDecl( StructFieldDecl(
name='ctrlrange', name='ctrlrange',
@@ -9463,8 +9463,8 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='forcelimited', name='forcelimited',
type=ValueType(name='int'), type=ValueType(name='mjtLimited'),
doc='are force limits defined (mjtLimited)', doc='are force limits defined',
), ),
StructFieldDecl( StructFieldDecl(
name='forcerange', name='forcerange',
@@ -9476,8 +9476,8 @@ STRUCTS: Mapping[str, StructDecl] = dict([
), ),
StructFieldDecl( StructFieldDecl(
name='actlimited', name='actlimited',
type=ValueType(name='int'), type=ValueType(name='mjtLimited'),
doc='are activation limits defined (mjtLimited)', doc='are activation limits defined',
), ),
StructFieldDecl( StructFieldDecl(
name='actrange', name='actrange',
+1 -1
View File
@@ -777,7 +777,7 @@ PYBIND11_MODULE(_specs, m, pybind11::mod_gil_not_used()) {
std::string key = py::str(item.first); std::string key = py::str(item.first);
if (key == "align") { if (key == "align") {
try { try {
out->align = kwargs["align"].cast<int>(); out->align = static_cast<mjtAlignFree>(kwargs["align"].cast<int>());
} catch (const py::cast_error& e) { } catch (const py::cast_error& e) {
throw pybind11::value_error("align is the wrong type."); throw pybind11::value_error("align is the wrong type.");
} }
@@ -225,6 +225,13 @@ void ImGui_SpecElementTable::operator()(const char* label, mjtByte& val,
Input(val, ref); Input(val, ref);
} }
void ImGui_SpecElementTable::operator()(const char* label, bool& val,
const bool& ref,
const char* tooltip) {
Label(label, tooltip);
Input(val, ref);
}
void ImGui_SpecElementTable::operator()(const char* label, mjtSize& val, void ImGui_SpecElementTable::operator()(const char* label, mjtSize& val,
const mjtSize& ref, const mjtSize& ref,
const char* tooltip) { const char* tooltip) {
@@ -257,6 +257,8 @@ class ImGui_SpecElementTable : public ImGui_DataPtrTable {
// Scalar values used by mjSpec elements. // Scalar values used by mjSpec elements.
void operator()(const char* label, mjtByte& val, const mjtByte& ref, void operator()(const char* label, mjtByte& val, const mjtByte& ref,
const char* tooltip); const char* tooltip);
void operator()(const char* label, bool& val, const bool& ref,
const char* tooltip);
void operator()(const char* label, mjtSize& val, const mjtSize& ref, void operator()(const char* label, mjtSize& val, const mjtSize& ref,
const char* tooltip); const char* tooltip);
void operator()(const char* label, int& val, const int& ref, void operator()(const char* label, int& val, const int& ref,
+5 -5
View File
@@ -1324,7 +1324,7 @@ const char* mjs_setToIntVelocity(mjsActuator* actuator, double kp, double kv[1],
double dampratio[1], double timeconst[1], double inheritrange) { double dampratio[1], double timeconst[1], double inheritrange) {
mjs_setToPosition(actuator, kp, kv, dampratio, timeconst, inheritrange); mjs_setToPosition(actuator, kp, kv, dampratio, timeconst, inheritrange);
actuator->dyntype = mjDYN_INTEGRATOR; actuator->dyntype = mjDYN_INTEGRATOR;
actuator->actlimited = 1; actuator->actlimited = mjLIMITED_TRUE;
if (inheritrange > 0) { if (inheritrange > 0) {
if (actuator->actrange[0] || actuator->actrange[1]) { if (actuator->actrange[0] || actuator->actrange[1]) {
@@ -1353,7 +1353,7 @@ const char* mjs_setToVelocity(mjsActuator* actuator, double kv) {
const char* mjs_setToDamper(mjsActuator* actuator, double kv) { const char* mjs_setToDamper(mjsActuator* actuator, double kv) {
mjuu_zerovec(actuator->gainprm, mjNGAIN); mjuu_zerovec(actuator->gainprm, mjNGAIN);
actuator->gainprm[2] = -kv; actuator->gainprm[2] = -kv;
actuator->ctrllimited = 1; actuator->ctrllimited = mjLIMITED_TRUE;
actuator->dyntype = mjDYN_NONE; actuator->dyntype = mjDYN_NONE;
actuator->gaintype = mjGAIN_AFFINE; actuator->gaintype = mjGAIN_AFFINE;
actuator->biastype = mjBIAS_NONE; actuator->biastype = mjBIAS_NONE;
@@ -1435,7 +1435,7 @@ const char* mjs_setToMuscle(mjsActuator* actuator, double timeconst[2], double t
// Set to adhesion actuator. // Set to adhesion actuator.
const char* mjs_setToAdhesion(mjsActuator* actuator, double gain) { const char* mjs_setToAdhesion(mjsActuator* actuator, double gain) {
actuator->gainprm[0] = gain; actuator->gainprm[0] = gain;
actuator->ctrllimited = 1; actuator->ctrllimited = mjLIMITED_TRUE;
actuator->gaintype = mjGAIN_FIXED; actuator->gaintype = mjGAIN_FIXED;
actuator->biastype = mjBIAS_NONE; actuator->biastype = mjBIAS_NONE;
@@ -1523,7 +1523,7 @@ const char* mjs_setToDCMotor(mjsActuator* actuator, double motorconst[2], double
} }
actuator->forcerange[0] = -tau_max; actuator->forcerange[0] = -tau_max;
actuator->forcerange[1] = tau_max; actuator->forcerange[1] = tau_max;
actuator->forcelimited = 1; actuator->forcelimited = mjLIMITED_TRUE;
} }
// saturation: [tau_max, i_max, (di/dt)_max] // saturation: [tau_max, i_max, (di/dt)_max]
@@ -1601,7 +1601,7 @@ const char* mjs_setToDCMotor(mjsActuator* actuator, double motorconst[2], double
actuator->actdim = actdim; actuator->actdim = actdim;
// enforce actlimited = 0; homogeneous bounds are invalid across DC motor states // enforce actlimited = 0; homogeneous bounds are invalid across DC motor states
actuator->actlimited = 0; actuator->actlimited = mjLIMITED_FALSE;
// DC motor always uses actearly // DC motor always uses actearly
actuator->actearly = 1; actuator->actearly = 1;
+3 -3
View File
@@ -5045,9 +5045,9 @@ void mjCModel::TryCompile(mjModel*& m, mjData*& d, const mjVFS* vfs) {
// the internal compiler struct (not the spec) to avoid permanently mutating // the internal compiler struct (not the spec) to avoid permanently mutating
// the spec (which would cause usethread="false" to appear in a saved XML). // the spec (which would cause usethread="false" to appear in a saved XML).
struct ScopedDisableThreading { struct ScopedDisableThreading {
mjtByte& ref; mjtBool& ref;
mjtByte saved; mjtBool saved;
explicit ScopedDisableThreading(mjtByte& r) : ref(r), saved(r) { ref = 0; } explicit ScopedDisableThreading(mjtBool& r) : ref(r), saved(r) { ref = 0; }
~ScopedDisableThreading() { ref = saved; } ~ScopedDisableThreading() { ref = saved; }
} disable_usethread(compiler.usethread); } disable_usethread(compiler.usethread);
#endif #endif
+11
View File
@@ -179,6 +179,17 @@ class mjXUtil {
static bool MapValue(tinyxml2::XMLElement* elem, const char* attr, int* data, static bool MapValue(tinyxml2::XMLElement* elem, const char* attr, int* data,
const mjMap* map, int mapSz, bool required = false); const mjMap* map, int mapSz, bool required = false);
template <typename T>
static bool MapValue(tinyxml2::XMLElement* elem, const char* attr, T* data,
const mjMap* map, int mapSz, bool required = false) {
int value;
if (MapValue(elem, attr, &value, map, mapSz, required)) {
*data = static_cast<T>(value);
return true;
}
return false;
}
// find attribute, translate unique space-separated keys to data, return number of keys found // find attribute, translate unique space-separated keys to data, return number of keys found
static int MapValues(tinyxml2::XMLElement* elem, const char* attr, int* data, static int MapValues(tinyxml2::XMLElement* elem, const char* attr, int* data,
const mjMap* map, int mapSz, bool required = false); const mjMap* map, int mapSz, bool required = false);
+3 -3
View File
@@ -5866,11 +5866,11 @@ public unsafe struct mjsCompiler_ {
public byte discardvisual; public byte discardvisual;
public byte usethread; public byte usethread;
public byte fusestatic; public byte fusestatic;
public int inertiafromgeom; public mjtInertiaFromGeom inertiafromgeom;
public fixed int inertiagrouprange[2]; public fixed int inertiagrouprange[2];
public byte saveinertial; public byte saveinertial;
public int alignfree; public byte alignfree;
public int conflict; public mjtConflict conflict;
public mjLROpt_ LRopt; public mjLROpt_ LRopt;
public void* meshdir; public void* meshdir;
public void* texturedir; public void* texturedir;
+78 -78
View File
@@ -2154,10 +2154,10 @@ struct MjsCompiler {
explicit MjsCompiler(mjsCompiler *ptr); explicit MjsCompiler(mjsCompiler *ptr);
mjsCompiler* get() const; mjsCompiler* get() const;
void set(mjsCompiler* ptr); void set(mjsCompiler* ptr);
mjtByte autolimits() const { mjtBool autolimits() const {
return ptr_->autolimits; return ptr_->autolimits;
} }
void set_autolimits(mjtByte value) { void set_autolimits(mjtBool value) {
ptr_->autolimits = value; ptr_->autolimits = value;
} }
double boundmass() const { double boundmass() const {
@@ -2178,70 +2178,70 @@ struct MjsCompiler {
void set_settotalmass(double value) { void set_settotalmass(double value) {
ptr_->settotalmass = value; ptr_->settotalmass = value;
} }
mjtByte balanceinertia() const { mjtBool balanceinertia() const {
return ptr_->balanceinertia; return ptr_->balanceinertia;
} }
void set_balanceinertia(mjtByte value) { void set_balanceinertia(mjtBool value) {
ptr_->balanceinertia = value; ptr_->balanceinertia = value;
} }
mjtByte fitaabb() const { mjtBool fitaabb() const {
return ptr_->fitaabb; return ptr_->fitaabb;
} }
void set_fitaabb(mjtByte value) { void set_fitaabb(mjtBool value) {
ptr_->fitaabb = value; ptr_->fitaabb = value;
} }
mjtByte degree() const { mjtBool degree() const {
return ptr_->degree; return ptr_->degree;
} }
void set_degree(mjtByte value) { void set_degree(mjtBool value) {
ptr_->degree = value; ptr_->degree = value;
} }
emscripten::val eulerseq() const { emscripten::val eulerseq() const {
return emscripten::val(emscripten::typed_memory_view(3, ptr_->eulerseq)); return emscripten::val(emscripten::typed_memory_view(3, ptr_->eulerseq));
} }
mjtByte discardvisual() const { mjtBool discardvisual() const {
return ptr_->discardvisual; return ptr_->discardvisual;
} }
void set_discardvisual(mjtByte value) { void set_discardvisual(mjtBool value) {
ptr_->discardvisual = value; ptr_->discardvisual = value;
} }
mjtByte usethread() const { mjtBool usethread() const {
return ptr_->usethread; return ptr_->usethread;
} }
void set_usethread(mjtByte value) { void set_usethread(mjtBool value) {
ptr_->usethread = value; ptr_->usethread = value;
} }
mjtByte fusestatic() const { mjtBool fusestatic() const {
return ptr_->fusestatic; return ptr_->fusestatic;
} }
void set_fusestatic(mjtByte value) { void set_fusestatic(mjtBool value) {
ptr_->fusestatic = value; ptr_->fusestatic = value;
} }
int inertiafromgeom() const { mjtInertiaFromGeom inertiafromgeom() const {
return ptr_->inertiafromgeom; return ptr_->inertiafromgeom;
} }
void set_inertiafromgeom(int value) { void set_inertiafromgeom(mjtInertiaFromGeom value) {
ptr_->inertiafromgeom = value; ptr_->inertiafromgeom = value;
} }
emscripten::val inertiagrouprange() const { emscripten::val inertiagrouprange() const {
return emscripten::val(emscripten::typed_memory_view(2, ptr_->inertiagrouprange)); return emscripten::val(emscripten::typed_memory_view(2, ptr_->inertiagrouprange));
} }
mjtByte saveinertial() const { mjtBool saveinertial() const {
return ptr_->saveinertial; return ptr_->saveinertial;
} }
void set_saveinertial(mjtByte value) { void set_saveinertial(mjtBool value) {
ptr_->saveinertial = value; ptr_->saveinertial = value;
} }
int alignfree() const { mjtBool alignfree() const {
return ptr_->alignfree; return ptr_->alignfree;
} }
void set_alignfree(int value) { void set_alignfree(mjtBool value) {
ptr_->alignfree = value; ptr_->alignfree = value;
} }
int conflict() const { mjtConflict conflict() const {
return ptr_->conflict; return ptr_->conflict;
} }
void set_conflict(int value) { void set_conflict(mjtConflict value) {
ptr_->conflict = value; ptr_->conflict = value;
} }
mjString meshdir() const { mjString meshdir() const {
@@ -2310,10 +2310,10 @@ struct MjsEquality {
emscripten::val data() const { emscripten::val data() const {
return emscripten::val(emscripten::typed_memory_view(11, ptr_->data)); return emscripten::val(emscripten::typed_memory_view(11, ptr_->data));
} }
mjtByte active() const { mjtBool active() const {
return ptr_->active; return ptr_->active;
} }
void set_active(mjtByte value) { void set_active(mjtBool value) {
ptr_->active = value; ptr_->active = value;
} }
mjString name1() const { mjString name1() const {
@@ -2466,22 +2466,22 @@ struct MjsFlex {
emscripten::val size() const { emscripten::val size() const {
return emscripten::val(emscripten::typed_memory_view(3, ptr_->size)); return emscripten::val(emscripten::typed_memory_view(3, ptr_->size));
} }
mjtByte internal() const { mjtBool internal() const {
return ptr_->internal; return ptr_->internal;
} }
void set_internal(mjtByte value) { void set_internal(mjtBool value) {
ptr_->internal = value; ptr_->internal = value;
} }
mjtByte flatskin() const { mjtBool flatskin() const {
return ptr_->flatskin; return ptr_->flatskin;
} }
void set_flatskin(mjtByte value) { void set_flatskin(mjtBool value) {
ptr_->flatskin = value; ptr_->flatskin = value;
} }
int selfcollide() const { mjtFlexSelf selfcollide() const {
return ptr_->selfcollide; return ptr_->selfcollide;
} }
void set_selfcollide(int value) { void set_selfcollide(mjtFlexSelf value) {
ptr_->selfcollide = value; ptr_->selfcollide = value;
} }
int passive() const { int passive() const {
@@ -2677,10 +2677,10 @@ struct MjsJoint {
void set_ref(double value) { void set_ref(double value) {
ptr_->ref = value; ptr_->ref = value;
} }
int align() const { mjtAlignFree align() const {
return ptr_->align; return ptr_->align;
} }
void set_align(int value) { void set_align(mjtAlignFree value) {
ptr_->align = value; ptr_->align = value;
} }
emscripten::val stiffness() const { emscripten::val stiffness() const {
@@ -2695,10 +2695,10 @@ struct MjsJoint {
emscripten::val springdamper() const { emscripten::val springdamper() const {
return emscripten::val(emscripten::typed_memory_view(2, ptr_->springdamper)); return emscripten::val(emscripten::typed_memory_view(2, ptr_->springdamper));
} }
int limited() const { mjtLimited limited() const {
return ptr_->limited; return ptr_->limited;
} }
void set_limited(int value) { void set_limited(mjtLimited value) {
ptr_->limited = value; ptr_->limited = value;
} }
emscripten::val range() const { emscripten::val range() const {
@@ -2716,10 +2716,10 @@ struct MjsJoint {
emscripten::val solimp_limit() const { emscripten::val solimp_limit() const {
return emscripten::val(emscripten::typed_memory_view(5, ptr_->solimp_limit)); return emscripten::val(emscripten::typed_memory_view(5, ptr_->solimp_limit));
} }
int actfrclimited() const { mjtLimited actfrclimited() const {
return ptr_->actfrclimited; return ptr_->actfrclimited;
} }
void set_actfrclimited(int value) { void set_actfrclimited(mjtLimited value) {
ptr_->actfrclimited = value; ptr_->actfrclimited = value;
} }
emscripten::val actfrcrange() const { emscripten::val actfrcrange() const {
@@ -2752,10 +2752,10 @@ struct MjsJoint {
void set_group(int value) { void set_group(int value) {
ptr_->group = value; ptr_->group = value;
} }
mjtByte actgravcomp() const { mjtBool actgravcomp() const {
return ptr_->actgravcomp; return ptr_->actgravcomp;
} }
void set_actgravcomp(mjtByte value) { void set_actgravcomp(mjtBool value) {
ptr_->actgravcomp = value; ptr_->actgravcomp = value;
} }
mjDoubleVec &userdata() const { mjDoubleVec &userdata() const {
@@ -2845,10 +2845,10 @@ struct MjsLight {
*(ptr_->targetbody) = value; *(ptr_->targetbody) = value;
} }
} }
mjtByte active() const { mjtBool active() const {
return ptr_->active; return ptr_->active;
} }
void set_active(mjtByte value) { void set_active(mjtBool value) {
ptr_->active = value; ptr_->active = value;
} }
mjtLightType type() const { mjtLightType type() const {
@@ -2865,10 +2865,10 @@ struct MjsLight {
*(ptr_->texture) = value; *(ptr_->texture) = value;
} }
} }
mjtByte castshadow() const { mjtBool castshadow() const {
return ptr_->castshadow; return ptr_->castshadow;
} }
void set_castshadow(mjtByte value) { void set_castshadow(mjtBool value) {
ptr_->castshadow = value; ptr_->castshadow = value;
} }
float bulbradius() const { float bulbradius() const {
@@ -2936,10 +2936,10 @@ struct MjsMaterial {
mjStringVec &textures() const { mjStringVec &textures() const {
return *(ptr_->textures); return *(ptr_->textures);
} }
mjtByte texuniform() const { mjtBool texuniform() const {
return ptr_->texuniform; return ptr_->texuniform;
} }
void set_texuniform(mjtByte value) { void set_texuniform(mjtBool value) {
ptr_->texuniform = value; ptr_->texuniform = value;
} }
emscripten::val texrepeat() const { emscripten::val texrepeat() const {
@@ -3115,10 +3115,10 @@ struct MjsPlugin {
*(ptr_->plugin_name) = value; *(ptr_->plugin_name) = value;
} }
} }
mjtByte active() const { mjtBool active() const {
return ptr_->active; return ptr_->active;
} }
void set_active(mjtByte value) { void set_active(mjtBool value) {
ptr_->active = value; ptr_->active = value;
} }
mjString info() const { mjString info() const {
@@ -3243,16 +3243,16 @@ struct MjsTendon {
void set_armature(double value) { void set_armature(double value) {
ptr_->armature = value; ptr_->armature = value;
} }
int limited() const { mjtLimited limited() const {
return ptr_->limited; return ptr_->limited;
} }
void set_limited(int value) { void set_limited(mjtLimited value) {
ptr_->limited = value; ptr_->limited = value;
} }
int actfrclimited() const { mjtLimited actfrclimited() const {
return ptr_->actfrclimited; return ptr_->actfrclimited;
} }
void set_actfrclimited(int value) { void set_actfrclimited(mjtLimited value) {
ptr_->actfrclimited = value; ptr_->actfrclimited = value;
} }
emscripten::val range() const { emscripten::val range() const {
@@ -3359,16 +3359,16 @@ struct MjsTexture {
void set_colorspace(mjtColorSpace value) { void set_colorspace(mjtColorSpace value) {
ptr_->colorspace = value; ptr_->colorspace = value;
} }
int builtin() const { mjtBuiltin builtin() const {
return ptr_->builtin; return ptr_->builtin;
} }
void set_builtin(int value) { void set_builtin(mjtBuiltin value) {
ptr_->builtin = value; ptr_->builtin = value;
} }
int mark() const { mjtMark mark() const {
return ptr_->mark; return ptr_->mark;
} }
void set_mark(int value) { void set_mark(mjtMark value) {
ptr_->mark = value; ptr_->mark = value;
} }
emscripten::val rgb1() const { emscripten::val rgb1() const {
@@ -3432,16 +3432,16 @@ struct MjsTexture {
std::vector<uint8_t> &data() const { std::vector<uint8_t> &data() const {
return *(reinterpret_cast<std::vector<uint8_t>*>(ptr_->data)); return *(reinterpret_cast<std::vector<uint8_t>*>(ptr_->data));
} }
mjtByte hflip() const { mjtBool hflip() const {
return ptr_->hflip; return ptr_->hflip;
} }
void set_hflip(mjtByte value) { void set_hflip(mjtBool value) {
ptr_->hflip = value; ptr_->hflip = value;
} }
mjtByte vflip() const { mjtBool vflip() const {
return ptr_->vflip; return ptr_->vflip;
} }
void set_vflip(mjtByte value) { void set_vflip(mjtBool value) {
ptr_->vflip = value; ptr_->vflip = value;
} }
mjString info() const { mjString info() const {
@@ -5730,10 +5730,10 @@ struct MjSpec {
*(ptr_->modelname) = value; *(ptr_->modelname) = value;
} }
} }
mjtByte strippath() const { mjtBool strippath() const {
return ptr_->strippath; return ptr_->strippath;
} }
void set_strippath(mjtByte value) { void set_strippath(mjtBool value) {
ptr_->strippath = value; ptr_->strippath = value;
} }
int memory() const { int memory() const {
@@ -5842,10 +5842,10 @@ struct MjSpec {
*(ptr_->modelfiledir) = value; *(ptr_->modelfiledir) = value;
} }
} }
mjtByte hasImplicitPluginElem() const { mjtBool hasImplicitPluginElem() const {
return ptr_->hasImplicitPluginElem; return ptr_->hasImplicitPluginElem;
} }
void set_hasImplicitPluginElem(mjtByte value) { void set_hasImplicitPluginElem(mjtBool value) {
ptr_->hasImplicitPluginElem = value; ptr_->hasImplicitPluginElem = value;
} }
@@ -5899,10 +5899,10 @@ struct MjsActuator {
void set_actdim(int value) { void set_actdim(int value) {
ptr_->actdim = value; ptr_->actdim = value;
} }
mjtByte actearly() const { mjtBool actearly() const {
return ptr_->actearly; return ptr_->actearly;
} }
void set_actearly(mjtByte value) { void set_actearly(mjtBool value) {
ptr_->actearly = value; ptr_->actearly = value;
} }
mjtTrn trntype() const { mjtTrn trntype() const {
@@ -5962,28 +5962,28 @@ struct MjsActuator {
void set_armature(double value) { void set_armature(double value) {
ptr_->armature = value; ptr_->armature = value;
} }
int ctrllimited() const { mjtLimited ctrllimited() const {
return ptr_->ctrllimited; return ptr_->ctrllimited;
} }
void set_ctrllimited(int value) { void set_ctrllimited(mjtLimited value) {
ptr_->ctrllimited = value; ptr_->ctrllimited = value;
} }
emscripten::val ctrlrange() const { emscripten::val ctrlrange() const {
return emscripten::val(emscripten::typed_memory_view(2, ptr_->ctrlrange)); return emscripten::val(emscripten::typed_memory_view(2, ptr_->ctrlrange));
} }
int forcelimited() const { mjtLimited forcelimited() const {
return ptr_->forcelimited; return ptr_->forcelimited;
} }
void set_forcelimited(int value) { void set_forcelimited(mjtLimited value) {
ptr_->forcelimited = value; ptr_->forcelimited = value;
} }
emscripten::val forcerange() const { emscripten::val forcerange() const {
return emscripten::val(emscripten::typed_memory_view(2, ptr_->forcerange)); return emscripten::val(emscripten::typed_memory_view(2, ptr_->forcerange));
} }
int actlimited() const { mjtLimited actlimited() const {
return ptr_->actlimited; return ptr_->actlimited;
} }
void set_actlimited(int value) { void set_actlimited(mjtLimited value) {
ptr_->actlimited = value; ptr_->actlimited = value;
} }
emscripten::val actrange() const { emscripten::val actrange() const {
@@ -6069,10 +6069,10 @@ struct MjsBody {
emscripten::val fullinertia() const { emscripten::val fullinertia() const {
return emscripten::val(emscripten::typed_memory_view(6, ptr_->fullinertia)); return emscripten::val(emscripten::typed_memory_view(6, ptr_->fullinertia));
} }
mjtByte mocap() const { mjtBool mocap() const {
return ptr_->mocap; return ptr_->mocap;
} }
void set_mocap(mjtByte value) { void set_mocap(mjtBool value) {
ptr_->mocap = value; ptr_->mocap = value;
} }
double gravcomp() const { double gravcomp() const {
@@ -6096,10 +6096,10 @@ struct MjsBody {
mjDoubleVec &userdata() const { mjDoubleVec &userdata() const {
return *(ptr_->userdata); return *(ptr_->userdata);
} }
mjtByte explicitinertial() const { mjtBool explicitinertial() const {
return ptr_->explicitinertial; return ptr_->explicitinertial;
} }
void set_explicitinertial(mjtByte value) { void set_explicitinertial(mjtBool value) {
ptr_->explicitinertial = value; ptr_->explicitinertial = value;
} }
mjString info() const { mjString info() const {
@@ -6316,16 +6316,16 @@ struct MjsMesh {
void set_inertia(mjtMeshInertia value) { void set_inertia(mjtMeshInertia value) {
ptr_->inertia = value; ptr_->inertia = value;
} }
mjtByte smoothnormal() const { mjtBool smoothnormal() const {
return ptr_->smoothnormal; return ptr_->smoothnormal;
} }
void set_smoothnormal(mjtByte value) { void set_smoothnormal(mjtBool value) {
ptr_->smoothnormal = value; ptr_->smoothnormal = value;
} }
mjtByte needsdf() const { mjtBool needsdf() const {
return ptr_->needsdf; return ptr_->needsdf;
} }
void set_needsdf(mjtByte value) { void set_needsdf(mjtBool value) {
ptr_->needsdf = value; ptr_->needsdf = value;
} }
int maxhullvert() const { int maxhullvert() const {