============= API Reference ============= Introduction ------------ This chapter is the reference manual for MuJoCo. It is generated from the header files included with MuJoCo, but also contains additional text not available in the headers. .. _Type: Type definitions ---------------- .. _tyPrimitive: Primitive types ^^^^^^^^^^^^^^^ MuJoCo defines a large number of primitive types described here. Except for :ref:`mjtNum` and :ref:`mjtByte`, all other primitive types are C enums used to define various integer constants. Note that the rest of the API does not use these enum types directly. Instead it uses ints, and only the documentation/comments state that certain ints correspond to certain enum types. This is because we want the API to be compiler-independent, and the C standard does not dictate how many bytes must be used to represent an enum type. Nevertheless we recommend using these types when calling the API functions (and letting the compiler do the enum-to-int type cast). .. _mjtNum: mjtNum ~~~~~~ .. code-block:: C #ifdef mjUSEDOUBLE typedef double mjtNum; #else typedef float mjtNum; #endif | Defined in `mjtnum.h `_ | This is the floating-point type used throughout the simulator. If the symbol ``mjUSEDOUBLE`` is defined in ``mjmodel.h``, this type is defined as ``double``, otherwise it is defined as ``float``. Currently only the double-precision version of MuJoCo is distributed, although the entire code base works with single-precision as well. We may release the single-precision version in the future for efficiency reasons, but the double-precision version will always be available. Thus it is safe to write user code assuming double precision. 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 ``mjUSEDOUBLE`` in ``mjtnum.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. .. _mjtByte: mjtByte ~~~~~~~ .. code-block:: C typedef unsigned char mjtByte; | Defined in `mjmodel.h `_ | Byte type used to represent boolean variables. .. _mjtDisableBit: mjtDisableBit ~~~~~~~~~~~~~ .. code-block:: C typedef enum _mjtDisableBit { 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_PASSIVE = 1<<5, // passive forces mjDSBL_GRAVITY = 1<<6, // gravitational forces mjDSBL_CLAMPCTRL = 1<<7, // clamp control to specified range mjDSBL_WARMSTART = 1<<8, // warmstart constraint solver mjDSBL_FILTERPARENT = 1<<9, // remove collisions with parent body mjDSBL_ACTUATION = 1<<10, // apply actuation forces mjDSBL_REFSAFE = 1<<11, // integrator safety: make ref[0]>=2*timestep mjNDISABLE = 12 // number of disable flags } mjtDisableBit; | Defined in `mjmodel.h `_ | Constants which are powers of 2. They are used as bitmasks for the field ``disableflags`` of :ref:`mjOption`. At runtime this field is ``m->opt.disableflags``. The number of these constants is given by ``mjNDISABLE`` which is also the length of the global string array :ref:`mjDISABLESTRING` with text descriptions of these flags. .. _mjtEnableBit: mjtEnableBit ~~~~~~~~~~~~ .. code-block:: C typedef enum _mjtEnableBit { mjENBL_OVERRIDE = 1<<0, // override contact parameters mjENBL_ENERGY = 1<<1, // energy computation mjENBL_FWDINV = 1<<2, // compare forward and inverse dynamics mjENBL_SENSORNOISE = 1<<3, // add noise to sensor data // experimental features: mjENBL_MULTICCD = 1<<30, // multi-point convex collision detection mjNENABLE = 5 // number of enable flags } mjtEnableBit; | Defined in `mjmodel.h `_ | Constants which are powers of 2. They are used as bitmasks for the field ``enableflags`` of :ref:`mjOption`. At runtime this field is ``m->opt.enableflags``. The number of these constants is given by ``mjNENABLE`` which is also the length of the global string array :ref:`mjENABLESTRING` with text descriptions of these flags. .. _mjtJoint: mjtJoint ~~~~~~~~ .. code-block:: C typedef enum _mjtJoint { 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; | Defined in `mjmodel.h `_ | Primitive joint types. These values are used in ``m->jnt_type``. The numbers in the comments indicate how many positional coordinates each joint type has. Note that ball joints and rotational components of free joints are represented as unit quaternions - which have 4 positional coordinates but 3 degrees of freedom each. .. _mjtGeom: mjtGeom ~~~~~~~ .. code-block:: C typedef enum _mjtGeom { // 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 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_SKIN, // skin mjGEOM_LABEL, // text label mjGEOM_NONE = 1001 // missing geom type } mjtGeom; | Defined in `mjmodel.h `_ | Geometric types supported by MuJoCo. The first group are "official" geom types that can be used in the model. The second group are geom types that cannot be used in the model but are used by the visualizer to add decorative elements. These values are used in ``m->geom_type`` and ``m->site_type``. .. _mjtCamLight: mjtCamLight ~~~~~~~~~~~ .. code-block:: C typedef enum _mjtCamLight { 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; | Defined in `mjmodel.h `_ | Dynamic modes for cameras and lights, specifying how the camera/light position and orientation are computed. These values are used in ``m->cam_mode`` and ``m->light_mode``. .. _mjtTexture: mjtTexture ~~~~~~~~~~ .. code-block:: C typedef enum _mjtTexture { 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; | Defined in `mjmodel.h `_ | Texture types, specifying how the texture will be mapped. These values are used in ``m->tex_type``. .. _mjtIntegrator: mjtIntegrator ~~~~~~~~~~~~~ .. code-block:: C typedef enum _mjtIntegrator // integrator mode { mjINT_EULER = 0, // semi-implicit Euler mjINT_RK4 // 4th-order Runge Kutta } mjtIntegrator; | Defined in `mjmodel.h `_ | Numerical integrator types. These values are used in ``m->opt.integrator``. .. _mjtCollision: mjtCollision ~~~~~~~~~~~~ .. code-block:: C typedef enum _mjtCollision // collision mode for selecting geom pairs { mjCOL_ALL = 0, // test precomputed and dynamic pairs mjCOL_PAIR, // test predefined pairs only mjCOL_DYNAMIC // test dynamic pairs only } mjtCollision; | Defined in `mjmodel.h `_ | Collision modes specifying how candidate geom pairs are generated for near-phase collision checking. These values are used in ``m->opt.collision``. .. _mjtCone: mjtCone ~~~~~~~ .. code-block:: C typedef enum _mjtCone // type of friction cone { mjCONE_PYRAMIDAL = 0, // pyramidal mjCONE_ELLIPTIC // elliptic } mjtCone; | Defined in `mjmodel.h `_ | Available friction cone types. These values are used in ``m->opt.cone``. .. _mjtJacobian: mjtJacobian ~~~~~~~~~~~ .. code-block:: C typedef enum _mjtJacobian // type of constraint Jacobian { mjJAC_DENSE = 0, // dense mjJAC_SPARSE, // sparse mjJAC_AUTO // dense if nv<=60, sparse otherwise } mjtJacobian; | Defined in `mjmodel.h `_ | Available Jacobian types. These values are used in ``m->opt.jacobian``. .. _mjtSolver: mjtSolver ~~~~~~~~~ .. code-block:: C typedef enum _mjtSolver // constraint solver algorithm { mjSOL_PGS = 0, // PGS (dual) mjSOL_CG, // CG (primal) mjSOL_NEWTON // Newton (primal) } mjtSolver; | Defined in `mjmodel.h `_ | Available constraint solver algorithms. These values are used in ``m->opt.solver``. .. _mjtEq: mjtEq ~~~~~ .. code-block:: C typedef enum _mjtEq { 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_DISTANCE // fix the contact distance betweent two geoms } mjtEq; | Defined in `mjmodel.h `_ | Equality constraint types. These values are used in ``m->eq_type``. .. _mjtWrap: mjtWrap ~~~~~~~ .. code-block:: C typedef enum _mjtWrap { 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; | Defined in `mjmodel.h `_ | Tendon wrapping object types. These values are used in ``m->wrap_type``. .. _mjtTrn: mjtTrn ~~~~~~ .. code-block:: C typedef enum _mjtTrn { 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_UNDEFINED = 1000 // undefined transmission type } mjtTrn; | Defined in `mjmodel.h `_ | Actuator transmission types. These values are used in ``m->actuator_trntype``. .. _mjtDyn: mjtDyn ~~~~~~ .. code-block:: C typedef enum _mjtDyn { 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_MUSCLE, // piece-wise linear filter with two time constants mjDYN_USER // user-defined dynamics type } mjtDyn; | Defined in `mjmodel.h `_ | Actuator dynamics types. These values are used in ``m->actuator_dyntype``. .. _mjtGain: mjtGain ~~~~~~~ .. code-block:: C typedef enum _mjtGain { mjGAIN_FIXED = 0, // fixed gain mjGAIN_AFFINE, // const + kp*length + kv*velocity mjGAIN_MUSCLE, // muscle FLV curve computed by mju_muscleGain() mjGAIN_USER // user-defined gain type } mjtGain; | Defined in `mjmodel.h `_ | Actuator gain types. These values are used in ``m->actuator_gaintype``. .. _mjtBias: mjtBias ~~~~~~~ .. code-block:: C typedef enum _mjtBias { mjBIAS_NONE = 0, // no bias mjBIAS_AFFINE, // const + kp*length + kv*velocity mjBIAS_MUSCLE, // muscle passive force computed by mju_muscleBias() mjBIAS_USER // user-defined bias type } mjtBias; | Defined in `mjmodel.h `_ | Actuator bias types. These values are used in ``m->actuator_biastype``. .. _mjtObj: mjtObj ~~~~~~ .. code-block:: C typedef enum _mjtObj { 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_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 } mjtObj; | Defined in `mjmodel.h `_ | MuJoCo object types. These values are used in the support functions :ref:`mj_name2id` and :ref:`mj_id2name` to convert between object names and integer ids. .. _mjtConstraint: mjtConstraint ~~~~~~~~~~~~~ .. code-block:: C typedef enum _mjtConstraint { 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; | Defined in `mjmodel.h `_ | Constraint types. These values are not used in mjModel, but are used in the mjData field ``d->efc_type`` when the list of active constraints is constructed at each simulation time step. .. _mjtConstraintState: mjtConstraintState ~~~~~~~~~~~~~~~~~~ .. code-block:: C typedef enum _mjtConstraintState { 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; | Defined in `mjmodel.h `_ | These values are used by the solver internally to keep track of the constraint states. .. _mjtSensor: mjtSensor ~~~~~~~~~ .. code-block:: C 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 or site along z-axis // 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 // 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 // user-defined sensor mjSENS_USER // sensor data provided by mjcb_sensor callback } mjtSensor; | Defined in `mjmodel.h `_ | Sensor types. These values are used in ``m->sensor_type``. .. _mjtStage: mjtStage ~~~~~~~~ .. code-block:: C typedef enum _mjtStage { mjSTAGE_NONE = 0, // no computations mjSTAGE_POS, // position-dependent computations mjSTAGE_VEL, // velocity-dependent computations mjSTAGE_ACC // acceleration/force-dependent computations } mjtStage; | Defined in `mjmodel.h `_ | These are the compute stages for the skipstage parameters of :ref:`mj_forwardSkip` and :ref:`mj_inverseSkip`. .. _mjtDataType: mjtDataType ~~~~~~~~~~~ .. code-block:: C 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; | Defined in `mjmodel.h `_ | These are the possible sensor data types, used in ``mjData.sensor_datatype``. .. _mjtWarning: mjtWarning ~~~~~~~~~~ .. code-block:: C 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_VGEOMFULL, // too many visual geoms 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; | Defined in `mjdata.h `_ | Warning types. The number of warning types is given by ``mjNWARNING`` which is also the length of the array ``mjData.warning``. .. _mjtTimer: mjtTimer ~~~~~~~~ .. code-block:: C typedef enum _mjtTimer { // 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_ACCELERATION, // fwdAcceleration mjTIMER_CONSTRAINT, // fwdConstraint // 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 mjNTIMER // number of timers } mjtTimer; | Defined in `mjdata.h `_ | Timer types. The number of timer types is given by ``mjNTIMER`` which is also the length of the array ``mjData.timer``, as well as the length of the string array :ref:`mjTIMERSTRING` with timer names. .. _mjtCatBit: mjtCatBit ~~~~~~~~~ .. code-block:: C typedef enum _mjtCatBit { mjCAT_STATIC = 1, // model elements in body 0 mjCAT_DYNAMIC = 2, // model elements in all other bodies mjCAT_DECOR = 4, // decorative geoms mjCAT_ALL = 7 // select all categories } mjtCatBit; | Defined in `mjvisualize.h `_ | These are the available categories of geoms in the abstract visualizer. The bitmask can be used in the function :ref:`mjr_render` to specify which categories should be rendered. .. _mjtMouse: mjtMouse ~~~~~~~~ .. code-block:: C typedef enum _mjtMouse { mjMOUSE_NONE = 0, // no action mjMOUSE_ROTATE_V, // rotate, vertical plane mjMOUSE_ROTATE_H, // rotate, horizontal plane mjMOUSE_MOVE_V, // move, vertical plane mjMOUSE_MOVE_H, // move, horizontal plane mjMOUSE_ZOOM, // zoom mjMOUSE_SELECT // selection } mjtMouse; | Defined in `mjvisualize.h `_ | These are the mouse actions that the abstract visualizer recognizes. It is up to the user to intercept mouse events and translate them into these actions, as illustrated in ``simulate.cc``. .. _mjtPertBit: mjtPertBit ~~~~~~~~~~ .. code-block:: C typedef enum _mjtPertBit { mjPERT_TRANSLATE = 1, // translation mjPERT_ROTATE = 2 // rotation } mjtPertBit; | Defined in `mjvisualize.h `_ | These bitmasks enable the translational and rotational components of the mouse perturbation. For the regular mouse, only one can be enabled at a time. For the 3D mouse (SpaceNavigator) both can be enabled simultaneously. They are used in ``mjvPerturb.active``. .. _mjtCamera: mjtCamera ~~~~~~~~~ .. code-block:: C typedef enum _mjtCamera { mjCAMERA_FREE = 0, // free camera mjCAMERA_TRACKING, // tracking camera; uses trackbodyid mjCAMERA_FIXED, // fixed camera; uses fixedcamid mjCAMERA_USER // user is responsible for setting OpenGL camera } mjtCamera; | Defined in `mjvisualize.h `_ | These are the possible camera types, used in ``mjvCamera.type``. .. _mjtLabel: mjtLabel ~~~~~~~~ .. code-block:: C typedef enum _mjtLabel { mjLABEL_NONE = 0, // nothing mjLABEL_BODY, // body labels mjLABEL_JOINT, // joint labels mjLABEL_GEOM, // geom labels mjLABEL_SITE, // site labels mjLABEL_CAMERA, // camera labels mjLABEL_LIGHT, // light labels mjLABEL_TENDON, // tendon labels mjLABEL_ACTUATOR, // actuator labels mjLABEL_CONSTRAINT, // constraint labels mjLABEL_SKIN, // skin labels mjLABEL_SELECTION, // selected object mjLABEL_SELPNT, // coordinates of selection point mjLABEL_CONTACTFORCE, // magnitude of contact force mjNLABEL // number of label types } mjtLabel; | Defined in `mjvisualize.h `_ | These are the abstract visualization elements that can have text labels. Used in ``mjvOption.label``. .. _mjtFrame: mjtFrame ~~~~~~~~ .. code-block:: C typedef enum _mjtFrame { mjFRAME_NONE = 0, // no frames mjFRAME_BODY, // body frames mjFRAME_GEOM, // geom frames mjFRAME_SITE, // site frames mjFRAME_CAMERA, // camera frames mjFRAME_LIGHT, // light frames mjFRAME_WORLD, // world frame mjNFRAME // number of visualization frames } mjtFrame; | Defined in `mjvisualize.h `_ | These are the MuJoCo objects whose spatial frames can be rendered. Used in ``mjvOption.frame``. .. _mjtVisFlag: mjtVisFlag ~~~~~~~~~~ .. code-block:: C typedef enum _mjtVisFlag { mjVIS_CONVEXHULL = 0, // mesh convex hull mjVIS_TEXTURE, // textures mjVIS_JOINT, // joints mjVIS_ACTUATOR, // actuators mjVIS_CAMERA, // cameras mjVIS_LIGHT, // lights mjVIS_TENDON, // tendons mjVIS_RANGEFINDER, // rangefinder sensors mjVIS_CONSTRAINT, // point constraints mjVIS_INERTIA, // equivalent inertia boxes mjVIS_SCLINERTIA, // scale equivalent inertia boxes with mass mjVIS_PERTFORCE, // perturbation force mjVIS_PERTOBJ, // perturbation object mjVIS_CONTACTPOINT, // contact points mjVIS_CONTACTFORCE, // contact force mjVIS_CONTACTSPLIT, // split contact force into normal and tanget mjVIS_TRANSPARENT, // make dynamic geoms more transparent mjVIS_AUTOCONNECT, // auto connect joints and body coms mjVIS_COM, // center of mass mjVIS_SELECT, // selection point mjVIS_STATIC, // static bodies mjVIS_SKIN, // skin mjNVISFLAG // number of visualization flags } mjtVisFlag; | Defined in `mjvisualize.h `_ | These are indices in the array ``mjvOption.flags``, whose elements enable/disable the visualization of the corresponding model or decoration element. .. _mjtRndFlag: mjtRndFlag ~~~~~~~~~~ .. code-block:: C typedef enum _mjtRndFlag { mjRND_SHADOW = 0, // shadows mjRND_WIREFRAME, // wireframe mjRND_REFLECTION, // reflections mjRND_ADDITIVE, // additive transparency mjRND_SKYBOX, // skybox mjRND_FOG, // fog mjRND_HAZE, // haze mjRND_SEGMENT, // segmentation with random color mjRND_IDCOLOR, // segmentation with segid+1 color mjNRNDFLAG // number of rendering flags } mjtRndFlag; | Defined in `mjvisualize.h `_ | These are indices in the array ``mjvScene.flags``, whose elements enable/disable OpenGL rendering effects. .. _mjtStereo: mjtStereo ~~~~~~~~~ .. code-block:: C typedef enum _mjtStereo { mjSTEREO_NONE = 0, // no stereo; use left eye only mjSTEREO_QUADBUFFERED, // quad buffered; revert to side-by-side if no hardware support mjSTEREO_SIDEBYSIDE // side-by-side } mjtStereo; | Defined in `mjvisualize.h `_ | These are the possible stereo rendering types. They are used in ``mjvScene.stereo``. .. _mjtGridPos: mjtGridPos ~~~~~~~~~~ .. code-block:: C typedef enum _mjtGridPos { mjGRID_TOPLEFT = 0, // top left mjGRID_TOPRIGHT, // top right mjGRID_BOTTOMLEFT, // bottom left mjGRID_BOTTOMRIGHT // bottom right } mjtGridPos; | Defined in `mjrender.h `_ | These are the possible grid positions for text overlays. They are used as an argument to the function :ref:`mjr_overlay`. .. _mjtFramebuffer: mjtFramebuffer ~~~~~~~~~~~~~~ .. code-block:: C typedef enum _mjtFramebuffer { mjFB_WINDOW = 0, // default/window buffer mjFB_OFFSCREEN // offscreen buffer } mjtFramebuffer; | Defined in `mjrender.h `_ | These are the possible framebuffers. They are used as an argument to the function :ref:`mjr_setBuffer`. .. _mjtFontScale: mjtFontScale ~~~~~~~~~~~~ .. code-block:: C typedef enum _mjtFontScale { mjFONTSCALE_50 = 50, // 50% scale, suitable for low-res rendering mjFONTSCALE_100 = 100, // normal scale, suitable in the absence of DPI scaling mjFONTSCALE_150 = 150, // 150% scale mjFONTSCALE_200 = 200, // 200% scale mjFONTSCALE_250 = 250, // 250% scale mjFONTSCALE_300 = 300 // 300% scale } mjtFontScale; | Defined in `mjrender.h `_ | These are the possible font sizes. The fonts are predefined bitmaps stored in the dynamic library at three different sizes. .. _mjtFont: mjtFont ~~~~~~~ .. code-block:: C typedef enum _mjtFont { mjFONT_NORMAL = 0, // normal font mjFONT_SHADOW, // normal font with shadow (for higher contrast) mjFONT_BIG // big font (for user alerts) } mjtFont; | Defined in `mjrender.h `_ | These are the possible font types. .. _mjtButton: mjtButton ~~~~~~~~~ .. code-block:: C typedef enum _mjtButton // mouse button { mjBUTTON_NONE = 0, // no button mjBUTTON_LEFT, // left button mjBUTTON_RIGHT, // right button mjBUTTON_MIDDLE // middle button } mjtButton; | Defined in `mjui.h `_ | Mouse button IDs used in the UI framework. .. _mjtEvent: mjtEvent ~~~~~~~~ .. code-block:: C typedef enum _mjtEvent // mouse and keyboard event type { mjEVENT_NONE = 0, // no event mjEVENT_MOVE, // mouse move mjEVENT_PRESS, // mouse button press mjEVENT_RELEASE, // mouse button release mjEVENT_SCROLL, // scroll mjEVENT_KEY, // key press mjEVENT_RESIZE // resize } mjtEvent; | Defined in `mjui.h `_ | Event types used in the UI framework. .. _mjtItem: mjtItem ~~~~~~~ .. code-block:: C typedef enum _mjtItem // UI item type { mjITEM_END = -2, // end of definition list (not an item) mjITEM_SECTION = -1, // section (not an item) mjITEM_SEPARATOR = 0, // separator mjITEM_STATIC, // static text mjITEM_BUTTON, // button // the rest have data pointer mjITEM_CHECKINT, // check box, int value mjITEM_CHECKBYTE, // check box, mjtByte value mjITEM_RADIO, // radio group mjITEM_SELECT, // selection box mjITEM_SLIDERINT, // slider, int value mjITEM_SLIDERNUM, // slider, mjtNum value mjITEM_EDITINT, // editable array, int values mjITEM_EDITNUM, // editable array, mjtNum values mjITEM_EDITTXT, // editable text mjNITEM // number of item types } mjtItem; | Defined in `mjui.h `_ | Item types used in the UI framework. .. _tyFunction: Function types ^^^^^^^^^^^^^^ MuJoCo callbacks have corresponding function types. They are defined in `mjdata.h `_ and in `mjui.h `_. The actual callback functions are documented later. .. _mjfGeneric: mjfGeneric ~~~~~~~~~~ .. code-block:: C typedef void (*mjfGeneric)(const mjModel* m, mjData* d); This is the function type of the callbacks :ref:`mjcb_passive` and :ref:`mjcb_control`. .. _mjfConFilt: mjfConFilt ~~~~~~~~~~ .. code-block:: C typedef int (*mjfConFilt)(const mjModel* m, mjData* d, int geom1, int geom2); This is the function type of the callback :ref:`mjcb_contactfilter`. The return value is 1: discard, 0: proceed with collision check. .. _mjfSensor: mjfSensor ~~~~~~~~~ .. code-block:: C typedef void (*mjfSensor)(const mjModel* m, mjData* d, int stage); This is the function type of the callback :ref:`mjcb_sensor`. .. _mjfTime: mjfTime ~~~~~~~ .. code-block:: C typedef mjtNum (*mjfTime)(void); This is the function type of the callback :ref:`mjcb_time`. .. _mjfAct: mjfAct ~~~~~~ .. code-block:: C typedef mjtNum (*mjfAct)(const mjModel* m, const mjData* d, int id); This is the function type of the callbacks :ref:`mjcb_act_dyn`, :ref:`mjcb_act_gain` and :ref:`mjcb_act_bias`. .. _mjfCollision: mjfCollision ~~~~~~~~~~~~ .. code-block:: C typedef int (*mjfCollision)(const mjModel* m, const mjData* d, mjContact* con, int g1, int g2, mjtNum margin); This is the function type of the callbacks in the collision table :ref:`mjCOLLISIONFUNC`. .. _mjfItemEnable: mjfItemEnable ~~~~~~~~~~~~~ .. code-block:: C typedef int (*mjfItemEnable)(int category, void* data); This is the function type of the predicate function used by the UI framework to determine if each item is enabled or disabled. .. _tyStructure: Data structures ^^^^^^^^^^^^^^^ MuJoCo uses several data structures shown below. They are taken directly from the header files which contain comments for each field. .. _mjVFS: mjVFS ~~~~~ .. code-block:: C struct _mjVFS // virtual file system for loading from memory { int nfile; // number of files present char filename[mjMAXVFS][mjMAXVFSNAME]; // file name without path int filesize[mjMAXVFS]; // file size in bytes void* filedata[mjMAXVFS]; // buffer with file data }; typedef struct _mjVFS mjVFS; | Defined in `mjmodel.h `_ | This is the data structure with the virtual file system. It can only be constructed programmatically, and does not have an analog in MJCF. .. _mjOption: mjOption ~~~~~~~~ .. code-block:: C struct _mjOption // physics options { // timing parameters mjtNum timestep; // timestep mjtNum apirate; // update rate for remote API (Hz) // solver parameters mjtNum impratio; // ratio of friction-to-normal contact impedance mjtNum tolerance; // main solver tolerance mjtNum noslip_tolerance; // noslip solver tolerance mjtNum mpr_tolerance; // MPR solver tolerance // physical constants mjtNum gravity[3]; // gravitational acceleration mjtNum wind[3]; // wind (for lift, drag and viscosity) mjtNum magnetic[3]; // global magnetic flux mjtNum density; // density of medium mjtNum viscosity; // viscosity of medium // override contact solver parameters (if enabled) mjtNum o_margin; // margin mjtNum o_solref[mjNREF]; // solref mjtNum o_solimp[mjNIMP]; // solimp // discrete settings int integrator; // integration mode (mjtIntegrator) int collision; // collision mode (mjtCollision) int cone; // type of friction cone (mjtCone) int jacobian; // type of Jacobian (mjtJacobian) int solver; // solver algorithm (mjtSolver) int iterations; // maximum number of main solver iterations int noslip_iterations; // maximum number of noslip solver iterations int mpr_iterations; // maximum number of MPR solver iterations int disableflags; // bit flags for disabling standard features int enableflags; // bit flags for enabling optional features }; typedef struct _mjOption mjOption; | Defined in `mjmodel.h `_ | This is the data structure with simulation options. It corresponds to the MJCF element :ref:`option