diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ed0692e..86fc48a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,7 +117,7 @@ set(MUJOCO_HEADERS include/mujoco/mjsan.h include/mujoco/mjspec.h include/mujoco/mjthread.h - include/mujoco/mjtnum.h + include/mujoco/mjtype.h include/mujoco/mjui.h include/mujoco/mjvisualize.h include/mujoco/mjxmacro.h diff --git a/doc/APIreference/APIglobals.rst b/doc/APIreference/APIglobals.rst index ba2d63ae..d823553a 100644 --- a/doc/APIreference/APIglobals.rst +++ b/doc/APIreference/APIglobals.rst @@ -415,7 +415,7 @@ indicated otherwise. - 1E-15 - The minimal value allowed in any denominator, and in general any mathematical operation where 0 is not allowed. In almost all cases, MuJoCo silently clamps smaller values to mjMINVAL. - Defined in `mjtnum.h `_. + Defined in `mjtype.h `_. * - ``mjPI`` - :math:`\pi` - The value of :math:`\pi`. This is used in various trigonometric functions, and also for conversion from degrees diff --git a/doc/APIreference/APItypes.rst b/doc/APIreference/APItypes.rst index dd34f411..f7779b3e 100644 --- a/doc/APIreference/APItypes.rst +++ b/doc/APIreference/APItypes.rst @@ -46,7 +46,7 @@ MuJoCo defines a large number of types: Primitive types --------------- -The two types below are defined in `mjtnum.h `__. +The three types below are defined in `mjtype.h `__. .. _mjtNum: @@ -63,7 +63,7 @@ double-precision version will always be available. Thus it is safe to write user However, our preference is to write code that works with either single or double precision. To this end we provide math utility functions that are always defined with the correct floating-point type. -Note that changing ``mjUSESINGLE`` in ``mjtnum.h`` will not change how the library was compiled, and instead will +Note that changing ``mjUSESINGLE`` in ``mjtype.h`` will not change how the library was compiled, and instead will result in numerous link errors. In general, the header files distributed with precompiled MuJoCo should never be changed by the user. diff --git a/doc/changelog.rst b/doc/changelog.rst index 29b713cc..5cd5f9c1 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -73,6 +73,10 @@ General - The :ref:`mjfCollision` functions now populate the :ref:`mjPreContact` struct instead of the :ref:`mjContact` struct. The :ref:`mjPreContact` only contains the necessary fields needed for the narrowphase collision detection. + - The header file ``mjtnum.h`` was renamed to + `mjtype.h ` and now includes all + enum type definitions. + - MJX: Removed the deprecated ``nconmax`` argument from ``mjx.make_data`` and ``mjx.put_data`` in favor of ``naconmax``. @@ -1194,7 +1198,7 @@ General 10. Added :ref:`mj_setKeyframe` for saving the current state into a model keyframe. 11. Added support for ``ball`` joints in the URDF parser ("spherical" in URDF). 12. Replaced ``mjUSEDOUBLE`` which was previously hard-coded in - `mjtnum.h `__ + `mjtnum.h `__ with the build-time flag ``mjUSESINGLE``. If this symbol is not defined, MuJoCo will use double-precision floating point, as usual. If ``mjUSESINGLE`` is defined, MuJoCo will use single-precision floating point. See :ref:`mjtNum`. diff --git a/doc/includes/references.h b/doc/includes/references.h index 7d929ee3..7f6371a2 100644 --- a/doc/includes/references.h +++ b/doc/includes/references.h @@ -16,91 +16,6 @@ // Error: C reference not found // NOLINTBEGIN -typedef enum mjtState_ { // state elements - mjSTATE_TIME = 1<<0, // time - mjSTATE_QPOS = 1<<1, // position - mjSTATE_QVEL = 1<<2, // velocity - mjSTATE_ACT = 1<<3, // actuator activation - mjSTATE_HISTORY = 1<<4, // history buffers (control, sensor) - mjSTATE_WARMSTART = 1<<5, // acceleration used for warmstart - mjSTATE_CTRL = 1<<6, // control - mjSTATE_QFRC_APPLIED = 1<<7, // applied generalized force - mjSTATE_XFRC_APPLIED = 1<<8, // applied Cartesian force/torque - mjSTATE_EQ_ACTIVE = 1<<9, // enable/disable constraints - mjSTATE_MOCAP_POS = 1<<10, // positions of mocap bodies - mjSTATE_MOCAP_QUAT = 1<<11, // orientations of mocap bodies - mjSTATE_USERDATA = 1<<12, // user data - mjSTATE_PLUGIN = 1<<13, // plugin state - - mjNSTATE = 14, // number of state elements - - // convenience values for commonly used state specifications - mjSTATE_PHYSICS = mjSTATE_QPOS | mjSTATE_QVEL | mjSTATE_ACT | mjSTATE_HISTORY, - mjSTATE_FULLPHYSICS = mjSTATE_TIME | mjSTATE_PHYSICS | mjSTATE_PLUGIN, - mjSTATE_USER = mjSTATE_CTRL | mjSTATE_QFRC_APPLIED | mjSTATE_XFRC_APPLIED | - mjSTATE_EQ_ACTIVE | mjSTATE_MOCAP_POS | mjSTATE_MOCAP_QUAT | - mjSTATE_USERDATA, - mjSTATE_INTEGRATION = mjSTATE_FULLPHYSICS | mjSTATE_USER | mjSTATE_WARMSTART -} mjtState; -typedef enum mjtConstraint_ { // type of constraint - mjCNSTR_EQUALITY = 0, // equality constraint - mjCNSTR_FRICTION_DOF, // dof friction - mjCNSTR_FRICTION_TENDON, // tendon friction - mjCNSTR_LIMIT_JOINT, // joint limit - mjCNSTR_LIMIT_TENDON, // tendon limit - mjCNSTR_CONTACT_FRICTIONLESS, // frictionless contact - mjCNSTR_CONTACT_PYRAMIDAL, // frictional contact, pyramidal friction cone - mjCNSTR_CONTACT_ELLIPTIC // frictional contact, elliptic friction cone -} mjtConstraint; -typedef enum mjtConstraintState_ { // constraint state - mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact) - mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact) - mjCNSTRSTATE_LINEARNEG, // linear cost, negative side (friction) - mjCNSTRSTATE_LINEARPOS, // linear cost, positive side (friction) - mjCNSTRSTATE_CONE // squared distance to cone cost (elliptic contact) -} mjtConstraintState; -typedef enum mjtWarning_ { // warning types - mjWARN_INERTIA = 0, // (near) singular inertia matrix - mjWARN_CONTACTFULL, // too many contacts in contact list - mjWARN_CNSTRFULL, // too many constraints - mjWARN_BADQPOS, // bad number in qpos - mjWARN_BADQVEL, // bad number in qvel - mjWARN_BADQACC, // bad number in qacc - mjWARN_BADCTRL, // bad number in ctrl - - mjNWARNING // number of warnings -} mjtWarning; -typedef enum mjtTimer_ { // internal timers - // main api - mjTIMER_STEP = 0, // step - mjTIMER_FORWARD, // forward - mjTIMER_INVERSE, // inverse - - // breakdown of step/forward - mjTIMER_POSITION, // fwdPosition - mjTIMER_VELOCITY, // fwdVelocity - mjTIMER_ACTUATION, // fwdActuation - mjTIMER_CONSTRAINT, // fwdConstraint - mjTIMER_ADVANCE, // mj_Euler, mj_implicit - - // breakdown of fwdPosition - mjTIMER_POS_KINEMATICS, // kinematics, com, tendon, transmission - mjTIMER_POS_INERTIA, // inertia computations - mjTIMER_POS_COLLISION, // collision detection - mjTIMER_POS_MAKE, // make constraints - mjTIMER_POS_PROJECT, // project constraints - - // breakdown of mj_collision - mjTIMER_COL_BROAD, // broadphase - mjTIMER_COL_NARROW, // narrowphase - - mjNTIMER // number of timers -} mjtTimer; -typedef enum mjtSleepState_ { // sleep state of an object - mjS_STATIC = -1, // object is static - mjS_ASLEEP = 0, // object is asleep - mjS_AWAKE = 1 // object is awake -} mjtSleepState; struct mjPreContact_ { // contact parameters set by narrowphase collision functions mjtNum dist; mjtNum pos[3]; @@ -486,369 +401,6 @@ struct mjData_ { uint64_t signature; // also held by the mjSpec that compiled the model }; typedef struct mjData_ mjData; -typedef enum mjtDisableBit_ { // disable default feature bitflags - mjDSBL_CONSTRAINT = 1<<0, // entire constraint solver - mjDSBL_EQUALITY = 1<<1, // equality constraints - mjDSBL_FRICTIONLOSS = 1<<2, // joint and tendon frictionloss constraints - mjDSBL_LIMIT = 1<<3, // joint and tendon limit constraints - mjDSBL_CONTACT = 1<<4, // contact constraints - mjDSBL_SPRING = 1<<5, // passive spring forces - mjDSBL_DAMPER = 1<<6, // passive damping forces - mjDSBL_GRAVITY = 1<<7, // gravitational forces - mjDSBL_CLAMPCTRL = 1<<8, // clamp control to specified range - mjDSBL_WARMSTART = 1<<9, // warmstart constraint solver - mjDSBL_FILTERPARENT = 1<<10, // remove collisions with parent body - mjDSBL_ACTUATION = 1<<11, // apply actuation forces - mjDSBL_REFSAFE = 1<<12, // integrator safety: make ref[0]>=2*timestep - mjDSBL_SENSOR = 1<<13, // sensors - mjDSBL_MIDPHASE = 1<<14, // mid-phase collision filtering - mjDSBL_EULERDAMP = 1<<15, // implicit integration of joint damping in Euler integrator - mjDSBL_AUTORESET = 1<<16, // automatic reset when numerical issues are detected - mjDSBL_NATIVECCD = 1<<17, // native convex collision detection - mjDSBL_ISLAND = 1<<18, // constraint island discovery - mjDSBL_MULTICCD = 1<<19, // multiple CCD contact points - - mjNDISABLE = 20 // number of disable flags -} mjtDisableBit; -typedef enum mjtEnableBit_ { // enable optional feature bitflags - mjENBL_OVERRIDE = 1<<0, // override contact parameters - mjENBL_ENERGY = 1<<1, // energy computation - mjENBL_FWDINV = 1<<2, // record solver statistics - mjENBL_INVDISCRETE = 1<<3, // discrete-time inverse dynamics - mjENBL_SLEEP = 1<<4, // sleeping - mjENBL_DIAGEXACT = 1<<5, // exact diagonal of constraint inertia - - mjNENABLE = 6 // number of enable flags -} mjtEnableBit; -typedef enum mjtJoint_ { // type of degree of freedom - mjJNT_FREE = 0, // global position and orientation (quat) (7) - mjJNT_BALL, // orientation (quat) relative to parent (4) - mjJNT_SLIDE, // sliding distance along body-fixed axis (1) - mjJNT_HINGE // rotation angle (rad) around body-fixed axis (1) -} mjtJoint; -typedef enum mjtGeom_ { // type of geometric shape - // regular geom types - mjGEOM_PLANE = 0, // plane - mjGEOM_HFIELD, // height field - mjGEOM_SPHERE, // sphere - mjGEOM_CAPSULE, // capsule - mjGEOM_ELLIPSOID, // ellipsoid - mjGEOM_CYLINDER, // cylinder - mjGEOM_BOX, // box - mjGEOM_MESH, // mesh - mjGEOM_SDF, // signed distance field - - mjNGEOMTYPES, // number of regular geom types - - // rendering-only geom types: not used in mjModel, not counted in mjNGEOMTYPES - mjGEOM_ARROW = 100, // arrow - mjGEOM_ARROW1, // arrow without wedges - mjGEOM_ARROW2, // arrow in both directions - mjGEOM_LINE, // line - mjGEOM_LINEBOX, // box with line edges - mjGEOM_FLEX, // flex - mjGEOM_SKIN, // skin - mjGEOM_LABEL, // text label - mjGEOM_TRIANGLE, // triangle - - mjGEOM_NONE = 1001 // missing geom type -} mjtGeom; -typedef enum mjtProjection_ { // type of camera projection - mjPROJ_PERSPECTIVE = 0, // perspective - mjPROJ_ORTHOGRAPHIC // orthographic -} mjtProjection; -typedef enum mjtCamLight_ { // tracking mode for camera and light - mjCAMLIGHT_FIXED = 0, // pos and rot fixed in body - mjCAMLIGHT_TRACK, // pos tracks body, rot fixed in global - mjCAMLIGHT_TRACKCOM, // pos tracks subtree com, rot fixed in body - mjCAMLIGHT_TARGETBODY, // pos fixed in body, rot tracks target body - mjCAMLIGHT_TARGETBODYCOM // pos fixed in body, rot tracks target subtree com -} mjtCamLight; -typedef enum mjtLightType_ { // type of light - mjLIGHT_SPOT = 0, // spot - mjLIGHT_DIRECTIONAL, // directional - mjLIGHT_POINT, // point - mjLIGHT_IMAGE, // image-based -} mjtLightType; -typedef enum mjtTexture_ { // type of texture - mjTEXTURE_2D = 0, // 2d texture, suitable for planes and hfields - mjTEXTURE_CUBE, // cube texture, suitable for all other geom types - mjTEXTURE_SKYBOX // cube texture used as skybox -} mjtTexture; -typedef enum mjtTextureRole_ { // role of texture map in rendering - mjTEXROLE_USER = 0, // unspecified - mjTEXROLE_RGB, // base color (albedo) - mjTEXROLE_OCCLUSION, // ambient occlusion - mjTEXROLE_ROUGHNESS, // roughness - mjTEXROLE_METALLIC, // metallic - mjTEXROLE_NORMAL, // normal (bump) map - mjTEXROLE_OPACITY, // opacity - mjTEXROLE_EMISSIVE, // light emission - mjTEXROLE_RGBA, // base color, opacity - mjTEXROLE_ORM, // occlusion, roughness, metallic - mjNTEXROLE -} mjtTextureRole; -typedef enum mjtColorSpace_ { // type of color space encoding - mjCOLORSPACE_AUTO = 0, // attempts to autodetect color space, defaults to linear - mjCOLORSPACE_LINEAR, // linear color space - mjCOLORSPACE_SRGB // standard RGB color space -} mjtColorSpace; -typedef enum mjtIntegrator_ { // integrator mode - mjINT_EULER = 0, // semi-implicit Euler - mjINT_RK4, // 4th-order Runge Kutta - mjINT_IMPLICIT, // implicit in velocity - mjINT_IMPLICITFAST // implicit in velocity, no rne derivative -} mjtIntegrator; -typedef enum mjtCone_ { // type of friction cone - mjCONE_PYRAMIDAL = 0, // pyramidal - mjCONE_ELLIPTIC // elliptic -} mjtCone; -typedef enum mjtJacobian_ { // type of constraint Jacobian - mjJAC_DENSE = 0, // dense - mjJAC_SPARSE, // sparse - mjJAC_AUTO // dense if nv<60, sparse otherwise -} mjtJacobian; -typedef enum mjtSolver_ { // constraint solver algorithm - mjSOL_PGS = 0, // PGS (dual) - mjSOL_CG, // CG (primal) - mjSOL_NEWTON // Newton (primal) -} mjtSolver; -typedef enum mjtEq_ { // type of equality constraint - mjEQ_CONNECT = 0, // connect two bodies at a point (ball joint) - mjEQ_WELD, // fix relative position and orientation of two bodies - mjEQ_JOINT, // couple the values of two scalar joints with cubic - mjEQ_TENDON, // couple the lengths of two tendons with cubic - mjEQ_FLEX, // fix all edge lengths of a flex - mjEQ_FLEXVERT, // fix all vertex lengths of a flex - mjEQ_FLEXSTRAIN, // constrain strain of a trilinear/quadratic flex (B-bar) - mjEQ_DISTANCE // unsupported, will cause an error if used -} mjtEq; -typedef enum mjtWrap_ { // type of tendon wrap object - mjWRAP_NONE = 0, // null object - mjWRAP_JOINT, // constant moment arm - mjWRAP_PULLEY, // pulley used to split tendon - mjWRAP_SITE, // pass through site - mjWRAP_SPHERE, // wrap around sphere - mjWRAP_CYLINDER // wrap around (infinite) cylinder -} mjtWrap; -typedef enum mjtTrn_ { // type of actuator transmission - mjTRN_JOINT = 0, // force on joint - mjTRN_JOINTINPARENT, // force on joint, expressed in parent frame - mjTRN_SLIDERCRANK, // force via slider-crank linkage - mjTRN_TENDON, // force on tendon - mjTRN_SITE, // force on site - mjTRN_BODY, // adhesion force on a body's geoms - - mjTRN_UNDEFINED = 1000 // undefined transmission type -} mjtTrn; -typedef enum mjtDyn_ { // type of actuator dynamics - mjDYN_NONE = 0, // no internal dynamics; ctrl specifies force - mjDYN_INTEGRATOR, // integrator: da/dt = u - mjDYN_FILTER, // linear filter: da/dt = (u-a) / tau - mjDYN_FILTEREXACT, // linear filter: da/dt = (u-a) / tau, with exact integration - mjDYN_MUSCLE, // piecewise linear filter with two time constants - mjDYN_DCMOTOR, // DC motor electrical dynamics - mjDYN_USER // user-defined dynamics type -} mjtDyn; -typedef enum mjtGain_ { // type of actuator gain - mjGAIN_FIXED = 0, // fixed gain - mjGAIN_AFFINE, // const + kp*length + kv*velocity - mjGAIN_MUSCLE, // muscle FLV curve computed by mju_muscleGain() - mjGAIN_DCMOTOR, // DC motor gain: K or K/R - mjGAIN_USER // user-defined gain type -} mjtGain; -typedef enum mjtBias_ { // type of actuator bias - mjBIAS_NONE = 0, // no bias - mjBIAS_AFFINE, // const + kp*length + kv*velocity - mjBIAS_MUSCLE, // muscle passive force computed by mju_muscleBias() - mjBIAS_DCMOTOR, // DC motor bias: back-EMF, cogging, LuGre friction - mjBIAS_USER // user-defined bias type -} mjtBias; -typedef enum mjtObj_ { // type of MujoCo object - mjOBJ_UNKNOWN = 0, // unknown object type - mjOBJ_BODY, // body - mjOBJ_XBODY, // body, used to access regular frame instead of i-frame - mjOBJ_JOINT, // joint - mjOBJ_DOF, // dof - mjOBJ_GEOM, // geom - mjOBJ_SITE, // site - mjOBJ_CAMERA, // camera - mjOBJ_LIGHT, // light - mjOBJ_FLEX, // flex - mjOBJ_MESH, // mesh - mjOBJ_SKIN, // skin - mjOBJ_HFIELD, // heightfield - mjOBJ_TEXTURE, // texture - mjOBJ_MATERIAL, // material for rendering - mjOBJ_PAIR, // geom pair to include - mjOBJ_EXCLUDE, // body pair to exclude - mjOBJ_EQUALITY, // equality constraint - mjOBJ_TENDON, // tendon - mjOBJ_ACTUATOR, // actuator - mjOBJ_SENSOR, // sensor - mjOBJ_NUMERIC, // numeric - mjOBJ_TEXT, // text - mjOBJ_TUPLE, // tuple - mjOBJ_KEY, // keyframe - mjOBJ_PLUGIN, // plugin instance - - mjNOBJECT, // number of object types - - // meta elements, do not appear in mjModel - mjOBJ_FRAME = 100, // frame - mjOBJ_DEFAULT, // default - mjOBJ_MODEL // entire model -} mjtObj; -typedef enum mjtSensor_ { // type of sensor - // common robotic sensors, attached to a site - mjSENS_TOUCH = 0, // scalar contact normal forces summed over sensor zone - mjSENS_ACCELEROMETER, // 3D linear acceleration, in local frame - mjSENS_VELOCIMETER, // 3D linear velocity, in local frame - mjSENS_GYRO, // 3D angular velocity, in local frame - mjSENS_FORCE, // 3D force between site's body and its parent body - mjSENS_TORQUE, // 3D torque between site's body and its parent body - mjSENS_MAGNETOMETER, // 3D magnetometer - mjSENS_RANGEFINDER, // scalar distance to nearest geom along z-axis - mjSENS_CAMPROJECTION, // pixel coordinates of a site in the camera image - - // sensors related to scalar joints, tendons, actuators - mjSENS_JOINTPOS, // scalar joint position (hinge and slide only) - mjSENS_JOINTVEL, // scalar joint velocity (hinge and slide only) - mjSENS_TENDONPOS, // scalar tendon position - mjSENS_TENDONVEL, // scalar tendon velocity - mjSENS_ACTUATORPOS, // scalar actuator position - mjSENS_ACTUATORVEL, // scalar actuator velocity - mjSENS_ACTUATORFRC, // scalar actuator force - mjSENS_JOINTACTFRC, // scalar actuator force, measured at the joint - mjSENS_TENDONACTFRC, // scalar actuator force, measured at the tendon - - // sensors related to ball joints - mjSENS_BALLQUAT, // 4D ball joint quaternion - mjSENS_BALLANGVEL, // 3D ball joint angular velocity - - // joint and tendon limit sensors, in constraint space - mjSENS_JOINTLIMITPOS, // joint limit distance-margin - mjSENS_JOINTLIMITVEL, // joint limit velocity - mjSENS_JOINTLIMITFRC, // joint limit force - mjSENS_TENDONLIMITPOS, // tendon limit distance-margin - mjSENS_TENDONLIMITVEL, // tendon limit velocity - mjSENS_TENDONLIMITFRC, // tendon limit force - - // sensors attached to an object with spatial frame: (x)body, geom, site, camera - mjSENS_FRAMEPOS, // 3D position - mjSENS_FRAMEQUAT, // 4D unit quaternion orientation - mjSENS_FRAMEXAXIS, // 3D unit vector: x-axis of object's frame - mjSENS_FRAMEYAXIS, // 3D unit vector: y-axis of object's frame - mjSENS_FRAMEZAXIS, // 3D unit vector: z-axis of object's frame - mjSENS_FRAMELINVEL, // 3D linear velocity - mjSENS_FRAMEANGVEL, // 3D angular velocity - mjSENS_FRAMELINACC, // 3D linear acceleration - mjSENS_FRAMEANGACC, // 3D angular acceleration - - // sensors related to kinematic subtrees; attached to a body (which is the subtree root) - mjSENS_SUBTREECOM, // 3D center of mass of subtree - mjSENS_SUBTREELINVEL, // 3D linear velocity of subtree - mjSENS_SUBTREEANGMOM, // 3D angular momentum of subtree - - // sensors of geometric relationships - mjSENS_INSIDESITE, // 1 if object is inside a site, 0 otherwise - mjSENS_GEOMDIST, // signed distance between two geoms - mjSENS_GEOMNORMAL, // normal direction between two geoms - mjSENS_GEOMFROMTO, // segment between two geoms - - // sensors for reporting contacts which occurred during the simulation - mjSENS_CONTACT, // contacts which occurred during the simulation - - // global sensors - mjSENS_E_POTENTIAL, // potential energy - mjSENS_E_KINETIC, // kinetic energy - mjSENS_CLOCK, // simulation time - - // sensors related to SDFs - mjSENS_TACTILE, // tactile sensor - - // plugin-controlled sensors - mjSENS_PLUGIN, // plugin-controlled - - // user-defined sensor - mjSENS_USER // sensor data provided by mjcb_sensor callback -} mjtSensor; -typedef enum mjtStage_ { // computation stage - mjSTAGE_NONE = 0, // no computations - mjSTAGE_POS, // position-dependent computations - mjSTAGE_VEL, // velocity-dependent computations - mjSTAGE_ACC // acceleration/force-dependent computations -} mjtStage; -typedef enum mjtDataType_ { // data type for sensors - mjDATATYPE_REAL = 0, // real values, no constraints - mjDATATYPE_POSITIVE, // positive values; 0 or negative: inactive - mjDATATYPE_AXIS, // 3D unit vector - mjDATATYPE_QUATERNION // unit quaternion -} mjtDataType; -typedef enum mjtConDataField_ { // data fields returned by contact sensors - mjCONDATA_FOUND = 0, // whether a contact was found - mjCONDATA_FORCE, // contact force - mjCONDATA_TORQUE, // contact torque - mjCONDATA_DIST, // contact penetration distance - mjCONDATA_POS, // contact position - mjCONDATA_NORMAL, // contact frame normal - mjCONDATA_TANGENT, // contact frame first tangent - - mjNCONDATA // number of contact sensor data fields -} mjtConDataField; -typedef enum mjtRayDataField_ { // data fields returned by rangefinder sensors - mjRAYDATA_DIST = 0, // distance from ray origin to nearest surface - mjRAYDATA_DIR, // normalized ray direction - mjRAYDATA_ORIGIN, // ray origin - mjRAYDATA_POINT, // point at which ray intersects nearest surface - mjRAYDATA_NORMAL, // surface normal at intersection point - mjRAYDATA_DEPTH, // depth along z-axis - - mjNRAYDATA // number of rangefinder sensor data fields -} mjtRayDataField; -typedef enum mjtCamOutBit_ { // camera output type bitflags - mjCAMOUT_RGB = 1<<0, // RGB image - mjCAMOUT_DEPTH = 1<<1, // depth image (distance from camera plane) - mjCAMOUT_DIST = 1<<2, // distance image (distance from camera origin) - mjCAMOUT_NORMAL = 1<<3, // normal image - mjCAMOUT_SEG = 1<<4, // segmentation image - - mjNCAMOUT = 5 // number of camera output types -} mjtCamOutBit; -typedef enum mjtSameFrame_ { // frame alignment of bodies with their children - mjSAMEFRAME_NONE = 0, // no alignment - mjSAMEFRAME_BODY, // frame is same as body frame - mjSAMEFRAME_INERTIA, // frame is same as inertial frame - mjSAMEFRAME_BODYROT, // frame orientation is same as body orientation - mjSAMEFRAME_INERTIAROT // frame orientation is same as inertia orientation -} mjtSameFrame; -typedef enum mjtSleepPolicy_ { // per-tree sleep policy - mjSLEEP_AUTO = 0, // compiler chooses sleep policy - mjSLEEP_AUTO_NEVER, // compiler sleep policy: never - mjSLEEP_AUTO_ALLOWED, // compiler sleep policy: allowed - mjSLEEP_NEVER, // user sleep policy: never - mjSLEEP_ALLOWED, // user sleep policy: allowed - mjSLEEP_INIT, // user sleep policy: initialized asleep -} mjtSleepPolicy; -typedef enum mjtLRMode_ { // mode for actuator length range computation - mjLRMODE_NONE = 0, // do not process any actuators - mjLRMODE_MUSCLE, // process muscle actuators - mjLRMODE_MUSCLEUSER, // process muscle and user actuators - mjLRMODE_ALL // process all actuators -} mjtLRMode; -typedef enum mjtFlexSelf_ { // mode for flex selfcollide - mjFLEXSELF_NONE = 0, // no self-collisions - mjFLEXSELF_NARROW, // skip midphase, go directly to narrowphase - mjFLEXSELF_BVH, // use BVH in midphase (if midphase enabled) - mjFLEXSELF_SAP, // use SAP in midphase - mjFLEXSELF_AUTO // choose between BVH and SAP automatically -} mjtFlexSelf; -typedef enum mjtSDFType_ { // signed distance function (SDF) type - mjSDFTYPE_SINGLE = 0, // single SDF - mjSDFTYPE_INTERSECTION, // max(A, B) - mjSDFTYPE_MIDSURFACE, // A - B - mjSDFTYPE_COLLISION, // A + B + abs(max(A, B)) -} mjtSDFType; struct mjLROpt_ { // options for mj_setLengthRange() // flags int mode; // which actuators to process (mjtLRMode) @@ -2609,6 +2161,454 @@ struct mjTask_ { // a task that can be executed by a thread pool. volatile int status; // status of the task }; typedef struct mjTask_ mjTask; +typedef enum mjtDisableBit_ { // disable default feature bitflags + mjDSBL_CONSTRAINT = 1<<0, // entire constraint solver + mjDSBL_EQUALITY = 1<<1, // equality constraints + mjDSBL_FRICTIONLOSS = 1<<2, // joint and tendon frictionloss constraints + mjDSBL_LIMIT = 1<<3, // joint and tendon limit constraints + mjDSBL_CONTACT = 1<<4, // contact constraints + mjDSBL_SPRING = 1<<5, // passive spring forces + mjDSBL_DAMPER = 1<<6, // passive damping forces + mjDSBL_GRAVITY = 1<<7, // gravitational forces + mjDSBL_CLAMPCTRL = 1<<8, // clamp control to specified range + mjDSBL_WARMSTART = 1<<9, // warmstart constraint solver + mjDSBL_FILTERPARENT = 1<<10, // remove collisions with parent body + mjDSBL_ACTUATION = 1<<11, // apply actuation forces + mjDSBL_REFSAFE = 1<<12, // integrator safety: make ref[0]>=2*timestep + mjDSBL_SENSOR = 1<<13, // sensors + mjDSBL_MIDPHASE = 1<<14, // mid-phase collision filtering + mjDSBL_EULERDAMP = 1<<15, // implicit integration of joint damping in Euler integrator + mjDSBL_AUTORESET = 1<<16, // automatic reset when numerical issues are detected + mjDSBL_NATIVECCD = 1<<17, // native convex collision detection + mjDSBL_ISLAND = 1<<18, // constraint island discovery + mjDSBL_MULTICCD = 1<<19, // multiple CCD contact points + + mjNDISABLE = 20 // number of disable flags +} mjtDisableBit; +typedef enum mjtEnableBit_ { // enable optional feature bitflags + mjENBL_OVERRIDE = 1<<0, // override contact parameters + mjENBL_ENERGY = 1<<1, // energy computation + mjENBL_FWDINV = 1<<2, // record solver statistics + mjENBL_INVDISCRETE = 1<<3, // discrete-time inverse dynamics + mjENBL_SLEEP = 1<<4, // sleeping + mjENBL_DIAGEXACT = 1<<5, // exact diagonal of constraint inertia + + mjNENABLE = 6 // number of enable flags +} mjtEnableBit; +typedef enum mjtJoint_ { // type of degree of freedom + mjJNT_FREE = 0, // global position and orientation (quat) (7) + mjJNT_BALL, // orientation (quat) relative to parent (4) + mjJNT_SLIDE, // sliding distance along body-fixed axis (1) + mjJNT_HINGE // rotation angle (rad) around body-fixed axis (1) +} mjtJoint; +typedef enum mjtGeom_ { // type of geometric shape + // regular geom types + mjGEOM_PLANE = 0, // plane + mjGEOM_HFIELD, // height field + mjGEOM_SPHERE, // sphere + mjGEOM_CAPSULE, // capsule + mjGEOM_ELLIPSOID, // ellipsoid + mjGEOM_CYLINDER, // cylinder + mjGEOM_BOX, // box + mjGEOM_MESH, // mesh + mjGEOM_SDF, // signed distance field + + mjNGEOMTYPES, // number of regular geom types + + // rendering-only geom types: not used in mjModel, not counted in mjNGEOMTYPES + mjGEOM_ARROW = 100, // arrow + mjGEOM_ARROW1, // arrow without wedges + mjGEOM_ARROW2, // arrow in both directions + mjGEOM_LINE, // line + mjGEOM_LINEBOX, // box with line edges + mjGEOM_FLEX, // flex + mjGEOM_SKIN, // skin + mjGEOM_LABEL, // text label + mjGEOM_TRIANGLE, // triangle + + mjGEOM_NONE = 1001 // missing geom type +} mjtGeom; +typedef enum mjtProjection_ { // type of camera projection + mjPROJ_PERSPECTIVE = 0, // perspective + mjPROJ_ORTHOGRAPHIC // orthographic +} mjtProjection; +typedef enum mjtCamLight_ { // tracking mode for camera and light + mjCAMLIGHT_FIXED = 0, // pos and rot fixed in body + mjCAMLIGHT_TRACK, // pos tracks body, rot fixed in global + mjCAMLIGHT_TRACKCOM, // pos tracks subtree com, rot fixed in body + mjCAMLIGHT_TARGETBODY, // pos fixed in body, rot tracks target body + mjCAMLIGHT_TARGETBODYCOM // pos fixed in body, rot tracks target subtree com +} mjtCamLight; +typedef enum mjtLightType_ { // type of light + mjLIGHT_SPOT = 0, // spot + mjLIGHT_DIRECTIONAL, // directional + mjLIGHT_POINT, // point + mjLIGHT_IMAGE, // image-based +} mjtLightType; +typedef enum mjtTexture_ { // type of texture + mjTEXTURE_2D = 0, // 2d texture, suitable for planes and hfields + mjTEXTURE_CUBE, // cube texture, suitable for all other geom types + mjTEXTURE_SKYBOX // cube texture used as skybox +} mjtTexture; +typedef enum mjtTextureRole_ { // role of texture map in rendering + mjTEXROLE_USER = 0, // unspecified + mjTEXROLE_RGB, // base color (albedo) + mjTEXROLE_OCCLUSION, // ambient occlusion + mjTEXROLE_ROUGHNESS, // roughness + mjTEXROLE_METALLIC, // metallic + mjTEXROLE_NORMAL, // normal (bump) map + mjTEXROLE_OPACITY, // opacity + mjTEXROLE_EMISSIVE, // light emission + mjTEXROLE_RGBA, // base color, opacity + mjTEXROLE_ORM, // occlusion, roughness, metallic + mjNTEXROLE +} mjtTextureRole; +typedef enum mjtColorSpace_ { // type of color space encoding + mjCOLORSPACE_AUTO = 0, // attempts to autodetect color space, defaults to linear + mjCOLORSPACE_LINEAR, // linear color space + mjCOLORSPACE_SRGB // standard RGB color space +} mjtColorSpace; +typedef enum mjtIntegrator_ { // integrator mode + mjINT_EULER = 0, // semi-implicit Euler + mjINT_RK4, // 4th-order Runge Kutta + mjINT_IMPLICIT, // implicit in velocity + mjINT_IMPLICITFAST // implicit in velocity, no rne derivative +} mjtIntegrator; +typedef enum mjtCone_ { // type of friction cone + mjCONE_PYRAMIDAL = 0, // pyramidal + mjCONE_ELLIPTIC // elliptic +} mjtCone; +typedef enum mjtJacobian_ { // type of constraint Jacobian + mjJAC_DENSE = 0, // dense + mjJAC_SPARSE, // sparse + mjJAC_AUTO // dense if nv<60, sparse otherwise +} mjtJacobian; +typedef enum mjtSolver_ { // constraint solver algorithm + mjSOL_PGS = 0, // PGS (dual) + mjSOL_CG, // CG (primal) + mjSOL_NEWTON // Newton (primal) +} mjtSolver; +typedef enum mjtEq_ { // type of equality constraint + mjEQ_CONNECT = 0, // connect two bodies at a point (ball joint) + mjEQ_WELD, // fix relative position and orientation of two bodies + mjEQ_JOINT, // couple the values of two scalar joints with cubic + mjEQ_TENDON, // couple the lengths of two tendons with cubic + mjEQ_FLEX, // fix all edge lengths of a flex + mjEQ_FLEXVERT, // fix all vertex lengths of a flex + mjEQ_FLEXSTRAIN, // constrain strain of a trilinear/quadratic flex (B-bar) + mjEQ_DISTANCE // unsupported, will cause an error if used +} mjtEq; +typedef enum mjtWrap_ { // type of tendon wrap object + mjWRAP_NONE = 0, // null object + mjWRAP_JOINT, // constant moment arm + mjWRAP_PULLEY, // pulley used to split tendon + mjWRAP_SITE, // pass through site + mjWRAP_SPHERE, // wrap around sphere + mjWRAP_CYLINDER // wrap around (infinite) cylinder +} mjtWrap; +typedef enum mjtTrn_ { // type of actuator transmission + mjTRN_JOINT = 0, // force on joint + mjTRN_JOINTINPARENT, // force on joint, expressed in parent frame + mjTRN_SLIDERCRANK, // force via slider-crank linkage + mjTRN_TENDON, // force on tendon + mjTRN_SITE, // force on site + mjTRN_BODY, // adhesion force on a body's geoms + + mjTRN_UNDEFINED = 1000 // undefined transmission type +} mjtTrn; +typedef enum mjtDyn_ { // type of actuator dynamics + mjDYN_NONE = 0, // no internal dynamics; ctrl specifies force + mjDYN_INTEGRATOR, // integrator: da/dt = u + mjDYN_FILTER, // linear filter: da/dt = (u-a) / tau + mjDYN_FILTEREXACT, // linear filter: da/dt = (u-a) / tau, with exact integration + mjDYN_MUSCLE, // piecewise linear filter with two time constants + mjDYN_DCMOTOR, // DC motor electrical dynamics + mjDYN_USER // user-defined dynamics type +} mjtDyn; +typedef enum mjtGain_ { // type of actuator gain + mjGAIN_FIXED = 0, // fixed gain + mjGAIN_AFFINE, // const + kp*length + kv*velocity + mjGAIN_MUSCLE, // muscle FLV curve computed by mju_muscleGain() + mjGAIN_DCMOTOR, // DC motor gain: K or K/R + mjGAIN_USER // user-defined gain type +} mjtGain; +typedef enum mjtBias_ { // type of actuator bias + mjBIAS_NONE = 0, // no bias + mjBIAS_AFFINE, // const + kp*length + kv*velocity + mjBIAS_MUSCLE, // muscle passive force computed by mju_muscleBias() + mjBIAS_DCMOTOR, // DC motor bias: back-EMF, cogging, LuGre friction + mjBIAS_USER // user-defined bias type +} mjtBias; +typedef enum mjtObj_ { // type of MujoCo object + mjOBJ_UNKNOWN = 0, // unknown object type + mjOBJ_BODY, // body + mjOBJ_XBODY, // body, used to access regular frame instead of i-frame + mjOBJ_JOINT, // joint + mjOBJ_DOF, // dof + mjOBJ_GEOM, // geom + mjOBJ_SITE, // site + mjOBJ_CAMERA, // camera + mjOBJ_LIGHT, // light + mjOBJ_FLEX, // flex + mjOBJ_MESH, // mesh + mjOBJ_SKIN, // skin + mjOBJ_HFIELD, // heightfield + mjOBJ_TEXTURE, // texture + mjOBJ_MATERIAL, // material for rendering + mjOBJ_PAIR, // geom pair to include + mjOBJ_EXCLUDE, // body pair to exclude + mjOBJ_EQUALITY, // equality constraint + mjOBJ_TENDON, // tendon + mjOBJ_ACTUATOR, // actuator + mjOBJ_SENSOR, // sensor + mjOBJ_NUMERIC, // numeric + mjOBJ_TEXT, // text + mjOBJ_TUPLE, // tuple + mjOBJ_KEY, // keyframe + mjOBJ_PLUGIN, // plugin instance + + mjNOBJECT, // number of object types + + // meta elements, do not appear in mjModel + mjOBJ_FRAME = 100, // frame + mjOBJ_DEFAULT, // default + mjOBJ_MODEL // entire model +} mjtObj; +typedef enum mjtSensor_ { // type of sensor + // common robotic sensors, attached to a site + mjSENS_TOUCH = 0, // scalar contact normal forces summed over sensor zone + mjSENS_ACCELEROMETER, // 3D linear acceleration, in local frame + mjSENS_VELOCIMETER, // 3D linear velocity, in local frame + mjSENS_GYRO, // 3D angular velocity, in local frame + mjSENS_FORCE, // 3D force between site's body and its parent body + mjSENS_TORQUE, // 3D torque between site's body and its parent body + mjSENS_MAGNETOMETER, // 3D magnetometer + mjSENS_RANGEFINDER, // scalar distance to nearest geom along z-axis + mjSENS_CAMPROJECTION, // pixel coordinates of a site in the camera image + + // sensors related to scalar joints, tendons, actuators + mjSENS_JOINTPOS, // scalar joint position (hinge and slide only) + mjSENS_JOINTVEL, // scalar joint velocity (hinge and slide only) + mjSENS_TENDONPOS, // scalar tendon position + mjSENS_TENDONVEL, // scalar tendon velocity + mjSENS_ACTUATORPOS, // scalar actuator position + mjSENS_ACTUATORVEL, // scalar actuator velocity + mjSENS_ACTUATORFRC, // scalar actuator force + mjSENS_JOINTACTFRC, // scalar actuator force, measured at the joint + mjSENS_TENDONACTFRC, // scalar actuator force, measured at the tendon + + // sensors related to ball joints + mjSENS_BALLQUAT, // 4D ball joint quaternion + mjSENS_BALLANGVEL, // 3D ball joint angular velocity + + // joint and tendon limit sensors, in constraint space + mjSENS_JOINTLIMITPOS, // joint limit distance-margin + mjSENS_JOINTLIMITVEL, // joint limit velocity + mjSENS_JOINTLIMITFRC, // joint limit force + mjSENS_TENDONLIMITPOS, // tendon limit distance-margin + mjSENS_TENDONLIMITVEL, // tendon limit velocity + mjSENS_TENDONLIMITFRC, // tendon limit force + + // sensors attached to an object with spatial frame: (x)body, geom, site, camera + mjSENS_FRAMEPOS, // 3D position + mjSENS_FRAMEQUAT, // 4D unit quaternion orientation + mjSENS_FRAMEXAXIS, // 3D unit vector: x-axis of object's frame + mjSENS_FRAMEYAXIS, // 3D unit vector: y-axis of object's frame + mjSENS_FRAMEZAXIS, // 3D unit vector: z-axis of object's frame + mjSENS_FRAMELINVEL, // 3D linear velocity + mjSENS_FRAMEANGVEL, // 3D angular velocity + mjSENS_FRAMELINACC, // 3D linear acceleration + mjSENS_FRAMEANGACC, // 3D angular acceleration + + // sensors related to kinematic subtrees; attached to a body (which is the subtree root) + mjSENS_SUBTREECOM, // 3D center of mass of subtree + mjSENS_SUBTREELINVEL, // 3D linear velocity of subtree + mjSENS_SUBTREEANGMOM, // 3D angular momentum of subtree + + // sensors of geometric relationships + mjSENS_INSIDESITE, // 1 if object is inside a site, 0 otherwise + mjSENS_GEOMDIST, // signed distance between two geoms + mjSENS_GEOMNORMAL, // normal direction between two geoms + mjSENS_GEOMFROMTO, // segment between two geoms + + // sensors for reporting contacts which occurred during the simulation + mjSENS_CONTACT, // contacts which occurred during the simulation + + // global sensors + mjSENS_E_POTENTIAL, // potential energy + mjSENS_E_KINETIC, // kinetic energy + mjSENS_CLOCK, // simulation time + + // sensors related to SDFs + mjSENS_TACTILE, // tactile sensor + + // plugin-controlled sensors + mjSENS_PLUGIN, // plugin-controlled + + // user-defined sensor + mjSENS_USER // sensor data provided by mjcb_sensor callback +} mjtSensor; +typedef enum mjtStage_ { // computation stage + mjSTAGE_NONE = 0, // no computations + mjSTAGE_POS, // position-dependent computations + mjSTAGE_VEL, // velocity-dependent computations + mjSTAGE_ACC // acceleration/force-dependent computations +} mjtStage; +typedef enum mjtDataType_ { // data type for sensors + mjDATATYPE_REAL = 0, // real values, no constraints + mjDATATYPE_POSITIVE, // positive values; 0 or negative: inactive + mjDATATYPE_AXIS, // 3D unit vector + mjDATATYPE_QUATERNION // unit quaternion +} mjtDataType; +typedef enum mjtConDataField_ { // data fields returned by contact sensors + mjCONDATA_FOUND = 0, // whether a contact was found + mjCONDATA_FORCE, // contact force + mjCONDATA_TORQUE, // contact torque + mjCONDATA_DIST, // contact penetration distance + mjCONDATA_POS, // contact position + mjCONDATA_NORMAL, // contact frame normal + mjCONDATA_TANGENT, // contact frame first tangent + + mjNCONDATA // number of contact sensor data fields +} mjtConDataField; +typedef enum mjtRayDataField_ { // data fields returned by rangefinder sensors + mjRAYDATA_DIST = 0, // distance from ray origin to nearest surface + mjRAYDATA_DIR, // normalized ray direction + mjRAYDATA_ORIGIN, // ray origin + mjRAYDATA_POINT, // point at which ray intersects nearest surface + mjRAYDATA_NORMAL, // surface normal at intersection point + mjRAYDATA_DEPTH, // depth along z-axis + + mjNRAYDATA // number of rangefinder sensor data fields +} mjtRayDataField; +typedef enum mjtCamOutBit_ { // camera output type bitflags + mjCAMOUT_RGB = 1<<0, // RGB image + mjCAMOUT_DEPTH = 1<<1, // depth image (distance from camera plane) + mjCAMOUT_DIST = 1<<2, // distance image (distance from camera origin) + mjCAMOUT_NORMAL = 1<<3, // normal image + mjCAMOUT_SEG = 1<<4, // segmentation image + + mjNCAMOUT = 5 // number of camera output types +} mjtCamOutBit; +typedef enum mjtSameFrame_ { // frame alignment of bodies with their children + mjSAMEFRAME_NONE = 0, // no alignment + mjSAMEFRAME_BODY, // frame is same as body frame + mjSAMEFRAME_INERTIA, // frame is same as inertial frame + mjSAMEFRAME_BODYROT, // frame orientation is same as body orientation + mjSAMEFRAME_INERTIAROT // frame orientation is same as inertia orientation +} mjtSameFrame; +typedef enum mjtSleepPolicy_ { // per-tree sleep policy + mjSLEEP_AUTO = 0, // compiler chooses sleep policy + mjSLEEP_AUTO_NEVER, // compiler sleep policy: never + mjSLEEP_AUTO_ALLOWED, // compiler sleep policy: allowed + mjSLEEP_NEVER, // user sleep policy: never + mjSLEEP_ALLOWED, // user sleep policy: allowed + mjSLEEP_INIT, // user sleep policy: initialized asleep +} mjtSleepPolicy; +typedef enum mjtLRMode_ { // mode for actuator length range computation + mjLRMODE_NONE = 0, // do not process any actuators + mjLRMODE_MUSCLE, // process muscle actuators + mjLRMODE_MUSCLEUSER, // process muscle and user actuators + mjLRMODE_ALL // process all actuators +} mjtLRMode; +typedef enum mjtFlexSelf_ { // mode for flex selfcollide + mjFLEXSELF_NONE = 0, // no self-collisions + mjFLEXSELF_NARROW, // skip midphase, go directly to narrowphase + mjFLEXSELF_BVH, // use BVH in midphase (if midphase enabled) + mjFLEXSELF_SAP, // use SAP in midphase + mjFLEXSELF_AUTO // choose between BVH and SAP automatically +} mjtFlexSelf; +typedef enum mjtSDFType_ { // signed distance function (SDF) type + mjSDFTYPE_SINGLE = 0, // single SDF + mjSDFTYPE_INTERSECTION, // max(A, B) + mjSDFTYPE_MIDSURFACE, // A - B + mjSDFTYPE_COLLISION, // A + B + abs(max(A, B)) +} mjtSDFType; +typedef enum mjtState_ { // state elements + mjSTATE_TIME = 1<<0, // time + mjSTATE_QPOS = 1<<1, // position + mjSTATE_QVEL = 1<<2, // velocity + mjSTATE_ACT = 1<<3, // actuator activation + mjSTATE_HISTORY = 1<<4, // history buffers (control, sensor) + mjSTATE_WARMSTART = 1<<5, // acceleration used for warmstart + mjSTATE_CTRL = 1<<6, // control + mjSTATE_QFRC_APPLIED = 1<<7, // applied generalized force + mjSTATE_XFRC_APPLIED = 1<<8, // applied Cartesian force/torque + mjSTATE_EQ_ACTIVE = 1<<9, // enable/disable constraints + mjSTATE_MOCAP_POS = 1<<10, // positions of mocap bodies + mjSTATE_MOCAP_QUAT = 1<<11, // orientations of mocap bodies + mjSTATE_USERDATA = 1<<12, // user data + mjSTATE_PLUGIN = 1<<13, // plugin state + + mjNSTATE = 14, // number of state elements + + // convenience values for commonly used state specifications + mjSTATE_PHYSICS = mjSTATE_QPOS | mjSTATE_QVEL | mjSTATE_ACT | mjSTATE_HISTORY, + mjSTATE_FULLPHYSICS = mjSTATE_TIME | mjSTATE_PHYSICS | mjSTATE_PLUGIN, + mjSTATE_USER = mjSTATE_CTRL | mjSTATE_QFRC_APPLIED | mjSTATE_XFRC_APPLIED | + mjSTATE_EQ_ACTIVE | mjSTATE_MOCAP_POS | mjSTATE_MOCAP_QUAT | + mjSTATE_USERDATA, + mjSTATE_INTEGRATION = mjSTATE_FULLPHYSICS | mjSTATE_USER | mjSTATE_WARMSTART +} mjtState; +typedef enum mjtConstraint_ { // type of constraint + mjCNSTR_EQUALITY = 0, // equality constraint + mjCNSTR_FRICTION_DOF, // dof friction + mjCNSTR_FRICTION_TENDON, // tendon friction + mjCNSTR_LIMIT_JOINT, // joint limit + mjCNSTR_LIMIT_TENDON, // tendon limit + mjCNSTR_CONTACT_FRICTIONLESS, // frictionless contact + mjCNSTR_CONTACT_PYRAMIDAL, // frictional contact, pyramidal friction cone + mjCNSTR_CONTACT_ELLIPTIC // frictional contact, elliptic friction cone +} mjtConstraint; +typedef enum mjtConstraintState_ { // constraint state + mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact) + mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact) + mjCNSTRSTATE_LINEARNEG, // linear cost, negative side (friction) + mjCNSTRSTATE_LINEARPOS, // linear cost, positive side (friction) + mjCNSTRSTATE_CONE // squared distance to cone cost (elliptic contact) +} mjtConstraintState; +typedef enum mjtWarning_ { // warning types + mjWARN_INERTIA = 0, // (near) singular inertia matrix + mjWARN_CONTACTFULL, // too many contacts in contact list + mjWARN_CNSTRFULL, // too many constraints + mjWARN_BADQPOS, // bad number in qpos + mjWARN_BADQVEL, // bad number in qvel + mjWARN_BADQACC, // bad number in qacc + mjWARN_BADCTRL, // bad number in ctrl + + mjNWARNING // number of warnings +} mjtWarning; +typedef enum mjtTimer_ { // internal timers + // main api + mjTIMER_STEP = 0, // step + mjTIMER_FORWARD, // forward + mjTIMER_INVERSE, // inverse + + // breakdown of step/forward + mjTIMER_POSITION, // fwdPosition + mjTIMER_VELOCITY, // fwdVelocity + mjTIMER_ACTUATION, // fwdActuation + mjTIMER_CONSTRAINT, // fwdConstraint + mjTIMER_ADVANCE, // mj_Euler, mj_implicit + + // breakdown of fwdPosition + mjTIMER_POS_KINEMATICS, // kinematics, com, tendon, transmission + mjTIMER_POS_INERTIA, // inertia computations + mjTIMER_POS_COLLISION, // collision detection + mjTIMER_POS_MAKE, // make constraints + mjTIMER_POS_PROJECT, // project constraints + + // breakdown of mj_collision + mjTIMER_COL_BROAD, // broadphase + mjTIMER_COL_NARROW, // narrowphase + + mjNTIMER // number of timers +} mjtTimer; +typedef enum mjtSleepState_ { // sleep state of an object + mjS_STATIC = -1, // object is static + mjS_ASLEEP = 0, // object is asleep + mjS_AWAKE = 1 // object is awake +} mjtSleepState; typedef enum mjtButton_ { // mouse button mjBUTTON_NONE = 0, // no button mjBUTTON_LEFT, // left button diff --git a/doc/programming/index.rst b/doc/programming/index.rst index 7b34cdcc..035fdaca 100644 --- a/doc/programming/index.rst +++ b/doc/programming/index.rst @@ -165,8 +165,9 @@ links below, to make this documentation self-contained. Defines the primitive types and structures needed by the OpenGL renderer. `mjui.h `__ Defines the primitive types and structures needed by the UI framework. -`mjtnum.h `__ - Defines MuJoCo's ``mjtNum`` floating-point type to be either ``double`` or ``float``. See :ref:`mjtNum`. +`mjtype.h `__ + Defines primitive types and enums, including the ``mjtNum`` floating-point type to be either ``double`` or ``float`` + (see :ref:`mjtNum`). `mjspec.h `__ Defines enums and structs used for :doc:`procedural model editing `. `mjplugin.h `__ diff --git a/include/mujoco/mjdata.h b/include/mujoco/mjdata.h index 8a22911c..e7e56e9e 100644 --- a/include/mujoco/mjdata.h +++ b/include/mujoco/mjdata.h @@ -18,107 +18,10 @@ #include #include -#include +#include #include #include -//---------------------------------- primitive types (mjt) ----------------------------------------- - -typedef enum mjtState_ { // state elements - mjSTATE_TIME = 1<<0, // time - mjSTATE_QPOS = 1<<1, // position - mjSTATE_QVEL = 1<<2, // velocity - mjSTATE_ACT = 1<<3, // actuator activation - mjSTATE_HISTORY = 1<<4, // history buffers (control, sensor) - mjSTATE_WARMSTART = 1<<5, // acceleration used for warmstart - mjSTATE_CTRL = 1<<6, // control - mjSTATE_QFRC_APPLIED = 1<<7, // applied generalized force - mjSTATE_XFRC_APPLIED = 1<<8, // applied Cartesian force/torque - mjSTATE_EQ_ACTIVE = 1<<9, // enable/disable constraints - mjSTATE_MOCAP_POS = 1<<10, // positions of mocap bodies - mjSTATE_MOCAP_QUAT = 1<<11, // orientations of mocap bodies - mjSTATE_USERDATA = 1<<12, // user data - mjSTATE_PLUGIN = 1<<13, // plugin state - - mjNSTATE = 14, // number of state elements - - // convenience values for commonly used state specifications - mjSTATE_PHYSICS = mjSTATE_QPOS | mjSTATE_QVEL | mjSTATE_ACT | mjSTATE_HISTORY, - mjSTATE_FULLPHYSICS = mjSTATE_TIME | mjSTATE_PHYSICS | mjSTATE_PLUGIN, - mjSTATE_USER = mjSTATE_CTRL | mjSTATE_QFRC_APPLIED | mjSTATE_XFRC_APPLIED | - mjSTATE_EQ_ACTIVE | mjSTATE_MOCAP_POS | mjSTATE_MOCAP_QUAT | - mjSTATE_USERDATA, - mjSTATE_INTEGRATION = mjSTATE_FULLPHYSICS | mjSTATE_USER | mjSTATE_WARMSTART -} mjtState; - - -typedef enum mjtConstraint_ { // type of constraint - mjCNSTR_EQUALITY = 0, // equality constraint - mjCNSTR_FRICTION_DOF, // dof friction - mjCNSTR_FRICTION_TENDON, // tendon friction - mjCNSTR_LIMIT_JOINT, // joint limit - mjCNSTR_LIMIT_TENDON, // tendon limit - mjCNSTR_CONTACT_FRICTIONLESS, // frictionless contact - mjCNSTR_CONTACT_PYRAMIDAL, // frictional contact, pyramidal friction cone - mjCNSTR_CONTACT_ELLIPTIC // frictional contact, elliptic friction cone -} mjtConstraint; - - -typedef enum mjtConstraintState_ { // constraint state - mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact) - mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact) - mjCNSTRSTATE_LINEARNEG, // linear cost, negative side (friction) - mjCNSTRSTATE_LINEARPOS, // linear cost, positive side (friction) - mjCNSTRSTATE_CONE // squared distance to cone cost (elliptic contact) -} mjtConstraintState; - - -typedef enum mjtWarning_ { // warning types - mjWARN_INERTIA = 0, // (near) singular inertia matrix - mjWARN_CONTACTFULL, // too many contacts in contact list - mjWARN_CNSTRFULL, // too many constraints - mjWARN_BADQPOS, // bad number in qpos - mjWARN_BADQVEL, // bad number in qvel - mjWARN_BADQACC, // bad number in qacc - mjWARN_BADCTRL, // bad number in ctrl - - mjNWARNING // number of warnings -} mjtWarning; - - -typedef enum mjtTimer_ { // internal timers - // main api - mjTIMER_STEP = 0, // step - mjTIMER_FORWARD, // forward - mjTIMER_INVERSE, // inverse - - // breakdown of step/forward - mjTIMER_POSITION, // fwdPosition - mjTIMER_VELOCITY, // fwdVelocity - mjTIMER_ACTUATION, // fwdActuation - mjTIMER_CONSTRAINT, // fwdConstraint - mjTIMER_ADVANCE, // mj_Euler, mj_implicit - - // breakdown of fwdPosition - mjTIMER_POS_KINEMATICS, // kinematics, com, tendon, transmission - mjTIMER_POS_INERTIA, // inertia computations - mjTIMER_POS_COLLISION, // collision detection - mjTIMER_POS_MAKE, // make constraints - mjTIMER_POS_PROJECT, // project constraints - - // breakdown of mj_collision - mjTIMER_COL_BROAD, // broadphase - mjTIMER_COL_NARROW, // narrowphase - - mjNTIMER // number of timers -} mjtTimer; - - -typedef enum mjtSleepState_ { // sleep state of an object - mjS_STATIC = -1, // object is static - mjS_ASLEEP = 0, // object is asleep - mjS_AWAKE = 1 // object is awake -} mjtSleepState; //------------------------------------- Contact ---------------------------------------------------- diff --git a/include/mujoco/mjmodel.h b/include/mujoco/mjmodel.h index 6e4ddb5d..2207581a 100644 --- a/include/mujoco/mjmodel.h +++ b/include/mujoco/mjmodel.h @@ -18,8 +18,7 @@ #include #include - -#include +#include // global constants #define mjPI 3.14159265358979323846 @@ -48,434 +47,6 @@ #define mjNISLAND 20 // number of mjData.solver arrays -//---------------------------------- enum types (mjt) ---------------------------------------------- - -typedef enum mjtDisableBit_ { // disable default feature bitflags - mjDSBL_CONSTRAINT = 1<<0, // entire constraint solver - mjDSBL_EQUALITY = 1<<1, // equality constraints - mjDSBL_FRICTIONLOSS = 1<<2, // joint and tendon frictionloss constraints - mjDSBL_LIMIT = 1<<3, // joint and tendon limit constraints - mjDSBL_CONTACT = 1<<4, // contact constraints - mjDSBL_SPRING = 1<<5, // passive spring forces - mjDSBL_DAMPER = 1<<6, // passive damping forces - mjDSBL_GRAVITY = 1<<7, // gravitational forces - mjDSBL_CLAMPCTRL = 1<<8, // clamp control to specified range - mjDSBL_WARMSTART = 1<<9, // warmstart constraint solver - mjDSBL_FILTERPARENT = 1<<10, // remove collisions with parent body - mjDSBL_ACTUATION = 1<<11, // apply actuation forces - mjDSBL_REFSAFE = 1<<12, // integrator safety: make ref[0]>=2*timestep - mjDSBL_SENSOR = 1<<13, // sensors - mjDSBL_MIDPHASE = 1<<14, // mid-phase collision filtering - mjDSBL_EULERDAMP = 1<<15, // implicit integration of joint damping in Euler integrator - mjDSBL_AUTORESET = 1<<16, // automatic reset when numerical issues are detected - mjDSBL_NATIVECCD = 1<<17, // native convex collision detection - mjDSBL_ISLAND = 1<<18, // constraint island discovery - mjDSBL_MULTICCD = 1<<19, // multiple CCD contact points - - mjNDISABLE = 20 // number of disable flags -} mjtDisableBit; - - -typedef enum mjtEnableBit_ { // enable optional feature bitflags - mjENBL_OVERRIDE = 1<<0, // override contact parameters - mjENBL_ENERGY = 1<<1, // energy computation - mjENBL_FWDINV = 1<<2, // record solver statistics - mjENBL_INVDISCRETE = 1<<3, // discrete-time inverse dynamics - mjENBL_SLEEP = 1<<4, // sleeping - mjENBL_DIAGEXACT = 1<<5, // exact diagonal of constraint inertia - - mjNENABLE = 6 // number of enable flags -} mjtEnableBit; - - -typedef enum mjtJoint_ { // type of degree of freedom - mjJNT_FREE = 0, // global position and orientation (quat) (7) - mjJNT_BALL, // orientation (quat) relative to parent (4) - mjJNT_SLIDE, // sliding distance along body-fixed axis (1) - mjJNT_HINGE // rotation angle (rad) around body-fixed axis (1) -} mjtJoint; - - -typedef enum mjtGeom_ { // type of geometric shape - // regular geom types - mjGEOM_PLANE = 0, // plane - mjGEOM_HFIELD, // height field - mjGEOM_SPHERE, // sphere - mjGEOM_CAPSULE, // capsule - mjGEOM_ELLIPSOID, // ellipsoid - mjGEOM_CYLINDER, // cylinder - mjGEOM_BOX, // box - mjGEOM_MESH, // mesh - mjGEOM_SDF, // signed distance field - - mjNGEOMTYPES, // number of regular geom types - - // rendering-only geom types: not used in mjModel, not counted in mjNGEOMTYPES - mjGEOM_ARROW = 100, // arrow - mjGEOM_ARROW1, // arrow without wedges - mjGEOM_ARROW2, // arrow in both directions - mjGEOM_LINE, // line - mjGEOM_LINEBOX, // box with line edges - mjGEOM_FLEX, // flex - mjGEOM_SKIN, // skin - mjGEOM_LABEL, // text label - mjGEOM_TRIANGLE, // triangle - - mjGEOM_NONE = 1001 // missing geom type -} mjtGeom; - - -typedef enum mjtProjection_ { // type of camera projection - mjPROJ_PERSPECTIVE = 0, // perspective - mjPROJ_ORTHOGRAPHIC // orthographic -} mjtProjection; - - -typedef enum mjtCamLight_ { // tracking mode for camera and light - mjCAMLIGHT_FIXED = 0, // pos and rot fixed in body - mjCAMLIGHT_TRACK, // pos tracks body, rot fixed in global - mjCAMLIGHT_TRACKCOM, // pos tracks subtree com, rot fixed in body - mjCAMLIGHT_TARGETBODY, // pos fixed in body, rot tracks target body - mjCAMLIGHT_TARGETBODYCOM // pos fixed in body, rot tracks target subtree com -} mjtCamLight; - - -typedef enum mjtLightType_ { // type of light - mjLIGHT_SPOT = 0, // spot - mjLIGHT_DIRECTIONAL, // directional - mjLIGHT_POINT, // point - mjLIGHT_IMAGE, // image-based -} mjtLightType; - - -typedef enum mjtTexture_ { // type of texture - mjTEXTURE_2D = 0, // 2d texture, suitable for planes and hfields - mjTEXTURE_CUBE, // cube texture, suitable for all other geom types - mjTEXTURE_SKYBOX // cube texture used as skybox -} mjtTexture; - - -typedef enum mjtTextureRole_ { // role of texture map in rendering - mjTEXROLE_USER = 0, // unspecified - mjTEXROLE_RGB, // base color (albedo) - mjTEXROLE_OCCLUSION, // ambient occlusion - mjTEXROLE_ROUGHNESS, // roughness - mjTEXROLE_METALLIC, // metallic - mjTEXROLE_NORMAL, // normal (bump) map - mjTEXROLE_OPACITY, // opacity - mjTEXROLE_EMISSIVE, // light emission - mjTEXROLE_RGBA, // base color, opacity - mjTEXROLE_ORM, // occlusion, roughness, metallic - mjNTEXROLE -} mjtTextureRole; - - -typedef enum mjtColorSpace_ { // type of color space encoding - mjCOLORSPACE_AUTO = 0, // attempts to autodetect color space, defaults to linear - mjCOLORSPACE_LINEAR, // linear color space - mjCOLORSPACE_SRGB // standard RGB color space -} mjtColorSpace; - - -typedef enum mjtIntegrator_ { // integrator mode - mjINT_EULER = 0, // semi-implicit Euler - mjINT_RK4, // 4th-order Runge Kutta - mjINT_IMPLICIT, // implicit in velocity - mjINT_IMPLICITFAST // implicit in velocity, no rne derivative -} mjtIntegrator; - - -typedef enum mjtCone_ { // type of friction cone - mjCONE_PYRAMIDAL = 0, // pyramidal - mjCONE_ELLIPTIC // elliptic -} mjtCone; - - -typedef enum mjtJacobian_ { // type of constraint Jacobian - mjJAC_DENSE = 0, // dense - mjJAC_SPARSE, // sparse - mjJAC_AUTO // dense if nv<60, sparse otherwise -} mjtJacobian; - - -typedef enum mjtSolver_ { // constraint solver algorithm - mjSOL_PGS = 0, // PGS (dual) - mjSOL_CG, // CG (primal) - mjSOL_NEWTON // Newton (primal) -} mjtSolver; - - -typedef enum mjtEq_ { // type of equality constraint - mjEQ_CONNECT = 0, // connect two bodies at a point (ball joint) - mjEQ_WELD, // fix relative position and orientation of two bodies - mjEQ_JOINT, // couple the values of two scalar joints with cubic - mjEQ_TENDON, // couple the lengths of two tendons with cubic - mjEQ_FLEX, // fix all edge lengths of a flex - mjEQ_FLEXVERT, // fix all vertex lengths of a flex - mjEQ_FLEXSTRAIN, // constrain strain of a trilinear/quadratic flex (B-bar) - mjEQ_DISTANCE // unsupported, will cause an error if used -} mjtEq; - - -typedef enum mjtWrap_ { // type of tendon wrap object - mjWRAP_NONE = 0, // null object - mjWRAP_JOINT, // constant moment arm - mjWRAP_PULLEY, // pulley used to split tendon - mjWRAP_SITE, // pass through site - mjWRAP_SPHERE, // wrap around sphere - mjWRAP_CYLINDER // wrap around (infinite) cylinder -} mjtWrap; - - -typedef enum mjtTrn_ { // type of actuator transmission - mjTRN_JOINT = 0, // force on joint - mjTRN_JOINTINPARENT, // force on joint, expressed in parent frame - mjTRN_SLIDERCRANK, // force via slider-crank linkage - mjTRN_TENDON, // force on tendon - mjTRN_SITE, // force on site - mjTRN_BODY, // adhesion force on a body's geoms - - mjTRN_UNDEFINED = 1000 // undefined transmission type -} mjtTrn; - - -typedef enum mjtDyn_ { // type of actuator dynamics - mjDYN_NONE = 0, // no internal dynamics; ctrl specifies force - mjDYN_INTEGRATOR, // integrator: da/dt = u - mjDYN_FILTER, // linear filter: da/dt = (u-a) / tau - mjDYN_FILTEREXACT, // linear filter: da/dt = (u-a) / tau, with exact integration - mjDYN_MUSCLE, // piecewise linear filter with two time constants - mjDYN_DCMOTOR, // DC motor electrical dynamics - mjDYN_USER // user-defined dynamics type -} mjtDyn; - - -typedef enum mjtGain_ { // type of actuator gain - mjGAIN_FIXED = 0, // fixed gain - mjGAIN_AFFINE, // const + kp*length + kv*velocity - mjGAIN_MUSCLE, // muscle FLV curve computed by mju_muscleGain() - mjGAIN_DCMOTOR, // DC motor gain: K or K/R - mjGAIN_USER // user-defined gain type -} mjtGain; - - -typedef enum mjtBias_ { // type of actuator bias - mjBIAS_NONE = 0, // no bias - mjBIAS_AFFINE, // const + kp*length + kv*velocity - mjBIAS_MUSCLE, // muscle passive force computed by mju_muscleBias() - mjBIAS_DCMOTOR, // DC motor bias: back-EMF, cogging, LuGre friction - mjBIAS_USER // user-defined bias type -} mjtBias; - - -typedef enum mjtObj_ { // type of MujoCo object - mjOBJ_UNKNOWN = 0, // unknown object type - mjOBJ_BODY, // body - mjOBJ_XBODY, // body, used to access regular frame instead of i-frame - mjOBJ_JOINT, // joint - mjOBJ_DOF, // dof - mjOBJ_GEOM, // geom - mjOBJ_SITE, // site - mjOBJ_CAMERA, // camera - mjOBJ_LIGHT, // light - mjOBJ_FLEX, // flex - mjOBJ_MESH, // mesh - mjOBJ_SKIN, // skin - mjOBJ_HFIELD, // heightfield - mjOBJ_TEXTURE, // texture - mjOBJ_MATERIAL, // material for rendering - mjOBJ_PAIR, // geom pair to include - mjOBJ_EXCLUDE, // body pair to exclude - mjOBJ_EQUALITY, // equality constraint - mjOBJ_TENDON, // tendon - mjOBJ_ACTUATOR, // actuator - mjOBJ_SENSOR, // sensor - mjOBJ_NUMERIC, // numeric - mjOBJ_TEXT, // text - mjOBJ_TUPLE, // tuple - mjOBJ_KEY, // keyframe - mjOBJ_PLUGIN, // plugin instance - - mjNOBJECT, // number of object types - - // meta elements, do not appear in mjModel - mjOBJ_FRAME = 100, // frame - mjOBJ_DEFAULT, // default - mjOBJ_MODEL // entire model -} mjtObj; - - -typedef enum mjtSensor_ { // type of sensor - // common robotic sensors, attached to a site - mjSENS_TOUCH = 0, // scalar contact normal forces summed over sensor zone - mjSENS_ACCELEROMETER, // 3D linear acceleration, in local frame - mjSENS_VELOCIMETER, // 3D linear velocity, in local frame - mjSENS_GYRO, // 3D angular velocity, in local frame - mjSENS_FORCE, // 3D force between site's body and its parent body - mjSENS_TORQUE, // 3D torque between site's body and its parent body - mjSENS_MAGNETOMETER, // 3D magnetometer - mjSENS_RANGEFINDER, // scalar distance to nearest geom along z-axis - mjSENS_CAMPROJECTION, // pixel coordinates of a site in the camera image - - // sensors related to scalar joints, tendons, actuators - mjSENS_JOINTPOS, // scalar joint position (hinge and slide only) - mjSENS_JOINTVEL, // scalar joint velocity (hinge and slide only) - mjSENS_TENDONPOS, // scalar tendon position - mjSENS_TENDONVEL, // scalar tendon velocity - mjSENS_ACTUATORPOS, // scalar actuator position - mjSENS_ACTUATORVEL, // scalar actuator velocity - mjSENS_ACTUATORFRC, // scalar actuator force - mjSENS_JOINTACTFRC, // scalar actuator force, measured at the joint - mjSENS_TENDONACTFRC, // scalar actuator force, measured at the tendon - - // sensors related to ball joints - mjSENS_BALLQUAT, // 4D ball joint quaternion - mjSENS_BALLANGVEL, // 3D ball joint angular velocity - - // joint and tendon limit sensors, in constraint space - mjSENS_JOINTLIMITPOS, // joint limit distance-margin - mjSENS_JOINTLIMITVEL, // joint limit velocity - mjSENS_JOINTLIMITFRC, // joint limit force - mjSENS_TENDONLIMITPOS, // tendon limit distance-margin - mjSENS_TENDONLIMITVEL, // tendon limit velocity - mjSENS_TENDONLIMITFRC, // tendon limit force - - // sensors attached to an object with spatial frame: (x)body, geom, site, camera - mjSENS_FRAMEPOS, // 3D position - mjSENS_FRAMEQUAT, // 4D unit quaternion orientation - mjSENS_FRAMEXAXIS, // 3D unit vector: x-axis of object's frame - mjSENS_FRAMEYAXIS, // 3D unit vector: y-axis of object's frame - mjSENS_FRAMEZAXIS, // 3D unit vector: z-axis of object's frame - mjSENS_FRAMELINVEL, // 3D linear velocity - mjSENS_FRAMEANGVEL, // 3D angular velocity - mjSENS_FRAMELINACC, // 3D linear acceleration - mjSENS_FRAMEANGACC, // 3D angular acceleration - - // sensors related to kinematic subtrees; attached to a body (which is the subtree root) - mjSENS_SUBTREECOM, // 3D center of mass of subtree - mjSENS_SUBTREELINVEL, // 3D linear velocity of subtree - mjSENS_SUBTREEANGMOM, // 3D angular momentum of subtree - - // sensors of geometric relationships - mjSENS_INSIDESITE, // 1 if object is inside a site, 0 otherwise - mjSENS_GEOMDIST, // signed distance between two geoms - mjSENS_GEOMNORMAL, // normal direction between two geoms - mjSENS_GEOMFROMTO, // segment between two geoms - - // sensors for reporting contacts which occurred during the simulation - mjSENS_CONTACT, // contacts which occurred during the simulation - - // global sensors - mjSENS_E_POTENTIAL, // potential energy - mjSENS_E_KINETIC, // kinetic energy - mjSENS_CLOCK, // simulation time - - // sensors related to SDFs - mjSENS_TACTILE, // tactile sensor - - // plugin-controlled sensors - mjSENS_PLUGIN, // plugin-controlled - - // user-defined sensor - mjSENS_USER // sensor data provided by mjcb_sensor callback -} mjtSensor; - - -typedef enum mjtStage_ { // computation stage - mjSTAGE_NONE = 0, // no computations - mjSTAGE_POS, // position-dependent computations - mjSTAGE_VEL, // velocity-dependent computations - mjSTAGE_ACC // acceleration/force-dependent computations -} mjtStage; - - -typedef enum mjtDataType_ { // data type for sensors - mjDATATYPE_REAL = 0, // real values, no constraints - mjDATATYPE_POSITIVE, // positive values; 0 or negative: inactive - mjDATATYPE_AXIS, // 3D unit vector - mjDATATYPE_QUATERNION // unit quaternion -} mjtDataType; - - -typedef enum mjtConDataField_ { // data fields returned by contact sensors - mjCONDATA_FOUND = 0, // whether a contact was found - mjCONDATA_FORCE, // contact force - mjCONDATA_TORQUE, // contact torque - mjCONDATA_DIST, // contact penetration distance - mjCONDATA_POS, // contact position - mjCONDATA_NORMAL, // contact frame normal - mjCONDATA_TANGENT, // contact frame first tangent - - mjNCONDATA // number of contact sensor data fields -} mjtConDataField; - - -typedef enum mjtRayDataField_ { // data fields returned by rangefinder sensors - mjRAYDATA_DIST = 0, // distance from ray origin to nearest surface - mjRAYDATA_DIR, // normalized ray direction - mjRAYDATA_ORIGIN, // ray origin - mjRAYDATA_POINT, // point at which ray intersects nearest surface - mjRAYDATA_NORMAL, // surface normal at intersection point - mjRAYDATA_DEPTH, // depth along z-axis - - mjNRAYDATA // number of rangefinder sensor data fields -} mjtRayDataField; - - -typedef enum mjtCamOutBit_ { // camera output type bitflags - mjCAMOUT_RGB = 1<<0, // RGB image - mjCAMOUT_DEPTH = 1<<1, // depth image (distance from camera plane) - mjCAMOUT_DIST = 1<<2, // distance image (distance from camera origin) - mjCAMOUT_NORMAL = 1<<3, // normal image - mjCAMOUT_SEG = 1<<4, // segmentation image - - mjNCAMOUT = 5 // number of camera output types -} mjtCamOutBit; - - -typedef enum mjtSameFrame_ { // frame alignment of bodies with their children - mjSAMEFRAME_NONE = 0, // no alignment - mjSAMEFRAME_BODY, // frame is same as body frame - mjSAMEFRAME_INERTIA, // frame is same as inertial frame - mjSAMEFRAME_BODYROT, // frame orientation is same as body orientation - mjSAMEFRAME_INERTIAROT // frame orientation is same as inertia orientation -} mjtSameFrame; - - -typedef enum mjtSleepPolicy_ { // per-tree sleep policy - mjSLEEP_AUTO = 0, // compiler chooses sleep policy - mjSLEEP_AUTO_NEVER, // compiler sleep policy: never - mjSLEEP_AUTO_ALLOWED, // compiler sleep policy: allowed - mjSLEEP_NEVER, // user sleep policy: never - mjSLEEP_ALLOWED, // user sleep policy: allowed - mjSLEEP_INIT, // user sleep policy: initialized asleep -} mjtSleepPolicy; - - -typedef enum mjtLRMode_ { // mode for actuator length range computation - mjLRMODE_NONE = 0, // do not process any actuators - mjLRMODE_MUSCLE, // process muscle actuators - mjLRMODE_MUSCLEUSER, // process muscle and user actuators - mjLRMODE_ALL // process all actuators -} mjtLRMode; - - -typedef enum mjtFlexSelf_ { // mode for flex selfcollide - mjFLEXSELF_NONE = 0, // no self-collisions - mjFLEXSELF_NARROW, // skip midphase, go directly to narrowphase - mjFLEXSELF_BVH, // use BVH in midphase (if midphase enabled) - mjFLEXSELF_SAP, // use SAP in midphase - mjFLEXSELF_AUTO // choose between BVH and SAP automatically -} mjtFlexSelf; - - -typedef enum mjtSDFType_ { // signed distance function (SDF) type - mjSDFTYPE_SINGLE = 0, // single SDF - mjSDFTYPE_INTERSECTION, // max(A, B) - mjSDFTYPE_MIDSURFACE, // A - B - mjSDFTYPE_COLLISION, // A + B + abs(max(A, B)) -} mjtSDFType; - //---------------------------------- mjLROpt ------------------------------------------------------- diff --git a/include/mujoco/mjplugin.h b/include/mujoco/mjplugin.h index 174a1f63..a0ee0076 100644 --- a/include/mujoco/mjplugin.h +++ b/include/mujoco/mjplugin.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include diff --git a/include/mujoco/mjspec.h b/include/mujoco/mjspec.h index ab1b2447..ad33cca3 100644 --- a/include/mujoco/mjspec.h +++ b/include/mujoco/mjspec.h @@ -17,7 +17,7 @@ #include #include -#include +#include // this is a C-API diff --git a/include/mujoco/mjtnum.h b/include/mujoco/mjtnum.h deleted file mode 100644 index 845ce73b..00000000 --- a/include/mujoco/mjtnum.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2021 DeepMind Technologies Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef MUJOCO_INCLUDE_MJTNUM_H_ -#define MUJOCO_INCLUDE_MJTNUM_H_ - -#include - - -//---------------------------------- floating-point definition ------------------------------------- - -// floating point data type and minval -#ifndef mjUSESINGLE - typedef double mjtNum; - #define mjMINVAL 1E-15 // minimum value in any denominator -#else - typedef float mjtNum; - #define mjMINVAL 1E-15f -#endif - - - -//---------------------------------- byte definition ----------------------------------------------- - -typedef unsigned char mjtByte; // used for true/false - - - -//---------------------------------- size definition ----------------------------------------------- - -typedef int64_t mjtSize; // used for buffer sizes - - - -#endif // MUJOCO_INCLUDE_MJTNUM_H_ diff --git a/include/mujoco/mjtype.h b/include/mujoco/mjtype.h new file mode 100644 index 00000000..62426a11 --- /dev/null +++ b/include/mujoco/mjtype.h @@ -0,0 +1,574 @@ +// Copyright 2021 DeepMind Technologies Limited +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef MUJOCO_INCLUDE_MJTYPE_H_ +#define MUJOCO_INCLUDE_MJTYPE_H_ + +#include + + +//---------------------------------- floating-point definition ------------------------------------- + +// floating point data type and minval +#ifndef mjUSESINGLE + typedef double mjtNum; + #define mjMINVAL 1E-15 // minimum value in any denominator +#else + typedef float mjtNum; + #define mjMINVAL 1E-15f +#endif + + + +//---------------------------------- byte definition ----------------------------------------------- + +typedef unsigned char mjtByte; // used for true/false + + + +//---------------------------------- size definition ----------------------------------------------- + +typedef int64_t mjtSize; // used for buffer sizes + + + +//---------------------------------- enum types (mjModel) ------------------------------------------ + +typedef enum mjtDisableBit_ { // disable default feature bitflags + mjDSBL_CONSTRAINT = 1<<0, // entire constraint solver + mjDSBL_EQUALITY = 1<<1, // equality constraints + mjDSBL_FRICTIONLOSS = 1<<2, // joint and tendon frictionloss constraints + mjDSBL_LIMIT = 1<<3, // joint and tendon limit constraints + mjDSBL_CONTACT = 1<<4, // contact constraints + mjDSBL_SPRING = 1<<5, // passive spring forces + mjDSBL_DAMPER = 1<<6, // passive damping forces + mjDSBL_GRAVITY = 1<<7, // gravitational forces + mjDSBL_CLAMPCTRL = 1<<8, // clamp control to specified range + mjDSBL_WARMSTART = 1<<9, // warmstart constraint solver + mjDSBL_FILTERPARENT = 1<<10, // remove collisions with parent body + mjDSBL_ACTUATION = 1<<11, // apply actuation forces + mjDSBL_REFSAFE = 1<<12, // integrator safety: make ref[0]>=2*timestep + mjDSBL_SENSOR = 1<<13, // sensors + mjDSBL_MIDPHASE = 1<<14, // mid-phase collision filtering + mjDSBL_EULERDAMP = 1<<15, // implicit integration of joint damping in Euler integrator + mjDSBL_AUTORESET = 1<<16, // automatic reset when numerical issues are detected + mjDSBL_NATIVECCD = 1<<17, // native convex collision detection + mjDSBL_ISLAND = 1<<18, // constraint island discovery + mjDSBL_MULTICCD = 1<<19, // multiple CCD contact points + + mjNDISABLE = 20 // number of disable flags +} mjtDisableBit; + + +typedef enum mjtEnableBit_ { // enable optional feature bitflags + mjENBL_OVERRIDE = 1<<0, // override contact parameters + mjENBL_ENERGY = 1<<1, // energy computation + mjENBL_FWDINV = 1<<2, // record solver statistics + mjENBL_INVDISCRETE = 1<<3, // discrete-time inverse dynamics + mjENBL_SLEEP = 1<<4, // sleeping + mjENBL_DIAGEXACT = 1<<5, // exact diagonal of constraint inertia + + mjNENABLE = 6 // number of enable flags +} mjtEnableBit; + + +typedef enum mjtJoint_ { // type of degree of freedom + mjJNT_FREE = 0, // global position and orientation (quat) (7) + mjJNT_BALL, // orientation (quat) relative to parent (4) + mjJNT_SLIDE, // sliding distance along body-fixed axis (1) + mjJNT_HINGE // rotation angle (rad) around body-fixed axis (1) +} mjtJoint; + + +typedef enum mjtGeom_ { // type of geometric shape + // regular geom types + mjGEOM_PLANE = 0, // plane + mjGEOM_HFIELD, // height field + mjGEOM_SPHERE, // sphere + mjGEOM_CAPSULE, // capsule + mjGEOM_ELLIPSOID, // ellipsoid + mjGEOM_CYLINDER, // cylinder + mjGEOM_BOX, // box + mjGEOM_MESH, // mesh + mjGEOM_SDF, // signed distance field + + mjNGEOMTYPES, // number of regular geom types + + // rendering-only geom types: not used in mjModel, not counted in mjNGEOMTYPES + mjGEOM_ARROW = 100, // arrow + mjGEOM_ARROW1, // arrow without wedges + mjGEOM_ARROW2, // arrow in both directions + mjGEOM_LINE, // line + mjGEOM_LINEBOX, // box with line edges + mjGEOM_FLEX, // flex + mjGEOM_SKIN, // skin + mjGEOM_LABEL, // text label + mjGEOM_TRIANGLE, // triangle + + mjGEOM_NONE = 1001 // missing geom type +} mjtGeom; + + +typedef enum mjtProjection_ { // type of camera projection + mjPROJ_PERSPECTIVE = 0, // perspective + mjPROJ_ORTHOGRAPHIC // orthographic +} mjtProjection; + + +typedef enum mjtCamLight_ { // tracking mode for camera and light + mjCAMLIGHT_FIXED = 0, // pos and rot fixed in body + mjCAMLIGHT_TRACK, // pos tracks body, rot fixed in global + mjCAMLIGHT_TRACKCOM, // pos tracks subtree com, rot fixed in body + mjCAMLIGHT_TARGETBODY, // pos fixed in body, rot tracks target body + mjCAMLIGHT_TARGETBODYCOM // pos fixed in body, rot tracks target subtree com +} mjtCamLight; + + +typedef enum mjtLightType_ { // type of light + mjLIGHT_SPOT = 0, // spot + mjLIGHT_DIRECTIONAL, // directional + mjLIGHT_POINT, // point + mjLIGHT_IMAGE, // image-based +} mjtLightType; + + +typedef enum mjtTexture_ { // type of texture + mjTEXTURE_2D = 0, // 2d texture, suitable for planes and hfields + mjTEXTURE_CUBE, // cube texture, suitable for all other geom types + mjTEXTURE_SKYBOX // cube texture used as skybox +} mjtTexture; + + +typedef enum mjtTextureRole_ { // role of texture map in rendering + mjTEXROLE_USER = 0, // unspecified + mjTEXROLE_RGB, // base color (albedo) + mjTEXROLE_OCCLUSION, // ambient occlusion + mjTEXROLE_ROUGHNESS, // roughness + mjTEXROLE_METALLIC, // metallic + mjTEXROLE_NORMAL, // normal (bump) map + mjTEXROLE_OPACITY, // opacity + mjTEXROLE_EMISSIVE, // light emission + mjTEXROLE_RGBA, // base color, opacity + mjTEXROLE_ORM, // occlusion, roughness, metallic + mjNTEXROLE +} mjtTextureRole; + + +typedef enum mjtColorSpace_ { // type of color space encoding + mjCOLORSPACE_AUTO = 0, // attempts to autodetect color space, defaults to linear + mjCOLORSPACE_LINEAR, // linear color space + mjCOLORSPACE_SRGB // standard RGB color space +} mjtColorSpace; + + +typedef enum mjtIntegrator_ { // integrator mode + mjINT_EULER = 0, // semi-implicit Euler + mjINT_RK4, // 4th-order Runge Kutta + mjINT_IMPLICIT, // implicit in velocity + mjINT_IMPLICITFAST // implicit in velocity, no rne derivative +} mjtIntegrator; + + +typedef enum mjtCone_ { // type of friction cone + mjCONE_PYRAMIDAL = 0, // pyramidal + mjCONE_ELLIPTIC // elliptic +} mjtCone; + + +typedef enum mjtJacobian_ { // type of constraint Jacobian + mjJAC_DENSE = 0, // dense + mjJAC_SPARSE, // sparse + mjJAC_AUTO // dense if nv<60, sparse otherwise +} mjtJacobian; + + +typedef enum mjtSolver_ { // constraint solver algorithm + mjSOL_PGS = 0, // PGS (dual) + mjSOL_CG, // CG (primal) + mjSOL_NEWTON // Newton (primal) +} mjtSolver; + + +typedef enum mjtEq_ { // type of equality constraint + mjEQ_CONNECT = 0, // connect two bodies at a point (ball joint) + mjEQ_WELD, // fix relative position and orientation of two bodies + mjEQ_JOINT, // couple the values of two scalar joints with cubic + mjEQ_TENDON, // couple the lengths of two tendons with cubic + mjEQ_FLEX, // fix all edge lengths of a flex + mjEQ_FLEXVERT, // fix all vertex lengths of a flex + mjEQ_FLEXSTRAIN, // constrain strain of a trilinear/quadratic flex (B-bar) + mjEQ_DISTANCE // unsupported, will cause an error if used +} mjtEq; + + +typedef enum mjtWrap_ { // type of tendon wrap object + mjWRAP_NONE = 0, // null object + mjWRAP_JOINT, // constant moment arm + mjWRAP_PULLEY, // pulley used to split tendon + mjWRAP_SITE, // pass through site + mjWRAP_SPHERE, // wrap around sphere + mjWRAP_CYLINDER // wrap around (infinite) cylinder +} mjtWrap; + + +typedef enum mjtTrn_ { // type of actuator transmission + mjTRN_JOINT = 0, // force on joint + mjTRN_JOINTINPARENT, // force on joint, expressed in parent frame + mjTRN_SLIDERCRANK, // force via slider-crank linkage + mjTRN_TENDON, // force on tendon + mjTRN_SITE, // force on site + mjTRN_BODY, // adhesion force on a body's geoms + + mjTRN_UNDEFINED = 1000 // undefined transmission type +} mjtTrn; + + +typedef enum mjtDyn_ { // type of actuator dynamics + mjDYN_NONE = 0, // no internal dynamics; ctrl specifies force + mjDYN_INTEGRATOR, // integrator: da/dt = u + mjDYN_FILTER, // linear filter: da/dt = (u-a) / tau + mjDYN_FILTEREXACT, // linear filter: da/dt = (u-a) / tau, with exact integration + mjDYN_MUSCLE, // piecewise linear filter with two time constants + mjDYN_DCMOTOR, // DC motor electrical dynamics + mjDYN_USER // user-defined dynamics type +} mjtDyn; + + +typedef enum mjtGain_ { // type of actuator gain + mjGAIN_FIXED = 0, // fixed gain + mjGAIN_AFFINE, // const + kp*length + kv*velocity + mjGAIN_MUSCLE, // muscle FLV curve computed by mju_muscleGain() + mjGAIN_DCMOTOR, // DC motor gain: K or K/R + mjGAIN_USER // user-defined gain type +} mjtGain; + + +typedef enum mjtBias_ { // type of actuator bias + mjBIAS_NONE = 0, // no bias + mjBIAS_AFFINE, // const + kp*length + kv*velocity + mjBIAS_MUSCLE, // muscle passive force computed by mju_muscleBias() + mjBIAS_DCMOTOR, // DC motor bias: back-EMF, cogging, LuGre friction + mjBIAS_USER // user-defined bias type +} mjtBias; + + +typedef enum mjtObj_ { // type of MujoCo object + mjOBJ_UNKNOWN = 0, // unknown object type + mjOBJ_BODY, // body + mjOBJ_XBODY, // body, used to access regular frame instead of i-frame + mjOBJ_JOINT, // joint + mjOBJ_DOF, // dof + mjOBJ_GEOM, // geom + mjOBJ_SITE, // site + mjOBJ_CAMERA, // camera + mjOBJ_LIGHT, // light + mjOBJ_FLEX, // flex + mjOBJ_MESH, // mesh + mjOBJ_SKIN, // skin + mjOBJ_HFIELD, // heightfield + mjOBJ_TEXTURE, // texture + mjOBJ_MATERIAL, // material for rendering + mjOBJ_PAIR, // geom pair to include + mjOBJ_EXCLUDE, // body pair to exclude + mjOBJ_EQUALITY, // equality constraint + mjOBJ_TENDON, // tendon + mjOBJ_ACTUATOR, // actuator + mjOBJ_SENSOR, // sensor + mjOBJ_NUMERIC, // numeric + mjOBJ_TEXT, // text + mjOBJ_TUPLE, // tuple + mjOBJ_KEY, // keyframe + mjOBJ_PLUGIN, // plugin instance + + mjNOBJECT, // number of object types + + // meta elements, do not appear in mjModel + mjOBJ_FRAME = 100, // frame + mjOBJ_DEFAULT, // default + mjOBJ_MODEL // entire model +} mjtObj; + + +typedef enum mjtSensor_ { // type of sensor + // common robotic sensors, attached to a site + mjSENS_TOUCH = 0, // scalar contact normal forces summed over sensor zone + mjSENS_ACCELEROMETER, // 3D linear acceleration, in local frame + mjSENS_VELOCIMETER, // 3D linear velocity, in local frame + mjSENS_GYRO, // 3D angular velocity, in local frame + mjSENS_FORCE, // 3D force between site's body and its parent body + mjSENS_TORQUE, // 3D torque between site's body and its parent body + mjSENS_MAGNETOMETER, // 3D magnetometer + mjSENS_RANGEFINDER, // scalar distance to nearest geom along z-axis + mjSENS_CAMPROJECTION, // pixel coordinates of a site in the camera image + + // sensors related to scalar joints, tendons, actuators + mjSENS_JOINTPOS, // scalar joint position (hinge and slide only) + mjSENS_JOINTVEL, // scalar joint velocity (hinge and slide only) + mjSENS_TENDONPOS, // scalar tendon position + mjSENS_TENDONVEL, // scalar tendon velocity + mjSENS_ACTUATORPOS, // scalar actuator position + mjSENS_ACTUATORVEL, // scalar actuator velocity + mjSENS_ACTUATORFRC, // scalar actuator force + mjSENS_JOINTACTFRC, // scalar actuator force, measured at the joint + mjSENS_TENDONACTFRC, // scalar actuator force, measured at the tendon + + // sensors related to ball joints + mjSENS_BALLQUAT, // 4D ball joint quaternion + mjSENS_BALLANGVEL, // 3D ball joint angular velocity + + // joint and tendon limit sensors, in constraint space + mjSENS_JOINTLIMITPOS, // joint limit distance-margin + mjSENS_JOINTLIMITVEL, // joint limit velocity + mjSENS_JOINTLIMITFRC, // joint limit force + mjSENS_TENDONLIMITPOS, // tendon limit distance-margin + mjSENS_TENDONLIMITVEL, // tendon limit velocity + mjSENS_TENDONLIMITFRC, // tendon limit force + + // sensors attached to an object with spatial frame: (x)body, geom, site, camera + mjSENS_FRAMEPOS, // 3D position + mjSENS_FRAMEQUAT, // 4D unit quaternion orientation + mjSENS_FRAMEXAXIS, // 3D unit vector: x-axis of object's frame + mjSENS_FRAMEYAXIS, // 3D unit vector: y-axis of object's frame + mjSENS_FRAMEZAXIS, // 3D unit vector: z-axis of object's frame + mjSENS_FRAMELINVEL, // 3D linear velocity + mjSENS_FRAMEANGVEL, // 3D angular velocity + mjSENS_FRAMELINACC, // 3D linear acceleration + mjSENS_FRAMEANGACC, // 3D angular acceleration + + // sensors related to kinematic subtrees; attached to a body (which is the subtree root) + mjSENS_SUBTREECOM, // 3D center of mass of subtree + mjSENS_SUBTREELINVEL, // 3D linear velocity of subtree + mjSENS_SUBTREEANGMOM, // 3D angular momentum of subtree + + // sensors of geometric relationships + mjSENS_INSIDESITE, // 1 if object is inside a site, 0 otherwise + mjSENS_GEOMDIST, // signed distance between two geoms + mjSENS_GEOMNORMAL, // normal direction between two geoms + mjSENS_GEOMFROMTO, // segment between two geoms + + // sensors for reporting contacts which occurred during the simulation + mjSENS_CONTACT, // contacts which occurred during the simulation + + // global sensors + mjSENS_E_POTENTIAL, // potential energy + mjSENS_E_KINETIC, // kinetic energy + mjSENS_CLOCK, // simulation time + + // sensors related to SDFs + mjSENS_TACTILE, // tactile sensor + + // plugin-controlled sensors + mjSENS_PLUGIN, // plugin-controlled + + // user-defined sensor + mjSENS_USER // sensor data provided by mjcb_sensor callback +} mjtSensor; + + +typedef enum mjtStage_ { // computation stage + mjSTAGE_NONE = 0, // no computations + mjSTAGE_POS, // position-dependent computations + mjSTAGE_VEL, // velocity-dependent computations + mjSTAGE_ACC // acceleration/force-dependent computations +} mjtStage; + + +typedef enum mjtDataType_ { // data type for sensors + mjDATATYPE_REAL = 0, // real values, no constraints + mjDATATYPE_POSITIVE, // positive values; 0 or negative: inactive + mjDATATYPE_AXIS, // 3D unit vector + mjDATATYPE_QUATERNION // unit quaternion +} mjtDataType; + + +typedef enum mjtConDataField_ { // data fields returned by contact sensors + mjCONDATA_FOUND = 0, // whether a contact was found + mjCONDATA_FORCE, // contact force + mjCONDATA_TORQUE, // contact torque + mjCONDATA_DIST, // contact penetration distance + mjCONDATA_POS, // contact position + mjCONDATA_NORMAL, // contact frame normal + mjCONDATA_TANGENT, // contact frame first tangent + + mjNCONDATA // number of contact sensor data fields +} mjtConDataField; + + +typedef enum mjtRayDataField_ { // data fields returned by rangefinder sensors + mjRAYDATA_DIST = 0, // distance from ray origin to nearest surface + mjRAYDATA_DIR, // normalized ray direction + mjRAYDATA_ORIGIN, // ray origin + mjRAYDATA_POINT, // point at which ray intersects nearest surface + mjRAYDATA_NORMAL, // surface normal at intersection point + mjRAYDATA_DEPTH, // depth along z-axis + + mjNRAYDATA // number of rangefinder sensor data fields +} mjtRayDataField; + + +typedef enum mjtCamOutBit_ { // camera output type bitflags + mjCAMOUT_RGB = 1<<0, // RGB image + mjCAMOUT_DEPTH = 1<<1, // depth image (distance from camera plane) + mjCAMOUT_DIST = 1<<2, // distance image (distance from camera origin) + mjCAMOUT_NORMAL = 1<<3, // normal image + mjCAMOUT_SEG = 1<<4, // segmentation image + + mjNCAMOUT = 5 // number of camera output types +} mjtCamOutBit; + + +typedef enum mjtSameFrame_ { // frame alignment of bodies with their children + mjSAMEFRAME_NONE = 0, // no alignment + mjSAMEFRAME_BODY, // frame is same as body frame + mjSAMEFRAME_INERTIA, // frame is same as inertial frame + mjSAMEFRAME_BODYROT, // frame orientation is same as body orientation + mjSAMEFRAME_INERTIAROT // frame orientation is same as inertia orientation +} mjtSameFrame; + + +typedef enum mjtSleepPolicy_ { // per-tree sleep policy + mjSLEEP_AUTO = 0, // compiler chooses sleep policy + mjSLEEP_AUTO_NEVER, // compiler sleep policy: never + mjSLEEP_AUTO_ALLOWED, // compiler sleep policy: allowed + mjSLEEP_NEVER, // user sleep policy: never + mjSLEEP_ALLOWED, // user sleep policy: allowed + mjSLEEP_INIT, // user sleep policy: initialized asleep +} mjtSleepPolicy; + + +typedef enum mjtLRMode_ { // mode for actuator length range computation + mjLRMODE_NONE = 0, // do not process any actuators + mjLRMODE_MUSCLE, // process muscle actuators + mjLRMODE_MUSCLEUSER, // process muscle and user actuators + mjLRMODE_ALL // process all actuators +} mjtLRMode; + + +typedef enum mjtFlexSelf_ { // mode for flex selfcollide + mjFLEXSELF_NONE = 0, // no self-collisions + mjFLEXSELF_NARROW, // skip midphase, go directly to narrowphase + mjFLEXSELF_BVH, // use BVH in midphase (if midphase enabled) + mjFLEXSELF_SAP, // use SAP in midphase + mjFLEXSELF_AUTO // choose between BVH and SAP automatically +} mjtFlexSelf; + + +typedef enum mjtSDFType_ { // signed distance function (SDF) type + mjSDFTYPE_SINGLE = 0, // single SDF + mjSDFTYPE_INTERSECTION, // max(A, B) + mjSDFTYPE_MIDSURFACE, // A - B + mjSDFTYPE_COLLISION, // A + B + abs(max(A, B)) +} mjtSDFType; + + + +//---------------------------------- enum types (mjData) ------------------------------------------- + +typedef enum mjtState_ { // state elements + mjSTATE_TIME = 1<<0, // time + mjSTATE_QPOS = 1<<1, // position + mjSTATE_QVEL = 1<<2, // velocity + mjSTATE_ACT = 1<<3, // actuator activation + mjSTATE_HISTORY = 1<<4, // history buffers (control, sensor) + mjSTATE_WARMSTART = 1<<5, // acceleration used for warmstart + mjSTATE_CTRL = 1<<6, // control + mjSTATE_QFRC_APPLIED = 1<<7, // applied generalized force + mjSTATE_XFRC_APPLIED = 1<<8, // applied Cartesian force/torque + mjSTATE_EQ_ACTIVE = 1<<9, // enable/disable constraints + mjSTATE_MOCAP_POS = 1<<10, // positions of mocap bodies + mjSTATE_MOCAP_QUAT = 1<<11, // orientations of mocap bodies + mjSTATE_USERDATA = 1<<12, // user data + mjSTATE_PLUGIN = 1<<13, // plugin state + + mjNSTATE = 14, // number of state elements + + // convenience values for commonly used state specifications + mjSTATE_PHYSICS = mjSTATE_QPOS | mjSTATE_QVEL | mjSTATE_ACT | mjSTATE_HISTORY, + mjSTATE_FULLPHYSICS = mjSTATE_TIME | mjSTATE_PHYSICS | mjSTATE_PLUGIN, + mjSTATE_USER = mjSTATE_CTRL | mjSTATE_QFRC_APPLIED | mjSTATE_XFRC_APPLIED | + mjSTATE_EQ_ACTIVE | mjSTATE_MOCAP_POS | mjSTATE_MOCAP_QUAT | + mjSTATE_USERDATA, + mjSTATE_INTEGRATION = mjSTATE_FULLPHYSICS | mjSTATE_USER | mjSTATE_WARMSTART +} mjtState; + + +typedef enum mjtConstraint_ { // type of constraint + mjCNSTR_EQUALITY = 0, // equality constraint + mjCNSTR_FRICTION_DOF, // dof friction + mjCNSTR_FRICTION_TENDON, // tendon friction + mjCNSTR_LIMIT_JOINT, // joint limit + mjCNSTR_LIMIT_TENDON, // tendon limit + mjCNSTR_CONTACT_FRICTIONLESS, // frictionless contact + mjCNSTR_CONTACT_PYRAMIDAL, // frictional contact, pyramidal friction cone + mjCNSTR_CONTACT_ELLIPTIC // frictional contact, elliptic friction cone +} mjtConstraint; + + +typedef enum mjtConstraintState_ { // constraint state + mjCNSTRSTATE_SATISFIED = 0, // constraint satisfied, zero cost (limit, contact) + mjCNSTRSTATE_QUADRATIC, // quadratic cost (equality, friction, limit, contact) + mjCNSTRSTATE_LINEARNEG, // linear cost, negative side (friction) + mjCNSTRSTATE_LINEARPOS, // linear cost, positive side (friction) + mjCNSTRSTATE_CONE // squared distance to cone cost (elliptic contact) +} mjtConstraintState; + + +typedef enum mjtWarning_ { // warning types + mjWARN_INERTIA = 0, // (near) singular inertia matrix + mjWARN_CONTACTFULL, // too many contacts in contact list + mjWARN_CNSTRFULL, // too many constraints + mjWARN_BADQPOS, // bad number in qpos + mjWARN_BADQVEL, // bad number in qvel + mjWARN_BADQACC, // bad number in qacc + mjWARN_BADCTRL, // bad number in ctrl + + mjNWARNING // number of warnings +} mjtWarning; + + +typedef enum mjtTimer_ { // internal timers + // main api + mjTIMER_STEP = 0, // step + mjTIMER_FORWARD, // forward + mjTIMER_INVERSE, // inverse + + // breakdown of step/forward + mjTIMER_POSITION, // fwdPosition + mjTIMER_VELOCITY, // fwdVelocity + mjTIMER_ACTUATION, // fwdActuation + mjTIMER_CONSTRAINT, // fwdConstraint + mjTIMER_ADVANCE, // mj_Euler, mj_implicit + + // breakdown of fwdPosition + mjTIMER_POS_KINEMATICS, // kinematics, com, tendon, transmission + mjTIMER_POS_INERTIA, // inertia computations + mjTIMER_POS_COLLISION, // collision detection + mjTIMER_POS_MAKE, // make constraints + mjTIMER_POS_PROJECT, // project constraints + + // breakdown of mj_collision + mjTIMER_COL_BROAD, // broadphase + mjTIMER_COL_NARROW, // narrowphase + + mjNTIMER // number of timers +} mjtTimer; + + +typedef enum mjtSleepState_ { // sleep state of an object + mjS_STATIC = -1, // object is static + mjS_ASLEEP = 0, // object is asleep + mjS_AWAKE = 1 // object is awake +} mjtSleepState; + +#endif // MUJOCO_INCLUDE_MJTYPE_H_ diff --git a/include/mujoco/mjvisualize.h b/include/mujoco/mjvisualize.h index 68e22d21..2379f82b 100644 --- a/include/mujoco/mjvisualize.h +++ b/include/mujoco/mjvisualize.h @@ -17,7 +17,7 @@ #include #include -#include +#include #define mjNGROUP 6 // number of geom, site, joint, skin groups with visflags diff --git a/include/mujoco/mujoco.h b/include/mujoco/mujoco.h index ab41686d..213afeb3 100644 --- a/include/mujoco/mujoco.h +++ b/include/mujoco/mujoco.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include diff --git a/plugin/actuator/pid.h b/plugin/actuator/pid.h index 984bf47c..0b1e831d 100644 --- a/plugin/actuator/pid.h +++ b/plugin/actuator/pid.h @@ -21,7 +21,7 @@ #include #include -#include +#include namespace mujoco::plugin::actuator { diff --git a/plugin/elasticity/cable.cc b/plugin/elasticity/cable.cc index d9746439..5fe190d3 100644 --- a/plugin/elasticity/cable.cc +++ b/plugin/elasticity/cable.cc @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include "cable.h" diff --git a/plugin/elasticity/cable.h b/plugin/elasticity/cable.h index bf2bf75d..e73d6c97 100644 --- a/plugin/elasticity/cable.h +++ b/plugin/elasticity/cable.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include diff --git a/plugin/sdf/bolt.cc b/plugin/sdf/bolt.cc index 4f052c06..c38cffe1 100644 --- a/plugin/sdf/bolt.cc +++ b/plugin/sdf/bolt.cc @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include "sdf.h" #include "bolt.h" diff --git a/plugin/sdf/bolt.h b/plugin/sdf/bolt.h index af04ba9a..71517b94 100644 --- a/plugin/sdf/bolt.h +++ b/plugin/sdf/bolt.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include "sdf.h" diff --git a/plugin/sdf/bowl.cc b/plugin/sdf/bowl.cc index 2ebbc5ac..73fb8205 100644 --- a/plugin/sdf/bowl.cc +++ b/plugin/sdf/bowl.cc @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include "sdf.h" #include "bowl.h" diff --git a/plugin/sdf/bowl.h b/plugin/sdf/bowl.h index 471f685c..98eacece 100644 --- a/plugin/sdf/bowl.h +++ b/plugin/sdf/bowl.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include "sdf.h" diff --git a/plugin/sdf/gear.cc b/plugin/sdf/gear.cc index 54288c21..ce3755fb 100644 --- a/plugin/sdf/gear.cc +++ b/plugin/sdf/gear.cc @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include "sdf.h" diff --git a/plugin/sdf/gear.h b/plugin/sdf/gear.h index f1f63a75..be0e6f89 100644 --- a/plugin/sdf/gear.h +++ b/plugin/sdf/gear.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include "sdf.h" diff --git a/plugin/sdf/nut.cc b/plugin/sdf/nut.cc index 117df406..38888fbf 100644 --- a/plugin/sdf/nut.cc +++ b/plugin/sdf/nut.cc @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include "sdf.h" #include "nut.h" diff --git a/plugin/sdf/nut.h b/plugin/sdf/nut.h index 9d7377f1..933fc931 100644 --- a/plugin/sdf/nut.h +++ b/plugin/sdf/nut.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include "sdf.h" diff --git a/plugin/sdf/torus.cc b/plugin/sdf/torus.cc index d48feb51..23f13ddd 100644 --- a/plugin/sdf/torus.cc +++ b/plugin/sdf/torus.cc @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include "sdf.h" #include "torus.h" diff --git a/plugin/sdf/torus.h b/plugin/sdf/torus.h index 8966d984..866160a0 100644 --- a/plugin/sdf/torus.h +++ b/plugin/sdf/torus.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include "sdf.h" namespace mujoco::plugin::sdf { diff --git a/plugin/sensor/touch_grid.cc b/plugin/sensor/touch_grid.cc index 98ba90f5..044bccdd 100644 --- a/plugin/sensor/touch_grid.cc +++ b/plugin/sensor/touch_grid.cc @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include diff --git a/plugin/sensor/touch_grid.h b/plugin/sensor/touch_grid.h index 34ad43ee..c0029065 100644 --- a/plugin/sensor/touch_grid.h +++ b/plugin/sensor/touch_grid.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include namespace mujoco::plugin::sensor { diff --git a/python/mujoco/constants.cc b/python/mujoco/constants.cc index 49c3ee58..593070d2 100644 --- a/python/mujoco/constants.cc +++ b/python/mujoco/constants.cc @@ -83,7 +83,7 @@ PYBIND11_MODULE(_constants, pymodule) { // from mujoco.h X(mjVERSION_HEADER); - // from mjtnum.h + // from mjtype.h X(mjMINVAL); #undef X diff --git a/python/mujoco/introspect/enums.py b/python/mujoco/introspect/enums.py index 7de73447..2247a805 100644 --- a/python/mujoco/introspect/enums.py +++ b/python/mujoco/introspect/enums.py @@ -508,16 +508,6 @@ ENUMS: Mapping[str, EnumDecl] = dict([ ('mjSDFTYPE_COLLISION', 3), ]), )), - ('mjtTaskStatus', - EnumDecl( - name='mjtTaskStatus', - declname='enum mjtTaskStatus_', - values=dict([ - ('mjTASK_NEW', 0), - ('mjTASK_QUEUED', 1), - ('mjTASK_COMPLETED', 2), - ]), - )), ('mjtState', EnumDecl( name='mjtState', @@ -619,6 +609,16 @@ ENUMS: Mapping[str, EnumDecl] = dict([ ('mjS_AWAKE', 1), ]), )), + ('mjtTaskStatus', + EnumDecl( + name='mjtTaskStatus', + declname='enum mjtTaskStatus_', + values=dict([ + ('mjTASK_NEW', 0), + ('mjTASK_QUEUED', 1), + ('mjTASK_COMPLETED', 2), + ]), + )), ('mjtGeomInertia', EnumDecl( name='mjtGeomInertia', diff --git a/python/mujoco/serialization.h b/python/mujoco/serialization.h index d38abefd..cb234ac8 100644 --- a/python/mujoco/serialization.h +++ b/python/mujoco/serialization.h @@ -18,7 +18,7 @@ #include #include -#include +#include namespace mujoco::python::_impl { diff --git a/src/engine/engine_collision_convex.h b/src/engine/engine_collision_convex.h index eae1e72d..969151cc 100644 --- a/src/engine/engine_collision_convex.h +++ b/src/engine/engine_collision_convex.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include // minimum number of vertices to use hill-climbing in mesh support #define mjMESH_HILLCLIMB_MIN 10 diff --git a/src/engine/engine_collision_driver.h b/src/engine/engine_collision_driver.h index 0e2b9edd..4734975e 100644 --- a/src/engine/engine_collision_driver.h +++ b/src/engine/engine_collision_driver.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/engine/engine_collision_gjk.c b/src/engine/engine_collision_gjk.c index 4b84695c..42227694 100644 --- a/src/engine/engine_collision_gjk.c +++ b/src/engine/engine_collision_gjk.c @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include "engine/engine_collision_convex.h" #include "engine/engine_util_blas.h" diff --git a/src/engine/engine_collision_gjk.h b/src/engine/engine_collision_gjk.h index 35cbf475..1464d80e 100644 --- a/src/engine/engine_collision_gjk.h +++ b/src/engine/engine_collision_gjk.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include "engine/engine_collision_convex.h" diff --git a/src/engine/engine_collision_primitive.h b/src/engine/engine_collision_primitive.h index b598c0e4..e2df2966 100644 --- a/src/engine/engine_collision_primitive.h +++ b/src/engine/engine_collision_primitive.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/engine/engine_collision_sdf.c b/src/engine/engine_collision_sdf.c index c5d093c0..490523f7 100644 --- a/src/engine/engine_collision_sdf.c +++ b/src/engine/engine_collision_sdf.c @@ -20,7 +20,7 @@ #include #include #include // IWYU pragma: keep -#include +#include #include "engine/engine_plugin.h" #include "engine/engine_util_blas.h" #include "engine/engine_util_errmem.h" diff --git a/src/engine/engine_collision_sdf.h b/src/engine/engine_collision_sdf.h index 64f9b298..79e3d722 100644 --- a/src/engine/engine_collision_sdf.h +++ b/src/engine/engine_collision_sdf.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/engine/engine_core_constraint.h b/src/engine/engine_core_constraint.h index 15c03b6b..9d3f9eb0 100644 --- a/src/engine/engine_core_constraint.h +++ b/src/engine/engine_core_constraint.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/engine/engine_core_smooth.h b/src/engine/engine_core_smooth.h index 258b625f..0ea923d5 100644 --- a/src/engine/engine_core_smooth.h +++ b/src/engine/engine_core_smooth.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/engine/engine_core_util.h b/src/engine/engine_core_util.h index 36ec5fd0..9f958937 100644 --- a/src/engine/engine_core_util.h +++ b/src/engine/engine_core_util.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/engine/engine_forward.h b/src/engine/engine_forward.h index 0a3fd5e0..f0ba9e40 100644 --- a/src/engine/engine_forward.h +++ b/src/engine/engine_forward.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/engine/engine_init.c b/src/engine/engine_init.c index 15fe707d..2d6855f6 100644 --- a/src/engine/engine_init.c +++ b/src/engine/engine_init.c @@ -17,7 +17,7 @@ #include #include -#include +#include #include "engine/engine_util_blas.h" #ifdef _MSC_VER diff --git a/src/engine/engine_inline.h b/src/engine/engine_inline.h index dbe4b8f3..9532271b 100644 --- a/src/engine/engine_inline.h +++ b/src/engine/engine_inline.h @@ -15,7 +15,7 @@ #ifndef MUJOCO_SRC_ENGINE_ENGINE_INLINE_H_ #define MUJOCO_SRC_ENGINE_ENGINE_INLINE_H_ -#include +#include #include #ifdef __cplusplus diff --git a/src/engine/engine_memory.h b/src/engine/engine_memory.h index 11459a79..bbfd836b 100644 --- a/src/engine/engine_memory.h +++ b/src/engine/engine_memory.h @@ -17,8 +17,8 @@ #include #include -#include #include // IWYU pragma: keep +#include #include #ifdef __cplusplus diff --git a/src/engine/engine_print.c b/src/engine/engine_print.c index 921c028a..54caa9b8 100644 --- a/src/engine/engine_print.c +++ b/src/engine/engine_print.c @@ -24,7 +24,7 @@ #include #include #include // IWYU pragma: keep -#include +#include #include #include "engine/engine_core_constraint.h" #include "engine/engine_core_util.h" diff --git a/src/engine/engine_support.h b/src/engine/engine_support.h index 7e1fd911..cf112cb0 100644 --- a/src/engine/engine_support.h +++ b/src/engine/engine_support.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/engine/engine_util_blas.c b/src/engine/engine_util_blas.c index 8d4e7c3e..e829fea0 100644 --- a/src/engine/engine_util_blas.c +++ b/src/engine/engine_util_blas.c @@ -16,7 +16,7 @@ #include -#include +#include #include "engine/engine_util_blas_avx.h" // IWYU pragma: keep diff --git a/src/engine/engine_util_blas.h b/src/engine/engine_util_blas.h index 4741385f..c5f83ac3 100644 --- a/src/engine/engine_util_blas.h +++ b/src/engine/engine_util_blas.h @@ -18,7 +18,7 @@ #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/engine/engine_util_blas_avx.h b/src/engine/engine_util_blas_avx.h index ff2af6c7..f86e34cc 100644 --- a/src/engine/engine_util_blas_avx.h +++ b/src/engine/engine_util_blas_avx.h @@ -22,7 +22,7 @@ #include -#include +#include // res = vec*scl static inline diff --git a/src/engine/engine_util_misc.h b/src/engine/engine_util_misc.h index ebf2ced7..f97bf4bb 100644 --- a/src/engine/engine_util_misc.h +++ b/src/engine/engine_util_misc.h @@ -17,7 +17,7 @@ #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/engine/engine_util_solve.h b/src/engine/engine_util_solve.h index 8cdb8ea9..1f0ef8c4 100644 --- a/src/engine/engine_util_solve.h +++ b/src/engine/engine_util_solve.h @@ -17,7 +17,7 @@ #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/engine/engine_util_sparse.c b/src/engine/engine_util_sparse.c index 0c79a27f..bd3cbc3b 100644 --- a/src/engine/engine_util_sparse.c +++ b/src/engine/engine_util_sparse.c @@ -17,7 +17,7 @@ #include #include #include // IWYU pragma: keep -#include +#include #include "engine/engine_memory.h" #include "engine/engine_util_blas.h" #include "engine/engine_util_misc.h" diff --git a/src/engine/engine_util_sparse.h b/src/engine/engine_util_sparse.h index 038ac5ce..ba5fc5ab 100644 --- a/src/engine/engine_util_sparse.h +++ b/src/engine/engine_util_sparse.h @@ -19,7 +19,7 @@ #include #include -#include +#include #include "engine/engine_util_sparse_avx.h" #ifdef __cplusplus diff --git a/src/engine/engine_util_sparse_avx.h b/src/engine/engine_util_sparse_avx.h index 32be6020..e9edfeff 100644 --- a/src/engine/engine_util_sparse_avx.h +++ b/src/engine/engine_util_sparse_avx.h @@ -23,7 +23,7 @@ #include #include -#include +#include //------------------------------ sparse operations using avx --------------------------------------- diff --git a/src/engine/engine_util_spatial.h b/src/engine/engine_util_spatial.h index 6a53ddfd..8b73de09 100644 --- a/src/engine/engine_util_spatial.h +++ b/src/engine/engine_util_spatial.h @@ -16,7 +16,7 @@ #define MUJOCO_SRC_ENGINE_ENGINE_UTIL_SPATIAL_H_ #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/src/user/user_api.h b/src/user/user_api.h index f1f216a7..cf1e26a6 100644 --- a/src/user/user_api.h +++ b/src/user/user_api.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include // this is a C-API diff --git a/src/user/user_composite.cc b/src/user/user_composite.cc index b62d7c24..d1bebf58 100644 --- a/src/user/user_composite.cc +++ b/src/user/user_composite.cc @@ -21,7 +21,7 @@ #include #include -#include +#include #include "cc/array_safety.h" #include "engine/engine_util_blas.h" #include "engine/engine_util_errmem.h" diff --git a/src/user/user_flexcomp.cc b/src/user/user_flexcomp.cc index 7030768c..f85aa413 100644 --- a/src/user/user_flexcomp.cc +++ b/src/user/user_flexcomp.cc @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include "cc/array_safety.h" #include "engine/engine_crossplatform.h" diff --git a/src/user/user_mesh.cc b/src/user/user_mesh.cc index fa08d766..17c4c9b6 100644 --- a/src/user/user_mesh.cc +++ b/src/user/user_mesh.cc @@ -57,7 +57,7 @@ #include #include #include -#include +#include #include "engine/engine_crossplatform.h" // IWYU pragma: keep #include "engine/engine_plugin.h" #include "engine/engine_util_errmem.h" diff --git a/src/user/user_model.cc b/src/user/user_model.cc index c9e38131..02b2b2b9 100644 --- a/src/user/user_model.cc +++ b/src/user/user_model.cc @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include "cc/array_safety.h" #include "engine/engine_core_util.h" diff --git a/src/user/user_model.h b/src/user/user_model.h index 6d554649..3af7167e 100644 --- a/src/user/user_model.h +++ b/src/user/user_model.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include "user/user_objects.h" typedef std::map > mjKeyMap; diff --git a/src/user/user_objects.h b/src/user/user_objects.h index cbe85e6b..ed93cf48 100644 --- a/src/user/user_objects.h +++ b/src/user/user_objects.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include "user/user_cache.h" #include "user/user_util.h" diff --git a/src/xml/xml_native_reader.cc b/src/xml/xml_native_reader.cc index 9b7ee999..7bb36644 100644 --- a/src/xml/xml_native_reader.cc +++ b/src/xml/xml_native_reader.cc @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include "engine/engine_plugin.h" #include "engine/engine_support.h" diff --git a/test/engine/engine_collision_gjk_test.cc b/test/engine/engine_collision_gjk_test.cc index 82ac3095..21fec2cf 100644 --- a/test/engine/engine_collision_gjk_test.cc +++ b/test/engine/engine_collision_gjk_test.cc @@ -24,7 +24,7 @@ #include "src/engine/engine_collision_convex.h" #include -#include +#include #include "test/fixture.h" #include #include diff --git a/test/engine/engine_collision_sdf_test.cc b/test/engine/engine_collision_sdf_test.cc index bcc0d1c3..1d4cf1ce 100644 --- a/test/engine/engine_collision_sdf_test.cc +++ b/test/engine/engine_collision_sdf_test.cc @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include "src/engine/engine_collision_sdf.h" #include "test/fixture.h" diff --git a/test/engine/engine_forward_test.cc b/test/engine/engine_forward_test.cc index bfcba7b6..401358c1 100644 --- a/test/engine/engine_forward_test.cc +++ b/test/engine/engine_forward_test.cc @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include "src/cc/array_safety.h" diff --git a/test/engine/engine_ray_test.cc b/test/engine/engine_ray_test.cc index 7c78c909..0078c7db 100644 --- a/test/engine/engine_ray_test.cc +++ b/test/engine/engine_ray_test.cc @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include "src/engine/engine_ray.h" #include "test/fixture.h" diff --git a/test/engine/engine_sensor_test.cc b/test/engine/engine_sensor_test.cc index 1474c856..a12fdec0 100644 --- a/test/engine/engine_sensor_test.cc +++ b/test/engine/engine_sensor_test.cc @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include "src/engine/engine_support.h" #include "src/engine/engine_util_blas.h" diff --git a/test/engine/engine_util_blas_test.cc b/test/engine/engine_util_blas_test.cc index 2ef25e73..595112ee 100644 --- a/test/engine/engine_util_blas_test.cc +++ b/test/engine/engine_util_blas_test.cc @@ -20,7 +20,7 @@ #include #include -#include +#include #include "test/fixture.h" namespace mujoco { diff --git a/test/engine/engine_util_spatial_test.cc b/test/engine/engine_util_spatial_test.cc index c0b7f4c6..5eda98d1 100644 --- a/test/engine/engine_util_spatial_test.cc +++ b/test/engine/engine_util_spatial_test.cc @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include "src/engine/engine_util_blas.h" #include "src/engine/engine_util_spatial.h" diff --git a/test/header_test.cc b/test/header_test.cc index 98cae8ca..98014a5f 100644 --- a/test/header_test.cc +++ b/test/header_test.cc @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/test/user/user_mesh_test.cc b/test/user/user_mesh_test.cc index 185b2678..9ea3a39a 100644 --- a/test/user/user_mesh_test.cc +++ b/test/user/user_mesh_test.cc @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include "src/cc/array_safety.h" #include "test/fixture.h" diff --git a/test/user/user_objects_test.cc b/test/user/user_objects_test.cc index d71ba4cb..8d9f5839 100644 --- a/test/user/user_objects_test.cc +++ b/test/user/user_objects_test.cc @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include "test/fixture.h" diff --git a/test/xml/xml_native_writer_test.cc b/test/xml/xml_native_writer_test.cc index 9a70372f..afa8215b 100644 --- a/test/xml/xml_native_writer_test.cc +++ b/test/xml/xml_native_writer_test.cc @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include "src/xml/xml_numeric_format.h" #include "test/fixture.h" diff --git a/unity/Runtime/Bindings/MjBindings.cs b/unity/Runtime/Bindings/MjBindings.cs index e66b47a3..999c50ef 100644 --- a/unity/Runtime/Bindings/MjBindings.cs +++ b/unity/Runtime/Bindings/MjBindings.cs @@ -64,7 +64,7 @@ public const bool ADDRESS_SANITIZER = true; public const bool THIRD_PARTY_MUJOCO_INCLUDE_MJSPEC_H_ = true; public const bool THIRD_PARTY_MUJOCO_INCLUDE_MJTHREAD_H_ = true; public const int mjMAXTHREAD = 128; -public const bool THIRD_PARTY_MUJOCO_INCLUDE_MJTNUM_H_ = true; +public const bool THIRD_PARTY_MUJOCO_INCLUDE_MJTYPE_H_ = true; public const double mjMINVAL = 1e-15; public const bool THIRD_PARTY_MUJOCO_MJUI_H_ = true; public const int mjMAXUISECT = 10; @@ -443,11 +443,6 @@ public enum mjtSDFType : int{ mjSDFTYPE_MIDSURFACE = 2, mjSDFTYPE_COLLISION = 3, } -public enum mjtTaskStatus : int{ - mjTASK_NEW = 0, - mjTASK_QUEUED = 1, - mjTASK_COMPLETED = 2, -} public enum mjtState : int{ mjSTATE_TIME = 1, mjSTATE_QPOS = 2, @@ -519,6 +514,11 @@ public enum mjtSleepState : int{ mjS_ASLEEP = 0, mjS_AWAKE = 1, } +public enum mjtTaskStatus : int{ + mjTASK_NEW = 0, + mjTASK_QUEUED = 1, + mjTASK_COMPLETED = 2, +} public enum mjtGeomInertia : int{ mjINERTIA_VOLUME = 0, mjINERTIA_SHELL = 1,