diff --git a/src/user/user_api.h b/src/user/user_api.h index faa6cd93..c6c51cd3 100644 --- a/src/user/user_api.h +++ b/src/user/user_api.h @@ -19,299 +19,370 @@ #include #include -typedef struct _mjString* mjString; -typedef struct _mjDouble* mjDouble; -typedef struct _mjElement* mjElement; - // this is a C-API #ifdef __cplusplus extern "C" { #endif -//---------------------------------- Public structs ------------------------------------------------ -// type of mesh -typedef enum _mjtGeomInertia { - mjINERTIA_VOLUME, - mjINERTIA_SHELL, +//---------------------------------- handles to internal objects ----------------------------------- + +typedef struct _mjElement* mjElement; +typedef struct _mjString* mjString; +typedef struct _mjDouble* mjDouble; + + +//---------------------------------- enum types (mjt) ---------------------------------------------- + +typedef enum _mjtGeomInertia { // type of inertia inference + mjINERTIA_VOLUME, // mass distributed in the volume + mjINERTIA_SHELL, // mass distributed on the surface } mjtGeomInertia; -typedef struct _mjmOrientation { +//---------------------------------- attribute structs (mjm) --------------------------------------- + +typedef struct _mjmOrientation { // alternative orientation specifiers double axisangle[4]; // rotation axis and angle double xyaxes[6]; // x and y axes double zaxis[3]; // z axis (use minimal rotation) - double euler[3]; // euler rotations + double euler[3]; // euler angles } mjmOrientation; -typedef struct _mjmPlugin { - bool active; - mjString name; - mjString instance_name; - mjElement instance; +typedef struct _mjmPlugin { // plugin specification + mjElement instance; // internal, do not modify + mjString name; // name + mjString instance_name; // instance name + bool active; // is the plugin active } mjmPlugin; -typedef struct _mjmBody { - mjElement element; // compiler only, do not modify - mjString name; // name - mjString classname; // class name - double pos[3]; // frame position - double quat[4]; // frame orientation - mjtByte mocap; // is this a mocap body - mjmOrientation alt; // frame alternative orientation - double gravcomp; // gravity compensation - mjDouble userdata; // user data - double ipos[3]; // inertial frame position - double iquat[4]; // inertial frame orientation - double mass; // mass - double inertia[3]; // diagonal inertia (in i-frame) - mjmOrientation ialt; // inertial frame alternative orientation - double fullinertia[6]; // non-axis-aligned inertia matrix - mjtByte explicitinertial; // whether to save the body with an explicit inertial clause - mjmPlugin plugin; // passive force plugin - mjString info; // message appended to errors +typedef struct _mjmBody { // body specification + mjElement element; // internal, do not modify + mjString name; // name + mjString classname; // childclass name + + // body frame + double pos[3]; // frame position + double quat[4]; // frame orientation + mjmOrientation alt; // frame alternative orientation + + // inertial frame + double mass; // mass + double ipos[3]; // inertial frame position + double iquat[4]; // inertial frame orientation + double inertia[3]; // diagonal inertia (in i-frame) + mjmOrientation ialt; // inertial frame alternative orientation + double fullinertia[6]; // non-axis-aligned inertia matrix + + // other + mjtByte mocap; // is this a mocap body + double gravcomp; // gravity compensation + mjDouble userdata; // user data + mjtByte explicitinertial; // whether to save the body with explicit inertial clause + mjmPlugin plugin; // passive force plugin + mjString info; // message appended to compiler errors } mjmBody; -typedef struct _mjmJoint { - mjElement element; // compiler only, do not modify - mjString name; // name - mjString classname; // class name +typedef struct _mjmJoint { // joint specification + mjElement element; // internal, do not modify + mjString name; // name + mjString classname; // class name + mjtJoint type; // joint type - // joint properties - mjtJoint type; // type of Joint - int group; // used for rendering - int limited; // does joint have limits: 0 false, 1 true, 2 auto - int actfrclimited; // are actuator forces on joints limited: 0 false, 1 true, 2 auto + // kinematics double pos[3]; // anchor position double axis[3]; // joint axis + double ref; // value at reference configuration: qpos0 + + // stiffness double stiffness; // stiffness coefficient + double springref; // spring reference value: qpos_spring double springdamper[2]; // timeconst, dampratio + + // limits + int limited; // does joint have limits double range[2]; // joint limits - double actfrcrange[2]; // actuator force limits + double margin; // margin value for joint limit detection mjtNum solref_limit[mjNREF]; // solver reference: joint limits mjtNum solimp_limit[mjNIMP]; // solver impedance: joint limits - mjtNum solref_friction[mjNREF]; // solver reference: dof friction - mjtNum solimp_friction[mjNIMP]; // solver impedance: dof friction - double margin; // margin value for joint limit detection - double ref; // value at reference configuration: qpos0 - double springref; // spring reference value: qpos_spring - mjDouble userdata; // user data + int actfrclimited; // are actuator forces on joint limited + double actfrcrange[2]; // actuator force limits // dof properties double armature; // armature inertia (mass for slider) double damping; // damping coefficient double frictionloss; // friction loss + mjtNum solref_friction[mjNREF]; // solver reference: dof friction + mjtNum solimp_friction[mjNIMP]; // solver impedance: dof friction - // other attributes - mjString info; // message appended to errors - double urdfeffort; // store effort field from urdf + // other + int group; // group + double urdfeffort; // effort (urdf) + mjDouble userdata; // user data + mjString info; // message appended to compiler errors } mjmJoint; -typedef struct _mjmGeom { - mjElement element; // compiler only, do not modify - mjString name; // name - mjString classname; // classname - mjtGeom type; // geom type - double pos[3]; // position - double quat[4]; // orientation - mjmOrientation alt; // alternative orientation specifications - int contype; // contact type - int conaffinity; // contact affinity - int condim; // contact dimensionality - int group; // used for rendering - int priority; // contact priority - double size[3]; // geom-specific size parameters - double friction[3]; // one-sided friction coefficients: slide, roll, spin - double solmix; // solver mixing for contact pairs - mjtNum solref[mjNREF]; // solver reference - mjtNum solimp[mjNIMP]; // solver impedance - double mass; // used to compute density - double density; // used to compute mass and inertia (from volume) - double fromto[6]; // alternative for capsule, cylinder, box, ellipsoid - double margin; // margin for contact detection - double gap; // include in solver if dist