diff --git a/Cargo.toml b/Cargo.toml index d7319cb..5e05708 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rusty_mujoco" -version = "0.2.0" +version = "0.3.0" edition = "2024" authors = ["kanarus "] documentation = "https://docs.rs/rusty_mujoco" diff --git a/README.md b/README.md index 157a745..4f0f1c4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

Rusty MuJoCo Binding

Rust bindings for the MuJoCo physics simulator

-

MuJoCo Version: 3.3.2

+

MuJoCo Version: 3.4.0


@@ -32,32 +32,32 @@ ## Requirements -- [MuJoCo 3.3.2](https://github.com/google-deepmind/mujoco/releases/tag/3.3.2) downloaded and installed +- [MuJoCo 3.4.0](https://github.com/google-deepmind/mujoco/releases/tag/3.4.0) downloaded and installed - Additionally, if you place mujoco library in a non-standard directory of the platform, you need `MUJOCO_LIB` environment variable set to the path of the directory containing - `libmujoco.so` or `mujoco.lib` (e.g. `$HOME/.mujoco/mujoco-3.3.2/lib` when you placed the official release above in `~/.mujoco`) + `libmujoco.so` or `mujoco.lib` (e.g. `$HOME/.mujoco/mujoco-3.4.0/lib` when you placed the official release above in `~/.mujoco`) ### Note / Tips - For example on x86_64 Linux, run: ```sh - wget https://github.com/google-deepmind/mujoco/releases/download/3.3.2/mujoco-3.3.2-linux-x86_64.tar.gz - tar -xzf mujoco-3.3.2-linux-x86_64.tar.gz + wget https://github.com/google-deepmind/mujoco/releases/download/3.4.0/mujoco-3.4.0-linux-x86_64.tar.gz + tar -xzf mujoco-3.4.0-linux-x86_64.tar.gz ``` - to download & expand MuJoCo 3.3.2.\ + to download & expand MuJoCo 3.4.0.\ On other platforms, do the same with the appropriate archive file for your system. - One way to setup is to install MuJoCo to _a default standard path_ like `/usr/local/lib/` - (or a folder in _PATH_ on Windows), then if needed create symlink to `mujoco-3.3.2/lib/libmujoco.so` there, + (or a folder in _PATH_ on Windows), then if needed create symlink to `mujoco-3.4.0/lib/libmujoco.so` there, and insert to your shell config file: ```sh # example on Linux with /usr/local/lib/ - export MUJOCO_LIB="/usr/local/lib/mujoco-3.3.2/lib" + export MUJOCO_LIB="/usr/local/lib/mujoco-3.4.0/lib" ``` Or if you'd like to avoid to install MuJoCo to such a system directory: ```sh # example on Linux with $HOME/.mujoco/ - export MUJOCO_LIB="$HOME/.mujoco/mujoco-3.3.2/lib" + export MUJOCO_LIB="$HOME/.mujoco/mujoco-3.4.0/lib" export LD_LIBRARY_PATH="$MUJOCO_LIB:$LD_LIBRARY_PATH" ``` @@ -70,7 +70,7 @@ ```toml [dependencies] -rusty_mujoco = "0.2" +rusty_mujoco = "0.3" glfw = "0.60" ``` diff --git a/build.rs b/build.rs index f3d8723..a76da06 100644 --- a/build.rs +++ b/build.rs @@ -163,7 +163,7 @@ fn bindgen() { .header_contents("bindgen.h", "#include \"mujoco.h\"") .clang_args([format!("-I{vendor_include}"), format!("-I{vendor_include_mujoco}")]) .use_core() - .raw_line("#![allow(unused, non_camel_case_types, non_snake_case, non_upper_case_globals)]") + .raw_line("#![allow(unused, non_camel_case_types, non_snake_case, non_upper_case_globals, clippy::all)]") .respect_cxx_access_specs(false) .default_visibility(bindgen::FieldVisibilityKind::PublicCrate) .newtype_enum("_?mjt.+[^Bit]") diff --git a/src/bindgen.rs b/src/bindgen.rs index 7443835..69e514a 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -1,8 +1,8 @@ /* automatically generated by rust-bindgen 0.72.1 */ -#![allow(unused, non_camel_case_types, non_snake_case, non_upper_case_globals)] +#![allow(unused, non_camel_case_types, non_snake_case, non_upper_case_globals, clippy::all)] -pub const mjVERSION_HEADER: u32 = 332; +pub const mjVERSION_HEADER: u32 = 340; pub const mjMINVAL: f64 = 0.000000000000001; pub const mjPI: f64 = 3.141592653589793; pub const mjMAXVAL: f64 = 10000000000.0; @@ -12,6 +12,7 @@ pub const mjMAXIMP: f64 = 0.9999; pub const mjMAXCONPAIR: usize = 50; pub const mjMAXTREEDEPTH: usize = 50; pub const mjMAXFLEXNODES: usize = 27; +pub const mjMINAWAKE: u32 = 10; pub const mjNEQDATA: usize = 11; pub const mjNDYN: usize = 10; pub const mjNGAIN: usize = 10; @@ -19,6 +20,7 @@ pub const mjNBIAS: usize = 10; pub const mjNFLUID: usize = 12; pub const mjNREF: usize = 2; pub const mjNIMP: usize = 5; +pub const mjNSENS: usize = 3; pub const mjNSOLVER: usize = 200; pub const mjNISLAND: usize = 20; pub const mjMAXTHREAD: usize = 128; @@ -26,7 +28,7 @@ pub const mjNGROUP: usize = 6; pub const mjMAXLIGHT: usize = 100; pub const mjMAXOVERLAY: usize = 500; pub const mjMAXLINE: usize = 100; -pub const mjMAXLINEPNT: usize = 1000; +pub const mjMAXLINEPNT: usize = 1001; pub const mjMAXPLANEGRID: usize = 200; pub const mjNAUX: usize = 10; pub const mjMAXTEXTURE: usize = 1000; @@ -70,6 +72,7 @@ pub const mjKEY_NUMPAD_0: u32 = 320; pub const mjKEY_NUMPAD_9: u32 = 329; pub type mjtNum = f64; pub type mjtByte = ::core::ffi::c_uchar; +pub type mjtSize = i64; pub const mjNDISABLE: usize = mjtDisableBit::mjNDISABLE.0 as usize; impl mjtDisableBit { pub const CONSTRAINT: mjtDisableBit = mjtDisableBit(1); @@ -77,19 +80,21 @@ impl mjtDisableBit { pub const FRICTIONLOSS: mjtDisableBit = mjtDisableBit(4); pub const LIMIT: mjtDisableBit = mjtDisableBit(8); pub const CONTACT: mjtDisableBit = mjtDisableBit(16); - pub const PASSIVE: mjtDisableBit = mjtDisableBit(32); - pub const GRAVITY: mjtDisableBit = mjtDisableBit(64); - pub const CLAMPCTRL: mjtDisableBit = mjtDisableBit(128); - pub const WARMSTART: mjtDisableBit = mjtDisableBit(256); - pub const FILTERPARENT: mjtDisableBit = mjtDisableBit(512); - pub const ACTUATION: mjtDisableBit = mjtDisableBit(1024); - pub const REFSAFE: mjtDisableBit = mjtDisableBit(2048); - pub const SENSOR: mjtDisableBit = mjtDisableBit(4096); - pub const MIDPHASE: mjtDisableBit = mjtDisableBit(8192); - pub const EULERDAMP: mjtDisableBit = mjtDisableBit(16384); - pub const AUTORESET: mjtDisableBit = mjtDisableBit(32768); - pub const NATIVECCD: mjtDisableBit = mjtDisableBit(65536); - const mjNDISABLE: mjtDisableBit = mjtDisableBit(17); + pub const SPRING: mjtDisableBit = mjtDisableBit(32); + pub const DAMPER: mjtDisableBit = mjtDisableBit(64); + pub const GRAVITY: mjtDisableBit = mjtDisableBit(128); + pub const CLAMPCTRL: mjtDisableBit = mjtDisableBit(256); + pub const WARMSTART: mjtDisableBit = mjtDisableBit(512); + pub const FILTERPARENT: mjtDisableBit = mjtDisableBit(1024); + pub const ACTUATION: mjtDisableBit = mjtDisableBit(2048); + pub const REFSAFE: mjtDisableBit = mjtDisableBit(4096); + pub const SENSOR: mjtDisableBit = mjtDisableBit(8192); + pub const MIDPHASE: mjtDisableBit = mjtDisableBit(16384); + pub const EULERDAMP: mjtDisableBit = mjtDisableBit(32768); + pub const AUTORESET: mjtDisableBit = mjtDisableBit(65536); + pub const NATIVECCD: mjtDisableBit = mjtDisableBit(131072); + pub const ISLAND: mjtDisableBit = mjtDisableBit(262144); + const mjNDISABLE: mjtDisableBit = mjtDisableBit(19); } impl ::core::ops::BitOr for mjtDisableBit { type Output = Self; @@ -127,7 +132,7 @@ impl mjtEnableBit { pub const FWDINV: mjtEnableBit = mjtEnableBit(4); pub const INVDISCRETE: mjtEnableBit = mjtEnableBit(8); pub const MULTICCD: mjtEnableBit = mjtEnableBit(16); - pub const ISLAND: mjtEnableBit = mjtEnableBit(32); + pub const SLEEP: mjtEnableBit = mjtEnableBit(32); const mjNENABLE: mjtEnableBit = mjtEnableBit(6); } impl ::core::ops::BitOr for mjtEnableBit { @@ -204,6 +209,15 @@ impl mjtCamLight { #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct mjtCamLight(pub(crate) ::core::ffi::c_uint); +impl mjtLightType { + pub const SPOT: mjtLightType = mjtLightType(0); + pub const DIRECTIONAL: mjtLightType = mjtLightType(1); + pub const POINT: mjtLightType = mjtLightType(2); + pub const IMAGE: mjtLightType = mjtLightType(3); +} +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtLightType(pub(crate) ::core::ffi::c_uint); impl mjtTexture { pub const D2: mjtTexture = mjtTexture(0); pub const CUBE: mjtTexture = mjtTexture(1); @@ -229,6 +243,14 @@ impl mjtTextureRole { #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct mjtTextureRole(pub(crate) ::core::ffi::c_uint); +impl mjtColorSpace { + pub const AUTO: mjtColorSpace = mjtColorSpace(0); + pub const LINEAR: mjtColorSpace = mjtColorSpace(1); + pub const SRGB: mjtColorSpace = mjtColorSpace(2); +} +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtColorSpace(pub(crate) ::core::ffi::c_uint); impl mjtIntegrator { pub const EULER: mjtIntegrator = mjtIntegrator(0); pub const RK4: mjtIntegrator = mjtIntegrator(1); @@ -360,29 +382,6 @@ impl mjtObj { #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct mjtObj(pub(crate) ::core::ffi::c_uint); -impl mjtConstraint { - pub const EQUALITY: mjtConstraint = mjtConstraint(0); - pub const FRICTION_DOF: mjtConstraint = mjtConstraint(1); - pub const FRICTION_TENDON: mjtConstraint = mjtConstraint(2); - pub const LIMIT_JOINT: mjtConstraint = mjtConstraint(3); - pub const LIMIT_TENDON: mjtConstraint = mjtConstraint(4); - pub const CONTACT_FRICTIONLESS: mjtConstraint = mjtConstraint(5); - pub const CONTACT_PYRAMIDAL: mjtConstraint = mjtConstraint(6); - pub const CONTACT_ELLIPTIC: mjtConstraint = mjtConstraint(7); -} -#[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtConstraint(pub(crate) ::core::ffi::c_uint); -impl mjtConstraintState { - pub const SATISFIED: mjtConstraintState = mjtConstraintState(0); - pub const QUADRATIC: mjtConstraintState = mjtConstraintState(1); - pub const LINEARNEG: mjtConstraintState = mjtConstraintState(2); - pub const LINEARPOS: mjtConstraintState = mjtConstraintState(3); - pub const CONE: mjtConstraintState = mjtConstraintState(4); -} -#[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtConstraintState(pub(crate) ::core::ffi::c_uint); impl mjtSensor { pub const TOUCH: mjtSensor = mjtSensor(0); pub const ACCELEROMETER: mjtSensor = mjtSensor(1); @@ -422,14 +421,17 @@ impl mjtSensor { pub const SUBTREECOM: mjtSensor = mjtSensor(35); pub const SUBTREELINVEL: mjtSensor = mjtSensor(36); pub const SUBTREEANGMOM: mjtSensor = mjtSensor(37); - pub const GEOMDIST: mjtSensor = mjtSensor(38); - pub const GEOMNORMAL: mjtSensor = mjtSensor(39); - pub const GEOMFROMTO: mjtSensor = mjtSensor(40); - pub const E_POTENTIAL: mjtSensor = mjtSensor(41); - pub const E_KINETIC: mjtSensor = mjtSensor(42); - pub const CLOCK: mjtSensor = mjtSensor(43); - pub const PLUGIN: mjtSensor = mjtSensor(44); - pub const USER: mjtSensor = mjtSensor(45); + pub const INSIDESITE: mjtSensor = mjtSensor(38); + pub const GEOMDIST: mjtSensor = mjtSensor(39); + pub const GEOMNORMAL: mjtSensor = mjtSensor(40); + pub const GEOMFROMTO: mjtSensor = mjtSensor(41); + pub const CONTACT: mjtSensor = mjtSensor(42); + pub const E_POTENTIAL: mjtSensor = mjtSensor(43); + pub const E_KINETIC: mjtSensor = mjtSensor(44); + pub const CLOCK: mjtSensor = mjtSensor(45); + pub const TACTILE: mjtSensor = mjtSensor(46); + pub const PLUGIN: mjtSensor = mjtSensor(47); + pub const USER: mjtSensor = mjtSensor(48); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] @@ -452,6 +454,20 @@ impl mjtDataType { #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct mjtDataType(pub(crate) ::core::ffi::c_uint); +pub const mjNCONDATA: usize = mjtConDataField::mjNCONDATA.0 as usize; +impl mjtConDataField { + pub const FOUND: mjtConDataField = mjtConDataField(0); + pub const FORCE: mjtConDataField = mjtConDataField(1); + pub const TORQUE: mjtConDataField = mjtConDataField(2); + pub const DIST: mjtConDataField = mjtConDataField(3); + pub const POS: mjtConDataField = mjtConDataField(4); + pub const NORMAL: mjtConDataField = mjtConDataField(5); + pub const TANGENT: mjtConDataField = mjtConDataField(6); + const mjNCONDATA: mjtConDataField = mjtConDataField(7); +} +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtConDataField(pub(crate) ::core::ffi::c_uint); impl mjtSameFrame { pub const NONE: mjtSameFrame = mjtSameFrame(0); pub const BODY: mjtSameFrame = mjtSameFrame(1); @@ -462,6 +478,17 @@ impl mjtSameFrame { #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct mjtSameFrame(pub(crate) ::core::ffi::c_uint); +impl mjtSleepPolicy { + pub const AUTO: mjtSleepPolicy = mjtSleepPolicy(0); + pub const AUTO_NEVER: mjtSleepPolicy = mjtSleepPolicy(1); + pub const AUTO_ALLOWED: mjtSleepPolicy = mjtSleepPolicy(2); + pub const NEVER: mjtSleepPolicy = mjtSleepPolicy(3); + pub const ALLOWED: mjtSleepPolicy = mjtSleepPolicy(4); + pub const INIT: mjtSleepPolicy = mjtSleepPolicy(5); +} +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtSleepPolicy(pub(crate) ::core::ffi::c_uint); impl mjtLRMode { pub const NONE: mjtLRMode = mjtLRMode(0); pub const MUSCLE: mjtLRMode = mjtLRMode(1); @@ -481,6 +508,15 @@ impl mjtFlexSelf { #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct mjtFlexSelf(pub(crate) ::core::ffi::c_uint); +impl mjtSDFType { + pub const SINGLE: mjtSDFType = mjtSDFType(0); + pub const INTERSECTION: mjtSDFType = mjtSDFType(1); + pub const MIDSURFACE: mjtSDFType = mjtSDFType(2); + pub const COLLISION: mjtSDFType = mjtSDFType(3); +} +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtSDFType(pub(crate) ::core::ffi::c_uint); #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct mjLROpt { @@ -497,6 +533,11 @@ pub struct mjLROpt { } #[repr(C)] #[derive(Debug, Copy, Clone)] +pub struct mjCache { + pub(crate) impl_: *mut ::core::ffi::c_void, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] pub struct mjVFS { pub(crate) impl_: *mut ::core::ffi::c_void, } @@ -504,12 +545,12 @@ pub struct mjVFS { #[derive(Debug, Copy, Clone)] pub struct mjOption { pub(crate) timestep: mjtNum, - pub(crate) apirate: mjtNum, pub(crate) impratio: mjtNum, pub(crate) tolerance: mjtNum, pub(crate) ls_tolerance: mjtNum, pub(crate) noslip_tolerance: mjtNum, pub(crate) ccd_tolerance: mjtNum, + pub(crate) sleep_tolerance: mjtNum, pub(crate) gravity: [mjtNum; 3usize], pub(crate) wind: [mjtNum; 3usize], pub(crate) magnetic: [mjtNum; 3usize], @@ -546,6 +587,7 @@ pub struct mjVisual { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct mjVisual___bindgen_ty_1 { + pub(crate) cameraid: ::core::ffi::c_int, pub(crate) orthographic: ::core::ffi::c_int, pub(crate) fovy: f32, pub(crate) ipd: f32, @@ -663,7 +705,13 @@ pub struct mjModel { pub(crate) nbvh: ::core::ffi::c_int, pub(crate) nbvhstatic: ::core::ffi::c_int, pub(crate) nbvhdynamic: ::core::ffi::c_int, + pub(crate) noct: ::core::ffi::c_int, pub(crate) njnt: ::core::ffi::c_int, + pub(crate) ntree: ::core::ffi::c_int, + pub(crate) nM: ::core::ffi::c_int, + pub(crate) nB: ::core::ffi::c_int, + pub(crate) nC: ::core::ffi::c_int, + pub(crate) nD: ::core::ffi::c_int, pub(crate) ngeom: ::core::ffi::c_int, pub(crate) nsite: ::core::ffi::c_int, pub(crate) ncam: ::core::ffi::c_int, @@ -725,12 +773,7 @@ pub struct mjModel { pub(crate) nnames: ::core::ffi::c_int, pub(crate) npaths: ::core::ffi::c_int, pub(crate) nnames_map: ::core::ffi::c_int, - pub(crate) nM: ::core::ffi::c_int, - pub(crate) nB: ::core::ffi::c_int, - pub(crate) nC: ::core::ffi::c_int, - pub(crate) nD: ::core::ffi::c_int, pub(crate) nJmom: ::core::ffi::c_int, - pub(crate) ntree: ::core::ffi::c_int, pub(crate) ngravcomp: ::core::ffi::c_int, pub(crate) nemax: ::core::ffi::c_int, pub(crate) njmax: ::core::ffi::c_int, @@ -738,8 +781,8 @@ pub struct mjModel { pub(crate) nuserdata: ::core::ffi::c_int, pub(crate) nsensordata: ::core::ffi::c_int, pub(crate) npluginstate: ::core::ffi::c_int, - pub(crate) narena: usize, - pub(crate) nbuffer: usize, + pub(crate) narena: mjtSize, + pub(crate) nbuffer: mjtSize, pub(crate) opt: mjOption, pub(crate) vis: mjVisual, pub(crate) stat: mjStatistic, @@ -779,6 +822,10 @@ pub struct mjModel { pub(crate) bvh_child: *mut ::core::ffi::c_int, pub(crate) bvh_nodeid: *mut ::core::ffi::c_int, pub(crate) bvh_aabb: *mut mjtNum, + pub(crate) oct_depth: *mut ::core::ffi::c_int, + pub(crate) oct_child: *mut ::core::ffi::c_int, + pub(crate) oct_aabb: *mut mjtNum, + pub(crate) oct_coeff: *mut mjtNum, pub(crate) jnt_type: *mut ::core::ffi::c_int, pub(crate) jnt_qposadr: *mut ::core::ffi::c_int, pub(crate) jnt_dofadr: *mut ::core::ffi::c_int, @@ -809,6 +856,12 @@ pub struct mjModel { pub(crate) dof_damping: *mut mjtNum, pub(crate) dof_invweight0: *mut mjtNum, pub(crate) dof_M0: *mut mjtNum, + pub(crate) dof_length: *mut mjtNum, + pub(crate) tree_bodyadr: *mut ::core::ffi::c_int, + pub(crate) tree_bodynum: *mut ::core::ffi::c_int, + pub(crate) tree_dofadr: *mut ::core::ffi::c_int, + pub(crate) tree_dofnum: *mut ::core::ffi::c_int, + pub(crate) tree_sleep_policy: *mut ::core::ffi::c_int, pub(crate) geom_type: *mut ::core::ffi::c_int, pub(crate) geom_contype: *mut ::core::ffi::c_int, pub(crate) geom_conaffinity: *mut ::core::ffi::c_int, @@ -862,9 +915,12 @@ pub struct mjModel { pub(crate) light_mode: *mut ::core::ffi::c_int, pub(crate) light_bodyid: *mut ::core::ffi::c_int, pub(crate) light_targetbodyid: *mut ::core::ffi::c_int, - pub(crate) light_directional: *mut mjtByte, + pub(crate) light_type: *mut ::core::ffi::c_int, + pub(crate) light_texid: *mut ::core::ffi::c_int, pub(crate) light_castshadow: *mut mjtByte, pub(crate) light_bulbradius: *mut f32, + pub(crate) light_intensity: *mut f32, + pub(crate) light_range: *mut f32, pub(crate) light_active: *mut mjtByte, pub(crate) light_pos: *mut mjtNum, pub(crate) light_dir: *mut mjtNum, @@ -890,6 +946,7 @@ pub struct mjModel { pub(crate) flex_internal: *mut mjtByte, pub(crate) flex_selfcollide: *mut ::core::ffi::c_int, pub(crate) flex_activelayers: *mut ::core::ffi::c_int, + pub(crate) flex_passive: *mut ::core::ffi::c_int, pub(crate) flex_dim: *mut ::core::ffi::c_int, pub(crate) flex_matid: *mut ::core::ffi::c_int, pub(crate) flex_group: *mut ::core::ffi::c_int, @@ -912,6 +969,7 @@ pub struct mjModel { pub(crate) flex_nodebodyid: *mut ::core::ffi::c_int, pub(crate) flex_vertbodyid: *mut ::core::ffi::c_int, pub(crate) flex_edge: *mut ::core::ffi::c_int, + pub(crate) flex_edgeflap: *mut ::core::ffi::c_int, pub(crate) flex_elem: *mut ::core::ffi::c_int, pub(crate) flex_elemtexcoord: *mut ::core::ffi::c_int, pub(crate) flex_elemedge: *mut ::core::ffi::c_int, @@ -926,6 +984,7 @@ pub struct mjModel { pub(crate) flexedge_invweight0: *mut mjtNum, pub(crate) flex_radius: *mut mjtNum, pub(crate) flex_stiffness: *mut mjtNum, + pub(crate) flex_bending: *mut mjtNum, pub(crate) flex_damping: *mut mjtNum, pub(crate) flex_edgestiffness: *mut mjtNum, pub(crate) flex_edgedamping: *mut mjtNum, @@ -944,6 +1003,8 @@ pub struct mjModel { pub(crate) mesh_facenum: *mut ::core::ffi::c_int, pub(crate) mesh_bvhadr: *mut ::core::ffi::c_int, pub(crate) mesh_bvhnum: *mut ::core::ffi::c_int, + pub(crate) mesh_octadr: *mut ::core::ffi::c_int, + pub(crate) mesh_octnum: *mut ::core::ffi::c_int, pub(crate) mesh_normaladr: *mut ::core::ffi::c_int, pub(crate) mesh_normalnum: *mut ::core::ffi::c_int, pub(crate) mesh_texcoordadr: *mut ::core::ffi::c_int, @@ -998,6 +1059,7 @@ pub struct mjModel { pub(crate) hfield_data: *mut f32, pub(crate) hfield_pathadr: *mut ::core::ffi::c_int, pub(crate) tex_type: *mut ::core::ffi::c_int, + pub(crate) tex_colorspace: *mut ::core::ffi::c_int, pub(crate) tex_height: *mut ::core::ffi::c_int, pub(crate) tex_width: *mut ::core::ffi::c_int, pub(crate) tex_nchannel: *mut ::core::ffi::c_int, @@ -1037,6 +1099,8 @@ pub struct mjModel { pub(crate) tendon_num: *mut ::core::ffi::c_int, pub(crate) tendon_matid: *mut ::core::ffi::c_int, pub(crate) tendon_group: *mut ::core::ffi::c_int, + pub(crate) tendon_treenum: *mut ::core::ffi::c_int, + pub(crate) tendon_treeid: *mut ::core::ffi::c_int, pub(crate) tendon_limited: *mut mjtByte, pub(crate) tendon_actfrclimited: *mut mjtByte, pub(crate) tendon_width: *mut mjtNum, @@ -1091,6 +1155,7 @@ pub struct mjModel { pub(crate) sensor_objid: *mut ::core::ffi::c_int, pub(crate) sensor_reftype: *mut ::core::ffi::c_int, pub(crate) sensor_refid: *mut ::core::ffi::c_int, + pub(crate) sensor_intprm: *mut ::core::ffi::c_int, pub(crate) sensor_dim: *mut ::core::ffi::c_int, pub(crate) sensor_adr: *mut ::core::ffi::c_int, pub(crate) sensor_cutoff: *mut mjtNum, @@ -1146,6 +1211,19 @@ pub struct mjModel { pub(crate) names: *mut ::core::ffi::c_char, pub(crate) names_map: *mut ::core::ffi::c_int, pub(crate) paths: *mut ::core::ffi::c_char, + pub(crate) B_rownnz: *mut ::core::ffi::c_int, + pub(crate) B_rowadr: *mut ::core::ffi::c_int, + pub(crate) B_colind: *mut ::core::ffi::c_int, + pub(crate) M_rownnz: *mut ::core::ffi::c_int, + pub(crate) M_rowadr: *mut ::core::ffi::c_int, + pub(crate) M_colind: *mut ::core::ffi::c_int, + pub(crate) mapM2M: *mut ::core::ffi::c_int, + pub(crate) D_rownnz: *mut ::core::ffi::c_int, + pub(crate) D_rowadr: *mut ::core::ffi::c_int, + pub(crate) D_diag: *mut ::core::ffi::c_int, + pub(crate) D_colind: *mut ::core::ffi::c_int, + pub(crate) mapM2D: *mut ::core::ffi::c_int, + pub(crate) mapD2M: *mut ::core::ffi::c_int, pub(crate) signature: u64, } impl mjtTaskStatus { @@ -1195,6 +1273,29 @@ impl mjtState { #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct mjtState(pub(crate) ::core::ffi::c_uint); +impl mjtConstraint { + pub const EQUALITY: mjtConstraint = mjtConstraint(0); + pub const FRICTION_DOF: mjtConstraint = mjtConstraint(1); + pub const FRICTION_TENDON: mjtConstraint = mjtConstraint(2); + pub const LIMIT_JOINT: mjtConstraint = mjtConstraint(3); + pub const LIMIT_TENDON: mjtConstraint = mjtConstraint(4); + pub const CONTACT_FRICTIONLESS: mjtConstraint = mjtConstraint(5); + pub const CONTACT_PYRAMIDAL: mjtConstraint = mjtConstraint(6); + pub const CONTACT_ELLIPTIC: mjtConstraint = mjtConstraint(7); +} +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtConstraint(pub(crate) ::core::ffi::c_uint); +impl mjtConstraintState { + pub const SATISFIED: mjtConstraintState = mjtConstraintState(0); + pub const QUADRATIC: mjtConstraintState = mjtConstraintState(1); + pub const LINEARNEG: mjtConstraintState = mjtConstraintState(2); + pub const LINEARPOS: mjtConstraintState = mjtConstraintState(3); + pub const CONE: mjtConstraintState = mjtConstraintState(4); +} +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtConstraintState(pub(crate) ::core::ffi::c_uint); pub const mjNWARNING: usize = mjtWarning::mjNWARNING.0 as usize; impl mjtWarning { pub const INERTIA: mjtWarning = mjtWarning(0); @@ -1232,6 +1333,14 @@ impl mjtTimer { #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct mjtTimer(pub(crate) ::core::ffi::c_uint); +impl mjtSleepState { + pub const STATIC: mjtSleepState = mjtSleepState(-1); + pub const ASLEEP: mjtSleepState = mjtSleepState(0); + pub const AWAKE: mjtSleepState = mjtSleepState(1); +} +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtSleepState(pub(crate) ::core::ffi::c_int); #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct mjContact { @@ -1281,15 +1390,15 @@ pub struct mjSolverStat { #[repr(C)] #[derive(Debug)] pub struct mjData { - pub(crate) narena: usize, - pub(crate) nbuffer: usize, + pub(crate) narena: mjtSize, + pub(crate) nbuffer: mjtSize, pub(crate) nplugin: ::core::ffi::c_int, pub(crate) pstack: usize, pub(crate) pbase: usize, pub(crate) parena: usize, - pub(crate) maxuse_stack: usize, - pub(crate) maxuse_threadstack: [usize; 128usize], - pub(crate) maxuse_arena: usize, + pub(crate) maxuse_stack: mjtSize, + pub(crate) maxuse_threadstack: [mjtSize; 128usize], + pub(crate) maxuse_arena: mjtSize, pub(crate) maxuse_con: ::core::ffi::c_int, pub(crate) maxuse_efc: ::core::ffi::c_int, pub(crate) solver: [mjSolverStat; 4000usize], @@ -1306,6 +1415,11 @@ pub struct mjData { pub(crate) nJ: ::core::ffi::c_int, pub(crate) nA: ::core::ffi::c_int, pub(crate) nisland: ::core::ffi::c_int, + pub(crate) nidof: ::core::ffi::c_int, + pub(crate) ntree_awake: ::core::ffi::c_int, + pub(crate) nbody_awake: ::core::ffi::c_int, + pub(crate) nparent_awake: ::core::ffi::c_int, + pub(crate) nv_awake: ::core::ffi::c_int, pub(crate) time: mjtNum, pub(crate) energy: [mjtNum; 2usize], pub(crate) buffer: *mut ::core::ffi::c_void, @@ -1325,6 +1439,7 @@ pub struct mjData { pub(crate) act_dot: *mut mjtNum, pub(crate) userdata: *mut mjtNum, pub(crate) sensordata: *mut mjtNum, + pub(crate) tree_asleep: *mut ::core::ffi::c_int, pub(crate) plugin: *mut ::core::ffi::c_int, pub(crate) plugin_data: *mut usize, pub(crate) xpos: *mut mjtNum, @@ -1352,6 +1467,7 @@ pub struct mjData { pub(crate) flexedge_J_colind: *mut ::core::ffi::c_int, pub(crate) flexedge_J: *mut mjtNum, pub(crate) flexedge_length: *mut mjtNum, + pub(crate) bvh_aabb_dyn: *mut mjtNum, pub(crate) ten_wrapadr: *mut ::core::ffi::c_int, pub(crate) ten_wrapnum: *mut ::core::ffi::c_int, pub(crate) ten_J_rownnz: *mut ::core::ffi::c_int, @@ -1368,10 +1484,15 @@ pub struct mjData { pub(crate) actuator_moment: *mut mjtNum, pub(crate) crb: *mut mjtNum, pub(crate) qM: *mut mjtNum, + pub(crate) M: *mut mjtNum, pub(crate) qLD: *mut mjtNum, pub(crate) qLDiagInv: *mut mjtNum, - pub(crate) bvh_aabb_dyn: *mut mjtNum, pub(crate) bvh_active: *mut mjtByte, + pub(crate) tree_awake: *mut ::core::ffi::c_int, + pub(crate) body_awake: *mut ::core::ffi::c_int, + pub(crate) body_awake_ind: *mut ::core::ffi::c_int, + pub(crate) parent_awake_ind: *mut ::core::ffi::c_int, + pub(crate) dof_awake_ind: *mut ::core::ffi::c_int, pub(crate) flexedge_velocity: *mut mjtNum, pub(crate) ten_velocity: *mut mjtNum, pub(crate) actuator_velocity: *mut mjtNum, @@ -1387,23 +1508,6 @@ pub struct mjData { pub(crate) subtree_angmom: *mut mjtNum, pub(crate) qH: *mut mjtNum, pub(crate) qHDiagInv: *mut mjtNum, - pub(crate) B_rownnz: *mut ::core::ffi::c_int, - pub(crate) B_rowadr: *mut ::core::ffi::c_int, - pub(crate) B_colind: *mut ::core::ffi::c_int, - pub(crate) M_rownnz: *mut ::core::ffi::c_int, - pub(crate) M_rowadr: *mut ::core::ffi::c_int, - pub(crate) M_colind: *mut ::core::ffi::c_int, - pub(crate) mapM2M: *mut ::core::ffi::c_int, - pub(crate) C_rownnz: *mut ::core::ffi::c_int, - pub(crate) C_rowadr: *mut ::core::ffi::c_int, - pub(crate) C_colind: *mut ::core::ffi::c_int, - pub(crate) mapM2C: *mut ::core::ffi::c_int, - pub(crate) D_rownnz: *mut ::core::ffi::c_int, - pub(crate) D_rowadr: *mut ::core::ffi::c_int, - pub(crate) D_diag: *mut ::core::ffi::c_int, - pub(crate) D_colind: *mut ::core::ffi::c_int, - pub(crate) mapM2D: *mut ::core::ffi::c_int, - pub(crate) mapD2M: *mut ::core::ffi::c_int, pub(crate) qDeriv: *mut mjtNum, pub(crate) qLU: *mut mjtNum, pub(crate) actuator_force: *mut mjtNum, @@ -1422,12 +1526,7 @@ pub struct mjData { pub(crate) efc_J_rowadr: *mut ::core::ffi::c_int, pub(crate) efc_J_rowsuper: *mut ::core::ffi::c_int, pub(crate) efc_J_colind: *mut ::core::ffi::c_int, - pub(crate) efc_JT_rownnz: *mut ::core::ffi::c_int, - pub(crate) efc_JT_rowadr: *mut ::core::ffi::c_int, - pub(crate) efc_JT_rowsuper: *mut ::core::ffi::c_int, - pub(crate) efc_JT_colind: *mut ::core::ffi::c_int, pub(crate) efc_J: *mut mjtNum, - pub(crate) efc_JT: *mut mjtNum, pub(crate) efc_pos: *mut mjtNum, pub(crate) efc_margin: *mut mjtNum, pub(crate) efc_frictionloss: *mut mjtNum, @@ -1436,15 +1535,42 @@ pub struct mjData { pub(crate) efc_D: *mut mjtNum, pub(crate) efc_R: *mut mjtNum, pub(crate) tendon_efcadr: *mut ::core::ffi::c_int, + pub(crate) tree_island: *mut ::core::ffi::c_int, + pub(crate) island_ntree: *mut ::core::ffi::c_int, + pub(crate) island_itreeadr: *mut ::core::ffi::c_int, + pub(crate) map_itree2tree: *mut ::core::ffi::c_int, pub(crate) dof_island: *mut ::core::ffi::c_int, - pub(crate) island_dofnum: *mut ::core::ffi::c_int, + pub(crate) island_nv: *mut ::core::ffi::c_int, + pub(crate) island_idofadr: *mut ::core::ffi::c_int, pub(crate) island_dofadr: *mut ::core::ffi::c_int, - pub(crate) island_dofind: *mut ::core::ffi::c_int, - pub(crate) dof_islandind: *mut ::core::ffi::c_int, + pub(crate) map_dof2idof: *mut ::core::ffi::c_int, + pub(crate) map_idof2dof: *mut ::core::ffi::c_int, + pub(crate) ifrc_smooth: *mut mjtNum, + pub(crate) iacc_smooth: *mut mjtNum, + pub(crate) iM_rownnz: *mut ::core::ffi::c_int, + pub(crate) iM_rowadr: *mut ::core::ffi::c_int, + pub(crate) iM_colind: *mut ::core::ffi::c_int, + pub(crate) iM: *mut mjtNum, + pub(crate) iLD: *mut mjtNum, + pub(crate) iLDiagInv: *mut mjtNum, + pub(crate) iacc: *mut mjtNum, pub(crate) efc_island: *mut ::core::ffi::c_int, - pub(crate) island_efcnum: *mut ::core::ffi::c_int, - pub(crate) island_efcadr: *mut ::core::ffi::c_int, - pub(crate) island_efcind: *mut ::core::ffi::c_int, + pub(crate) island_ne: *mut ::core::ffi::c_int, + pub(crate) island_nf: *mut ::core::ffi::c_int, + pub(crate) island_nefc: *mut ::core::ffi::c_int, + pub(crate) island_iefcadr: *mut ::core::ffi::c_int, + pub(crate) map_efc2iefc: *mut ::core::ffi::c_int, + pub(crate) map_iefc2efc: *mut ::core::ffi::c_int, + pub(crate) iefc_type: *mut ::core::ffi::c_int, + pub(crate) iefc_id: *mut ::core::ffi::c_int, + pub(crate) iefc_J_rownnz: *mut ::core::ffi::c_int, + pub(crate) iefc_J_rowadr: *mut ::core::ffi::c_int, + pub(crate) iefc_J_rowsuper: *mut ::core::ffi::c_int, + pub(crate) iefc_J_colind: *mut ::core::ffi::c_int, + pub(crate) iefc_J: *mut mjtNum, + pub(crate) iefc_frictionloss: *mut mjtNum, + pub(crate) iefc_D: *mut mjtNum, + pub(crate) iefc_R: *mut mjtNum, pub(crate) efc_AR_rownnz: *mut ::core::ffi::c_int, pub(crate) efc_AR_rowadr: *mut ::core::ffi::c_int, pub(crate) efc_AR_colind: *mut ::core::ffi::c_int, @@ -1452,8 +1578,12 @@ pub struct mjData { pub(crate) efc_vel: *mut mjtNum, pub(crate) efc_aref: *mut mjtNum, pub(crate) efc_b: *mut mjtNum, - pub(crate) efc_force: *mut mjtNum, + pub(crate) iefc_aref: *mut mjtNum, + pub(crate) iefc_state: *mut ::core::ffi::c_int, + pub(crate) iefc_force: *mut mjtNum, pub(crate) efc_state: *mut ::core::ffi::c_int, + pub(crate) efc_force: *mut mjtNum, + pub(crate) ifrc_constraint: *mut mjtNum, pub(crate) threadpool: usize, pub(crate) signature: u64, } @@ -1484,1554 +1614,1327 @@ pub type mjfCollision = ::core::option::Option< margin: mjtNum, ) -> ::core::ffi::c_int, >; -impl mjtCatBit { - pub const STATIC: mjtCatBit = mjtCatBit(1); - pub const DYNAMIC: mjtCatBit = mjtCatBit(2); - pub const DECOR: mjtCatBit = mjtCatBit(4); - pub const ALL: mjtCatBit = mjtCatBit(7); -} -impl ::core::ops::BitOr for mjtCatBit { - type Output = Self; - #[inline] - fn bitor(self, other: Self) -> Self { - mjtCatBit(self.0 | other.0) - } -} -impl ::core::ops::BitOrAssign for mjtCatBit { - #[inline] - fn bitor_assign(&mut self, rhs: mjtCatBit) { - self.0 |= rhs.0; - } -} -impl ::core::ops::BitAnd for mjtCatBit { - type Output = Self; - #[inline] - fn bitand(self, other: Self) -> Self { - mjtCatBit(self.0 & other.0) - } -} -impl ::core::ops::BitAndAssign for mjtCatBit { - #[inline] - fn bitand_assign(&mut self, rhs: mjtCatBit) { - self.0 &= rhs.0; - } +pub type mjString = ::core::ffi::c_void; +pub type mjStringVec = ::core::ffi::c_void; +pub type mjIntVec = ::core::ffi::c_void; +pub type mjIntVecVec = ::core::ffi::c_void; +pub type mjFloatVec = ::core::ffi::c_void; +pub type mjFloatVecVec = ::core::ffi::c_void; +pub type mjDoubleVec = ::core::ffi::c_void; +pub type mjByteVec = ::core::ffi::c_void; +impl mjtGeomInertia { + pub const VOLUME: mjtGeomInertia = mjtGeomInertia(0); + pub const SHELL: mjtGeomInertia = mjtGeomInertia(1); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtCatBit(pub(crate) ::core::ffi::c_uint); -impl mjtMouse { - pub const NONE: mjtMouse = mjtMouse(0); - pub const ROTATE_V: mjtMouse = mjtMouse(1); - pub const ROTATE_H: mjtMouse = mjtMouse(2); - pub const MOVE_V: mjtMouse = mjtMouse(3); - pub const MOVE_H: mjtMouse = mjtMouse(4); - pub const ZOOM: mjtMouse = mjtMouse(5); - pub const SELECT: mjtMouse = mjtMouse(6); +pub struct mjtGeomInertia(pub(crate) ::core::ffi::c_uint); +impl mjtMeshInertia { + pub const INERTIA_CONVEX: mjtMeshInertia = mjtMeshInertia(0); + pub const INERTIA_EXACT: mjtMeshInertia = mjtMeshInertia(1); + pub const INERTIA_LEGACY: mjtMeshInertia = mjtMeshInertia(2); + pub const INERTIA_SHELL: mjtMeshInertia = mjtMeshInertia(3); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtMouse(pub(crate) ::core::ffi::c_uint); -impl mjtPertBit { - pub const TRANSLATE: mjtPertBit = mjtPertBit(1); - pub const ROTATE: mjtPertBit = mjtPertBit(2); -} -impl ::core::ops::BitOr for mjtPertBit { - type Output = Self; - #[inline] - fn bitor(self, other: Self) -> Self { - mjtPertBit(self.0 | other.0) - } -} -impl ::core::ops::BitOrAssign for mjtPertBit { - #[inline] - fn bitor_assign(&mut self, rhs: mjtPertBit) { - self.0 |= rhs.0; - } -} -impl ::core::ops::BitAnd for mjtPertBit { - type Output = Self; - #[inline] - fn bitand(self, other: Self) -> Self { - mjtPertBit(self.0 & other.0) - } +pub struct mjtMeshInertia(pub(crate) ::core::ffi::c_uint); +impl mjtMeshBuiltin { + pub const BUILTIN_NONE: mjtMeshBuiltin = mjtMeshBuiltin(0); + pub const BUILTIN_SPHERE: mjtMeshBuiltin = mjtMeshBuiltin(1); + pub const BUILTIN_HEMISPHERE: mjtMeshBuiltin = mjtMeshBuiltin(2); + pub const BUILTIN_CONE: mjtMeshBuiltin = mjtMeshBuiltin(3); + pub const BUILTIN_SUPERSPHERE: mjtMeshBuiltin = mjtMeshBuiltin(4); + pub const BUILTIN_SUPERTORUS: mjtMeshBuiltin = mjtMeshBuiltin(5); + pub const BUILTIN_WEDGE: mjtMeshBuiltin = mjtMeshBuiltin(6); + pub const BUILTIN_PLATE: mjtMeshBuiltin = mjtMeshBuiltin(7); } -impl ::core::ops::BitAndAssign for mjtPertBit { - #[inline] - fn bitand_assign(&mut self, rhs: mjtPertBit) { - self.0 &= rhs.0; - } +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtMeshBuiltin(pub(crate) ::core::ffi::c_uint); +impl mjtBuiltin { + pub const NONE: mjtBuiltin = mjtBuiltin(0); + pub const GRADIENT: mjtBuiltin = mjtBuiltin(1); + pub const CHECKER: mjtBuiltin = mjtBuiltin(2); + pub const FLAT: mjtBuiltin = mjtBuiltin(3); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtPertBit(pub(crate) ::core::ffi::c_uint); -impl mjtCamera { - pub const FREE: mjtCamera = mjtCamera(0); - pub const TRACKING: mjtCamera = mjtCamera(1); - pub const FIXED: mjtCamera = mjtCamera(2); - pub const USER: mjtCamera = mjtCamera(3); +pub struct mjtBuiltin(pub(crate) ::core::ffi::c_uint); +impl mjtMark { + pub const NONE: mjtMark = mjtMark(0); + pub const EDGE: mjtMark = mjtMark(1); + pub const CROSS: mjtMark = mjtMark(2); + pub const RANDOM: mjtMark = mjtMark(3); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtCamera(pub(crate) ::core::ffi::c_uint); -pub const mjNLABEL: usize = mjtLabel::mjNLABEL.0 as usize; -impl mjtLabel { - pub const NONE: mjtLabel = mjtLabel(0); - pub const BODY: mjtLabel = mjtLabel(1); - pub const JOINT: mjtLabel = mjtLabel(2); - pub const GEOM: mjtLabel = mjtLabel(3); - pub const SITE: mjtLabel = mjtLabel(4); - pub const CAMERA: mjtLabel = mjtLabel(5); - pub const LIGHT: mjtLabel = mjtLabel(6); - pub const TENDON: mjtLabel = mjtLabel(7); - pub const ACTUATOR: mjtLabel = mjtLabel(8); - pub const CONSTRAINT: mjtLabel = mjtLabel(9); - pub const FLEX: mjtLabel = mjtLabel(10); - pub const SKIN: mjtLabel = mjtLabel(11); - pub const SELECTION: mjtLabel = mjtLabel(12); - pub const SELPNT: mjtLabel = mjtLabel(13); - pub const CONTACTPOINT: mjtLabel = mjtLabel(14); - pub const CONTACTFORCE: mjtLabel = mjtLabel(15); - pub const ISLAND: mjtLabel = mjtLabel(16); - const mjNLABEL: mjtLabel = mjtLabel(17); +pub struct mjtMark(pub(crate) ::core::ffi::c_uint); +impl mjtLimited { + pub const FALSE: mjtLimited = mjtLimited(0); + pub const TRUE: mjtLimited = mjtLimited(1); + pub const AUTO: mjtLimited = mjtLimited(2); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtLabel(pub(crate) ::core::ffi::c_uint); -pub const mjNFRAME: usize = mjtFrame::mjNFRAME.0 as usize; -impl mjtFrame { - pub const NONE: mjtFrame = mjtFrame(0); - pub const BODY: mjtFrame = mjtFrame(1); - pub const GEOM: mjtFrame = mjtFrame(2); - pub const SITE: mjtFrame = mjtFrame(3); - pub const CAMERA: mjtFrame = mjtFrame(4); - pub const LIGHT: mjtFrame = mjtFrame(5); - pub const CONTACT: mjtFrame = mjtFrame(6); - pub const WORLD: mjtFrame = mjtFrame(7); - const mjNFRAME: mjtFrame = mjtFrame(8); +pub struct mjtLimited(pub(crate) ::core::ffi::c_uint); +impl mjtAlignFree { + pub const FALSE: mjtAlignFree = mjtAlignFree(0); + pub const TRUE: mjtAlignFree = mjtAlignFree(1); + pub const AUTO: mjtAlignFree = mjtAlignFree(2); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtFrame(pub(crate) ::core::ffi::c_uint); -pub const mjNVISFLAG: usize = mjtVisFlag::mjNVISFLAG.0 as usize; -impl mjtVisFlag { - pub const CONVEXHULL: mjtVisFlag = mjtVisFlag(0); - pub const TEXTURE: mjtVisFlag = mjtVisFlag(1); - pub const JOINT: mjtVisFlag = mjtVisFlag(2); - pub const CAMERA: mjtVisFlag = mjtVisFlag(3); - pub const ACTUATOR: mjtVisFlag = mjtVisFlag(4); - pub const ACTIVATION: mjtVisFlag = mjtVisFlag(5); - pub const LIGHT: mjtVisFlag = mjtVisFlag(6); - pub const TENDON: mjtVisFlag = mjtVisFlag(7); - pub const RANGEFINDER: mjtVisFlag = mjtVisFlag(8); - pub const CONSTRAINT: mjtVisFlag = mjtVisFlag(9); - pub const INERTIA: mjtVisFlag = mjtVisFlag(10); - pub const SCLINERTIA: mjtVisFlag = mjtVisFlag(11); - pub const PERTFORCE: mjtVisFlag = mjtVisFlag(12); - pub const PERTOBJ: mjtVisFlag = mjtVisFlag(13); - pub const CONTACTPOINT: mjtVisFlag = mjtVisFlag(14); - pub const ISLAND: mjtVisFlag = mjtVisFlag(15); - pub const CONTACTFORCE: mjtVisFlag = mjtVisFlag(16); - pub const CONTACTSPLIT: mjtVisFlag = mjtVisFlag(17); - pub const TRANSPARENT: mjtVisFlag = mjtVisFlag(18); - pub const AUTOCONNECT: mjtVisFlag = mjtVisFlag(19); - pub const COM: mjtVisFlag = mjtVisFlag(20); - pub const SELECT: mjtVisFlag = mjtVisFlag(21); - pub const STATIC: mjtVisFlag = mjtVisFlag(22); - pub const SKIN: mjtVisFlag = mjtVisFlag(23); - pub const FLEXVERT: mjtVisFlag = mjtVisFlag(24); - pub const FLEXEDGE: mjtVisFlag = mjtVisFlag(25); - pub const FLEXFACE: mjtVisFlag = mjtVisFlag(26); - pub const FLEXSKIN: mjtVisFlag = mjtVisFlag(27); - pub const BODYBVH: mjtVisFlag = mjtVisFlag(28); - pub const FLEXBVH: mjtVisFlag = mjtVisFlag(29); - pub const MESHBVH: mjtVisFlag = mjtVisFlag(30); - pub const SDFITER: mjtVisFlag = mjtVisFlag(31); - const mjNVISFLAG: mjtVisFlag = mjtVisFlag(32); -} -#[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtVisFlag(pub(crate) ::core::ffi::c_uint); -pub const mjNRNDFLAG: usize = mjtRndFlag::mjNRNDFLAG.0 as usize; -impl mjtRndFlag { - pub const SHADOW: mjtRndFlag = mjtRndFlag(0); - pub const WIREFRAME: mjtRndFlag = mjtRndFlag(1); - pub const REFLECTION: mjtRndFlag = mjtRndFlag(2); - pub const ADDITIVE: mjtRndFlag = mjtRndFlag(3); - pub const SKYBOX: mjtRndFlag = mjtRndFlag(4); - pub const FOG: mjtRndFlag = mjtRndFlag(5); - pub const HAZE: mjtRndFlag = mjtRndFlag(6); - pub const SEGMENT: mjtRndFlag = mjtRndFlag(7); - pub const IDCOLOR: mjtRndFlag = mjtRndFlag(8); - pub const CULL_FACE: mjtRndFlag = mjtRndFlag(9); - const mjNRNDFLAG: mjtRndFlag = mjtRndFlag(10); +pub struct mjtAlignFree(pub(crate) ::core::ffi::c_uint); +impl mjtInertiaFromGeom { + pub const FALSE: mjtInertiaFromGeom = mjtInertiaFromGeom(0); + pub const TRUE: mjtInertiaFromGeom = mjtInertiaFromGeom(1); + pub const AUTO: mjtInertiaFromGeom = mjtInertiaFromGeom(2); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtRndFlag(pub(crate) ::core::ffi::c_uint); -impl mjtStereo { - pub const NONE: mjtStereo = mjtStereo(0); - pub const QUADBUFFERED: mjtStereo = mjtStereo(1); - pub const SIDEBYSIDE: mjtStereo = mjtStereo(2); +pub struct mjtInertiaFromGeom(pub(crate) ::core::ffi::c_uint); +impl mjtOrientation { + pub const QUAT: mjtOrientation = mjtOrientation(0); + pub const AXISANGLE: mjtOrientation = mjtOrientation(1); + pub const XYAXES: mjtOrientation = mjtOrientation(2); + pub const ZAXIS: mjtOrientation = mjtOrientation(3); + pub const EULER: mjtOrientation = mjtOrientation(4); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtStereo(pub(crate) ::core::ffi::c_uint); +pub struct mjtOrientation(pub(crate) ::core::ffi::c_uint); #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjvPerturb { - pub(crate) select: ::core::ffi::c_int, - pub(crate) flexselect: ::core::ffi::c_int, - pub(crate) skinselect: ::core::ffi::c_int, - pub(crate) active: ::core::ffi::c_int, - pub(crate) active2: ::core::ffi::c_int, - pub(crate) refpos: [mjtNum; 3usize], - pub(crate) refquat: [mjtNum; 4usize], - pub(crate) refselpos: [mjtNum; 3usize], - pub(crate) localpos: [mjtNum; 3usize], - pub(crate) localmass: mjtNum, - pub(crate) scale: mjtNum, +pub struct mjsElement { + pub(crate) elemtype: mjtObj, + pub(crate) signature: u64, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjvCamera { - pub(crate) type_: ::core::ffi::c_int, - pub(crate) fixedcamid: ::core::ffi::c_int, - pub(crate) trackbodyid: ::core::ffi::c_int, - pub(crate) lookat: [mjtNum; 3usize], - pub(crate) distance: mjtNum, - pub(crate) azimuth: mjtNum, - pub(crate) elevation: mjtNum, - pub(crate) orthographic: ::core::ffi::c_int, +pub struct mjsCompiler { + pub(crate) autolimits: mjtByte, + pub(crate) boundmass: f64, + pub(crate) boundinertia: f64, + pub(crate) settotalmass: f64, + pub(crate) balanceinertia: mjtByte, + pub(crate) fitaabb: mjtByte, + pub(crate) degree: mjtByte, + pub(crate) eulerseq: [::core::ffi::c_char; 3usize], + pub(crate) discardvisual: mjtByte, + pub(crate) usethread: mjtByte, + pub(crate) fusestatic: mjtByte, + pub(crate) inertiafromgeom: ::core::ffi::c_int, + pub(crate) inertiagrouprange: [::core::ffi::c_int; 2usize], + pub(crate) saveinertial: mjtByte, + pub(crate) alignfree: ::core::ffi::c_int, + pub(crate) LRopt: mjLROpt, + pub(crate) meshdir: *mut mjString, + pub(crate) texturedir: *mut mjString, +} +#[repr(C)] +#[derive(Debug)] +pub struct mjSpec { + pub(crate) element: *mut mjsElement, + pub(crate) modelname: *mut mjString, + pub(crate) compiler: mjsCompiler, + pub(crate) strippath: mjtByte, + pub(crate) option: mjOption, + pub(crate) visual: mjVisual, + pub(crate) stat: mjStatistic, + pub(crate) memory: mjtSize, + pub(crate) nemax: ::core::ffi::c_int, + pub(crate) nuserdata: ::core::ffi::c_int, + pub(crate) nuser_body: ::core::ffi::c_int, + pub(crate) nuser_jnt: ::core::ffi::c_int, + pub(crate) nuser_geom: ::core::ffi::c_int, + pub(crate) nuser_site: ::core::ffi::c_int, + pub(crate) nuser_cam: ::core::ffi::c_int, + pub(crate) nuser_tendon: ::core::ffi::c_int, + pub(crate) nuser_actuator: ::core::ffi::c_int, + pub(crate) nuser_sensor: ::core::ffi::c_int, + pub(crate) nkey: ::core::ffi::c_int, + pub(crate) njmax: ::core::ffi::c_int, + pub(crate) nconmax: ::core::ffi::c_int, + pub(crate) nstack: mjtSize, + pub(crate) comment: *mut mjString, + pub(crate) modelfiledir: *mut mjString, + pub(crate) hasImplicitPluginElem: mjtByte, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjvGLCamera { - pub(crate) pos: [f32; 3usize], - pub(crate) forward: [f32; 3usize], - pub(crate) up: [f32; 3usize], - pub(crate) frustum_center: f32, - pub(crate) frustum_width: f32, - pub(crate) frustum_bottom: f32, - pub(crate) frustum_top: f32, - pub(crate) frustum_near: f32, - pub(crate) frustum_far: f32, - pub(crate) orthographic: ::core::ffi::c_int, +pub struct mjsOrientation { + pub(crate) type_: mjtOrientation, + pub(crate) axisangle: [f64; 4usize], + pub(crate) xyaxes: [f64; 6usize], + pub(crate) zaxis: [f64; 3usize], + pub(crate) euler: [f64; 3usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjvGeom { - pub(crate) type_: ::core::ffi::c_int, - pub(crate) dataid: ::core::ffi::c_int, - pub(crate) objtype: ::core::ffi::c_int, - pub(crate) objid: ::core::ffi::c_int, - pub(crate) category: ::core::ffi::c_int, - pub(crate) matid: ::core::ffi::c_int, - pub(crate) texcoord: ::core::ffi::c_int, - pub(crate) segid: ::core::ffi::c_int, - pub(crate) size: [f32; 3usize], - pub(crate) pos: [f32; 3usize], - pub(crate) mat: [f32; 9usize], - pub(crate) rgba: [f32; 4usize], - pub(crate) emission: f32, - pub(crate) specular: f32, - pub(crate) shininess: f32, - pub(crate) reflectance: f32, - pub(crate) label: [::core::ffi::c_char; 100usize], - pub(crate) camdist: f32, - pub(crate) modelrbound: f32, - pub(crate) transparent: mjtByte, +pub struct mjsPlugin { + pub(crate) element: *mut mjsElement, + pub(crate) name: *mut mjString, + pub(crate) plugin_name: *mut mjString, + pub(crate) active: mjtByte, + pub(crate) info: *mut mjString, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjvLight { - pub(crate) pos: [f32; 3usize], - pub(crate) dir: [f32; 3usize], - pub(crate) attenuation: [f32; 3usize], - pub(crate) cutoff: f32, - pub(crate) exponent: f32, - pub(crate) ambient: [f32; 3usize], - pub(crate) diffuse: [f32; 3usize], - pub(crate) specular: [f32; 3usize], - pub(crate) headlight: mjtByte, - pub(crate) directional: mjtByte, - pub(crate) castshadow: mjtByte, - pub(crate) bulbradius: f32, +pub struct mjsBody { + pub(crate) element: *mut mjsElement, + pub(crate) childclass: *mut mjString, + pub(crate) pos: [f64; 3usize], + pub(crate) quat: [f64; 4usize], + pub(crate) alt: mjsOrientation, + pub(crate) mass: f64, + pub(crate) ipos: [f64; 3usize], + pub(crate) iquat: [f64; 4usize], + pub(crate) inertia: [f64; 3usize], + pub(crate) ialt: mjsOrientation, + pub(crate) fullinertia: [f64; 6usize], + pub(crate) mocap: mjtByte, + pub(crate) gravcomp: f64, + pub(crate) sleep: mjtSleepPolicy, + pub(crate) userdata: *mut mjDoubleVec, + pub(crate) explicitinertial: mjtByte, + pub(crate) plugin: mjsPlugin, + pub(crate) info: *mut mjString, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjvOption { - pub(crate) label: ::core::ffi::c_int, - pub(crate) frame: ::core::ffi::c_int, - pub(crate) geomgroup: [mjtByte; 6usize], - pub(crate) sitegroup: [mjtByte; 6usize], - pub(crate) jointgroup: [mjtByte; 6usize], - pub(crate) tendongroup: [mjtByte; 6usize], - pub(crate) actuatorgroup: [mjtByte; 6usize], - pub(crate) flexgroup: [mjtByte; 6usize], - pub(crate) skingroup: [mjtByte; 6usize], - pub(crate) flags: [mjtByte; 32usize], - pub(crate) bvh_depth: ::core::ffi::c_int, - pub(crate) flex_layer: ::core::ffi::c_int, +pub struct mjsFrame { + pub(crate) element: *mut mjsElement, + pub(crate) childclass: *mut mjString, + pub(crate) pos: [f64; 3usize], + pub(crate) quat: [f64; 4usize], + pub(crate) alt: mjsOrientation, + pub(crate) info: *mut mjString, } #[repr(C)] -#[derive(Debug)] -pub struct mjvScene { - pub(crate) maxgeom: ::core::ffi::c_int, - pub(crate) ngeom: ::core::ffi::c_int, - pub(crate) geoms: *mut mjvGeom, - pub(crate) geomorder: *mut ::core::ffi::c_int, - pub(crate) nflex: ::core::ffi::c_int, - pub(crate) flexedgeadr: *mut ::core::ffi::c_int, - pub(crate) flexedgenum: *mut ::core::ffi::c_int, - pub(crate) flexvertadr: *mut ::core::ffi::c_int, - pub(crate) flexvertnum: *mut ::core::ffi::c_int, - pub(crate) flexfaceadr: *mut ::core::ffi::c_int, - pub(crate) flexfacenum: *mut ::core::ffi::c_int, - pub(crate) flexfaceused: *mut ::core::ffi::c_int, - pub(crate) flexedge: *mut ::core::ffi::c_int, - pub(crate) flexvert: *mut f32, - pub(crate) flexface: *mut f32, - pub(crate) flexnormal: *mut f32, - pub(crate) flextexcoord: *mut f32, - pub(crate) flexvertopt: mjtByte, - pub(crate) flexedgeopt: mjtByte, - pub(crate) flexfaceopt: mjtByte, - pub(crate) flexskinopt: mjtByte, - pub(crate) nskin: ::core::ffi::c_int, - pub(crate) skinfacenum: *mut ::core::ffi::c_int, - pub(crate) skinvertadr: *mut ::core::ffi::c_int, - pub(crate) skinvertnum: *mut ::core::ffi::c_int, - pub(crate) skinvert: *mut f32, - pub(crate) skinnormal: *mut f32, - pub(crate) nlight: ::core::ffi::c_int, - pub(crate) lights: [mjvLight; 100usize], - pub(crate) camera: [mjvGLCamera; 2usize], - pub(crate) enabletransform: mjtByte, - pub(crate) translate: [f32; 3usize], - pub(crate) rotate: [f32; 4usize], - pub(crate) scale: f32, - pub(crate) stereo: ::core::ffi::c_int, - pub(crate) flags: [mjtByte; 10usize], - pub(crate) framewidth: ::core::ffi::c_int, - pub(crate) framergb: [f32; 3usize], +#[derive(Debug, Copy, Clone)] +pub struct mjsJoint { + pub(crate) element: *mut mjsElement, + pub(crate) type_: mjtJoint, + pub(crate) pos: [f64; 3usize], + pub(crate) axis: [f64; 3usize], + pub(crate) ref_: f64, + pub(crate) align: ::core::ffi::c_int, + pub(crate) stiffness: f64, + pub(crate) springref: f64, + pub(crate) springdamper: [f64; 2usize], + pub(crate) limited: ::core::ffi::c_int, + pub(crate) range: [f64; 2usize], + pub(crate) margin: f64, + pub(crate) solref_limit: [mjtNum; 2usize], + pub(crate) solimp_limit: [mjtNum; 5usize], + pub(crate) actfrclimited: ::core::ffi::c_int, + pub(crate) actfrcrange: [f64; 2usize], + pub(crate) armature: f64, + pub(crate) damping: f64, + pub(crate) frictionloss: f64, + pub(crate) solref_friction: [mjtNum; 2usize], + pub(crate) solimp_friction: [mjtNum; 5usize], + pub(crate) group: ::core::ffi::c_int, + pub(crate) actgravcomp: mjtByte, + pub(crate) userdata: *mut mjDoubleVec, + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsGeom { + pub(crate) element: *mut mjsElement, + pub(crate) type_: mjtGeom, + pub(crate) pos: [f64; 3usize], + pub(crate) quat: [f64; 4usize], + pub(crate) alt: mjsOrientation, + pub(crate) fromto: [f64; 6usize], + pub(crate) size: [f64; 3usize], + pub(crate) contype: ::core::ffi::c_int, + pub(crate) conaffinity: ::core::ffi::c_int, + pub(crate) condim: ::core::ffi::c_int, + pub(crate) priority: ::core::ffi::c_int, + pub(crate) friction: [f64; 3usize], + pub(crate) solmix: f64, + pub(crate) solref: [mjtNum; 2usize], + pub(crate) solimp: [mjtNum; 5usize], + pub(crate) margin: f64, + pub(crate) gap: f64, + pub(crate) mass: f64, + pub(crate) density: f64, + pub(crate) typeinertia: mjtGeomInertia, + pub(crate) fluid_ellipsoid: mjtNum, + pub(crate) fluid_coefs: [mjtNum; 5usize], + pub(crate) material: *mut mjString, + pub(crate) rgba: [f32; 4usize], + pub(crate) group: ::core::ffi::c_int, + pub(crate) hfieldname: *mut mjString, + pub(crate) meshname: *mut mjString, + pub(crate) fitscale: f64, + pub(crate) userdata: *mut mjDoubleVec, + pub(crate) plugin: mjsPlugin, + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsSite { + pub(crate) element: *mut mjsElement, + pub(crate) pos: [f64; 3usize], + pub(crate) quat: [f64; 4usize], + pub(crate) alt: mjsOrientation, + pub(crate) fromto: [f64; 6usize], + pub(crate) size: [f64; 3usize], + pub(crate) type_: mjtGeom, + pub(crate) material: *mut mjString, + pub(crate) group: ::core::ffi::c_int, + pub(crate) rgba: [f32; 4usize], + pub(crate) userdata: *mut mjDoubleVec, + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsCamera { + pub(crate) element: *mut mjsElement, + pub(crate) pos: [f64; 3usize], + pub(crate) quat: [f64; 4usize], + pub(crate) alt: mjsOrientation, + pub(crate) mode: mjtCamLight, + pub(crate) targetbody: *mut mjString, + pub(crate) orthographic: ::core::ffi::c_int, + pub(crate) fovy: f64, + pub(crate) ipd: f64, + pub(crate) intrinsic: [f32; 4usize], + pub(crate) sensor_size: [f32; 2usize], + pub(crate) resolution: [f32; 2usize], + pub(crate) focal_length: [f32; 2usize], + pub(crate) focal_pixel: [f32; 2usize], + pub(crate) principal_length: [f32; 2usize], + pub(crate) principal_pixel: [f32; 2usize], + pub(crate) userdata: *mut mjDoubleVec, + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsLight { + pub(crate) element: *mut mjsElement, + pub(crate) pos: [f64; 3usize], + pub(crate) dir: [f64; 3usize], + pub(crate) mode: mjtCamLight, + pub(crate) targetbody: *mut mjString, + pub(crate) active: mjtByte, + pub(crate) type_: mjtLightType, + pub(crate) texture: *mut mjString, + pub(crate) castshadow: mjtByte, + pub(crate) bulbradius: f32, + pub(crate) intensity: f32, + pub(crate) range: f32, + pub(crate) attenuation: [f32; 3usize], + pub(crate) cutoff: f32, + pub(crate) exponent: f32, + pub(crate) ambient: [f32; 3usize], + pub(crate) diffuse: [f32; 3usize], + pub(crate) specular: [f32; 3usize], + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsFlex { + pub(crate) element: *mut mjsElement, + pub(crate) contype: ::core::ffi::c_int, + pub(crate) conaffinity: ::core::ffi::c_int, + pub(crate) condim: ::core::ffi::c_int, + pub(crate) priority: ::core::ffi::c_int, + pub(crate) friction: [f64; 3usize], + pub(crate) solmix: f64, + pub(crate) solref: [mjtNum; 2usize], + pub(crate) solimp: [mjtNum; 5usize], + pub(crate) margin: f64, + pub(crate) gap: f64, + pub(crate) dim: ::core::ffi::c_int, + pub(crate) radius: f64, + pub(crate) internal: mjtByte, + pub(crate) flatskin: mjtByte, + pub(crate) selfcollide: ::core::ffi::c_int, + pub(crate) vertcollide: ::core::ffi::c_int, + pub(crate) passive: ::core::ffi::c_int, + pub(crate) activelayers: ::core::ffi::c_int, + pub(crate) group: ::core::ffi::c_int, + pub(crate) edgestiffness: f64, + pub(crate) edgedamping: f64, + pub(crate) rgba: [f32; 4usize], + pub(crate) material: *mut mjString, + pub(crate) young: f64, + pub(crate) poisson: f64, + pub(crate) damping: f64, + pub(crate) thickness: f64, + pub(crate) elastic2d: ::core::ffi::c_int, + pub(crate) nodebody: *mut mjStringVec, + pub(crate) vertbody: *mut mjStringVec, + pub(crate) node: *mut mjDoubleVec, + pub(crate) vert: *mut mjDoubleVec, + pub(crate) elem: *mut mjIntVec, + pub(crate) texcoord: *mut mjFloatVec, + pub(crate) elemtexcoord: *mut mjIntVec, + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsMesh { + pub(crate) element: *mut mjsElement, + pub(crate) content_type: *mut mjString, + pub(crate) file: *mut mjString, + pub(crate) refpos: [f64; 3usize], + pub(crate) refquat: [f64; 4usize], + pub(crate) scale: [f64; 3usize], + pub(crate) inertia: mjtMeshInertia, + pub(crate) smoothnormal: mjtByte, + pub(crate) needsdf: mjtByte, + pub(crate) maxhullvert: ::core::ffi::c_int, + pub(crate) uservert: *mut mjFloatVec, + pub(crate) usernormal: *mut mjFloatVec, + pub(crate) usertexcoord: *mut mjFloatVec, + pub(crate) userface: *mut mjIntVec, + pub(crate) userfacenormal: *mut mjIntVec, + pub(crate) userfacetexcoord: *mut mjIntVec, + pub(crate) plugin: mjsPlugin, + pub(crate) material: *mut mjString, + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsHField { + pub(crate) element: *mut mjsElement, + pub(crate) content_type: *mut mjString, + pub(crate) file: *mut mjString, + pub(crate) size: [f64; 4usize], + pub(crate) nrow: ::core::ffi::c_int, + pub(crate) ncol: ::core::ffi::c_int, + pub(crate) userdata: *mut mjFloatVec, + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsSkin { + pub(crate) element: *mut mjsElement, + pub(crate) file: *mut mjString, + pub(crate) material: *mut mjString, + pub(crate) rgba: [f32; 4usize], + pub(crate) inflate: f32, + pub(crate) group: ::core::ffi::c_int, + pub(crate) vert: *mut mjFloatVec, + pub(crate) texcoord: *mut mjFloatVec, + pub(crate) face: *mut mjIntVec, + pub(crate) bodyname: *mut mjStringVec, + pub(crate) bindpos: *mut mjFloatVec, + pub(crate) bindquat: *mut mjFloatVec, + pub(crate) vertid: *mut mjIntVecVec, + pub(crate) vertweight: *mut mjFloatVecVec, + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsTexture { + pub(crate) element: *mut mjsElement, + pub(crate) type_: mjtTexture, + pub(crate) colorspace: mjtColorSpace, + pub(crate) builtin: ::core::ffi::c_int, + pub(crate) mark: ::core::ffi::c_int, + pub(crate) rgb1: [f64; 3usize], + pub(crate) rgb2: [f64; 3usize], + pub(crate) markrgb: [f64; 3usize], + pub(crate) random: f64, + pub(crate) height: ::core::ffi::c_int, + pub(crate) width: ::core::ffi::c_int, + pub(crate) nchannel: ::core::ffi::c_int, + pub(crate) content_type: *mut mjString, + pub(crate) file: *mut mjString, + pub(crate) gridsize: [::core::ffi::c_int; 2usize], + pub(crate) gridlayout: [::core::ffi::c_char; 12usize], + pub(crate) cubefiles: *mut mjStringVec, + pub(crate) data: *mut mjByteVec, + pub(crate) hflip: mjtByte, + pub(crate) vflip: mjtByte, + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsMaterial { + pub(crate) element: *mut mjsElement, + pub(crate) textures: *mut mjStringVec, + pub(crate) texuniform: mjtByte, + pub(crate) texrepeat: [f32; 2usize], + pub(crate) emission: f32, + pub(crate) specular: f32, + pub(crate) shininess: f32, + pub(crate) reflectance: f32, + pub(crate) metallic: f32, + pub(crate) roughness: f32, + pub(crate) rgba: [f32; 4usize], + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsPair { + pub(crate) element: *mut mjsElement, + pub(crate) geomname1: *mut mjString, + pub(crate) geomname2: *mut mjString, + pub(crate) condim: ::core::ffi::c_int, + pub(crate) solref: [mjtNum; 2usize], + pub(crate) solreffriction: [mjtNum; 2usize], + pub(crate) solimp: [mjtNum; 5usize], + pub(crate) margin: f64, + pub(crate) gap: f64, + pub(crate) friction: [f64; 5usize], + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsExclude { + pub(crate) element: *mut mjsElement, + pub(crate) bodyname1: *mut mjString, + pub(crate) bodyname2: *mut mjString, + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsEquality { + pub(crate) element: *mut mjsElement, + pub(crate) type_: mjtEq, + pub(crate) data: [f64; 11usize], + pub(crate) active: mjtByte, + pub(crate) name1: *mut mjString, + pub(crate) name2: *mut mjString, + pub(crate) objtype: mjtObj, + pub(crate) solref: [mjtNum; 2usize], + pub(crate) solimp: [mjtNum; 5usize], + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsTendon { + pub(crate) element: *mut mjsElement, + pub(crate) stiffness: f64, + pub(crate) springlength: [f64; 2usize], + pub(crate) damping: f64, + pub(crate) frictionloss: f64, + pub(crate) solref_friction: [mjtNum; 2usize], + pub(crate) solimp_friction: [mjtNum; 5usize], + pub(crate) armature: f64, + pub(crate) limited: ::core::ffi::c_int, + pub(crate) actfrclimited: ::core::ffi::c_int, + pub(crate) range: [f64; 2usize], + pub(crate) actfrcrange: [f64; 2usize], + pub(crate) margin: f64, + pub(crate) solref_limit: [mjtNum; 2usize], + pub(crate) solimp_limit: [mjtNum; 5usize], + pub(crate) material: *mut mjString, + pub(crate) width: f64, + pub(crate) rgba: [f32; 4usize], + pub(crate) group: ::core::ffi::c_int, + pub(crate) userdata: *mut mjDoubleVec, + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsWrap { + pub(crate) element: *mut mjsElement, + pub(crate) type_: mjtWrap, + pub(crate) info: *mut mjString, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjsActuator { + pub(crate) element: *mut mjsElement, + pub(crate) gaintype: mjtGain, + pub(crate) gainprm: [f64; 10usize], + pub(crate) biastype: mjtBias, + pub(crate) biasprm: [f64; 10usize], + pub(crate) dyntype: mjtDyn, + pub(crate) dynprm: [f64; 10usize], + pub(crate) actdim: ::core::ffi::c_int, + pub(crate) actearly: mjtByte, + pub(crate) trntype: mjtTrn, + pub(crate) gear: [f64; 6usize], + pub(crate) target: *mut mjString, + pub(crate) refsite: *mut mjString, + pub(crate) slidersite: *mut mjString, + pub(crate) cranklength: f64, + pub(crate) lengthrange: [f64; 2usize], + pub(crate) inheritrange: f64, + pub(crate) ctrllimited: ::core::ffi::c_int, + pub(crate) ctrlrange: [f64; 2usize], + pub(crate) forcelimited: ::core::ffi::c_int, + pub(crate) forcerange: [f64; 2usize], + pub(crate) actlimited: ::core::ffi::c_int, + pub(crate) actrange: [f64; 2usize], + pub(crate) group: ::core::ffi::c_int, + pub(crate) userdata: *mut mjDoubleVec, + pub(crate) plugin: mjsPlugin, + pub(crate) info: *mut mjString, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjvFigure { - pub(crate) flg_legend: ::core::ffi::c_int, - pub(crate) flg_ticklabel: [::core::ffi::c_int; 2usize], - pub(crate) flg_extend: ::core::ffi::c_int, - pub(crate) flg_barplot: ::core::ffi::c_int, - pub(crate) flg_selection: ::core::ffi::c_int, - pub(crate) flg_symmetric: ::core::ffi::c_int, - pub(crate) linewidth: f32, - pub(crate) gridwidth: f32, - pub(crate) gridsize: [::core::ffi::c_int; 2usize], - pub(crate) gridrgb: [f32; 3usize], - pub(crate) figurergba: [f32; 4usize], - pub(crate) panergba: [f32; 4usize], - pub(crate) legendrgba: [f32; 4usize], - pub(crate) textrgb: [f32; 3usize], - pub(crate) linergb: [[f32; 3usize]; 100usize], - pub(crate) range: [[f32; 2usize]; 2usize], - pub(crate) xformat: [::core::ffi::c_char; 20usize], - pub(crate) yformat: [::core::ffi::c_char; 20usize], - pub(crate) minwidth: [::core::ffi::c_char; 20usize], - pub(crate) title: [::core::ffi::c_char; 1000usize], - pub(crate) xlabel: [::core::ffi::c_char; 100usize], - pub(crate) linename: [[::core::ffi::c_char; 100usize]; 100usize], - pub(crate) legendoffset: ::core::ffi::c_int, - pub(crate) subplot: ::core::ffi::c_int, - pub(crate) highlight: [::core::ffi::c_int; 2usize], - pub(crate) highlightid: ::core::ffi::c_int, - pub(crate) selection: f32, - pub(crate) linepnt: [::core::ffi::c_int; 100usize], - pub(crate) linedata: [[f32; 2000usize]; 100usize], - pub(crate) xaxispixel: [::core::ffi::c_int; 2usize], - pub(crate) yaxispixel: [::core::ffi::c_int; 2usize], - pub(crate) xaxisdata: [f32; 2usize], - pub(crate) yaxisdata: [f32; 2usize], +pub struct mjsSensor { + pub(crate) element: *mut mjsElement, + pub(crate) type_: mjtSensor, + pub(crate) objtype: mjtObj, + pub(crate) objname: *mut mjString, + pub(crate) reftype: mjtObj, + pub(crate) refname: *mut mjString, + pub(crate) intprm: [::core::ffi::c_int; 3usize], + pub(crate) datatype: mjtDataType, + pub(crate) needstage: mjtStage, + pub(crate) dim: ::core::ffi::c_int, + pub(crate) cutoff: f64, + pub(crate) noise: f64, + pub(crate) userdata: *mut mjDoubleVec, + pub(crate) plugin: mjsPlugin, + pub(crate) info: *mut mjString, } #[repr(C)] -#[derive(Debug)] -pub struct mjvSceneState { - pub(crate) nbuffer: ::core::ffi::c_int, - pub(crate) buffer: *mut ::core::ffi::c_void, - pub(crate) maxgeom: ::core::ffi::c_int, - pub(crate) scratch: mjvScene, - pub(crate) model: mjvSceneState___bindgen_ty_1, - pub(crate) data: mjvSceneState___bindgen_ty_2, +#[derive(Debug, Copy, Clone)] +pub struct mjsNumeric { + pub(crate) element: *mut mjsElement, + pub(crate) data: *mut mjDoubleVec, + pub(crate) size: ::core::ffi::c_int, + pub(crate) info: *mut mjString, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjvSceneState___bindgen_ty_1 { - pub(crate) nv: ::core::ffi::c_int, - pub(crate) nu: ::core::ffi::c_int, - pub(crate) na: ::core::ffi::c_int, - pub(crate) nbody: ::core::ffi::c_int, - pub(crate) nbvh: ::core::ffi::c_int, - pub(crate) nbvhstatic: ::core::ffi::c_int, - pub(crate) njnt: ::core::ffi::c_int, - pub(crate) ngeom: ::core::ffi::c_int, - pub(crate) nsite: ::core::ffi::c_int, - pub(crate) ncam: ::core::ffi::c_int, - pub(crate) nlight: ::core::ffi::c_int, - pub(crate) nmesh: ::core::ffi::c_int, - pub(crate) nskin: ::core::ffi::c_int, - pub(crate) nflex: ::core::ffi::c_int, - pub(crate) nflexvert: ::core::ffi::c_int, - pub(crate) nflextexcoord: ::core::ffi::c_int, - pub(crate) nskinvert: ::core::ffi::c_int, - pub(crate) nskinface: ::core::ffi::c_int, - pub(crate) nskinbone: ::core::ffi::c_int, - pub(crate) nskinbonevert: ::core::ffi::c_int, - pub(crate) nmat: ::core::ffi::c_int, - pub(crate) neq: ::core::ffi::c_int, - pub(crate) ntendon: ::core::ffi::c_int, - pub(crate) ntree: ::core::ffi::c_int, - pub(crate) nwrap: ::core::ffi::c_int, - pub(crate) nsensor: ::core::ffi::c_int, - pub(crate) nnames: ::core::ffi::c_int, - pub(crate) npaths: ::core::ffi::c_int, - pub(crate) nsensordata: ::core::ffi::c_int, - pub(crate) narena: ::core::ffi::c_int, - pub(crate) opt: mjOption, - pub(crate) vis: mjVisual, - pub(crate) stat: mjStatistic, - pub(crate) body_parentid: *mut ::core::ffi::c_int, - pub(crate) body_rootid: *mut ::core::ffi::c_int, - pub(crate) body_weldid: *mut ::core::ffi::c_int, - pub(crate) body_mocapid: *mut ::core::ffi::c_int, - pub(crate) body_jntnum: *mut ::core::ffi::c_int, - pub(crate) body_jntadr: *mut ::core::ffi::c_int, - pub(crate) body_dofnum: *mut ::core::ffi::c_int, - pub(crate) body_dofadr: *mut ::core::ffi::c_int, - pub(crate) body_geomnum: *mut ::core::ffi::c_int, - pub(crate) body_geomadr: *mut ::core::ffi::c_int, - pub(crate) body_iquat: *mut mjtNum, - pub(crate) body_mass: *mut mjtNum, - pub(crate) body_inertia: *mut mjtNum, - pub(crate) body_bvhadr: *mut ::core::ffi::c_int, - pub(crate) body_bvhnum: *mut ::core::ffi::c_int, - pub(crate) bvh_depth: *mut ::core::ffi::c_int, - pub(crate) bvh_child: *mut ::core::ffi::c_int, - pub(crate) bvh_nodeid: *mut ::core::ffi::c_int, - pub(crate) bvh_aabb: *mut mjtNum, - pub(crate) jnt_type: *mut ::core::ffi::c_int, - pub(crate) jnt_bodyid: *mut ::core::ffi::c_int, - pub(crate) jnt_group: *mut ::core::ffi::c_int, - pub(crate) geom_type: *mut ::core::ffi::c_int, - pub(crate) geom_bodyid: *mut ::core::ffi::c_int, - pub(crate) geom_contype: *mut ::core::ffi::c_int, - pub(crate) geom_conaffinity: *mut ::core::ffi::c_int, - pub(crate) geom_dataid: *mut ::core::ffi::c_int, - pub(crate) geom_matid: *mut ::core::ffi::c_int, - pub(crate) geom_group: *mut ::core::ffi::c_int, - pub(crate) geom_size: *mut mjtNum, - pub(crate) geom_aabb: *mut mjtNum, - pub(crate) geom_rbound: *mut mjtNum, - pub(crate) geom_rgba: *mut f32, - pub(crate) site_type: *mut ::core::ffi::c_int, - pub(crate) site_bodyid: *mut ::core::ffi::c_int, - pub(crate) site_matid: *mut ::core::ffi::c_int, - pub(crate) site_group: *mut ::core::ffi::c_int, - pub(crate) site_size: *mut mjtNum, - pub(crate) site_rgba: *mut f32, - pub(crate) cam_orthographic: *mut ::core::ffi::c_int, - pub(crate) cam_fovy: *mut mjtNum, - pub(crate) cam_ipd: *mut mjtNum, - pub(crate) cam_resolution: *mut ::core::ffi::c_int, - pub(crate) cam_sensorsize: *mut f32, - pub(crate) cam_intrinsic: *mut f32, - pub(crate) light_directional: *mut mjtByte, - pub(crate) light_castshadow: *mut mjtByte, - pub(crate) light_bulbradius: *mut f32, - pub(crate) light_active: *mut mjtByte, - pub(crate) light_attenuation: *mut f32, - pub(crate) light_cutoff: *mut f32, - pub(crate) light_exponent: *mut f32, - pub(crate) light_ambient: *mut f32, - pub(crate) light_diffuse: *mut f32, - pub(crate) light_specular: *mut f32, - pub(crate) flex_flatskin: *mut mjtByte, - pub(crate) flex_dim: *mut ::core::ffi::c_int, - pub(crate) flex_matid: *mut ::core::ffi::c_int, - pub(crate) flex_group: *mut ::core::ffi::c_int, - pub(crate) flex_interp: *mut ::core::ffi::c_int, - pub(crate) flex_nodeadr: *mut ::core::ffi::c_int, - pub(crate) flex_nodenum: *mut ::core::ffi::c_int, - pub(crate) flex_nodebodyid: *mut ::core::ffi::c_int, - pub(crate) flex_vertadr: *mut ::core::ffi::c_int, - pub(crate) flex_vertnum: *mut ::core::ffi::c_int, - pub(crate) flex_elem: *mut ::core::ffi::c_int, - pub(crate) flex_elemtexcoord: *mut ::core::ffi::c_int, - pub(crate) flex_elemlayer: *mut ::core::ffi::c_int, - pub(crate) flex_elemadr: *mut ::core::ffi::c_int, - pub(crate) flex_elemnum: *mut ::core::ffi::c_int, - pub(crate) flex_elemdataadr: *mut ::core::ffi::c_int, - pub(crate) flex_shell: *mut ::core::ffi::c_int, - pub(crate) flex_shellnum: *mut ::core::ffi::c_int, - pub(crate) flex_shelldataadr: *mut ::core::ffi::c_int, - pub(crate) flex_texcoordadr: *mut ::core::ffi::c_int, - pub(crate) flex_bvhadr: *mut ::core::ffi::c_int, - pub(crate) flex_bvhnum: *mut ::core::ffi::c_int, - pub(crate) flex_centered: *mut mjtByte, - pub(crate) flex_node: *mut mjtNum, - pub(crate) flex_radius: *mut mjtNum, - pub(crate) flex_rgba: *mut f32, - pub(crate) flex_texcoord: *mut f32, - pub(crate) hfield_pathadr: *mut ::core::ffi::c_int, - pub(crate) mesh_bvhadr: *mut ::core::ffi::c_int, - pub(crate) mesh_bvhnum: *mut ::core::ffi::c_int, - pub(crate) mesh_texcoordadr: *mut ::core::ffi::c_int, - pub(crate) mesh_graphadr: *mut ::core::ffi::c_int, - pub(crate) mesh_pathadr: *mut ::core::ffi::c_int, - pub(crate) skin_matid: *mut ::core::ffi::c_int, - pub(crate) skin_group: *mut ::core::ffi::c_int, - pub(crate) skin_rgba: *mut f32, - pub(crate) skin_inflate: *mut f32, - pub(crate) skin_vertadr: *mut ::core::ffi::c_int, - pub(crate) skin_vertnum: *mut ::core::ffi::c_int, - pub(crate) skin_texcoordadr: *mut ::core::ffi::c_int, - pub(crate) skin_faceadr: *mut ::core::ffi::c_int, - pub(crate) skin_facenum: *mut ::core::ffi::c_int, - pub(crate) skin_boneadr: *mut ::core::ffi::c_int, - pub(crate) skin_bonenum: *mut ::core::ffi::c_int, - pub(crate) skin_vert: *mut f32, - pub(crate) skin_face: *mut ::core::ffi::c_int, - pub(crate) skin_bonevertadr: *mut ::core::ffi::c_int, - pub(crate) skin_bonevertnum: *mut ::core::ffi::c_int, - pub(crate) skin_bonebindpos: *mut f32, - pub(crate) skin_bonebindquat: *mut f32, - pub(crate) skin_bonebodyid: *mut ::core::ffi::c_int, - pub(crate) skin_bonevertid: *mut ::core::ffi::c_int, - pub(crate) skin_bonevertweight: *mut f32, - pub(crate) skin_pathadr: *mut ::core::ffi::c_int, - pub(crate) tex_pathadr: *mut ::core::ffi::c_int, - pub(crate) mat_texid: *mut ::core::ffi::c_int, - pub(crate) mat_texuniform: *mut mjtByte, - pub(crate) mat_texrepeat: *mut f32, - pub(crate) mat_emission: *mut f32, - pub(crate) mat_specular: *mut f32, - pub(crate) mat_shininess: *mut f32, - pub(crate) mat_reflectance: *mut f32, - pub(crate) mat_metallic: *mut f32, - pub(crate) mat_roughness: *mut f32, - pub(crate) mat_rgba: *mut f32, - pub(crate) eq_type: *mut ::core::ffi::c_int, - pub(crate) eq_obj1id: *mut ::core::ffi::c_int, - pub(crate) eq_obj2id: *mut ::core::ffi::c_int, - pub(crate) eq_objtype: *mut ::core::ffi::c_int, - pub(crate) eq_data: *mut mjtNum, - pub(crate) tendon_num: *mut ::core::ffi::c_int, - pub(crate) tendon_matid: *mut ::core::ffi::c_int, - pub(crate) tendon_group: *mut ::core::ffi::c_int, - pub(crate) tendon_limited: *mut mjtByte, - pub(crate) tendon_actfrclimited: *mut mjtByte, - pub(crate) tendon_width: *mut mjtNum, - pub(crate) tendon_range: *mut mjtNum, - pub(crate) tendon_actfrcrange: *mut mjtNum, - pub(crate) tendon_stiffness: *mut mjtNum, - pub(crate) tendon_damping: *mut mjtNum, - pub(crate) tendon_frictionloss: *mut mjtNum, - pub(crate) tendon_lengthspring: *mut mjtNum, - pub(crate) tendon_rgba: *mut f32, - pub(crate) actuator_trntype: *mut ::core::ffi::c_int, - pub(crate) actuator_dyntype: *mut ::core::ffi::c_int, - pub(crate) actuator_trnid: *mut ::core::ffi::c_int, - pub(crate) actuator_actadr: *mut ::core::ffi::c_int, - pub(crate) actuator_actnum: *mut ::core::ffi::c_int, - pub(crate) actuator_group: *mut ::core::ffi::c_int, - pub(crate) actuator_ctrllimited: *mut mjtByte, - pub(crate) actuator_actlimited: *mut mjtByte, - pub(crate) actuator_ctrlrange: *mut mjtNum, - pub(crate) actuator_actrange: *mut mjtNum, - pub(crate) actuator_cranklength: *mut mjtNum, - pub(crate) sensor_type: *mut ::core::ffi::c_int, - pub(crate) sensor_objid: *mut ::core::ffi::c_int, - pub(crate) sensor_adr: *mut ::core::ffi::c_int, - pub(crate) name_bodyadr: *mut ::core::ffi::c_int, - pub(crate) name_jntadr: *mut ::core::ffi::c_int, - pub(crate) name_geomadr: *mut ::core::ffi::c_int, - pub(crate) name_siteadr: *mut ::core::ffi::c_int, - pub(crate) name_camadr: *mut ::core::ffi::c_int, - pub(crate) name_lightadr: *mut ::core::ffi::c_int, - pub(crate) name_eqadr: *mut ::core::ffi::c_int, - pub(crate) name_tendonadr: *mut ::core::ffi::c_int, - pub(crate) name_actuatoradr: *mut ::core::ffi::c_int, - pub(crate) names: *mut ::core::ffi::c_char, - pub(crate) paths: *mut ::core::ffi::c_char, +pub struct mjsText { + pub(crate) element: *mut mjsElement, + pub(crate) data: *mut mjString, + pub(crate) info: *mut mjString, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjvSceneState___bindgen_ty_2 { - pub(crate) warning: [mjWarningStat; 8usize], - pub(crate) nefc: ::core::ffi::c_int, - pub(crate) ncon: ::core::ffi::c_int, - pub(crate) nisland: ::core::ffi::c_int, - pub(crate) time: mjtNum, - pub(crate) act: *mut mjtNum, - pub(crate) ctrl: *mut mjtNum, - pub(crate) xfrc_applied: *mut mjtNum, - pub(crate) eq_active: *mut mjtByte, - pub(crate) sensordata: *mut mjtNum, - pub(crate) xpos: *mut mjtNum, - pub(crate) xquat: *mut mjtNum, - pub(crate) xmat: *mut mjtNum, - pub(crate) xipos: *mut mjtNum, - pub(crate) ximat: *mut mjtNum, - pub(crate) xanchor: *mut mjtNum, - pub(crate) xaxis: *mut mjtNum, - pub(crate) geom_xpos: *mut mjtNum, - pub(crate) geom_xmat: *mut mjtNum, - pub(crate) site_xpos: *mut mjtNum, - pub(crate) site_xmat: *mut mjtNum, - pub(crate) cam_xpos: *mut mjtNum, - pub(crate) cam_xmat: *mut mjtNum, - pub(crate) light_xpos: *mut mjtNum, - pub(crate) light_xdir: *mut mjtNum, - pub(crate) subtree_com: *mut mjtNum, - pub(crate) ten_wrapadr: *mut ::core::ffi::c_int, - pub(crate) ten_wrapnum: *mut ::core::ffi::c_int, - pub(crate) wrap_obj: *mut ::core::ffi::c_int, - pub(crate) ten_length: *mut mjtNum, - pub(crate) wrap_xpos: *mut mjtNum, - pub(crate) bvh_aabb_dyn: *mut mjtNum, - pub(crate) bvh_active: *mut mjtByte, - pub(crate) island_dofadr: *mut ::core::ffi::c_int, - pub(crate) island_dofind: *mut ::core::ffi::c_int, - pub(crate) dof_island: *mut ::core::ffi::c_int, - pub(crate) efc_island: *mut ::core::ffi::c_int, - pub(crate) tendon_efcadr: *mut ::core::ffi::c_int, - pub(crate) flexvert_xpos: *mut mjtNum, - pub(crate) contact: *mut mjContact, - pub(crate) efc_force: *mut mjtNum, - pub(crate) arena: *mut ::core::ffi::c_void, +pub struct mjsTuple { + pub(crate) element: *mut mjsElement, + pub(crate) objtype: *mut mjIntVec, + pub(crate) objname: *mut mjStringVec, + pub(crate) objprm: *mut mjDoubleVec, + pub(crate) info: *mut mjString, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjResource { - pub(crate) name: *mut ::core::ffi::c_char, - pub(crate) data: *mut ::core::ffi::c_void, - pub(crate) timestamp: [::core::ffi::c_char; 512usize], - pub(crate) provider: *const mjpResourceProvider, +pub struct mjsKey { + pub(crate) element: *mut mjsElement, + pub(crate) time: f64, + pub(crate) qpos: *mut mjDoubleVec, + pub(crate) qvel: *mut mjDoubleVec, + pub(crate) act: *mut mjDoubleVec, + pub(crate) mpos: *mut mjDoubleVec, + pub(crate) mquat: *mut mjDoubleVec, + pub(crate) ctrl: *mut mjDoubleVec, + pub(crate) info: *mut mjString, } -pub type mjfOpenResource = - ::core::option::Option ::core::ffi::c_int>; -pub type mjfReadResource = ::core::option::Option< - unsafe extern "C" fn( - resource: *mut mjResource, - buffer: *mut *const ::core::ffi::c_void, - ) -> ::core::ffi::c_int, ->; -pub type mjfCloseResource = ::core::option::Option; -pub type mjfGetResourceDir = ::core::option::Option< - unsafe extern "C" fn( - resource: *mut mjResource, - dir: *mut *const ::core::ffi::c_char, - ndir: *mut ::core::ffi::c_int, - ), ->; -pub type mjfResourceModified = ::core::option::Option< - unsafe extern "C" fn( - resource: *const mjResource, - timestamp: *const ::core::ffi::c_char, - ) -> ::core::ffi::c_int, ->; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjpResourceProvider { - pub(crate) prefix: *const ::core::ffi::c_char, - pub(crate) open: mjfOpenResource, - pub(crate) read: mjfReadResource, - pub(crate) close: mjfCloseResource, - pub(crate) getdir: mjfGetResourceDir, - pub(crate) modified: mjfResourceModified, - pub(crate) data: *mut ::core::ffi::c_void, +pub struct mjsDefault { + pub(crate) element: *mut mjsElement, + pub(crate) joint: *mut mjsJoint, + pub(crate) geom: *mut mjsGeom, + pub(crate) site: *mut mjsSite, + pub(crate) camera: *mut mjsCamera, + pub(crate) light: *mut mjsLight, + pub(crate) flex: *mut mjsFlex, + pub(crate) mesh: *mut mjsMesh, + pub(crate) material: *mut mjsMaterial, + pub(crate) pair: *mut mjsPair, + pub(crate) equality: *mut mjsEquality, + pub(crate) tendon: *mut mjsTendon, + pub(crate) actuator: *mut mjsActuator, } -impl mjtPluginCapabilityBit { - pub const ACTUATOR: mjtPluginCapabilityBit = mjtPluginCapabilityBit(1); - pub const SENSOR: mjtPluginCapabilityBit = mjtPluginCapabilityBit(2); - pub const PASSIVE: mjtPluginCapabilityBit = mjtPluginCapabilityBit(4); - pub const SDF: mjtPluginCapabilityBit = mjtPluginCapabilityBit(8); +impl mjtCatBit { + pub const STATIC: mjtCatBit = mjtCatBit(1); + pub const DYNAMIC: mjtCatBit = mjtCatBit(2); + pub const DECOR: mjtCatBit = mjtCatBit(4); + pub const ALL: mjtCatBit = mjtCatBit(7); } -impl ::core::ops::BitOr for mjtPluginCapabilityBit { +impl ::core::ops::BitOr for mjtCatBit { type Output = Self; #[inline] fn bitor(self, other: Self) -> Self { - mjtPluginCapabilityBit(self.0 | other.0) + mjtCatBit(self.0 | other.0) } } -impl ::core::ops::BitOrAssign for mjtPluginCapabilityBit { +impl ::core::ops::BitOrAssign for mjtCatBit { #[inline] - fn bitor_assign(&mut self, rhs: mjtPluginCapabilityBit) { + fn bitor_assign(&mut self, rhs: mjtCatBit) { self.0 |= rhs.0; - } -} -impl ::core::ops::BitAnd for mjtPluginCapabilityBit { - type Output = Self; - #[inline] - fn bitand(self, other: Self) -> Self { - mjtPluginCapabilityBit(self.0 & other.0) - } -} -impl ::core::ops::BitAndAssign for mjtPluginCapabilityBit { - #[inline] - fn bitand_assign(&mut self, rhs: mjtPluginCapabilityBit) { - self.0 &= rhs.0; - } -} -#[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtPluginCapabilityBit(pub(crate) ::core::ffi::c_uint); -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjpPlugin { - pub(crate) name: *const ::core::ffi::c_char, - pub(crate) nattribute: ::core::ffi::c_int, - pub(crate) attributes: *const *const ::core::ffi::c_char, - pub(crate) capabilityflags: ::core::ffi::c_int, - pub(crate) needstage: ::core::ffi::c_int, - pub(crate) nstate: ::core::option::Option< - unsafe extern "C" fn(m: *const mjModel, instance: ::core::ffi::c_int) -> ::core::ffi::c_int, - >, - pub(crate) nsensordata: ::core::option::Option< - unsafe extern "C" fn( - m: *const mjModel, - instance: ::core::ffi::c_int, - sensor_id: ::core::ffi::c_int, - ) -> ::core::ffi::c_int, - >, - pub(crate) init: ::core::option::Option< - unsafe extern "C" fn( - m: *const mjModel, - d: *mut mjData, - instance: ::core::ffi::c_int, - ) -> ::core::ffi::c_int, - >, - pub(crate) destroy: - ::core::option::Option, - pub(crate) copy: ::core::option::Option< - unsafe extern "C" fn( - dest: *mut mjData, - m: *const mjModel, - src: *const mjData, - instance: ::core::ffi::c_int, - ), - >, - pub(crate) reset: ::core::option::Option< - unsafe extern "C" fn( - m: *const mjModel, - plugin_state: *mut mjtNum, - plugin_data: *mut ::core::ffi::c_void, - instance: ::core::ffi::c_int, - ), - >, - pub(crate) compute: ::core::option::Option< - unsafe extern "C" fn( - m: *const mjModel, - d: *mut mjData, - instance: ::core::ffi::c_int, - capability_bit: ::core::ffi::c_int, - ), - >, - pub(crate) advance: ::core::option::Option< - unsafe extern "C" fn(m: *const mjModel, d: *mut mjData, instance: ::core::ffi::c_int), - >, - pub(crate) visualize: ::core::option::Option< - unsafe extern "C" fn( - m: *const mjModel, - d: *mut mjData, - opt: *const mjvOption, - scn: *mut mjvScene, - instance: ::core::ffi::c_int, - ), - >, - pub(crate) actuator_act_dot: ::core::option::Option< - unsafe extern "C" fn(m: *const mjModel, d: *mut mjData, instance: ::core::ffi::c_int), - >, - pub(crate) sdf_distance: ::core::option::Option< - unsafe extern "C" fn( - point: *const [mjtNum; 3usize], - d: *const mjData, - instance: ::core::ffi::c_int, - ) -> mjtNum, - >, - pub(crate) sdf_gradient: ::core::option::Option< - unsafe extern "C" fn( - gradient: *mut [mjtNum; 3usize], - point: *const [mjtNum; 3usize], - d: *const mjData, - instance: ::core::ffi::c_int, - ), - >, - pub(crate) sdf_staticdistance: ::core::option::Option< - unsafe extern "C" fn(point: *const [mjtNum; 3usize], attributes: *const mjtNum) -> mjtNum, - >, - pub(crate) sdf_attribute: ::core::option::Option< - unsafe extern "C" fn( - attribute: *mut [mjtNum; 0usize], - name: *mut [*const ::core::ffi::c_char; 0usize], - value: *mut [*const ::core::ffi::c_char; 0usize], - ), - >, - pub(crate) sdf_aabb: ::core::option::Option< - unsafe extern "C" fn(aabb: *mut [mjtNum; 6usize], attributes: *const mjtNum), - >, -} -pub type mjfPluginLibraryLoadCallback = ::core::option::Option< - unsafe extern "C" fn( - filename: *const ::core::ffi::c_char, - first: ::core::ffi::c_int, - count: ::core::ffi::c_int, - ), ->; -impl mjtGridPos { - pub const TOPLEFT: mjtGridPos = mjtGridPos(0); - pub const TOPRIGHT: mjtGridPos = mjtGridPos(1); - pub const BOTTOMLEFT: mjtGridPos = mjtGridPos(2); - pub const BOTTOMRIGHT: mjtGridPos = mjtGridPos(3); - pub const TOP: mjtGridPos = mjtGridPos(4); - pub const BOTTOM: mjtGridPos = mjtGridPos(5); - pub const LEFT: mjtGridPos = mjtGridPos(6); - pub const RIGHT: mjtGridPos = mjtGridPos(7); + } } -#[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtGridPos(pub(crate) ::core::ffi::c_uint); -impl mjtFramebuffer { - pub const WINDOW: mjtFramebuffer = mjtFramebuffer(0); - pub const OFFSCREEN: mjtFramebuffer = mjtFramebuffer(1); +impl ::core::ops::BitAnd for mjtCatBit { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + mjtCatBit(self.0 & other.0) + } } -#[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtFramebuffer(pub(crate) ::core::ffi::c_uint); -impl mjtDepthMap { - pub const ZERONEAR: mjtDepthMap = mjtDepthMap(0); - pub const ZEROFAR: mjtDepthMap = mjtDepthMap(1); +impl ::core::ops::BitAndAssign for mjtCatBit { + #[inline] + fn bitand_assign(&mut self, rhs: mjtCatBit) { + self.0 &= rhs.0; + } } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtDepthMap(pub(crate) ::core::ffi::c_uint); -impl mjtFontScale { - pub const X50: mjtFontScale = mjtFontScale(50); - pub const X100: mjtFontScale = mjtFontScale(100); - pub const X150: mjtFontScale = mjtFontScale(150); - pub const X200: mjtFontScale = mjtFontScale(200); - pub const X250: mjtFontScale = mjtFontScale(250); - pub const X300: mjtFontScale = mjtFontScale(300); +pub struct mjtCatBit(pub(crate) ::core::ffi::c_uint); +impl mjtMouse { + pub const NONE: mjtMouse = mjtMouse(0); + pub const ROTATE_V: mjtMouse = mjtMouse(1); + pub const ROTATE_H: mjtMouse = mjtMouse(2); + pub const MOVE_V: mjtMouse = mjtMouse(3); + pub const MOVE_H: mjtMouse = mjtMouse(4); + pub const ZOOM: mjtMouse = mjtMouse(5); + pub const MOVE_V_REL: mjtMouse = mjtMouse(6); + pub const MOVE_H_REL: mjtMouse = mjtMouse(7); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtFontScale(pub(crate) ::core::ffi::c_uint); -impl mjtFont { - pub const NORMAL: mjtFont = mjtFont(0); - pub const SHADOW: mjtFont = mjtFont(1); - pub const BIG: mjtFont = mjtFont(2); +pub struct mjtMouse(pub(crate) ::core::ffi::c_uint); +impl mjtPertBit { + pub const TRANSLATE: mjtPertBit = mjtPertBit(1); + pub const ROTATE: mjtPertBit = mjtPertBit(2); } -#[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtFont(pub(crate) ::core::ffi::c_uint); -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjrRect { - pub(crate) left: ::core::ffi::c_int, - pub(crate) bottom: ::core::ffi::c_int, - pub(crate) width: ::core::ffi::c_int, - pub(crate) height: ::core::ffi::c_int, +impl ::core::ops::BitOr for mjtPertBit { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + mjtPertBit(self.0 | other.0) + } } -#[repr(C)] -#[derive(Debug)] -pub struct mjrContext { - pub(crate) lineWidth: f32, - pub(crate) shadowClip: f32, - pub(crate) shadowScale: f32, - pub(crate) fogStart: f32, - pub(crate) fogEnd: f32, - pub(crate) fogRGBA: [f32; 4usize], - pub(crate) shadowSize: ::core::ffi::c_int, - pub(crate) offWidth: ::core::ffi::c_int, - pub(crate) offHeight: ::core::ffi::c_int, - pub(crate) offSamples: ::core::ffi::c_int, - pub(crate) fontScale: ::core::ffi::c_int, - pub(crate) auxWidth: [::core::ffi::c_int; 10usize], - pub(crate) auxHeight: [::core::ffi::c_int; 10usize], - pub(crate) auxSamples: [::core::ffi::c_int; 10usize], - pub(crate) offFBO: ::core::ffi::c_uint, - pub(crate) offFBO_r: ::core::ffi::c_uint, - pub(crate) offColor: ::core::ffi::c_uint, - pub(crate) offColor_r: ::core::ffi::c_uint, - pub(crate) offDepthStencil: ::core::ffi::c_uint, - pub(crate) offDepthStencil_r: ::core::ffi::c_uint, - pub(crate) shadowFBO: ::core::ffi::c_uint, - pub(crate) shadowTex: ::core::ffi::c_uint, - pub(crate) auxFBO: [::core::ffi::c_uint; 10usize], - pub(crate) auxFBO_r: [::core::ffi::c_uint; 10usize], - pub(crate) auxColor: [::core::ffi::c_uint; 10usize], - pub(crate) auxColor_r: [::core::ffi::c_uint; 10usize], - pub(crate) mat_texid: [::core::ffi::c_int; 10000usize], - pub(crate) mat_texuniform: [::core::ffi::c_int; 1000usize], - pub(crate) mat_texrepeat: [f32; 2000usize], - pub(crate) ntexture: ::core::ffi::c_int, - pub(crate) textureType: [::core::ffi::c_int; 1000usize], - pub(crate) texture: [::core::ffi::c_uint; 1000usize], - pub(crate) basePlane: ::core::ffi::c_uint, - pub(crate) baseMesh: ::core::ffi::c_uint, - pub(crate) baseHField: ::core::ffi::c_uint, - pub(crate) baseBuiltin: ::core::ffi::c_uint, - pub(crate) baseFontNormal: ::core::ffi::c_uint, - pub(crate) baseFontShadow: ::core::ffi::c_uint, - pub(crate) baseFontBig: ::core::ffi::c_uint, - pub(crate) rangePlane: ::core::ffi::c_int, - pub(crate) rangeMesh: ::core::ffi::c_int, - pub(crate) rangeHField: ::core::ffi::c_int, - pub(crate) rangeBuiltin: ::core::ffi::c_int, - pub(crate) rangeFont: ::core::ffi::c_int, - pub(crate) nskin: ::core::ffi::c_int, - pub(crate) skinvertVBO: *mut ::core::ffi::c_uint, - pub(crate) skinnormalVBO: *mut ::core::ffi::c_uint, - pub(crate) skintexcoordVBO: *mut ::core::ffi::c_uint, - pub(crate) skinfaceVBO: *mut ::core::ffi::c_uint, - pub(crate) charWidth: [::core::ffi::c_int; 127usize], - pub(crate) charWidthBig: [::core::ffi::c_int; 127usize], - pub(crate) charHeight: ::core::ffi::c_int, - pub(crate) charHeightBig: ::core::ffi::c_int, - pub(crate) glInitialized: ::core::ffi::c_int, - pub(crate) windowAvailable: ::core::ffi::c_int, - pub(crate) windowSamples: ::core::ffi::c_int, - pub(crate) windowStereo: ::core::ffi::c_int, - pub(crate) windowDoublebuffer: ::core::ffi::c_int, - pub(crate) currentBuffer: ::core::ffi::c_int, - pub(crate) readPixelFormat: ::core::ffi::c_int, - pub(crate) readDepthMap: ::core::ffi::c_int, +impl ::core::ops::BitOrAssign for mjtPertBit { + #[inline] + fn bitor_assign(&mut self, rhs: mjtPertBit) { + self.0 |= rhs.0; + } } -pub type mjString = ::core::ffi::c_void; -pub type mjStringVec = ::core::ffi::c_void; -pub type mjIntVec = ::core::ffi::c_void; -pub type mjIntVecVec = ::core::ffi::c_void; -pub type mjFloatVec = ::core::ffi::c_void; -pub type mjFloatVecVec = ::core::ffi::c_void; -pub type mjDoubleVec = ::core::ffi::c_void; -pub type mjByteVec = ::core::ffi::c_void; -impl mjtGeomInertia { - pub const VOLUME: mjtGeomInertia = mjtGeomInertia(0); - pub const SHELL: mjtGeomInertia = mjtGeomInertia(1); +impl ::core::ops::BitAnd for mjtPertBit { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + mjtPertBit(self.0 & other.0) + } } -#[repr(transparent)] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtGeomInertia(pub(crate) ::core::ffi::c_uint); -impl mjtMeshInertia { - pub const INERTIA_CONVEX: mjtMeshInertia = mjtMeshInertia(0); - pub const INERTIA_EXACT: mjtMeshInertia = mjtMeshInertia(1); - pub const INERTIA_LEGACY: mjtMeshInertia = mjtMeshInertia(2); - pub const INERTIA_SHELL: mjtMeshInertia = mjtMeshInertia(3); +impl ::core::ops::BitAndAssign for mjtPertBit { + #[inline] + fn bitand_assign(&mut self, rhs: mjtPertBit) { + self.0 &= rhs.0; + } } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtMeshInertia(pub(crate) ::core::ffi::c_uint); -impl mjtBuiltin { - pub const NONE: mjtBuiltin = mjtBuiltin(0); - pub const GRADIENT: mjtBuiltin = mjtBuiltin(1); - pub const CHECKER: mjtBuiltin = mjtBuiltin(2); - pub const FLAT: mjtBuiltin = mjtBuiltin(3); +pub struct mjtPertBit(pub(crate) ::core::ffi::c_uint); +impl mjtCamera { + pub const FREE: mjtCamera = mjtCamera(0); + pub const TRACKING: mjtCamera = mjtCamera(1); + pub const FIXED: mjtCamera = mjtCamera(2); + pub const USER: mjtCamera = mjtCamera(3); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtBuiltin(pub(crate) ::core::ffi::c_uint); -impl mjtMark { - pub const NONE: mjtMark = mjtMark(0); - pub const EDGE: mjtMark = mjtMark(1); - pub const CROSS: mjtMark = mjtMark(2); - pub const RANDOM: mjtMark = mjtMark(3); +pub struct mjtCamera(pub(crate) ::core::ffi::c_uint); +pub const mjNLABEL: usize = mjtLabel::mjNLABEL.0 as usize; +impl mjtLabel { + pub const NONE: mjtLabel = mjtLabel(0); + pub const BODY: mjtLabel = mjtLabel(1); + pub const JOINT: mjtLabel = mjtLabel(2); + pub const GEOM: mjtLabel = mjtLabel(3); + pub const SITE: mjtLabel = mjtLabel(4); + pub const CAMERA: mjtLabel = mjtLabel(5); + pub const LIGHT: mjtLabel = mjtLabel(6); + pub const TENDON: mjtLabel = mjtLabel(7); + pub const ACTUATOR: mjtLabel = mjtLabel(8); + pub const CONSTRAINT: mjtLabel = mjtLabel(9); + pub const FLEX: mjtLabel = mjtLabel(10); + pub const SKIN: mjtLabel = mjtLabel(11); + pub const SELECTION: mjtLabel = mjtLabel(12); + pub const SELPNT: mjtLabel = mjtLabel(13); + pub const CONTACTPOINT: mjtLabel = mjtLabel(14); + pub const CONTACTFORCE: mjtLabel = mjtLabel(15); + pub const ISLAND: mjtLabel = mjtLabel(16); + const mjNLABEL: mjtLabel = mjtLabel(17); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtMark(pub(crate) ::core::ffi::c_uint); -impl mjtLimited { - pub const FALSE: mjtLimited = mjtLimited(0); - pub const TRUE: mjtLimited = mjtLimited(1); - pub const AUTO: mjtLimited = mjtLimited(2); +pub struct mjtLabel(pub(crate) ::core::ffi::c_uint); +pub const mjNFRAME: usize = mjtFrame::mjNFRAME.0 as usize; +impl mjtFrame { + pub const NONE: mjtFrame = mjtFrame(0); + pub const BODY: mjtFrame = mjtFrame(1); + pub const GEOM: mjtFrame = mjtFrame(2); + pub const SITE: mjtFrame = mjtFrame(3); + pub const CAMERA: mjtFrame = mjtFrame(4); + pub const LIGHT: mjtFrame = mjtFrame(5); + pub const CONTACT: mjtFrame = mjtFrame(6); + pub const WORLD: mjtFrame = mjtFrame(7); + const mjNFRAME: mjtFrame = mjtFrame(8); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtLimited(pub(crate) ::core::ffi::c_uint); -impl mjtAlignFree { - pub const FALSE: mjtAlignFree = mjtAlignFree(0); - pub const TRUE: mjtAlignFree = mjtAlignFree(1); - pub const AUTO: mjtAlignFree = mjtAlignFree(2); +pub struct mjtFrame(pub(crate) ::core::ffi::c_uint); +pub const mjNVISFLAG: usize = mjtVisFlag::mjNVISFLAG.0 as usize; +impl mjtVisFlag { + pub const CONVEXHULL: mjtVisFlag = mjtVisFlag(0); + pub const TEXTURE: mjtVisFlag = mjtVisFlag(1); + pub const JOINT: mjtVisFlag = mjtVisFlag(2); + pub const CAMERA: mjtVisFlag = mjtVisFlag(3); + pub const ACTUATOR: mjtVisFlag = mjtVisFlag(4); + pub const ACTIVATION: mjtVisFlag = mjtVisFlag(5); + pub const LIGHT: mjtVisFlag = mjtVisFlag(6); + pub const TENDON: mjtVisFlag = mjtVisFlag(7); + pub const RANGEFINDER: mjtVisFlag = mjtVisFlag(8); + pub const CONSTRAINT: mjtVisFlag = mjtVisFlag(9); + pub const INERTIA: mjtVisFlag = mjtVisFlag(10); + pub const SCLINERTIA: mjtVisFlag = mjtVisFlag(11); + pub const PERTFORCE: mjtVisFlag = mjtVisFlag(12); + pub const PERTOBJ: mjtVisFlag = mjtVisFlag(13); + pub const CONTACTPOINT: mjtVisFlag = mjtVisFlag(14); + pub const ISLAND: mjtVisFlag = mjtVisFlag(15); + pub const CONTACTFORCE: mjtVisFlag = mjtVisFlag(16); + pub const CONTACTSPLIT: mjtVisFlag = mjtVisFlag(17); + pub const TRANSPARENT: mjtVisFlag = mjtVisFlag(18); + pub const AUTOCONNECT: mjtVisFlag = mjtVisFlag(19); + pub const COM: mjtVisFlag = mjtVisFlag(20); + pub const SELECT: mjtVisFlag = mjtVisFlag(21); + pub const STATIC: mjtVisFlag = mjtVisFlag(22); + pub const SKIN: mjtVisFlag = mjtVisFlag(23); + pub const FLEXVERT: mjtVisFlag = mjtVisFlag(24); + pub const FLEXEDGE: mjtVisFlag = mjtVisFlag(25); + pub const FLEXFACE: mjtVisFlag = mjtVisFlag(26); + pub const FLEXSKIN: mjtVisFlag = mjtVisFlag(27); + pub const BODYBVH: mjtVisFlag = mjtVisFlag(28); + pub const MESHBVH: mjtVisFlag = mjtVisFlag(29); + pub const SDFITER: mjtVisFlag = mjtVisFlag(30); + const mjNVISFLAG: mjtVisFlag = mjtVisFlag(31); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtAlignFree(pub(crate) ::core::ffi::c_uint); -impl mjtInertiaFromGeom { - pub const FALSE: mjtInertiaFromGeom = mjtInertiaFromGeom(0); - pub const TRUE: mjtInertiaFromGeom = mjtInertiaFromGeom(1); - pub const AUTO: mjtInertiaFromGeom = mjtInertiaFromGeom(2); +pub struct mjtVisFlag(pub(crate) ::core::ffi::c_uint); +pub const mjNRNDFLAG: usize = mjtRndFlag::mjNRNDFLAG.0 as usize; +impl mjtRndFlag { + pub const SHADOW: mjtRndFlag = mjtRndFlag(0); + pub const WIREFRAME: mjtRndFlag = mjtRndFlag(1); + pub const REFLECTION: mjtRndFlag = mjtRndFlag(2); + pub const ADDITIVE: mjtRndFlag = mjtRndFlag(3); + pub const SKYBOX: mjtRndFlag = mjtRndFlag(4); + pub const FOG: mjtRndFlag = mjtRndFlag(5); + pub const HAZE: mjtRndFlag = mjtRndFlag(6); + pub const SEGMENT: mjtRndFlag = mjtRndFlag(7); + pub const IDCOLOR: mjtRndFlag = mjtRndFlag(8); + pub const CULL_FACE: mjtRndFlag = mjtRndFlag(9); + const mjNRNDFLAG: mjtRndFlag = mjtRndFlag(10); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtInertiaFromGeom(pub(crate) ::core::ffi::c_uint); -impl mjtOrientation { - pub const QUAT: mjtOrientation = mjtOrientation(0); - pub const AXISANGLE: mjtOrientation = mjtOrientation(1); - pub const XYAXES: mjtOrientation = mjtOrientation(2); - pub const ZAXIS: mjtOrientation = mjtOrientation(3); - pub const EULER: mjtOrientation = mjtOrientation(4); +pub struct mjtRndFlag(pub(crate) ::core::ffi::c_uint); +impl mjtStereo { + pub const NONE: mjtStereo = mjtStereo(0); + pub const QUADBUFFERED: mjtStereo = mjtStereo(1); + pub const SIDEBYSIDE: mjtStereo = mjtStereo(2); } #[repr(transparent)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct mjtOrientation(pub(crate) ::core::ffi::c_uint); -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsElement { - pub(crate) elemtype: mjtObj, - pub(crate) signature: u64, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsCompiler { - pub(crate) autolimits: mjtByte, - pub(crate) boundmass: f64, - pub(crate) boundinertia: f64, - pub(crate) settotalmass: f64, - pub(crate) balanceinertia: mjtByte, - pub(crate) fitaabb: mjtByte, - pub(crate) degree: mjtByte, - pub(crate) eulerseq: [::core::ffi::c_char; 3usize], - pub(crate) discardvisual: mjtByte, - pub(crate) usethread: mjtByte, - pub(crate) fusestatic: mjtByte, - pub(crate) inertiafromgeom: ::core::ffi::c_int, - pub(crate) inertiagrouprange: [::core::ffi::c_int; 2usize], - pub(crate) saveinertial: mjtByte, - pub(crate) alignfree: ::core::ffi::c_int, - pub(crate) LRopt: mjLROpt, -} -#[repr(C)] -#[derive(Debug)] -pub struct mjSpec { - pub(crate) element: *mut mjsElement, - pub(crate) modelname: *mut mjString, - pub(crate) compiler: mjsCompiler, - pub(crate) strippath: mjtByte, - pub(crate) meshdir: *mut mjString, - pub(crate) texturedir: *mut mjString, - pub(crate) option: mjOption, - pub(crate) visual: mjVisual, - pub(crate) stat: mjStatistic, - pub(crate) memory: usize, - pub(crate) nemax: ::core::ffi::c_int, - pub(crate) nuserdata: ::core::ffi::c_int, - pub(crate) nuser_body: ::core::ffi::c_int, - pub(crate) nuser_jnt: ::core::ffi::c_int, - pub(crate) nuser_geom: ::core::ffi::c_int, - pub(crate) nuser_site: ::core::ffi::c_int, - pub(crate) nuser_cam: ::core::ffi::c_int, - pub(crate) nuser_tendon: ::core::ffi::c_int, - pub(crate) nuser_actuator: ::core::ffi::c_int, - pub(crate) nuser_sensor: ::core::ffi::c_int, - pub(crate) nkey: ::core::ffi::c_int, - pub(crate) njmax: ::core::ffi::c_int, - pub(crate) nconmax: ::core::ffi::c_int, - pub(crate) nstack: usize, - pub(crate) comment: *mut mjString, - pub(crate) modelfiledir: *mut mjString, - pub(crate) hasImplicitPluginElem: mjtByte, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsOrientation { - pub(crate) type_: mjtOrientation, - pub(crate) axisangle: [f64; 4usize], - pub(crate) xyaxes: [f64; 6usize], - pub(crate) zaxis: [f64; 3usize], - pub(crate) euler: [f64; 3usize], -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsPlugin { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) plugin_name: *mut mjString, - pub(crate) active: mjtByte, - pub(crate) info: *mut mjString, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsBody { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) childclass: *mut mjString, - pub(crate) pos: [f64; 3usize], - pub(crate) quat: [f64; 4usize], - pub(crate) alt: mjsOrientation, - pub(crate) mass: f64, - pub(crate) ipos: [f64; 3usize], - pub(crate) iquat: [f64; 4usize], - pub(crate) inertia: [f64; 3usize], - pub(crate) ialt: mjsOrientation, - pub(crate) fullinertia: [f64; 6usize], - pub(crate) mocap: mjtByte, - pub(crate) gravcomp: f64, - pub(crate) userdata: *mut mjDoubleVec, - pub(crate) explicitinertial: mjtByte, - pub(crate) plugin: mjsPlugin, - pub(crate) info: *mut mjString, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsFrame { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) childclass: *mut mjString, - pub(crate) pos: [f64; 3usize], - pub(crate) quat: [f64; 4usize], - pub(crate) alt: mjsOrientation, - pub(crate) info: *mut mjString, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsJoint { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) type_: mjtJoint, - pub(crate) pos: [f64; 3usize], - pub(crate) axis: [f64; 3usize], - pub(crate) ref_: f64, - pub(crate) align: ::core::ffi::c_int, - pub(crate) stiffness: f64, - pub(crate) springref: f64, - pub(crate) springdamper: [f64; 2usize], - pub(crate) limited: ::core::ffi::c_int, - pub(crate) range: [f64; 2usize], - pub(crate) margin: f64, - pub(crate) solref_limit: [mjtNum; 2usize], - pub(crate) solimp_limit: [mjtNum; 5usize], - pub(crate) actfrclimited: ::core::ffi::c_int, - pub(crate) actfrcrange: [f64; 2usize], - pub(crate) armature: f64, - pub(crate) damping: f64, - pub(crate) frictionloss: f64, - pub(crate) solref_friction: [mjtNum; 2usize], - pub(crate) solimp_friction: [mjtNum; 5usize], - pub(crate) group: ::core::ffi::c_int, - pub(crate) actgravcomp: mjtByte, - pub(crate) userdata: *mut mjDoubleVec, - pub(crate) info: *mut mjString, -} +pub struct mjtStereo(pub(crate) ::core::ffi::c_uint); #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjsGeom { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) type_: mjtGeom, - pub(crate) pos: [f64; 3usize], - pub(crate) quat: [f64; 4usize], - pub(crate) alt: mjsOrientation, - pub(crate) fromto: [f64; 6usize], - pub(crate) size: [f64; 3usize], - pub(crate) contype: ::core::ffi::c_int, - pub(crate) conaffinity: ::core::ffi::c_int, - pub(crate) condim: ::core::ffi::c_int, - pub(crate) priority: ::core::ffi::c_int, - pub(crate) friction: [f64; 3usize], - pub(crate) solmix: f64, - pub(crate) solref: [mjtNum; 2usize], - pub(crate) solimp: [mjtNum; 5usize], - pub(crate) margin: f64, - pub(crate) gap: f64, - pub(crate) mass: f64, - pub(crate) density: f64, - pub(crate) typeinertia: mjtGeomInertia, - pub(crate) fluid_ellipsoid: mjtNum, - pub(crate) fluid_coefs: [mjtNum; 5usize], - pub(crate) material: *mut mjString, - pub(crate) rgba: [f32; 4usize], - pub(crate) group: ::core::ffi::c_int, - pub(crate) hfieldname: *mut mjString, - pub(crate) meshname: *mut mjString, - pub(crate) fitscale: f64, - pub(crate) userdata: *mut mjDoubleVec, - pub(crate) plugin: mjsPlugin, - pub(crate) info: *mut mjString, +pub struct mjvPerturb { + pub(crate) select: ::core::ffi::c_int, + pub(crate) flexselect: ::core::ffi::c_int, + pub(crate) skinselect: ::core::ffi::c_int, + pub(crate) active: ::core::ffi::c_int, + pub(crate) active2: ::core::ffi::c_int, + pub(crate) refpos: [mjtNum; 3usize], + pub(crate) refquat: [mjtNum; 4usize], + pub(crate) refselpos: [mjtNum; 3usize], + pub(crate) localpos: [mjtNum; 3usize], + pub(crate) localmass: mjtNum, + pub(crate) scale: mjtNum, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjsSite { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) pos: [f64; 3usize], - pub(crate) quat: [f64; 4usize], - pub(crate) alt: mjsOrientation, - pub(crate) fromto: [f64; 6usize], - pub(crate) size: [f64; 3usize], - pub(crate) type_: mjtGeom, - pub(crate) material: *mut mjString, - pub(crate) group: ::core::ffi::c_int, - pub(crate) rgba: [f32; 4usize], - pub(crate) userdata: *mut mjDoubleVec, - pub(crate) info: *mut mjString, +pub struct mjvCamera { + pub(crate) type_: ::core::ffi::c_int, + pub(crate) fixedcamid: ::core::ffi::c_int, + pub(crate) trackbodyid: ::core::ffi::c_int, + pub(crate) lookat: [mjtNum; 3usize], + pub(crate) distance: mjtNum, + pub(crate) azimuth: mjtNum, + pub(crate) elevation: mjtNum, + pub(crate) orthographic: ::core::ffi::c_int, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjsCamera { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) pos: [f64; 3usize], - pub(crate) quat: [f64; 4usize], - pub(crate) alt: mjsOrientation, - pub(crate) mode: mjtCamLight, - pub(crate) targetbody: *mut mjString, +pub struct mjvGLCamera { + pub(crate) pos: [f32; 3usize], + pub(crate) forward: [f32; 3usize], + pub(crate) up: [f32; 3usize], + pub(crate) frustum_center: f32, + pub(crate) frustum_width: f32, + pub(crate) frustum_bottom: f32, + pub(crate) frustum_top: f32, + pub(crate) frustum_near: f32, + pub(crate) frustum_far: f32, pub(crate) orthographic: ::core::ffi::c_int, - pub(crate) fovy: f64, - pub(crate) ipd: f64, - pub(crate) intrinsic: [f32; 4usize], - pub(crate) sensor_size: [f32; 2usize], - pub(crate) resolution: [f32; 2usize], - pub(crate) focal_length: [f32; 2usize], - pub(crate) focal_pixel: [f32; 2usize], - pub(crate) principal_length: [f32; 2usize], - pub(crate) principal_pixel: [f32; 2usize], - pub(crate) userdata: *mut mjDoubleVec, - pub(crate) info: *mut mjString, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjsLight { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) pos: [f64; 3usize], - pub(crate) dir: [f64; 3usize], - pub(crate) mode: mjtCamLight, - pub(crate) targetbody: *mut mjString, - pub(crate) active: mjtByte, - pub(crate) directional: mjtByte, - pub(crate) castshadow: mjtByte, - pub(crate) bulbradius: f64, +pub struct mjvGeom { + pub(crate) type_: ::core::ffi::c_int, + pub(crate) dataid: ::core::ffi::c_int, + pub(crate) objtype: ::core::ffi::c_int, + pub(crate) objid: ::core::ffi::c_int, + pub(crate) category: ::core::ffi::c_int, + pub(crate) matid: ::core::ffi::c_int, + pub(crate) texcoord: ::core::ffi::c_int, + pub(crate) segid: ::core::ffi::c_int, + pub(crate) size: [f32; 3usize], + pub(crate) pos: [f32; 3usize], + pub(crate) mat: [f32; 9usize], + pub(crate) rgba: [f32; 4usize], + pub(crate) emission: f32, + pub(crate) specular: f32, + pub(crate) shininess: f32, + pub(crate) reflectance: f32, + pub(crate) label: [::core::ffi::c_char; 100usize], + pub(crate) camdist: f32, + pub(crate) modelrbound: f32, + pub(crate) transparent: mjtByte, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mjvLight { + pub(crate) id: ::core::ffi::c_int, + pub(crate) pos: [f32; 3usize], + pub(crate) dir: [f32; 3usize], + pub(crate) type_: ::core::ffi::c_int, + pub(crate) texid: ::core::ffi::c_int, pub(crate) attenuation: [f32; 3usize], pub(crate) cutoff: f32, pub(crate) exponent: f32, pub(crate) ambient: [f32; 3usize], pub(crate) diffuse: [f32; 3usize], pub(crate) specular: [f32; 3usize], - pub(crate) info: *mut mjString, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsFlex { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) contype: ::core::ffi::c_int, - pub(crate) conaffinity: ::core::ffi::c_int, - pub(crate) condim: ::core::ffi::c_int, - pub(crate) priority: ::core::ffi::c_int, - pub(crate) friction: [f64; 3usize], - pub(crate) solmix: f64, - pub(crate) solref: [mjtNum; 2usize], - pub(crate) solimp: [mjtNum; 5usize], - pub(crate) margin: f64, - pub(crate) gap: f64, - pub(crate) dim: ::core::ffi::c_int, - pub(crate) radius: f64, - pub(crate) internal: mjtByte, - pub(crate) flatskin: mjtByte, - pub(crate) selfcollide: ::core::ffi::c_int, - pub(crate) activelayers: ::core::ffi::c_int, - pub(crate) group: ::core::ffi::c_int, - pub(crate) edgestiffness: f64, - pub(crate) edgedamping: f64, - pub(crate) rgba: [f32; 4usize], - pub(crate) material: *mut mjString, - pub(crate) young: f64, - pub(crate) poisson: f64, - pub(crate) damping: f64, - pub(crate) thickness: f64, - pub(crate) nodebody: *mut mjStringVec, - pub(crate) vertbody: *mut mjStringVec, - pub(crate) node: *mut mjDoubleVec, - pub(crate) vert: *mut mjDoubleVec, - pub(crate) elem: *mut mjIntVec, - pub(crate) texcoord: *mut mjFloatVec, - pub(crate) elemtexcoord: *mut mjIntVec, - pub(crate) info: *mut mjString, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsMesh { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) content_type: *mut mjString, - pub(crate) file: *mut mjString, - pub(crate) refpos: [f64; 3usize], - pub(crate) refquat: [f64; 4usize], - pub(crate) scale: [f64; 3usize], - pub(crate) inertia: mjtMeshInertia, - pub(crate) smoothnormal: mjtByte, - pub(crate) maxhullvert: ::core::ffi::c_int, - pub(crate) uservert: *mut mjFloatVec, - pub(crate) usernormal: *mut mjFloatVec, - pub(crate) usertexcoord: *mut mjFloatVec, - pub(crate) userface: *mut mjIntVec, - pub(crate) userfacetexcoord: *mut mjIntVec, - pub(crate) plugin: mjsPlugin, - pub(crate) info: *mut mjString, + pub(crate) headlight: mjtByte, + pub(crate) castshadow: mjtByte, + pub(crate) bulbradius: f32, + pub(crate) intensity: f32, + pub(crate) range: f32, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjsHField { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) content_type: *mut mjString, - pub(crate) file: *mut mjString, - pub(crate) size: [f64; 4usize], - pub(crate) nrow: ::core::ffi::c_int, - pub(crate) ncol: ::core::ffi::c_int, - pub(crate) userdata: *mut mjFloatVec, - pub(crate) info: *mut mjString, +pub struct mjvOption { + pub(crate) label: ::core::ffi::c_int, + pub(crate) frame: ::core::ffi::c_int, + pub(crate) geomgroup: [mjtByte; 6usize], + pub(crate) sitegroup: [mjtByte; 6usize], + pub(crate) jointgroup: [mjtByte; 6usize], + pub(crate) tendongroup: [mjtByte; 6usize], + pub(crate) actuatorgroup: [mjtByte; 6usize], + pub(crate) flexgroup: [mjtByte; 6usize], + pub(crate) skingroup: [mjtByte; 6usize], + pub(crate) flags: [mjtByte; 31usize], + pub(crate) bvh_depth: ::core::ffi::c_int, + pub(crate) flex_layer: ::core::ffi::c_int, } #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsSkin { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) file: *mut mjString, - pub(crate) material: *mut mjString, - pub(crate) rgba: [f32; 4usize], - pub(crate) inflate: f32, - pub(crate) group: ::core::ffi::c_int, - pub(crate) vert: *mut mjFloatVec, - pub(crate) texcoord: *mut mjFloatVec, - pub(crate) face: *mut mjIntVec, - pub(crate) bodyname: *mut mjStringVec, - pub(crate) bindpos: *mut mjFloatVec, - pub(crate) bindquat: *mut mjFloatVec, - pub(crate) vertid: *mut mjIntVecVec, - pub(crate) vertweight: *mut mjFloatVecVec, - pub(crate) info: *mut mjString, +#[derive(Debug)] +pub struct mjvScene { + pub(crate) maxgeom: ::core::ffi::c_int, + pub(crate) ngeom: ::core::ffi::c_int, + pub(crate) geoms: *mut mjvGeom, + pub(crate) geomorder: *mut ::core::ffi::c_int, + pub(crate) nflex: ::core::ffi::c_int, + pub(crate) flexedgeadr: *mut ::core::ffi::c_int, + pub(crate) flexedgenum: *mut ::core::ffi::c_int, + pub(crate) flexvertadr: *mut ::core::ffi::c_int, + pub(crate) flexvertnum: *mut ::core::ffi::c_int, + pub(crate) flexfaceadr: *mut ::core::ffi::c_int, + pub(crate) flexfacenum: *mut ::core::ffi::c_int, + pub(crate) flexfaceused: *mut ::core::ffi::c_int, + pub(crate) flexedge: *mut ::core::ffi::c_int, + pub(crate) flexvert: *mut f32, + pub(crate) flexface: *mut f32, + pub(crate) flexnormal: *mut f32, + pub(crate) flextexcoord: *mut f32, + pub(crate) flexvertopt: mjtByte, + pub(crate) flexedgeopt: mjtByte, + pub(crate) flexfaceopt: mjtByte, + pub(crate) flexskinopt: mjtByte, + pub(crate) nskin: ::core::ffi::c_int, + pub(crate) skinfacenum: *mut ::core::ffi::c_int, + pub(crate) skinvertadr: *mut ::core::ffi::c_int, + pub(crate) skinvertnum: *mut ::core::ffi::c_int, + pub(crate) skinvert: *mut f32, + pub(crate) skinnormal: *mut f32, + pub(crate) nlight: ::core::ffi::c_int, + pub(crate) lights: [mjvLight; 100usize], + pub(crate) camera: [mjvGLCamera; 2usize], + pub(crate) enabletransform: mjtByte, + pub(crate) translate: [f32; 3usize], + pub(crate) rotate: [f32; 4usize], + pub(crate) scale: f32, + pub(crate) stereo: ::core::ffi::c_int, + pub(crate) flags: [mjtByte; 10usize], + pub(crate) framewidth: ::core::ffi::c_int, + pub(crate) framergb: [f32; 3usize], + pub(crate) status: ::core::ffi::c_int, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjsTexture { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) type_: mjtTexture, - pub(crate) builtin: ::core::ffi::c_int, - pub(crate) mark: ::core::ffi::c_int, - pub(crate) rgb1: [f64; 3usize], - pub(crate) rgb2: [f64; 3usize], - pub(crate) markrgb: [f64; 3usize], - pub(crate) random: f64, - pub(crate) height: ::core::ffi::c_int, - pub(crate) width: ::core::ffi::c_int, - pub(crate) nchannel: ::core::ffi::c_int, - pub(crate) content_type: *mut mjString, - pub(crate) file: *mut mjString, +pub struct mjvFigure { + pub(crate) flg_legend: ::core::ffi::c_int, + pub(crate) flg_ticklabel: [::core::ffi::c_int; 2usize], + pub(crate) flg_extend: ::core::ffi::c_int, + pub(crate) flg_barplot: ::core::ffi::c_int, + pub(crate) flg_selection: ::core::ffi::c_int, + pub(crate) flg_symmetric: ::core::ffi::c_int, + pub(crate) linewidth: f32, + pub(crate) gridwidth: f32, pub(crate) gridsize: [::core::ffi::c_int; 2usize], - pub(crate) gridlayout: [::core::ffi::c_char; 13usize], - pub(crate) cubefiles: *mut mjStringVec, - pub(crate) data: *mut mjByteVec, - pub(crate) hflip: mjtByte, - pub(crate) vflip: mjtByte, - pub(crate) info: *mut mjString, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsMaterial { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) textures: *mut mjStringVec, - pub(crate) texuniform: mjtByte, - pub(crate) texrepeat: [f32; 2usize], - pub(crate) emission: f32, - pub(crate) specular: f32, - pub(crate) shininess: f32, - pub(crate) reflectance: f32, - pub(crate) metallic: f32, - pub(crate) roughness: f32, - pub(crate) rgba: [f32; 4usize], - pub(crate) info: *mut mjString, + pub(crate) gridrgb: [f32; 3usize], + pub(crate) figurergba: [f32; 4usize], + pub(crate) panergba: [f32; 4usize], + pub(crate) legendrgba: [f32; 4usize], + pub(crate) textrgb: [f32; 3usize], + pub(crate) linergb: [[f32; 3usize]; 100usize], + pub(crate) range: [[f32; 2usize]; 2usize], + pub(crate) xformat: [::core::ffi::c_char; 20usize], + pub(crate) yformat: [::core::ffi::c_char; 20usize], + pub(crate) minwidth: [::core::ffi::c_char; 20usize], + pub(crate) title: [::core::ffi::c_char; 1000usize], + pub(crate) xlabel: [::core::ffi::c_char; 100usize], + pub(crate) linename: [[::core::ffi::c_char; 100usize]; 100usize], + pub(crate) legendoffset: ::core::ffi::c_int, + pub(crate) subplot: ::core::ffi::c_int, + pub(crate) highlight: [::core::ffi::c_int; 2usize], + pub(crate) highlightid: ::core::ffi::c_int, + pub(crate) selection: f32, + pub(crate) linepnt: [::core::ffi::c_int; 100usize], + pub(crate) linedata: [[f32; 2002usize]; 100usize], + pub(crate) xaxispixel: [::core::ffi::c_int; 2usize], + pub(crate) yaxispixel: [::core::ffi::c_int; 2usize], + pub(crate) xaxisdata: [f32; 2usize], + pub(crate) yaxisdata: [f32; 2usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjsPair { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) geomname1: *mut mjString, - pub(crate) geomname2: *mut mjString, - pub(crate) condim: ::core::ffi::c_int, - pub(crate) solref: [mjtNum; 2usize], - pub(crate) solreffriction: [mjtNum; 2usize], - pub(crate) solimp: [mjtNum; 5usize], - pub(crate) margin: f64, - pub(crate) gap: f64, - pub(crate) friction: [f64; 5usize], - pub(crate) info: *mut mjString, +pub struct mjResource { + pub(crate) name: *mut ::core::ffi::c_char, + pub(crate) data: *mut ::core::ffi::c_void, + pub(crate) timestamp: [::core::ffi::c_char; 512usize], + pub(crate) provider: *const mjpResourceProvider, } +pub type mjfOpenResource = + ::core::option::Option ::core::ffi::c_int>; +pub type mjfReadResource = ::core::option::Option< + unsafe extern "C" fn( + resource: *mut mjResource, + buffer: *mut *const ::core::ffi::c_void, + ) -> ::core::ffi::c_int, +>; +pub type mjfCloseResource = ::core::option::Option; +pub type mjfGetResourceDir = ::core::option::Option< + unsafe extern "C" fn( + resource: *mut mjResource, + dir: *mut *const ::core::ffi::c_char, + ndir: *mut ::core::ffi::c_int, + ), +>; +pub type mjfResourceModified = ::core::option::Option< + unsafe extern "C" fn( + resource: *const mjResource, + timestamp: *const ::core::ffi::c_char, + ) -> ::core::ffi::c_int, +>; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjsExclude { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) bodyname1: *mut mjString, - pub(crate) bodyname2: *mut mjString, - pub(crate) info: *mut mjString, +pub struct mjpResourceProvider { + pub(crate) prefix: *const ::core::ffi::c_char, + pub(crate) open: mjfOpenResource, + pub(crate) read: mjfReadResource, + pub(crate) close: mjfCloseResource, + pub(crate) getdir: mjfGetResourceDir, + pub(crate) modified: mjfResourceModified, + pub(crate) data: *mut ::core::ffi::c_void, } +pub type mjfDecode = + ::core::option::Option *mut mjSpec>; +pub type mjfCanDecode = + ::core::option::Option ::core::ffi::c_int>; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjsEquality { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) type_: mjtEq, - pub(crate) data: [f64; 11usize], - pub(crate) active: mjtByte, - pub(crate) name1: *mut mjString, - pub(crate) name2: *mut mjString, - pub(crate) objtype: mjtObj, - pub(crate) solref: [mjtNum; 2usize], - pub(crate) solimp: [mjtNum; 5usize], - pub(crate) info: *mut mjString, +pub struct mjpDecoder { + pub(crate) content_type: *const ::core::ffi::c_char, + pub(crate) extension: *const ::core::ffi::c_char, + pub(crate) can_decode: mjfCanDecode, + pub(crate) decode: mjfDecode, } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsTendon { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) stiffness: f64, - pub(crate) springlength: [f64; 2usize], - pub(crate) damping: f64, - pub(crate) frictionloss: f64, - pub(crate) solref_friction: [mjtNum; 2usize], - pub(crate) solimp_friction: [mjtNum; 5usize], - pub(crate) armature: f64, - pub(crate) limited: ::core::ffi::c_int, - pub(crate) actfrclimited: ::core::ffi::c_int, - pub(crate) range: [f64; 2usize], - pub(crate) actfrcrange: [f64; 2usize], - pub(crate) margin: f64, - pub(crate) solref_limit: [mjtNum; 2usize], - pub(crate) solimp_limit: [mjtNum; 5usize], - pub(crate) material: *mut mjString, - pub(crate) width: f64, - pub(crate) rgba: [f32; 4usize], - pub(crate) group: ::core::ffi::c_int, - pub(crate) userdata: *mut mjDoubleVec, - pub(crate) info: *mut mjString, +impl mjtPluginCapabilityBit { + pub const ACTUATOR: mjtPluginCapabilityBit = mjtPluginCapabilityBit(1); + pub const SENSOR: mjtPluginCapabilityBit = mjtPluginCapabilityBit(2); + pub const PASSIVE: mjtPluginCapabilityBit = mjtPluginCapabilityBit(4); + pub const SDF: mjtPluginCapabilityBit = mjtPluginCapabilityBit(8); } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsWrap { - pub(crate) element: *mut mjsElement, - pub(crate) info: *mut mjString, +impl ::core::ops::BitOr for mjtPluginCapabilityBit { + type Output = Self; + #[inline] + fn bitor(self, other: Self) -> Self { + mjtPluginCapabilityBit(self.0 | other.0) + } +} +impl ::core::ops::BitOrAssign for mjtPluginCapabilityBit { + #[inline] + fn bitor_assign(&mut self, rhs: mjtPluginCapabilityBit) { + self.0 |= rhs.0; + } +} +impl ::core::ops::BitAnd for mjtPluginCapabilityBit { + type Output = Self; + #[inline] + fn bitand(self, other: Self) -> Self { + mjtPluginCapabilityBit(self.0 & other.0) + } +} +impl ::core::ops::BitAndAssign for mjtPluginCapabilityBit { + #[inline] + fn bitand_assign(&mut self, rhs: mjtPluginCapabilityBit) { + self.0 &= rhs.0; + } } +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtPluginCapabilityBit(pub(crate) ::core::ffi::c_uint); #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjsActuator { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) gaintype: mjtGain, - pub(crate) gainprm: [f64; 10usize], - pub(crate) biastype: mjtBias, - pub(crate) biasprm: [f64; 10usize], - pub(crate) dyntype: mjtDyn, - pub(crate) dynprm: [f64; 10usize], - pub(crate) actdim: ::core::ffi::c_int, - pub(crate) actearly: mjtByte, - pub(crate) trntype: mjtTrn, - pub(crate) gear: [f64; 6usize], - pub(crate) target: *mut mjString, - pub(crate) refsite: *mut mjString, - pub(crate) slidersite: *mut mjString, - pub(crate) cranklength: f64, - pub(crate) lengthrange: [f64; 2usize], - pub(crate) inheritrange: f64, - pub(crate) ctrllimited: ::core::ffi::c_int, - pub(crate) ctrlrange: [f64; 2usize], - pub(crate) forcelimited: ::core::ffi::c_int, - pub(crate) forcerange: [f64; 2usize], - pub(crate) actlimited: ::core::ffi::c_int, - pub(crate) actrange: [f64; 2usize], - pub(crate) group: ::core::ffi::c_int, - pub(crate) userdata: *mut mjDoubleVec, - pub(crate) plugin: mjsPlugin, - pub(crate) info: *mut mjString, +pub struct mjpPlugin { + pub(crate) name: *const ::core::ffi::c_char, + pub(crate) nattribute: ::core::ffi::c_int, + pub(crate) attributes: *const *const ::core::ffi::c_char, + pub(crate) capabilityflags: ::core::ffi::c_int, + pub(crate) needstage: ::core::ffi::c_int, + pub(crate) nstate: ::core::option::Option< + unsafe extern "C" fn(m: *const mjModel, instance: ::core::ffi::c_int) -> ::core::ffi::c_int, + >, + pub(crate) nsensordata: ::core::option::Option< + unsafe extern "C" fn( + m: *const mjModel, + instance: ::core::ffi::c_int, + sensor_id: ::core::ffi::c_int, + ) -> ::core::ffi::c_int, + >, + pub(crate) init: ::core::option::Option< + unsafe extern "C" fn( + m: *const mjModel, + d: *mut mjData, + instance: ::core::ffi::c_int, + ) -> ::core::ffi::c_int, + >, + pub(crate) destroy: + ::core::option::Option, + pub(crate) copy: ::core::option::Option< + unsafe extern "C" fn( + dest: *mut mjData, + m: *const mjModel, + src: *const mjData, + instance: ::core::ffi::c_int, + ), + >, + pub(crate) reset: ::core::option::Option< + unsafe extern "C" fn( + m: *const mjModel, + plugin_state: *mut mjtNum, + plugin_data: *mut ::core::ffi::c_void, + instance: ::core::ffi::c_int, + ), + >, + pub(crate) compute: ::core::option::Option< + unsafe extern "C" fn( + m: *const mjModel, + d: *mut mjData, + instance: ::core::ffi::c_int, + capability_bit: ::core::ffi::c_int, + ), + >, + pub(crate) advance: ::core::option::Option< + unsafe extern "C" fn(m: *const mjModel, d: *mut mjData, instance: ::core::ffi::c_int), + >, + pub(crate) visualize: ::core::option::Option< + unsafe extern "C" fn( + m: *const mjModel, + d: *mut mjData, + opt: *const mjvOption, + scn: *mut mjvScene, + instance: ::core::ffi::c_int, + ), + >, + pub(crate) actuator_act_dot: ::core::option::Option< + unsafe extern "C" fn(m: *const mjModel, d: *mut mjData, instance: ::core::ffi::c_int), + >, + pub(crate) sdf_distance: ::core::option::Option< + unsafe extern "C" fn( + point: *const [mjtNum; 3usize], + d: *const mjData, + instance: ::core::ffi::c_int, + ) -> mjtNum, + >, + pub(crate) sdf_gradient: ::core::option::Option< + unsafe extern "C" fn( + gradient: *mut [mjtNum; 3usize], + point: *const [mjtNum; 3usize], + d: *const mjData, + instance: ::core::ffi::c_int, + ), + >, + pub(crate) sdf_staticdistance: ::core::option::Option< + unsafe extern "C" fn(point: *const [mjtNum; 3usize], attributes: *const mjtNum) -> mjtNum, + >, + pub(crate) sdf_attribute: ::core::option::Option< + unsafe extern "C" fn( + attribute: *mut [mjtNum; 0usize], + name: *mut [*const ::core::ffi::c_char; 0usize], + value: *mut [*const ::core::ffi::c_char; 0usize], + ), + >, + pub(crate) sdf_aabb: ::core::option::Option< + unsafe extern "C" fn(aabb: *mut [mjtNum; 6usize], attributes: *const mjtNum), + >, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjsSensor { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) type_: mjtSensor, - pub(crate) objtype: mjtObj, - pub(crate) objname: *mut mjString, - pub(crate) reftype: mjtObj, - pub(crate) refname: *mut mjString, - pub(crate) datatype: mjtDataType, - pub(crate) needstage: mjtStage, - pub(crate) dim: ::core::ffi::c_int, - pub(crate) cutoff: f64, - pub(crate) noise: f64, - pub(crate) userdata: *mut mjDoubleVec, - pub(crate) plugin: mjsPlugin, - pub(crate) info: *mut mjString, +pub struct mjSDF { + pub(crate) plugin: *mut *const mjpPlugin, + pub(crate) id: *mut ::core::ffi::c_int, + pub(crate) type_: mjtSDFType, + pub(crate) relpos: *mut mjtNum, + pub(crate) relmat: *mut mjtNum, + pub(crate) geomtype: *mut mjtGeom, } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsNumeric { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) data: *mut mjDoubleVec, - pub(crate) size: ::core::ffi::c_int, - pub(crate) info: *mut mjString, +pub type mjfPluginLibraryLoadCallback = ::core::option::Option< + unsafe extern "C" fn( + filename: *const ::core::ffi::c_char, + first: ::core::ffi::c_int, + count: ::core::ffi::c_int, + ), +>; +impl mjtGridPos { + pub const TOPLEFT: mjtGridPos = mjtGridPos(0); + pub const TOPRIGHT: mjtGridPos = mjtGridPos(1); + pub const BOTTOMLEFT: mjtGridPos = mjtGridPos(2); + pub const BOTTOMRIGHT: mjtGridPos = mjtGridPos(3); + pub const TOP: mjtGridPos = mjtGridPos(4); + pub const BOTTOM: mjtGridPos = mjtGridPos(5); + pub const LEFT: mjtGridPos = mjtGridPos(6); + pub const RIGHT: mjtGridPos = mjtGridPos(7); } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsText { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) data: *mut mjString, - pub(crate) info: *mut mjString, +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtGridPos(pub(crate) ::core::ffi::c_uint); +impl mjtFramebuffer { + pub const WINDOW: mjtFramebuffer = mjtFramebuffer(0); + pub const OFFSCREEN: mjtFramebuffer = mjtFramebuffer(1); } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsTuple { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) objtype: *mut mjIntVec, - pub(crate) objname: *mut mjStringVec, - pub(crate) objprm: *mut mjDoubleVec, - pub(crate) info: *mut mjString, +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtFramebuffer(pub(crate) ::core::ffi::c_uint); +impl mjtDepthMap { + pub const ZERONEAR: mjtDepthMap = mjtDepthMap(0); + pub const ZEROFAR: mjtDepthMap = mjtDepthMap(1); +} +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtDepthMap(pub(crate) ::core::ffi::c_uint); +impl mjtFontScale { + pub const X50: mjtFontScale = mjtFontScale(50); + pub const X100: mjtFontScale = mjtFontScale(100); + pub const X150: mjtFontScale = mjtFontScale(150); + pub const X200: mjtFontScale = mjtFontScale(200); + pub const X250: mjtFontScale = mjtFontScale(250); + pub const X300: mjtFontScale = mjtFontScale(300); +} +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtFontScale(pub(crate) ::core::ffi::c_uint); +impl mjtFont { + pub const NORMAL: mjtFont = mjtFont(0); + pub const SHADOW: mjtFont = mjtFont(1); + pub const BIG: mjtFont = mjtFont(2); } +#[repr(transparent)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct mjtFont(pub(crate) ::core::ffi::c_uint); #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct mjsKey { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) time: f64, - pub(crate) qpos: *mut mjDoubleVec, - pub(crate) qvel: *mut mjDoubleVec, - pub(crate) act: *mut mjDoubleVec, - pub(crate) mpos: *mut mjDoubleVec, - pub(crate) mquat: *mut mjDoubleVec, - pub(crate) ctrl: *mut mjDoubleVec, - pub(crate) info: *mut mjString, +pub struct mjrRect { + pub(crate) left: ::core::ffi::c_int, + pub(crate) bottom: ::core::ffi::c_int, + pub(crate) width: ::core::ffi::c_int, + pub(crate) height: ::core::ffi::c_int, } #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct mjsDefault { - pub(crate) element: *mut mjsElement, - pub(crate) name: *mut mjString, - pub(crate) joint: *mut mjsJoint, - pub(crate) geom: *mut mjsGeom, - pub(crate) site: *mut mjsSite, - pub(crate) camera: *mut mjsCamera, - pub(crate) light: *mut mjsLight, - pub(crate) flex: *mut mjsFlex, - pub(crate) mesh: *mut mjsMesh, - pub(crate) material: *mut mjsMaterial, - pub(crate) pair: *mut mjsPair, - pub(crate) equality: *mut mjsEquality, - pub(crate) tendon: *mut mjsTendon, - pub(crate) actuator: *mut mjsActuator, +#[derive(Debug)] +pub struct mjrContext { + pub(crate) lineWidth: f32, + pub(crate) shadowClip: f32, + pub(crate) shadowScale: f32, + pub(crate) fogStart: f32, + pub(crate) fogEnd: f32, + pub(crate) fogRGBA: [f32; 4usize], + pub(crate) shadowSize: ::core::ffi::c_int, + pub(crate) offWidth: ::core::ffi::c_int, + pub(crate) offHeight: ::core::ffi::c_int, + pub(crate) offSamples: ::core::ffi::c_int, + pub(crate) fontScale: ::core::ffi::c_int, + pub(crate) auxWidth: [::core::ffi::c_int; 10usize], + pub(crate) auxHeight: [::core::ffi::c_int; 10usize], + pub(crate) auxSamples: [::core::ffi::c_int; 10usize], + pub(crate) offFBO: ::core::ffi::c_uint, + pub(crate) offFBO_r: ::core::ffi::c_uint, + pub(crate) offColor: ::core::ffi::c_uint, + pub(crate) offColor_r: ::core::ffi::c_uint, + pub(crate) offDepthStencil: ::core::ffi::c_uint, + pub(crate) offDepthStencil_r: ::core::ffi::c_uint, + pub(crate) shadowFBO: ::core::ffi::c_uint, + pub(crate) shadowTex: ::core::ffi::c_uint, + pub(crate) auxFBO: [::core::ffi::c_uint; 10usize], + pub(crate) auxFBO_r: [::core::ffi::c_uint; 10usize], + pub(crate) auxColor: [::core::ffi::c_uint; 10usize], + pub(crate) auxColor_r: [::core::ffi::c_uint; 10usize], + pub(crate) mat_texid: [::core::ffi::c_int; 10000usize], + pub(crate) mat_texuniform: [::core::ffi::c_int; 1000usize], + pub(crate) mat_texrepeat: [f32; 2000usize], + pub(crate) ntexture: ::core::ffi::c_int, + pub(crate) textureType: [::core::ffi::c_int; 1000usize], + pub(crate) texture: [::core::ffi::c_uint; 1000usize], + pub(crate) basePlane: ::core::ffi::c_uint, + pub(crate) baseMesh: ::core::ffi::c_uint, + pub(crate) baseHField: ::core::ffi::c_uint, + pub(crate) baseBuiltin: ::core::ffi::c_uint, + pub(crate) baseFontNormal: ::core::ffi::c_uint, + pub(crate) baseFontShadow: ::core::ffi::c_uint, + pub(crate) baseFontBig: ::core::ffi::c_uint, + pub(crate) rangePlane: ::core::ffi::c_int, + pub(crate) rangeMesh: ::core::ffi::c_int, + pub(crate) rangeHField: ::core::ffi::c_int, + pub(crate) rangeBuiltin: ::core::ffi::c_int, + pub(crate) rangeFont: ::core::ffi::c_int, + pub(crate) nskin: ::core::ffi::c_int, + pub(crate) skinvertVBO: *mut ::core::ffi::c_uint, + pub(crate) skinnormalVBO: *mut ::core::ffi::c_uint, + pub(crate) skintexcoordVBO: *mut ::core::ffi::c_uint, + pub(crate) skinfaceVBO: *mut ::core::ffi::c_uint, + pub(crate) charWidth: [::core::ffi::c_int; 127usize], + pub(crate) charWidthBig: [::core::ffi::c_int; 127usize], + pub(crate) charHeight: ::core::ffi::c_int, + pub(crate) charHeightBig: ::core::ffi::c_int, + pub(crate) glInitialized: ::core::ffi::c_int, + pub(crate) windowAvailable: ::core::ffi::c_int, + pub(crate) windowSamples: ::core::ffi::c_int, + pub(crate) windowStereo: ::core::ffi::c_int, + pub(crate) windowDoublebuffer: ::core::ffi::c_int, + pub(crate) currentBuffer: ::core::ffi::c_int, + pub(crate) readPixelFormat: ::core::ffi::c_int, + pub(crate) readDepthMap: ::core::ffi::c_int, } impl mjtButton { pub const NONE: mjtButton = mjtButton(0); @@ -3288,12 +3191,12 @@ unsafe extern "C" { pub static mut mjcb_act_gain: mjfAct; pub static mut mjcb_act_bias: mjfAct; pub static mut mjCOLLISIONFUNC: [[mjfCollision; 9usize]; 9usize]; - pub static mut mjDISABLESTRING: [*const ::core::ffi::c_char; 17usize]; + pub static mut mjDISABLESTRING: [*const ::core::ffi::c_char; 19usize]; pub static mut mjENABLESTRING: [*const ::core::ffi::c_char; 6usize]; pub static mut mjTIMERSTRING: [*const ::core::ffi::c_char; 15usize]; pub static mut mjLABELSTRING: [*const ::core::ffi::c_char; 17usize]; pub static mut mjFRAMESTRING: [*const ::core::ffi::c_char; 8usize]; - pub static mut mjVISSTRING: [[*const ::core::ffi::c_char; 3usize]; 32usize]; + pub static mut mjVISSTRING: [[*const ::core::ffi::c_char; 3usize]; 31usize]; pub static mut mjRNDSTRING: [[*const ::core::ffi::c_char; 3usize]; 10usize]; pub fn mj_defaultVFS(vfs: *mut mjVFS); pub fn mj_addFileVFS( @@ -3312,6 +3215,11 @@ unsafe extern "C" { filename: *const ::core::ffi::c_char, ) -> ::core::ffi::c_int; pub fn mj_deleteVFS(vfs: *mut mjVFS); + pub fn mj_getCacheSize(cache: *const mjCache) -> usize; + pub fn mj_getCacheCapacity(cache: *const mjCache) -> usize; + pub fn mj_setCacheCapacity(cache: *mut mjCache, size: usize) -> usize; + pub fn mj_getCache() -> *mut mjCache; + pub fn mj_clearCache(cache: *mut mjCache); pub fn mj_loadXML( filename: *const ::core::ffi::c_char, vfs: *const mjVFS, @@ -3330,7 +3238,15 @@ unsafe extern "C" { error: *mut ::core::ffi::c_char, error_sz: ::core::ffi::c_int, ) -> *mut mjSpec; + pub fn mj_parse( + filename: *const ::core::ffi::c_char, + content_type: *const ::core::ffi::c_char, + vfs: *const mjVFS, + error: *mut ::core::ffi::c_char, + error_sz: ::core::ffi::c_int, + ) -> *mut mjSpec; pub fn mj_compile(s: *mut mjSpec, vfs: *const mjVFS) -> *mut mjModel; + pub fn mj_copyBack(s: *mut mjSpec, m: *const mjModel) -> ::core::ffi::c_int; pub fn mj_recompile( s: *mut mjSpec, vfs: *const mjVFS, @@ -3357,6 +3273,10 @@ unsafe extern "C" { error: *mut ::core::ffi::c_char, error_sz: ::core::ffi::c_int, ) -> ::core::ffi::c_int; + pub fn mju_getXMLDependencies( + filename: *const ::core::ffi::c_char, + dependencies: *mut mjStringVec, + ); pub fn mj_step(m: *const mjModel, d: *mut mjData); pub fn mj_step1(m: *const mjModel, d: *mut mjData); pub fn mj_step2(m: *const mjModel, d: *mut mjData); @@ -3387,9 +3307,10 @@ unsafe extern "C" { ); pub fn mj_loadModel(filename: *const ::core::ffi::c_char, vfs: *const mjVFS) -> *mut mjModel; pub fn mj_deleteModel(m: *mut mjModel); - pub fn mj_sizeModel(m: *const mjModel) -> ::core::ffi::c_int; + pub fn mj_sizeModel(m: *const mjModel) -> mjtSize; pub fn mj_makeData(m: *const mjModel) -> *mut mjData; pub fn mj_copyData(dest: *mut mjData, m: *const mjModel, src: *const mjData) -> *mut mjData; + pub fn mjv_copyData(dest: *mut mjData, m: *const mjModel, src: *const mjData) -> *mut mjData; pub fn mj_resetData(m: *const mjModel, d: *mut mjData); pub fn mj_resetDataDebug(m: *const mjModel, d: *mut mjData, debug_value: ::core::ffi::c_uchar); pub fn mj_resetDataKeyframe(m: *const mjModel, d: *mut mjData, key: ::core::ffi::c_int); @@ -3449,6 +3370,13 @@ unsafe extern "C" { flg_html: ::core::ffi::c_int, flg_pad: ::core::ffi::c_int, ) -> ::core::ffi::c_int; + pub fn mj_printScene(s: *const mjvScene, filename: *const ::core::ffi::c_char); + pub fn mj_printFormattedScene( + s: *const mjvScene, + filename: *const ::core::ffi::c_char, + float_format: *const ::core::ffi::c_char, + ); + pub fn mj_fwdKinematics(m: *const mjModel, d: *mut mjData); pub fn mj_fwdPosition(m: *const mjModel, d: *mut mjData); pub fn mj_fwdVelocity(m: *const mjModel, d: *mut mjData); pub fn mj_fwdActuation(m: *const mjModel, d: *mut mjData); @@ -3476,6 +3404,7 @@ unsafe extern "C" { pub fn mj_tendon(m: *const mjModel, d: *mut mjData); pub fn mj_transmission(m: *const mjModel, d: *mut mjData); pub fn mj_crb(m: *const mjModel, d: *mut mjData); + pub fn mj_makeM(m: *const mjModel, d: *mut mjData); pub fn mj_factorM(m: *const mjModel, d: *mut mjData); pub fn mj_solveM( m: *const mjModel, @@ -3514,18 +3443,31 @@ unsafe extern "C" { cost: *mut [mjtNum; 1usize], flg_coneHessian: ::core::ffi::c_int, ); - pub fn mj_stateSize(m: *const mjModel, spec: ::core::ffi::c_uint) -> ::core::ffi::c_int; + pub fn mj_stateSize(m: *const mjModel, sig: ::core::ffi::c_uint) -> ::core::ffi::c_int; pub fn mj_getState( m: *const mjModel, d: *const mjData, state: *mut mjtNum, - spec: ::core::ffi::c_uint, + sig: ::core::ffi::c_uint, + ); + pub fn mj_extractState( + m: *const mjModel, + src: *const mjtNum, + srcsig: ::core::ffi::c_uint, + dst: *mut mjtNum, + dstsig: ::core::ffi::c_uint, ); pub fn mj_setState( m: *const mjModel, d: *mut mjData, state: *const mjtNum, - spec: ::core::ffi::c_uint, + sig: ::core::ffi::c_uint, + ); + pub fn mj_copyState( + m: *const mjModel, + src: *const mjData, + dst: *mut mjData, + sig: ::core::ffi::c_uint, ); pub fn mj_setKeyframe(m: *mut mjModel, d: *const mjData, k: ::core::ffi::c_int); pub fn mj_addContact( @@ -3699,7 +3641,7 @@ unsafe extern "C" { m: *const mjModel, d: *mut mjData, pnt: *const [mjtNum; 3usize], - vec: *const mjtNum, + vec: *const [mjtNum; 3usize], geomgroup: *const mjtByte, flg_static: mjtByte, bodyexclude: ::core::ffi::c_int, @@ -3749,8 +3691,8 @@ unsafe extern "C" { flg_face: mjtByte, flg_skin: mjtByte, flexid: ::core::ffi::c_int, - pnt: *const mjtNum, - vec: *const mjtNum, + pnt: *const [mjtNum; 3usize], + vec: *const [mjtNum; 3usize], vertid: *mut [::core::ffi::c_int; 1usize], ) -> mjtNum; pub fn mju_raySkin( @@ -3805,14 +3747,6 @@ unsafe extern "C" { scn: *const mjvScene, cam: *mut mjvCamera, ); - pub fn mjv_moveCameraFromState( - scnstate: *const mjvSceneState, - action: ::core::ffi::c_int, - reldx: mjtNum, - reldy: mjtNum, - scn: *const mjvScene, - cam: *mut mjvCamera, - ); pub fn mjv_movePerturb( m: *const mjModel, d: *const mjData, @@ -3822,14 +3756,6 @@ unsafe extern "C" { scn: *const mjvScene, pert: *mut mjvPerturb, ); - pub fn mjv_movePerturbFromState( - scnstate: *const mjvSceneState, - action: ::core::ffi::c_int, - reldx: mjtNum, - reldy: mjtNum, - scn: *const mjvScene, - pert: *mut mjvPerturb, - ); pub fn mjv_moveModel( m: *const mjModel, action: ::core::ffi::c_int, @@ -3894,29 +3820,7 @@ unsafe extern "C" { catmask: ::core::ffi::c_int, scn: *mut mjvScene, ); - pub fn mjv_updateSceneFromState( - scnstate: *const mjvSceneState, - opt: *const mjvOption, - pert: *const mjvPerturb, - cam: *mut mjvCamera, - catmask: ::core::ffi::c_int, - scn: *mut mjvScene, - ) -> ::core::ffi::c_int; pub fn mjv_copyModel(dest: *mut mjModel, src: *const mjModel); - pub fn mjv_defaultSceneState(scnstate: *mut mjvSceneState); - pub fn mjv_makeSceneState( - m: *const mjModel, - d: *const mjData, - scnstate: *mut mjvSceneState, - maxgeom: ::core::ffi::c_int, - ); - pub fn mjv_freeSceneState(scnstate: *mut mjvSceneState); - pub fn mjv_updateSceneState( - m: *const mjModel, - d: *mut mjData, - opt: *const mjvOption, - scnstate: *mut mjvSceneState, - ); pub fn mjv_addGeoms( m: *const mjModel, d: *mut mjData, @@ -3933,6 +3837,21 @@ unsafe extern "C" { scn: *mut mjvScene, ); pub fn mjv_updateSkin(m: *const mjModel, d: *const mjData, scn: *mut mjvScene); + pub fn mjv_cameraFrame( + headpos: *mut [mjtNum; 3usize], + forward: *mut [mjtNum; 3usize], + up: *mut [mjtNum; 3usize], + right: *mut [mjtNum; 3usize], + d: *const mjData, + cam: *const mjvCamera, + ); + pub fn mjv_cameraFrustum( + zver: *mut [f32; 2usize], + zhor: *mut [f32; 2usize], + zclip: *mut [f32; 2usize], + m: *const mjModel, + cam: *const mjvCamera, + ); pub fn mjr_defaultContext(con: *mut mjrContext); pub fn mjr_makeContext(m: *const mjModel, con: *mut mjrContext, fontscale: ::core::ffi::c_int); pub fn mjr_changeFont(fontscale: ::core::ffi::c_int, con: *mut mjrContext); @@ -4423,7 +4342,7 @@ unsafe extern "C" { pub fn mju_writeNumBytes(nbytes: usize) -> *const ::core::ffi::c_char; pub fn mju_warningText(warning: ::core::ffi::c_int, info: usize) -> *const ::core::ffi::c_char; pub fn mju_isBad(x: mjtNum) -> ::core::ffi::c_int; - pub fn mju_isZero(vec: *mut mjtNum, n: ::core::ffi::c_int) -> ::core::ffi::c_int; + pub fn mju_isZero(vec: *const mjtNum, n: ::core::ffi::c_int) -> ::core::ffi::c_int; pub fn mju_standardNormal(num2: *mut mjtNum) -> mjtNum; pub fn mju_f2n(res: *mut mjtNum, vec: *const f32, n: ::core::ffi::c_int); pub fn mju_n2f(res: *mut f32, vec: *const mjtNum, n: ::core::ffi::c_int); @@ -4438,6 +4357,20 @@ unsafe extern "C" { n: ::core::ffi::c_int, ) -> *mut ::core::ffi::c_char; pub fn mju_sigmoid(x: mjtNum) -> mjtNum; + pub fn mjc_getSDF(m: *const mjModel, id: ::core::ffi::c_int) -> *const mjpPlugin; + pub fn mjc_distance( + m: *const mjModel, + d: *const mjData, + s: *const mjSDF, + x: *const [mjtNum; 3usize], + ) -> mjtNum; + pub fn mjc_gradient( + m: *const mjModel, + d: *const mjData, + s: *const mjSDF, + gradient: *mut [mjtNum; 3usize], + x: *const [mjtNum; 3usize], + ); pub fn mjd_transitionFD( m: *const mjModel, d: *mut mjData, @@ -4490,6 +4423,12 @@ unsafe extern "C" { resource_name: *const ::core::ffi::c_char, ) -> *const mjpResourceProvider; pub fn mjp_getResourceProviderAtSlot(slot: ::core::ffi::c_int) -> *const mjpResourceProvider; + pub fn mjp_registerDecoder(decoder: *const mjpDecoder); + pub fn mjp_defaultDecoder(decoder: *mut mjpDecoder); + pub fn mjp_findDecoder( + resource: *const mjResource, + content_type: *const ::core::ffi::c_char, + ) -> *const mjpDecoder; pub fn mju_threadPoolCreate(number_of_threads: usize) -> *mut mjThreadPool; pub fn mju_bindThreadPool(d: *mut mjData, thread_pool: *mut ::core::ffi::c_void); pub fn mju_threadPoolEnqueue(thread_pool: *mut mjThreadPool, task: *mut mjTask); @@ -4502,8 +4441,6 @@ unsafe extern "C" { prefix: *const ::core::ffi::c_char, suffix: *const ::core::ffi::c_char, ) -> *mut mjsElement; - pub fn mjs_detachBody(s: *mut mjSpec, b: *mut mjsBody) -> ::core::ffi::c_int; - pub fn mjs_detachDefault(s: *mut mjSpec, d: *mut mjsDefault) -> ::core::ffi::c_int; pub fn mjs_addBody(body: *mut mjsBody, def: *const mjsDefault) -> *mut mjsBody; pub fn mjs_addSite(body: *mut mjsBody, def: *const mjsDefault) -> *mut mjsSite; pub fn mjs_addJoint(body: *mut mjsBody, def: *const mjsDefault) -> *mut mjsJoint; @@ -4512,7 +4449,7 @@ unsafe extern "C" { pub fn mjs_addCamera(body: *mut mjsBody, def: *const mjsDefault) -> *mut mjsCamera; pub fn mjs_addLight(body: *mut mjsBody, def: *const mjsDefault) -> *mut mjsLight; pub fn mjs_addFrame(body: *mut mjsBody, parentframe: *mut mjsFrame) -> *mut mjsFrame; - pub fn mjs_delete(element: *mut mjsElement) -> ::core::ffi::c_int; + pub fn mjs_delete(spec: *mut mjSpec, element: *mut mjsElement) -> ::core::ffi::c_int; pub fn mjs_addActuator(s: *mut mjSpec, def: *const mjsDefault) -> *mut mjsActuator; pub fn mjs_addSensor(s: *mut mjSpec) -> *mut mjsSensor; pub fn mjs_addFlex(s: *mut mjSpec) -> *mut mjsFlex; @@ -4542,11 +4479,57 @@ unsafe extern "C" { classname: *const ::core::ffi::c_char, parent: *const mjsDefault, ) -> *mut mjsDefault; + pub fn mjs_setToMotor(actuator: *mut mjsActuator) -> *const ::core::ffi::c_char; + pub fn mjs_setToPosition( + actuator: *mut mjsActuator, + kp: f64, + kv: *mut [f64; 1usize], + dampratio: *mut [f64; 1usize], + timeconst: *mut [f64; 1usize], + inheritrange: f64, + ) -> *const ::core::ffi::c_char; + pub fn mjs_setToIntVelocity( + actuator: *mut mjsActuator, + kp: f64, + kv: *mut [f64; 1usize], + dampratio: *mut [f64; 1usize], + timeconst: *mut [f64; 1usize], + inheritrange: f64, + ) -> *const ::core::ffi::c_char; + pub fn mjs_setToVelocity(actuator: *mut mjsActuator, kv: f64) -> *const ::core::ffi::c_char; + pub fn mjs_setToDamper(actuator: *mut mjsActuator, kv: f64) -> *const ::core::ffi::c_char; + pub fn mjs_setToCylinder( + actuator: *mut mjsActuator, + timeconst: f64, + bias: f64, + area: f64, + diameter: f64, + ) -> *const ::core::ffi::c_char; + pub fn mjs_setToMuscle( + actuator: *mut mjsActuator, + timeconst: *mut [f64; 2usize], + tausmooth: f64, + range: *mut [f64; 2usize], + force: f64, + scale: f64, + lmin: f64, + lmax: f64, + vmax: f64, + fpmax: f64, + fvmax: f64, + ) -> *const ::core::ffi::c_char; + pub fn mjs_setToAdhesion(actuator: *mut mjsActuator, gain: f64) -> *const ::core::ffi::c_char; pub fn mjs_addMesh(s: *mut mjSpec, def: *const mjsDefault) -> *mut mjsMesh; pub fn mjs_addHField(s: *mut mjSpec) -> *mut mjsHField; pub fn mjs_addSkin(s: *mut mjSpec) -> *mut mjsSkin; pub fn mjs_addTexture(s: *mut mjSpec) -> *mut mjsTexture; pub fn mjs_addMaterial(s: *mut mjSpec, def: *const mjsDefault) -> *mut mjsMaterial; + pub fn mjs_makeMesh( + mesh: *mut mjsMesh, + builtin: mjtMeshBuiltin, + params: *mut f64, + nparams: ::core::ffi::c_int, + ) -> ::core::ffi::c_int; pub fn mjs_getSpec(element: *mut mjsElement) -> *mut mjSpec; pub fn mjs_findSpec(spec: *mut mjSpec, name: *const ::core::ffi::c_char) -> *mut mjSpec; pub fn mjs_findBody(s: *mut mjSpec, name: *const ::core::ffi::c_char) -> *mut mjsBody; @@ -4578,6 +4561,14 @@ unsafe extern "C" { ) -> *mut mjsElement; pub fn mjs_firstElement(s: *mut mjSpec, type_: mjtObj) -> *mut mjsElement; pub fn mjs_nextElement(s: *mut mjSpec, element: *mut mjsElement) -> *mut mjsElement; + pub fn mjs_getWrapTarget(wrap: *mut mjsWrap) -> *mut mjsElement; + pub fn mjs_getWrapSideSite(wrap: *mut mjsWrap) -> *mut mjsSite; + pub fn mjs_getWrapDivisor(wrap: *mut mjsWrap) -> f64; + pub fn mjs_getWrapCoef(wrap: *mut mjsWrap) -> f64; + pub fn mjs_setName( + element: *mut mjsElement, + name: *const ::core::ffi::c_char, + ) -> ::core::ffi::c_int; pub fn mjs_setBuffer( dest: *mut mjByteVec, array: *const ::core::ffi::c_void, @@ -4609,8 +4600,12 @@ unsafe extern "C" { ); pub fn mjs_setDouble(dest: *mut mjDoubleVec, array: *const f64, size: ::core::ffi::c_int); pub fn mjs_setPluginAttributes(plugin: *mut mjsPlugin, attributes: *mut ::core::ffi::c_void); + pub fn mjs_getName(element: *mut mjsElement) -> *mut mjString; pub fn mjs_getString(source: *const mjString) -> *const ::core::ffi::c_char; pub fn mjs_getDouble(source: *const mjDoubleVec, size: *mut ::core::ffi::c_int) -> *const f64; + pub fn mjs_getWrapNum(tendonspec: *const mjsTendon) -> ::core::ffi::c_int; + pub fn mjs_getWrap(tendonspec: *const mjsTendon, i: ::core::ffi::c_int) -> *mut mjsWrap; + pub fn mjs_getPluginAttributes(plugin: *const mjsPlugin) -> *const ::core::ffi::c_void; pub fn mjs_setDefault(element: *mut mjsElement, def: *const mjsDefault); pub fn mjs_setFrame(dest: *mut mjsElement, frame: *mut mjsFrame) -> ::core::ffi::c_int; pub fn mjs_resolveOrientation( @@ -4625,11 +4620,18 @@ unsafe extern "C" { key: *const ::core::ffi::c_char, data: *const ::core::ffi::c_void, ); + pub fn mjs_setUserValueWithCleanup( + element: *mut mjsElement, + key: *const ::core::ffi::c_char, + data: *const ::core::ffi::c_void, + cleanup: ::core::option::Option, + ); pub fn mjs_getUserValue( element: *mut mjsElement, key: *const ::core::ffi::c_char, ) -> *const ::core::ffi::c_void; pub fn mjs_deleteUserValue(element: *mut mjsElement, key: *const ::core::ffi::c_char); + pub fn mjs_sensorDim(sensor: *const mjsSensor) -> ::core::ffi::c_int; pub fn mjs_defaultSpec(spec: *mut mjSpec); pub fn mjs_defaultOrientation(orient: *mut mjsOrientation); pub fn mjs_defaultBody(body: *mut mjsBody); diff --git a/src/functions/attachment.rs b/src/functions/attachment.rs index 445ddb1..3663cdf 100644 --- a/src/functions/attachment.rs +++ b/src/functions/attachment.rs @@ -27,21 +27,21 @@ pub fn mjs_attach<'element>( } /// Delete body and descendants from mjSpec, remove all references. -/* int mjs_detachBody(mjSpec* s, mjsBody* b); */ +/* int mjs_delete(mjSpec* spec, mjsElement* element); */ pub fn mjs_detachBody(s: &mut mjSpec, b: &mut mjsBody) -> Result<(), ()> { /* - + > return 0 on success */ - if unsafe { crate::bindgen::mjs_detachBody(s.as_mut_ptr(), b) } == 0 {Ok(())} else {Err(())} + if unsafe { crate::bindgen::mjs_delete(s.as_mut_ptr(), b.element) } == 0 {Ok(())} else {Err(())} } /// Delete default class and descendants from mjSpec, remove all references. -/* int mjs_detachDefault(mjSpec* s, mjsDefault* d); */ +/* int mjs_delete(mjSpec* spec, mjsElement* element); */ pub fn mjs_detachDefault(s: &mut mjSpec, d: &mut mjsDefault) -> Result<(), ()> { /* - + > return 0 on success */ - if unsafe { crate::bindgen::mjs_detachDefault(s.as_mut_ptr(), d) } == 0 {Ok(())} else {Err(())} + if unsafe { crate::bindgen::mjs_delete(s.as_mut_ptr(), d.element) } == 0 {Ok(())} else {Err(())} } diff --git a/src/functions/attribute_setters.rs b/src/functions/attribute_setters.rs index 54797da..ae340fc 100644 --- a/src/functions/attribute_setters.rs +++ b/src/functions/attribute_setters.rs @@ -66,6 +66,7 @@ pub fn mjs_setDouble(dest: &mut mjDoubleVec, array: &[f64]) { } /// Set plugin attributes. +#[allow(clippy::not_unsafe_ptr_arg_deref)] pub fn mjs_setPluginAttributes(plugin: &mut mjsPlugin, attributes: *mut std::ffi::c_void) { unsafe { crate::bindgen::mjs_setPluginAttributes(plugin, attributes); } } diff --git a/src/functions/ray_casting.rs b/src/functions/ray_casting.rs index dabc777..7505ca8 100644 --- a/src/functions/ray_casting.rs +++ b/src/functions/ray_casting.rs @@ -36,8 +36,6 @@ pub fn mj_multiRay( bodyexclude: i32, cutoff: f64, ) -> Vec, f64)>> { - let vec: &[f64] = array_flatslice(&vec); - let mut geomid = vec![-1; N_RAY]; let mut dist = vec![-1.0; N_RAY]; @@ -224,8 +222,8 @@ pub fn mju_rayFlex( flg_face as u8, flg_skin as u8, flexid.index() as i32, - pnt.as_ptr(), - vec.as_ptr(), + &pnt, + &vec, &mut vertid, ) }; diff --git a/src/functions/tree_elements.rs b/src/functions/tree_elements.rs index 4f111d2..c5bb956 100644 --- a/src/functions/tree_elements.rs +++ b/src/functions/tree_elements.rs @@ -1,6 +1,6 @@ //! # [Tree elements](https://mujoco.readthedocs.io/en/stable/APIreference/APIfunctions.html#tree-elements) -use crate::{mjsBody, mjsDefault, mjsSite, mjsJoint, mjsGeom, mjsCamera, mjsLight, mjsFrame, mjsElement}; +use crate::{mjsBody, mjsDefault, mjsSite, mjsJoint, mjsGeom, mjsCamera, mjsLight, mjsFrame, mjsElement, mjSpec}; /// Add child body to body, return child. /* mjsBody* mjs_addBody(mjsBody* body, const mjsDefault* def); */ @@ -72,11 +72,11 @@ pub fn mjs_addFrame<'body>( } /// Delete object corresponding to the given element. -/* int mjs_delete(mjsElement* element); */ -pub fn mjs_delete(element: &mut mjsElement) -> Result<(), ()> { +/* int mjs_delete(mjSpec* spec, mjsElement* element); */ +pub fn mjs_delete(spec: &mut mjSpec, element: &mut mjsElement) -> Result<(), ()> { /* > return 0 on success */ - if unsafe { crate::bindgen::mjs_delete(element) } == 0 {Ok(())} else {Err(())} + if unsafe { crate::bindgen::mjs_delete(spec.as_mut_ptr(), element) } == 0 {Ok(())} else {Err(())} } diff --git a/src/types/mjdata.rs b/src/types/mjdata.rs index 905822f..6af347f 100644 --- a/src/types/mjdata.rs +++ b/src/types/mjdata.rs @@ -14,8 +14,8 @@ resource_wrapper!( fields_mapping!(mjData { scalars { // constant sizes - narena: usize = "size of the arena in bytes (inclusive of the stack)"; - nbuffer: usize = "size of main buffer in bytes"; + narena: crate::bindgen::mjtSize = "size of the arena in bytes (inclusive of the stack)"; + nbuffer: crate::bindgen::mjtSize = "size of main buffer in bytes"; nplugin: usize = "number of plugin instances"; // stack pointer @@ -26,9 +26,9 @@ fields_mapping!(mjData { parena: usize = "first available byte in arena"; // memory utilization statistics - maxuse_stack: usize = "maximum stack allocation in bytes"; - maxuse_threadstack: [usize; mjMAXTHREAD] = "maximum stack allocation per thread in bytes"; - maxuse_arena: usize = "maximum arena allocation in bytes"; + maxuse_stack: crate::bindgen::mjtSize = "maximum stack allocation in bytes"; + maxuse_threadstack: [crate::bindgen::mjtSize; mjMAXTHREAD] = "maximum stack allocation per thread in bytes"; + maxuse_arena: crate::bindgen::mjtSize = "maximum arena allocation in bytes"; maxuse_con: usize = "maximum number of contacts"; maxuse_efc: usize = "maximum number of scalar constraints"; @@ -371,24 +371,6 @@ buffer_slices_depending_on_model! { // computed by mj_makeConstraint tendon_efcadr: [i32; ntendon * 1] = "first efc address involving tendon; -1: none (ntendon x 1)"; - efc_JT_rownnz: [i32; nv * 1] = "number of non-zeros in constraint Jacobian row (nv x 1)"; - efc_JT_rowadr: [i32; nv * 1] = "row start address in colind array (nv x 1)"; - efc_JT_rowsuper: [i32; nv * 1] = "number of subsequent rows in supernode (nv x 1)"; - - // computed by mj_resetData - B_rownnz: [i32; nbody * 1] = "body-dof: non-zeros in each row (nbody x 1)"; - B_rowadr: [i32; nbody * 1] = "body-dof: address of each row in B_colind (nbody x 1)"; - B_colind: [i32; nB * 1] = "body-dof: column indices of non-zeros (nB x 1)"; - M_rownnz: [i32; nv * 1] = "reduced inertia: non-zeros in each row (nv x 1)"; - M_rowadr: [i32; nv * 1] = "reduced inertia: address of each row in M_colind (nv x 1)"; - M_colind: [i32; nC * 1] = "reduced inertia: column indices of non-zeros (nC x 1)"; - mapM2M: [i32; nC * 1] = "index mapping from qM to M (nC x 1)"; - D_rownnz: [i32; nv * 1] = "full inertia: non-zeros in each row (nv x 1)"; - D_rowadr: [i32; nv * 1] = "full inertia: address of each row in D_colind (nv x 1)"; - D_diag: [i32; nv * 1] = "full inertia: index of diagonal element in each row (nv x 1)"; - D_colind: [i32; nD * 1] = "full inertia: column indices of non-zeros (nD x 1)"; - mapM2D: [i32; nD * 1] = "index mapping from qM to D (nD x 1)"; - mapD2M: [i32; nM * 1] = "index mapping from D to qM (nM x 1)"; // computed by mj_island (island dof structure) dof_island: [i32; nv * 1] = "island id of this dof; -1: none (nv x 1)"; @@ -436,9 +418,7 @@ buffer_slices! { efc_J_rowadr: [i32; nefc] = "row start address in colind array (nefc x 1)"; efc_J_rowsuper: [i32; nefc] = "number of subsequent rows in supernode (nefc x 1)"; efc_J_colind: [i32; nJ] = "column indices in constraint Jacobian (nJ x 1)"; - efc_JT_colind: [i32; nJ] = "column indices in constraint Jacobian transposed (nJ x 1)"; efc_J: [f64; nJ] = "constraint Jacobian (nJ x 1)"; - efc_JT: [f64; nJ] = "constraint Jacobian transposed (nJ x 1)"; efc_pos: [f64; nefc] = "constraint position (equality, contact) (nefc x 1)"; efc_margin: [f64; nefc] = "inclusion margin (contact) (nefc x 1)"; efc_frictionloss: [f64; nefc] = "frictionloss (friction) (nefc x 1)"; @@ -453,3 +433,61 @@ buffer_slices! { // computed by mj_fwdVelocity/mj_referenceConstraint efc_vel: [f64; nefc] = "velocity in constraint space: J*qvel (nefc x 1)"; } + +#[allow(non_snake_case)] +impl mjData { + /// body-dof: non-zeros in each row (nbody x 1) + pub unsafe fn B_rownnz<'m>(&self, model: &'m mjModel) -> &'m [i32] { + model.B_rownnz() + } + /// body-dof: row addresses (nbody x 1) + pub unsafe fn B_rowadr<'m>(&self, model: &'m mjModel) -> &'m [i32] { + model.B_rowadr() + } + /// body-dof: column indices (nB x 1) + pub unsafe fn B_colind<'m>(&self, model: &'m mjModel) -> &'m [i32] { + model.B_colind() + } + + /// reduced inertia: non-zeros in each row (nv x 1) + pub unsafe fn M_rownnz<'m>(&self, model: &'m mjModel) -> &'m [i32] { + model.M_rownnz() + } + /// reduced inertia: row addresses (nv x 1) + pub unsafe fn M_rowadr<'m>(&self, model: &'m mjModel) -> &'m [i32] { + model.M_rowadr() + } + /// reduced inertia: column indices (nC x 1) + pub unsafe fn M_colind<'m>(&self, model: &'m mjModel) -> &'m [i32] { + model.M_colind() + } + /// index mapping from qM to M (nC x 1) + pub unsafe fn mapM2M<'m>(&self, model: &'m mjModel) -> &'m [i32] { + model.mapM2M() + } + + /// full inertia: non-zeros in each row (nv x 1) + pub unsafe fn D_rownnz<'m>(&self, model: &'m mjModel) -> &'m [i32] { + model.D_rownnz() + } + /// full inertia: row addresses (nv x 1) + pub unsafe fn D_rowadr<'m>(&self, model: &'m mjModel) -> &'m [i32] { + model.D_rowadr() + } + /// full inertia: index of diagonal element in each row (nv x 1) + pub unsafe fn D_diag<'m>(&self, model: &'m mjModel) -> &'m [i32] { + model.D_diag() + } + /// full inertia: column indices (nD x 1) + pub unsafe fn D_colind<'m>(&self, model: &'m mjModel) -> &'m [i32] { + model.D_colind() + } + /// index mapping from M to D (nD x 1) + pub unsafe fn mapM2D<'m>(&self, model: &'m mjModel) -> &'m [i32] { + model.mapM2D() + } + /// index mapping from D to M (nC x 1) + pub unsafe fn mapD2M<'m>(&self, model: &'m mjModel) -> &'m [i32] { + model.mapD2M() + } +} diff --git a/src/types/mjmodel.rs b/src/types/mjmodel.rs index d0a3823..2890ad3 100644 --- a/src/types/mjmodel.rs +++ b/src/types/mjmodel.rs @@ -19,6 +19,7 @@ fields_mapping!(mjModel { nbvh: usize = "number of total bounding volumes in all bodies"; nbvhstatic: usize = "number of static bounding volumes (aabb stored in mjModel)"; nbvhdynamic: usize = "number of dynamic bounding volumes (aabb stored in mjData)"; + noct: usize = "number of total octree cells in all meshes"; njnt: usize = "number of joints"; ngeom: usize = "number of geoms"; nsite: usize = "number of sites"; @@ -97,8 +98,8 @@ fields_mapping!(mjModel { nsensordata: usize = "number of mjtNums in sensor data vector"; npluginstate: usize = "number of mjtNums in plugin state vector"; - narena: usize = "number of bytes in the mjData arena (inclusive of stack)"; - nbuffer: usize = "number of bytes in buffer"; + narena: crate::bindgen::mjtSize = "number of bytes in the mjData arena (inclusive of stack)"; + nbuffer: crate::bindgen::mjtSize = "number of bytes in buffer"; signature: u64 = "model signature, used to detect changes in model"; } @@ -1957,3 +1958,61 @@ impl mjModel { /* TODO: *name* */ } + +#[allow(non_snake_case)] +impl mjModel { + /// body-dof: non-zeros in each row (nbody x 1) + pub fn B_rownnz(&self) -> &[i32] { + unsafe { slice((*self.as_ptr()).B_rownnz as *const i32, self.nbody()) } + } + /// body-dof: row addresses (nbody x 1) + pub fn B_rowadr(&self) -> &[i32] { + unsafe { slice((*self.as_ptr()).B_rowadr as *const i32, self.nbody()) } + } + /// body-dof: column indices (nB x 1) + pub fn B_colind(&self) -> &[i32] { + unsafe { slice((*self.as_ptr()).B_colind as *const i32, self.nB()) } + } + + /// reduced inertia: non-zeros in each row (nv x 1) + pub fn M_rownnz(&self) -> &[i32] { + unsafe { slice((*self.as_ptr()).M_rownnz as *const i32, self.nv()) } + } + /// reduced inertia: row addresses (nv x 1) + pub fn M_rowadr(&self) -> &[i32] { + unsafe { slice((*self.as_ptr()).M_rowadr as *const i32, self.nv()) } + } + /// reduced inertia: column indices (nC x 1) + pub fn M_colind(&self) -> &[i32] { + unsafe { slice((*self.as_ptr()).M_colind as *const i32, self.nC()) } + } + /// index mapping from qM to M (nC x 1) + pub fn mapM2M(&self) -> &[i32] { + unsafe { slice((*self.as_ptr()).mapM2M as *const i32, self.nC()) } + } + + /// full inertia: non-zeros in each row (nv x 1) + pub fn D_rownnz(&self) -> &[i32] { + unsafe { slice((*self.as_ptr()).D_rownnz as *const i32, self.nv()) } + } + /// full inertia: row addresses (nv x 1) + pub fn D_rowadr(&self) -> &[i32] { + unsafe { slice((*self.as_ptr()).D_rowadr as *const i32, self.nv()) } + } + /// full inertia: index of diagonal element in each row (nv x 1) + pub fn D_diag(&self) -> &[i32] { + unsafe { slice((*self.as_ptr()).D_diag as *const i32, self.nv()) } + } + /// full inertia: column indices (nD x 1) + pub fn D_colind(&self) -> &[i32] { + unsafe { slice((*self.as_ptr()).D_colind as *const i32, self.nD()) } + } + /// index mapping from M to D (nD x 1) + pub fn mapM2D(&self) -> &[i32] { + unsafe { slice((*self.as_ptr()).mapM2D as *const i32, self.nD()) } + } + /// index mapping from D to M (nC x 1) + pub fn mapD2M(&self) -> &[i32] { + unsafe { slice((*self.as_ptr()).mapD2M as *const i32, self.nC()) } + } +} diff --git a/src/types/mjoption.rs b/src/types/mjoption.rs index f962981..59f7309 100644 --- a/src/types/mjoption.rs +++ b/src/types/mjoption.rs @@ -18,7 +18,6 @@ fields_mapping!(mjOption { scalars { // timing parameters timestep / set_timestep: f64 = "simulation timestep in seconds"; - apirate / set_apirate: f64 = "update rate for remote API in Hz"; // solver parameters impratio / set_impratio: f64 = "ratio of friction-to-normal contact impedance"; @@ -26,6 +25,7 @@ fields_mapping!(mjOption { ls_tolerance / set_ls_tolerance: f64 = "CG/Newton linesearch tolerance"; noslip_tolerance / set_noslip_tolerance: f64 = "noslip solver tolerance"; ccd_tolerance / set_ccd_tolerance: f64 = "convex collision solver tolerance"; + sleep_tolerance / set_sleep_tolerance: f64 = "sleep velocity tolerance"; // physical constants gravity / set_gravity: [f64; 3] = "gravitational acceleration"; diff --git a/src/types/model_editing.rs b/src/types/model_editing.rs index 8a63af1..9446f39 100644 --- a/src/types/model_editing.rs +++ b/src/types/model_editing.rs @@ -83,20 +83,24 @@ impl mjSpec { /// mesh and hfield directory pub fn meshdir(&self) -> Option<&mjString> { - if self.meshdir.is_null() {None} else {Some(unsafe { &*self.meshdir })} + let meshdir = unsafe { (*self.as_ptr()).compiler.meshdir }; + if meshdir.is_null() {None} else {Some(unsafe { &*meshdir })} } /// mutable mesh and hfield directory pub fn meshdir_mut(&mut self) -> Option<&mut mjString> { - if self.meshdir.is_null() {None} else {Some(unsafe { &mut *self.meshdir })} + let meshdir = unsafe { (*self.as_mut_ptr()).compiler.meshdir }; + if meshdir.is_null() {None} else {Some(unsafe { &mut *meshdir })} } /// texture directory pub fn texturedir(&self) -> Option<&mjString> { - if self.texturedir.is_null() {None} else {Some(unsafe { &*self.texturedir })} + let texturedir = unsafe { (*self.as_ptr()).compiler.texturedir }; + if texturedir.is_null() {None} else {Some(unsafe { &*texturedir })} } /// mutable texture directory pub fn texturedir_mut(&mut self) -> Option<&mut mjString> { - if self.texturedir.is_null() {None} else {Some(unsafe { &mut *self.texturedir })} + let texturedir = unsafe { (*self.as_mut_ptr()).compiler.texturedir }; + if texturedir.is_null() {None} else {Some(unsafe { &mut *texturedir })} } } diff --git a/vendor/include/mujoco/mjdata.h b/vendor/include/mujoco/mjdata.h index d6f9877..a813ee1 100644 --- a/vendor/include/mujoco/mjdata.h +++ b/vendor/include/mujoco/mjdata.h @@ -51,6 +51,27 @@ typedef enum mjtState_ { // state elements } 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 @@ -93,6 +114,13 @@ typedef enum mjtTimer_ { // internal 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; + + //---------------------------------- mjContact ----------------------------------------------------- struct mjContact_ { // result of collision detection functions @@ -122,7 +150,7 @@ struct mjContact_ { // result of collision detection functions int vert[2]; // vertex ids; -1 for geom or flex element // flag set by mj_setContact or mj_instantiateContact - int exclude; // 0: include, 1: in gap, 2: fused, 3: no dofs + int exclude; // 0: include, 1: in gap, 2: fused, 3: no dofs, 4: passive // address computed by mj_instantiateContact int efc_address; // address in efc; -1: not included @@ -162,8 +190,8 @@ typedef struct mjSolverStat_ mjSolverStat; struct mjData_ { // constant sizes - size_t narena; // size of the arena in bytes (inclusive of the stack) - size_t nbuffer; // size of main buffer in bytes + mjtSize narena; // size of the arena in bytes (inclusive of the stack) + mjtSize nbuffer; // size of main buffer in bytes int nplugin; // number of plugin instances // stack pointer @@ -174,9 +202,9 @@ struct mjData_ { size_t parena; // first available byte in arena // memory utilization statistics - size_t maxuse_stack; // maximum stack allocation in bytes - size_t maxuse_threadstack[mjMAXTHREAD]; // maximum stack allocation per thread in bytes - size_t maxuse_arena; // maximum arena allocation in bytes + mjtSize maxuse_stack; // maximum stack allocation in bytes + mjtSize maxuse_threadstack[mjMAXTHREAD]; // maximum stack allocation per thread in bytes + mjtSize maxuse_arena; // maximum arena allocation in bytes int maxuse_con; // maximum number of contacts int maxuse_efc; // maximum number of scalar constraints @@ -199,6 +227,11 @@ struct mjData_ { int nJ; // number of non-zeros in constraint Jacobian int nA; // number of non-zeros in constraint inverse inertia matrix int nisland; // number of detected constraint islands + int nidof; // number of dofs in all islands + int ntree_awake; // number of awake trees + int nbody_awake; // number of awake dynamic and static bodies + int nparent_awake; // number of bodies with awake parents + int nv_awake; // number of awake dofs // global properties mjtNum time; // simulation time @@ -239,6 +272,9 @@ struct mjData_ { // sensors mjtNum* sensordata; // sensor data array (nsensordata x 1) + // sleep state + int* tree_asleep; // <0: awake; >=0: index cycle of sleeping trees (ntree x 1) + // plugins int* plugin; // copy of m->plugin, required for deletion (nplugin x 1) uintptr_t* plugin_data; // pointer to plugin-managed data structure (nplugin x 1) @@ -275,6 +311,7 @@ struct mjData_ { int* flexedge_J_colind; // column indices in sparse Jacobian (nflexedge x nv) mjtNum* flexedge_J; // flex edge Jacobian (nflexedge x nv) mjtNum* flexedge_length; // flex edge lengths (nflexedge x 1) + mjtNum* bvh_aabb_dyn; // global bounding box (center, size) (nbvhdynamic x 6) // computed by mj_fwdPosition/mj_tendon int* ten_wrapadr; // start address of tendon's path (ntendon x 1) @@ -294,18 +331,25 @@ struct mjData_ { int* moment_colind; // column indices in sparse Jacobian (nJmom x 1) mjtNum* actuator_moment; // actuator moments (nJmom x 1) - // computed by mj_fwdPosition/mj_crb + // computed by mj_fwdPosition/mj_makeM mjtNum* crb; // com-based composite inertia and mass (nbody x 10) - mjtNum* qM; // total inertia (sparse) (nM x 1) + mjtNum* qM; // inertia (sparse) (nM x 1) + mjtNum* M; // reduced inertia (compressed sparse row) (nC x 1) // computed by mj_fwdPosition/mj_factorM - mjtNum* qLD; // L'*D*L factorization of M (sparse) (nM x 1) + mjtNum* qLD; // L'*D*L factorization of M (sparse) (nC x 1) mjtNum* qLDiagInv; // 1/diag(D) (nv x 1) // computed by mj_collisionTree - mjtNum* bvh_aabb_dyn; // global bounding box (center, size) (nbvhdynamic x 6) mjtByte* bvh_active; // was bounding volume checked for collision (nbvh x 1) + // computed by mj_updateSleep + int* tree_awake; // is tree awake; 0: asleep; 1: awake (ntree x 1) + int* body_awake; // body sleep state (mjtSleepState) (nbody x 1) + int* body_awake_ind; // indices of awake and static bodies (nbody x 1) + int* parent_awake_ind; // indices of bodies with awake or static parents (nbody x 1) + int* dof_awake_ind; // indices of awake dofs (nv x 1) + //-------------------- POSITION, VELOCITY dependent // computed by mj_fwdVelocity @@ -335,25 +379,6 @@ struct mjData_ { mjtNum* qH; // L'*D*L factorization of modified M (nM x 1) mjtNum* qHDiagInv; // 1/diag(D) of modified M (nv x 1) - // computed by mj_resetData - int* B_rownnz; // body-dof: non-zeros in each row (nbody x 1) - int* B_rowadr; // body-dof: address of each row in B_colind (nbody x 1) - int* B_colind; // body-dof: column indices of non-zeros (nB x 1) - int* M_rownnz; // inertia: non-zeros in each row (nv x 1) - int* M_rowadr; // inertia: address of each row in M_colind (nv x 1) - int* M_colind; // inertia: column indices of non-zeros (nM x 1) - int* mapM2M; // index mapping from M (legacy) to M (CSR) (nM x 1) - int* C_rownnz; // reduced dof-dof: non-zeros in each row (nv x 1) - int* C_rowadr; // reduced dof-dof: address of each row in C_colind (nv x 1) - int* C_colind; // reduced dof-dof: column indices of non-zeros (nC x 1) - int* mapM2C; // index mapping from M to C (nC x 1) - int* D_rownnz; // dof-dof: non-zeros in each row (nv x 1) - int* D_rowadr; // dof-dof: address of each row in D_colind (nv x 1) - int* D_diag; // dof-dof: index of diagonal element (nv x 1) - int* D_colind; // dof-dof: column indices of non-zeros (nD x 1) - int* mapM2D; // index mapping from M to D (nD x 1) - int* mapD2M; // index mapping from D to M (nM x 1) - // computed by mj_implicit/mj_derivative mjtNum* qDeriv; // d (passive + actuator - bias) / d qvel (nD x 1) @@ -394,12 +419,7 @@ struct mjData_ { int* efc_J_rowadr; // row start address in colind array (nefc x 1) int* efc_J_rowsuper; // number of subsequent rows in supernode (nefc x 1) int* efc_J_colind; // column indices in constraint Jacobian (nJ x 1) - int* efc_JT_rownnz; // number of non-zeros in constraint Jacobian row T (nv x 1) - int* efc_JT_rowadr; // row start address in colind array T (nv x 1) - int* efc_JT_rowsuper; // number of subsequent rows in supernode T (nv x 1) - int* efc_JT_colind; // column indices in constraint Jacobian T (nJ x 1) mjtNum* efc_J; // constraint Jacobian (nJ x 1) - mjtNum* efc_JT; // constraint Jacobian transposed (nJ x 1) mjtNum* efc_pos; // constraint position (equality, contact) (nefc x 1) mjtNum* efc_margin; // inclusion margin (contact) (nefc x 1) mjtNum* efc_frictionloss; // frictionloss (friction) (nefc x 1) @@ -409,16 +429,51 @@ struct mjData_ { mjtNum* efc_R; // inverse constraint mass (nefc x 1) int* tendon_efcadr; // first efc address involving tendon; -1: none (ntendon x 1) - // computed by mj_island + // computed by mj_island (island tree structure) + int* tree_island; // island id of this tree; -1: none (ntree x 1) + int* island_ntree; // number of trees in this island (nisland x 1) + int* island_itreeadr; // island start address in itree vector (nisland x 1) + int* map_itree2tree; // map from itree to tree (ntree x 1) + + // computed by mj_island (island dof structure) int* dof_island; // island id of this dof; -1: none (nv x 1) - int* island_dofnum; // number of dofs in island (nisland x 1) - int* island_dofadr; // start address in island_dofind (nisland x 1) - int* island_dofind; // island dof indices; -1: none (nv x 1) - int* dof_islandind; // dof island indices; -1: none (nv x 1) + int* island_nv; // number of dofs in this island (nisland x 1) + int* island_idofadr; // island start address in idof vector (nisland x 1) + int* island_dofadr; // island start address in dof vector (nisland x 1) + int* map_dof2idof; // map from dof to idof (nv x 1) + int* map_idof2dof; // map from idof to dof; >= nidof: unconstrained (nv x 1) + + // computed by mj_island (dofs sorted by island) + mjtNum* ifrc_smooth; // net unconstrained force (nidof x 1) + mjtNum* iacc_smooth; // unconstrained acceleration (nidof x 1) + int* iM_rownnz; // inertia: non-zeros in each row (nidof x 1) + int* iM_rowadr; // inertia: address of each row in iM_colind (nidof x 1) + int* iM_colind; // inertia: column indices of non-zeros (nC x 1) + mjtNum* iM; // total inertia (sparse) (nC x 1) + mjtNum* iLD; // L'*D*L factorization of M (sparse) (nC x 1) + mjtNum* iLDiagInv; // 1/diag(D) (nidof x 1) + mjtNum* iacc; // acceleration (nidof x 1) + + // computed by mj_island (island constraint structure) int* efc_island; // island id of this constraint (nefc x 1) - int* island_efcnum; // number of constraints in island (nisland x 1) - int* island_efcadr; // start address in island_efcind (nisland x 1) - int* island_efcind; // island constraint indices (nefc x 1) + int* island_ne; // number of equality constraints in island (nisland x 1) + int* island_nf; // number of friction constraints in island (nisland x 1) + int* island_nefc; // number of constraints in island (nisland x 1) + int* island_iefcadr; // start address in iefc vector (nisland x 1) + int* map_efc2iefc; // map from efc to iefc (nefc x 1) + int* map_iefc2efc; // map from iefc to efc (nefc x 1) + + // computed by mj_island (constraints sorted by island) + int* iefc_type; // constraint type (mjtConstraint) (nefc x 1) + int* iefc_id; // id of object of specified type (nefc x 1) + int* iefc_J_rownnz; // number of non-zeros in constraint Jacobian row (nefc x 1) + int* iefc_J_rowadr; // row start address in colind array (nefc x 1) + int* iefc_J_rowsuper; // number of subsequent rows in supernode (nefc x 1) + int* iefc_J_colind; // column indices in constraint Jacobian (nJ x 1) + mjtNum* iefc_J; // constraint Jacobian (nJ x 1) + mjtNum* iefc_frictionloss; // frictionloss (friction) (nefc x 1) + mjtNum* iefc_D; // constraint mass (nefc x 1) + mjtNum* iefc_R; // inverse constraint mass (nefc x 1) // computed by mj_projectConstraint (PGS solver) int* efc_AR_rownnz; // number of non-zeros in AR (nefc x 1) @@ -436,8 +491,12 @@ struct mjData_ { // computed by mj_fwdConstraint/mj_inverse mjtNum* efc_b; // linear cost term: J*qacc_smooth - aref (nefc x 1) - mjtNum* efc_force; // constraint force in constraint space (nefc x 1) + mjtNum* iefc_aref; // reference pseudo-acceleration (nefc x 1) + int* iefc_state; // constraint state (mjtConstraintState) (nefc x 1) + mjtNum* iefc_force; // constraint force in constraint space (nefc x 1) int* efc_state; // constraint state (mjtConstraintState) (nefc x 1) + mjtNum* efc_force; // constraint force in constraint space (nefc x 1) + mjtNum* ifrc_constraint; // constraint force (nidof x 1) // thread pool pointer uintptr_t threadpool; diff --git a/vendor/include/mujoco/mjmodel.h b/vendor/include/mujoco/mjmodel.h index b6bdbfc..0e51ce3 100644 --- a/vendor/include/mujoco/mjmodel.h +++ b/vendor/include/mujoco/mjmodel.h @@ -30,6 +30,7 @@ #define mjMAXCONPAIR 50 // maximum number of contacts per geom pair #define mjMAXTREEDEPTH 50 // maximum bounding volume hierarchy depth #define mjMAXFLEXNODES 27 // maximum number of flex nodes +#define mjMINAWAKE 10 // minimum number of timesteps before sleeping //---------------------------------- sizes --------------------------------------------------------- @@ -41,6 +42,7 @@ #define mjNFLUID 12 // number of fluid interaction parameters #define mjNREF 2 // number of solver reference parameters #define mjNIMP 5 // number of solver impedance parameters +#define mjNSENS 3 // number of sensor parameters #define mjNSOLVER 200 // size of one mjData.solver array #define mjNISLAND 20 // number of mjData.solver arrays @@ -53,20 +55,22 @@ typedef enum mjtDisableBit_ { // disable default feature bitflags 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 - mjDSBL_SENSOR = 1<<12, // sensors - mjDSBL_MIDPHASE = 1<<13, // mid-phase collision filtering - mjDSBL_EULERDAMP = 1<<14, // implicit integration of joint damping in Euler integrator - mjDSBL_AUTORESET = 1<<15, // automatic reset when numerical issues are detected - mjDSBL_NATIVECCD = 1<<16, // native convex collision detection - - mjNDISABLE = 17 // number of disable flags + 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 + + mjNDISABLE = 19 // number of disable flags } mjtDisableBit; @@ -77,7 +81,7 @@ typedef enum mjtEnableBit_ { // enable optional feature bitflags mjENBL_INVDISCRETE = 1<<3, // discrete-time inverse dynamics // experimental features: mjENBL_MULTICCD = 1<<4, // multi-point convex collision detection - mjENBL_ISLAND = 1<<5, // constraint island discovery + mjENBL_SLEEP = 1<<5, // sleeping mjNENABLE = 6 // number of enable flags } mjtEnableBit; @@ -129,6 +133,14 @@ typedef enum mjtCamLight_ { // tracking mode for camera and light } 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 @@ -151,6 +163,13 @@ typedef enum mjtTextureRole_ { // role of texture map in rendering } 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 @@ -275,27 +294,6 @@ typedef enum mjtObj_ { // type of MujoCo object } mjtObj; -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 mjtSensor_ { // type of sensor // common robotic sensors, attached to a site mjSENS_TOUCH = 0, // scalar contact normal forces summed over sensor zone @@ -347,16 +345,23 @@ typedef enum mjtSensor_ { // type of sensor mjSENS_SUBTREELINVEL, // 3D linear velocity of subtree mjSENS_SUBTREEANGMOM, // 3D angular momentum of subtree - // sensors for geometric distance; attached to geoms or bodies + // 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 @@ -381,6 +386,19 @@ typedef enum mjtDataType_ { // data type for sensors } 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 = 7 // number of contact sensor data fields +} mjtConDataField; + + typedef enum mjtSameFrame_ { // frame alignment of bodies with their children mjSAMEFRAME_NONE = 0, // no alignment mjSAMEFRAME_BODY, // frame is same as body frame @@ -390,6 +408,16 @@ typedef enum mjtSameFrame_ { // frame alignment of bodies with their childr } 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 @@ -407,6 +435,14 @@ typedef enum mjtFlexSelf_ { // mode for flex selfcollide } 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 ------------------------------------------------------- struct mjLROpt_ { // options for mj_setLengthRange() @@ -426,6 +462,12 @@ struct mjLROpt_ { // options for mj_setLengthRange() }; typedef struct mjLROpt_ mjLROpt; +//---------------------------------- mjCache ------------------------------------------------------- + +struct mjCache_ { // asset cache used by the compiler + void* impl_; // internal pointer to cache +}; +typedef struct mjCache_ mjCache; //---------------------------------- mjVFS --------------------------------------------------------- @@ -439,7 +481,6 @@ typedef struct mjVFS_ mjVFS; 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 @@ -448,6 +489,9 @@ struct mjOption_ { // physics options mjtNum noslip_tolerance; // noslip solver tolerance mjtNum ccd_tolerance; // convex collision solver tolerance + // sleep settings + mjtNum sleep_tolerance; // sleep velocity tolerance + // physical constants mjtNum gravity[3]; // gravitational acceleration mjtNum wind[3]; // wind (for lift, drag and viscosity) @@ -485,6 +529,7 @@ typedef struct mjOption_ mjOption; struct mjVisual_ { // visualization options struct { // global parameters + int cameraid; // initial camera id (-1: free) int orthographic; // is the free camera orthographic (0: no, 1: yes) float fovy; // y field-of-view of free camera (orthographic ? length : degree) float ipd; // inter-pupilary distance for free camera @@ -607,7 +652,13 @@ struct mjModel_ { int nbvh; // number of total bounding volumes in all bodies int nbvhstatic; // number of static bounding volumes (aabb stored in mjModel) int nbvhdynamic; // number of dynamic bounding volumes (aabb stored in mjData) + int noct; // number of total octree cells in all meshes int njnt; // number of joints + int ntree; // number of kinematic trees under world body + int nM; // number of non-zeros in sparse inertia matrix + int nB; // number of non-zeros in sparse body-dof matrix + int nC; // number of non-zeros in sparse reduced dof-dof matrix + int nD; // number of non-zeros in sparse dof-dof matrix int ngeom; // number of geoms int nsite; // number of sites int ncam; // number of cameras @@ -671,12 +722,7 @@ struct mjModel_ { // sizes set after mjModel construction int nnames_map; // number of slots in the names hash map - int nM; // number of non-zeros in sparse inertia matrix - int nB; // number of non-zeros in sparse body-dof matrix - int nC; // number of non-zeros in sparse reduced dof-dof matrix - int nD; // number of non-zeros in sparse dof-dof matrix int nJmom; // number of non-zeros in sparse actuator_moment matrix - int ntree; // number of kinematic trees under world body int ngravcomp; // number of bodies with nonzero gravcomp int nemax; // number of potential equality-constraint rows int njmax; // number of available rows in constraint Jacobian (legacy) @@ -685,8 +731,8 @@ struct mjModel_ { int nsensordata; // number of mjtNums in sensor data vector int npluginstate; // number of mjtNums in plugin state vector - size_t narena; // number of bytes in the mjData arena (inclusive of stack) - size_t nbuffer; // number of bytes in buffer + mjtSize narena; // number of bytes in the mjData arena (inclusive of stack) + mjtSize nbuffer; // number of bytes in buffer // ------------------------------- options and statistics @@ -740,6 +786,12 @@ struct mjModel_ { int* bvh_nodeid; // geom or elem id of node; -1: non-leaf (nbvh x 1) mjtNum* bvh_aabb; // local bounding box (center, size) (nbvhstatic x 6) + // octree spatial partitioning + int* oct_depth; // depth in the octree (noct x 1) + int* oct_child; // children of octree node (noct x 8) + mjtNum* oct_aabb; // octree node bounding box (center, size) (noct x 6) + mjtNum* oct_coeff; // octree interpolation coefficients (noct x 8) + // joints int* jnt_type; // type of joint (mjtJoint) (njnt x 1) int* jnt_qposadr; // start addr in 'qpos' for joint's data (njnt x 1) @@ -773,6 +825,14 @@ struct mjModel_ { mjtNum* dof_damping; // damping coefficient (nv x 1) mjtNum* dof_invweight0; // diag. inverse inertia in qpos0 (nv x 1) mjtNum* dof_M0; // diag. inertia in qpos0 (nv x 1) + mjtNum* dof_length; // linear: 1; angular: approx. length scale (nv x 1) + + // trees + int* tree_bodyadr; // start addr of bodies (ntree x 1) + int* tree_bodynum; // number of bodies in tree (ntree x 1) + int* tree_dofadr; // start addr of dofs (ntree x 1) + int* tree_dofnum; // number of dofs in tree (ntree x 1) + int* tree_sleep_policy; // sleep policy (mjtSleepPolicy) (ntree x 1) // geoms int* geom_type; // geometric type (mjtGeom) (ngeom x 1) @@ -834,9 +894,12 @@ struct mjModel_ { int* light_mode; // light tracking mode (mjtCamLight) (nlight x 1) int* light_bodyid; // id of light's body (nlight x 1) int* light_targetbodyid; // id of targeted body; -1: none (nlight x 1) - mjtByte* light_directional; // directional light (nlight x 1) + int* light_type; // spot, directional, etc. (mjtLightType) (nlight x 1) + int* light_texid; // texture id for image lights (nlight x 1) mjtByte* light_castshadow; // does light cast shadows (nlight x 1) float* light_bulbradius; // light radius for soft shadows (nlight x 1) + float* light_intensity; // intensity, in candela (nlight x 1) + float* light_range; // range of effectiveness (nlight x 1) mjtByte* light_active; // is light on (nlight x 1) mjtNum* light_pos; // position rel. to body frame (nlight x 3) mjtNum* light_dir; // direction rel. to body frame (nlight x 3) @@ -864,6 +927,7 @@ struct mjModel_ { mjtByte* flex_internal; // internal flex collision enabled (nflex x 1) int* flex_selfcollide; // self collision mode (mjtFlexSelf) (nflex x 1) int* flex_activelayers; // number of active element layers, 3D only (nflex x 1) + int* flex_passive; // passive collisions enabled (nflex x 1) // flexes: other properties int* flex_dim; // 1: lines, 2: triangles, 3: tetrahedra (nflex x 1) @@ -888,6 +952,7 @@ struct mjModel_ { int* flex_nodebodyid; // node body ids (nflexnode x 1) int* flex_vertbodyid; // vertex body ids (nflexvert x 1) int* flex_edge; // edge vertex ids (2 per edge) (nflexedge x 2) + int* flex_edgeflap; // adjacent vertex ids (dim=2 only) (nflexedge x 2) int* flex_elem; // element vertex ids (dim+1 per elem) (nflexelemdata x 1) int* flex_elemtexcoord; // element texture coordinates (dim+1) (nflexelemdata x 1) int* flex_elemedge; // element edge ids (nflexelemedge x 1) @@ -902,6 +967,7 @@ struct mjModel_ { mjtNum* flexedge_invweight0; // edge inv. weight in qpos0 (nflexedge x 1) mjtNum* flex_radius; // radius around primitive element (nflex x 1) mjtNum* flex_stiffness; // finite element stiffness matrix (nflexelem x 21) + mjtNum* flex_bending; // bending stiffness (nflexedge x 17) mjtNum* flex_damping; // Rayleigh's damping coefficient (nflex x 1) mjtNum* flex_edgestiffness; // edge stiffness (nflex x 1) mjtNum* flex_edgedamping; // edge damping (nflex x 1) @@ -922,6 +988,8 @@ struct mjModel_ { int* mesh_facenum; // number of faces (nmesh x 1) int* mesh_bvhadr; // address of bvh root (nmesh x 1) int* mesh_bvhnum; // number of bvh (nmesh x 1) + int* mesh_octadr; // address of octree root (nmesh x 1) + int* mesh_octnum; // number of octree nodes (nmesh x 1) int* mesh_normaladr; // first normal address (nmesh x 1) int* mesh_normalnum; // number of normals (nmesh x 1) int* mesh_texcoordadr; // texcoord data address; -1: no texcoord (nmesh x 1) @@ -982,6 +1050,7 @@ struct mjModel_ { // textures int* tex_type; // texture type (mjtTexture) (ntex x 1) + int* tex_colorspace; // texture colorspace (mjtColorSpace) (ntex x 1) int* tex_height; // number of rows in texture image (ntex x 1) int* tex_width; // number of columns in texture image (ntex x 1) int* tex_nchannel; // number of channels in texture image (ntex x 1) @@ -1031,6 +1100,8 @@ struct mjModel_ { int* tendon_num; // number of objects in tendon's path (ntendon x 1) int* tendon_matid; // material id for rendering (ntendon x 1) int* tendon_group; // group for visibility (ntendon x 1) + int* tendon_treenum; // number of trees along tendon's path (ntendon x 1) + int* tendon_treeid; // first two trees along tendon's path (ntendon x 2) mjtByte* tendon_limited; // does tendon have length limits (ntendon x 1) mjtByte* tendon_actfrclimited; // does tendon have actuator force limits (ntendon x 1) mjtNum* tendon_width; // width for rendering (ntendon x 1) @@ -1091,6 +1162,7 @@ struct mjModel_ { int* sensor_objid; // id of sensorized object (nsensor x 1) int* sensor_reftype; // type of reference frame (mjtObj) (nsensor x 1) int* sensor_refid; // id of reference frame; -1: global frame (nsensor x 1) + int* sensor_intprm; // sensor parameters (nsensor x mjNSENS) int* sensor_dim; // number of scalar outputs (nsensor x 1) int* sensor_adr; // address in sensor array (nsensor x 1) mjtNum* sensor_cutoff; // cutoff for real and positive; 0: ignore (nsensor x 1) @@ -1161,6 +1233,21 @@ struct mjModel_ { // paths char* paths; // paths to assets, 0-terminated (npaths x 1) + // sparse structures + int* B_rownnz; // body-dof: non-zeros in each row (nbody x 1) + int* B_rowadr; // body-dof: row addresses (nbody x 1) + int* B_colind; // body-dof: column indices (nB x 1) + int* M_rownnz; // reduced inertia: non-zeros in each row (nv x 1) + int* M_rowadr; // reduced inertia: row addresses (nv x 1) + int* M_colind; // reduced inertia: column indices (nC x 1) + int* mapM2M; // index mapping from qM to M (nC x 1) + int* D_rownnz; // full inertia: non-zeros in each row (nv x 1) + int* D_rowadr; // full inertia: row addresses (nv x 1) + int* D_diag; // full inertia: index of diagonal element (nv x 1) + int* D_colind; // full inertia: column indices (nD x 1) + int* mapM2D; // index mapping from M to D (nD x 1) + int* mapD2M; // index mapping from D to M (nC x 1) + // compilation signature uint64_t signature; // also held by the mjSpec that compiled this model }; diff --git a/vendor/include/mujoco/mjplugin.h b/vendor/include/mujoco/mjplugin.h index 0fc31a6..a9e5127 100644 --- a/vendor/include/mujoco/mjplugin.h +++ b/vendor/include/mujoco/mjplugin.h @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -64,6 +65,25 @@ struct mjpResourceProvider { }; typedef struct mjpResourceProvider mjpResourceProvider; +//---------------------------------- Decoder ------------------------------------------------------- + +// function pointer types +// return an mjSpec representing the decoded resource. +typedef mjSpec* (*mjfDecode)(const mjResource* resource); +// return true if the given resource can be decoded. +typedef int (*mjfCanDecode)(const mjResource* resource); + +// the struct defining the decoder plugin's interface +struct mjpDecoder { + const char* content_type; + const char* extension; + // user-facing functions + mjfCanDecode can_decode; // quickly check if this decoder can handle the resource + mjfDecode decode; // main decoding function + // the caller takes ownership of the spec returned by decode and is responsible + // for cleaning it up +}; +typedef struct mjpDecoder mjpDecoder; //---------------------------------- Plugins ------------------------------------------------------- @@ -135,6 +155,16 @@ struct mjpPlugin_ { }; typedef struct mjpPlugin_ mjpPlugin; +struct mjSDF_ { + const mjpPlugin** plugin; + int* id; + mjtSDFType type; + mjtNum* relpos; + mjtNum* relmat; + mjtGeom* geomtype; +}; +typedef struct mjSDF_ mjSDF; + #if defined(__has_attribute) #if __has_attribute(constructor) diff --git a/vendor/include/mujoco/mjrender.h b/vendor/include/mujoco/mjrender.h index 9a8ed1b..4eeacea 100644 --- a/vendor/include/mujoco/mjrender.h +++ b/vendor/include/mujoco/mjrender.h @@ -149,7 +149,7 @@ struct mjrContext_ { // custom OpenGL context // character info int charWidth[127]; // character widths: normal and shadow - int charWidthBig[127]; // chacarter widths: big + int charWidthBig[127]; // character widths: big int charHeight; // character heights: normal and shadow int charHeightBig; // character heights: big diff --git a/vendor/include/mujoco/mjspec.h b/vendor/include/mujoco/mjspec.h index 3202d9d..6c1ced2 100644 --- a/vendor/include/mujoco/mjspec.h +++ b/vendor/include/mujoco/mjspec.h @@ -71,6 +71,18 @@ typedef enum mjtMeshInertia_ { // type of mesh inertia } mjtMeshInertia; +typedef enum mjtMeshBuiltin_ { // type of built-in procedural mesh + mjMESH_BUILTIN_NONE = 0, // no built-in mesh + mjMESH_BUILTIN_SPHERE, // sphere + mjMESH_BUILTIN_HEMISPHERE, // hemisphere + mjMESH_BUILTIN_CONE, // cone + mjMESH_BUILTIN_SUPERSPHERE, // supersphere + mjMESH_BUILTIN_SUPERTORUS, // supertorus + mjMESH_BUILTIN_WEDGE, // wedge + mjMESH_BUILTIN_PLATE, // plate +} mjtMeshBuiltin; + + typedef enum mjtBuiltin_ { // type of built-in procedural texture mjBUILTIN_NONE = 0, // no built-in texture mjBUILTIN_GRADIENT, // gradient: rgb1->rgb2 @@ -93,6 +105,7 @@ typedef enum mjtLimited_ { // type of limit specification mjLIMITED_AUTO, // limited inferred from presence of range } mjtLimited; + typedef enum mjtAlignFree_ { // whether to align free joints with the inertial frame mjALIGNFREE_FALSE = 0, // don't align mjALIGNFREE_TRUE, // align @@ -141,6 +154,8 @@ typedef struct mjsCompiler_ { // compiler options mjtByte saveinertial; // save explicit inertial clause for all bodies to XML int alignfree; // align free joints with inertial frame mjLROpt LRopt; // options for lengthrange computation + mjString* meshdir; // mesh and hfield directory + mjString* texturedir; // texture directory } mjsCompiler; @@ -151,8 +166,6 @@ typedef struct mjSpec_ { // model specification // compiler data mjsCompiler compiler; // compiler options mjtByte strippath; // automatically strip paths from mesh files - mjString* meshdir; // mesh and hfield directory - mjString* texturedir; // texture directory // engine data mjOption option; // physics options @@ -160,7 +173,7 @@ typedef struct mjSpec_ { // model specification mjStatistic stat; // statistics override (if defined) // sizes - size_t memory; // number of bytes in arena+stack memory + mjtSize memory; // number of bytes in arena+stack memory int nemax; // max number of equality constraints int nuserdata; // number of mjtNums in userdata int nuser_body; // number of mjtNums in body_user @@ -174,7 +187,7 @@ typedef struct mjSpec_ { // model specification int nkey; // number of keyframes int njmax; // (deprecated) max number of constraints int nconmax; // (deprecated) max number of detected contacts - size_t nstack; // (deprecated) number of mjtNums in mjData stack + mjtSize nstack; // (deprecated) number of mjtNums in mjData stack // global data mjString* comment; // comment at top of XML @@ -205,7 +218,6 @@ typedef struct mjsPlugin_ { // plugin specification typedef struct mjsBody_ { // body specification mjsElement* element; // element type - mjString* name; // name mjString* childclass; // childclass name // body frame @@ -224,6 +236,7 @@ typedef struct mjsBody_ { // body specification // other mjtByte mocap; // is this a mocap body double gravcomp; // gravity compensation + mjtSleepPolicy sleep; // sleep policy mjDoubleVec* userdata; // user data mjtByte explicitinertial; // whether to save the body with explicit inertial clause mjsPlugin plugin; // passive force plugin @@ -233,7 +246,6 @@ typedef struct mjsBody_ { // body specification typedef struct mjsFrame_ { // frame specification mjsElement* element; // element type - mjString* name; // name mjString* childclass; // childclass name double pos[3]; // position double quat[4]; // orientation @@ -244,7 +256,6 @@ typedef struct mjsFrame_ { // frame specification typedef struct mjsJoint_ { // joint specification mjsElement* element; // element type - mjString* name; // name mjtJoint type; // joint type // kinematics @@ -284,7 +295,6 @@ typedef struct mjsJoint_ { // joint specification typedef struct mjsGeom_ { // geom specification mjsElement* element; // element type - mjString* name; // name mjtGeom type; // geom type // frame, size @@ -332,7 +342,6 @@ typedef struct mjsGeom_ { // geom specification typedef struct mjsSite_ { // site specification mjsElement* element; // element type - mjString* name; // name // frame, size double pos[3]; // position @@ -355,7 +364,6 @@ typedef struct mjsSite_ { // site specification typedef struct mjsCamera_ { // camera specification mjsElement* element; // element type - mjString* name; // name // extrinsics double pos[3]; // position @@ -384,7 +392,6 @@ typedef struct mjsCamera_ { // camera specification typedef struct mjsLight_ { // light specification mjsElement* element; // element type - mjString* name; // name // frame double pos[3]; // position @@ -394,9 +401,12 @@ typedef struct mjsLight_ { // light specification // intrinsics mjtByte active; // is light active - mjtByte directional; // is light directional or spot + mjtLightType type; // type of light + mjString* texture; // texture name for image lights mjtByte castshadow; // does light cast shadows - double bulbradius; // bulb radius, for soft shadows + float bulbradius; // bulb radius, for soft shadows + float intensity; // intensity, in candelas + float range; // range of effectiveness float attenuation[3]; // OpenGL attenuation (quadratic model) float cutoff; // OpenGL cutoff float exponent; // OpenGL exponent @@ -411,7 +421,6 @@ typedef struct mjsLight_ { // light specification typedef struct mjsFlex_ { // flex specification mjsElement* element; // element type - mjString* name; // name // contact properties int contype; // contact type @@ -430,7 +439,9 @@ typedef struct mjsFlex_ { // flex specification double radius; // radius around primitive element mjtByte internal; // enable internal collisions mjtByte flatskin; // render flex skin with flat shading - int selfcollide; // mode for flex self colllision + int selfcollide; // mode for flex self collision + int vertcollide; // mode for vertex collision + int passive; // mode for passive collisions int activelayers; // number of active element layers in 3D int group; // group for visualizatioh double edgestiffness; // edge stiffness @@ -441,6 +452,7 @@ typedef struct mjsFlex_ { // flex specification double poisson; // Poisson's ratio double damping; // Rayleigh's damping double thickness; // thickness (2D only) + int elastic2d; // 2D passive forces; 0: none, 1: bending, 2: stretching, 3: both // mesh properties mjStringVec* nodebody; // node body names @@ -458,7 +470,6 @@ typedef struct mjsFlex_ { // flex specification typedef struct mjsMesh_ { // mesh specification mjsElement* element; // element type - mjString* name; // name mjString* content_type; // content type of file mjString* file; // mesh file double refpos[3]; // reference position @@ -466,20 +477,22 @@ typedef struct mjsMesh_ { // mesh specification double scale[3]; // rescale mesh mjtMeshInertia inertia; // inertia type (convex, legacy, exact, shell) mjtByte smoothnormal; // do not exclude large-angle faces from normals + mjtByte needsdf; // compute sdf from mesh int maxhullvert; // maximum vertex count for the convex hull mjFloatVec* uservert; // user vertex data mjFloatVec* usernormal; // user normal data mjFloatVec* usertexcoord; // user texcoord data mjIntVec* userface; // user vertex indices + mjIntVec* userfacenormal; // user face normal indices mjIntVec* userfacetexcoord; // user texcoord indices mjsPlugin plugin; // sdf plugin + mjString* material; // name of material mjString* info; // message appended to compiler errors } mjsMesh; typedef struct mjsHField_ { // height field specification mjsElement* element; // element type - mjString* name; // name mjString* content_type; // content type of file mjString* file; // file: (nrow, ncol, [elevation data]) double size[4]; // hfield size (ignore referencing geom size) @@ -493,7 +506,6 @@ typedef struct mjsHField_ { // height field specification typedef struct mjsSkin_ { // skin specification mjsElement* element; // element type - mjString* name; // name mjString* file; // skin file mjString* material; // name of material used for rendering float rgba[4]; // rgba when material is omitted @@ -519,8 +531,8 @@ typedef struct mjsSkin_ { // skin specification typedef struct mjsTexture_ { // texture specification mjsElement* element; // element type - mjString* name; // name mjtTexture type; // texture type + mjtColorSpace colorspace; // colorspace // method 1: builtin int builtin; // builtin type (mjtBuiltin) @@ -537,7 +549,7 @@ typedef struct mjsTexture_ { // texture specification mjString* content_type; // content type of file mjString* file; // png file to load; use for all sides of cube int gridsize[2]; // size of grid for composite file; (1,1)-repeat - char gridlayout[13]; // row-major: L,R,F,B,U,D for faces; . for unused + char gridlayout[12]; // row-major: L,R,F,B,U,D for faces; . for unused // method 3: separate files mjStringVec* cubefiles; // different file for each side of the cube @@ -556,7 +568,6 @@ typedef struct mjsTexture_ { // texture specification typedef struct mjsMaterial_ { // material specification mjsElement* element; // element type - mjString* name; // name mjStringVec* textures; // names of textures (empty: none) mjtByte texuniform; // make texture cube uniform float texrepeat[2]; // texture repetition for 2D mapping @@ -573,7 +584,6 @@ typedef struct mjsMaterial_ { // material specification typedef struct mjsPair_ { // pair specification mjsElement* element; // element type - mjString* name; // name mjString* geomname1; // name of geom 1 mjString* geomname2; // name of geom 2 @@ -591,7 +601,6 @@ typedef struct mjsPair_ { // pair specification typedef struct mjsExclude_ { // exclude specification mjsElement* element; // element type - mjString* name; // name mjString* bodyname1; // name of geom 1 mjString* bodyname2; // name of geom 2 mjString* info; // message appended to errors @@ -600,7 +609,6 @@ typedef struct mjsExclude_ { // exclude specification typedef struct mjsEquality_ { // equality specification mjsElement* element; // element type - mjString* name; // name mjtEq type; // constraint type double data[mjNEQDATA]; // type-dependent data mjtByte active; // is equality initially active @@ -615,7 +623,6 @@ typedef struct mjsEquality_ { // equality specification typedef struct mjsTendon_ { // tendon specification mjsElement* element; // element type - mjString* name; // name // stiffness, damping, friction, armature double stiffness; // stiffness coefficient @@ -649,13 +656,13 @@ typedef struct mjsTendon_ { // tendon specification typedef struct mjsWrap_ { // wrapping object specification mjsElement* element; // element type + mjtWrap type; // wrap type mjString* info; // message appended to errors } mjsWrap; typedef struct mjsActuator_ { // actuator specification mjsElement* element; // element type - mjString* name; // name // gain, bias mjtGain gaintype; // gain type @@ -697,7 +704,6 @@ typedef struct mjsActuator_ { // actuator specification typedef struct mjsSensor_ { // sensor specification mjsElement* element; // element type - mjString* name; // name // sensor definition mjtSensor type; // type of sensor @@ -705,6 +711,7 @@ typedef struct mjsSensor_ { // sensor specification mjString* objname; // name of sensorized object mjtObj reftype; // type of referenced object mjString* refname; // name of referenced object + int intprm[mjNSENS]; // integer parameters // user-defined sensors mjtDataType datatype; // data type for sensor measurement @@ -724,7 +731,6 @@ typedef struct mjsSensor_ { // sensor specification typedef struct mjsNumeric_ { // custom numeric field specification mjsElement* element; // element type - mjString* name; // name mjDoubleVec* data; // initialization data int size; // array size, can be bigger than data size mjString* info; // message appended to compiler errors @@ -733,7 +739,6 @@ typedef struct mjsNumeric_ { // custom numeric field specification typedef struct mjsText_ { // custom text specification mjsElement* element; // element type - mjString* name; // name mjString* data; // text string mjString* info; // message appended to compiler errors } mjsText; @@ -741,7 +746,6 @@ typedef struct mjsText_ { // custom text specification typedef struct mjsTuple_ { // tuple specification mjsElement* element; // element type - mjString* name; // name mjIntVec* objtype; // object types mjStringVec* objname; // object names mjDoubleVec* objprm; // object parameters @@ -751,7 +755,6 @@ typedef struct mjsTuple_ { // tuple specification typedef struct mjsKey_ { // keyframe specification mjsElement* element; // element type - mjString* name; // name double time; // time mjDoubleVec* qpos; // qpos mjDoubleVec* qvel; // qvel @@ -765,7 +768,6 @@ typedef struct mjsKey_ { // keyframe specification typedef struct mjsDefault_ { // default specification mjsElement* element; // element type - mjString* name; // class name mjsJoint* joint; // joint defaults mjsGeom* geom; // geom defaults mjsSite* site; // site defaults diff --git a/vendor/include/mujoco/mjtnum.h b/vendor/include/mujoco/mjtnum.h index e50b5ff..9c900fc 100644 --- a/vendor/include/mujoco/mjtnum.h +++ b/vendor/include/mujoco/mjtnum.h @@ -15,6 +15,9 @@ #ifndef MUJOCO_INCLUDE_MJTNUM_H_ #define MUJOCO_INCLUDE_MJTNUM_H_ +#include + + //---------------------------------- floating-point definition ------------------------------------- // floating point data type and minval @@ -34,4 +37,10 @@ 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/vendor/include/mujoco/mjvisualize.h b/vendor/include/mujoco/mjvisualize.h index 0a757cf..25a2861 100644 --- a/vendor/include/mujoco/mjvisualize.h +++ b/vendor/include/mujoco/mjvisualize.h @@ -24,7 +24,7 @@ #define mjMAXLIGHT 100 // maximum number of lights in a scene #define mjMAXOVERLAY 500 // maximum number of characters in overlay text #define mjMAXLINE 100 // maximum number of lines per plot -#define mjMAXLINEPNT 1000 // maximum number points per line +#define mjMAXLINEPNT 1001 // maximum number points per line #define mjMAXPLANEGRID 200 // maximum number of grid divisions for plane @@ -45,7 +45,8 @@ typedef enum mjtMouse_ { // mouse interaction mode mjMOUSE_MOVE_V, // move, vertical plane mjMOUSE_MOVE_H, // move, horizontal plane mjMOUSE_ZOOM, // zoom - mjMOUSE_SELECT // selection + mjMOUSE_MOVE_V_REL, // move, vertical plane, relative to target + mjMOUSE_MOVE_H_REL, // move, horizontal plane, relative to target } mjtMouse; @@ -130,7 +131,6 @@ typedef enum mjtVisFlag_ { // flags enabling model element visualization mjVIS_FLEXFACE, // flex element faces mjVIS_FLEXSKIN, // flex smooth skin (disables the rest) mjVIS_BODYBVH, // body bounding volume hierarchy - mjVIS_FLEXBVH, // flex bounding volume hierarchy mjVIS_MESHBVH, // mesh bounding volume hierarchy mjVIS_SDFITER, // iterations of SDF gradient descent @@ -226,7 +226,7 @@ typedef struct mjvGLCamera_ mjvGLCamera; struct mjvGeom_ { // abstract geom // type info int type; // geom type (mjtGeom) - int dataid; // mesh, hfield or plane id; -1: none + int dataid; // mesh, hfield or plane id; -1: none; mesh: 2*id or 2*id+1 (hull) int objtype; // mujoco object type; mjOBJ_UNKNOWN for decor int objid; // mujoco object id; -1 for decor int category; // visual category @@ -259,8 +259,11 @@ typedef struct mjvGeom_ mjvGeom; //---------------------------------- mjvLight ------------------------------------------------------ struct mjvLight_ { // OpenGL light + int id; // light id, -1 for headlight float pos[3]; // position rel. to body frame float dir[3]; // direction rel. to body frame + int type; // type (mjtLightType) + int texid; // texture id for image lights float attenuation[3]; // OpenGL attenuation (quadratic model) float cutoff; // OpenGL cutoff float exponent; // OpenGL exponent @@ -268,9 +271,10 @@ struct mjvLight_ { // OpenGL light float diffuse[3]; // diffuse rgb (alpha=1) float specular[3]; // specular rgb (alpha=1) mjtByte headlight; // headlight - mjtByte directional; // directional light mjtByte castshadow; // does light cast shadows float bulbradius; // bulb radius for soft shadows + float intensity; // intensity, in candelas + float range; // range of effectiveness }; typedef struct mjvLight_ mjvLight; @@ -350,6 +354,7 @@ struct mjvScene_ { // abstract scene passed to OpenGL renderer // framing int framewidth; // frame pixel width; 0: disable framing float framergb[3]; // frame color + int status; // status; 0: ok, 1: geoms exhausted }; typedef struct mjvScene_ mjvScene; @@ -404,291 +409,4 @@ struct mjvFigure_ { // abstract 2D figure passed to OpenGL rendere }; typedef struct mjvFigure_ mjvFigure; - -//---------------------------------- mjvSceneState ------------------------------------------------- - -struct mjvSceneState_ { - int nbuffer; // size of the buffer in bytes - void* buffer; // heap-allocated memory for all arrays in this struct - int maxgeom; // maximum number of mjvGeom supported by this state object - mjvScene scratch; // scratch space for vis geoms inserted by the user and plugins - - // fields in mjModel that are necessary to re-render a scene - struct { - int nv; - int nu; - int na; - int nbody; - int nbvh; - int nbvhstatic; - int njnt; - int ngeom; - int nsite; - int ncam; - int nlight; - int nmesh; - int nskin; - int nflex; - int nflexvert; - int nflextexcoord; - int nskinvert; - int nskinface; - int nskinbone; - int nskinbonevert; - int nmat; - int neq; - int ntendon; - int ntree; - int nwrap; - int nsensor; - int nnames; - int npaths; - int nsensordata; - int narena; - - mjOption opt; - mjVisual vis; - mjStatistic stat; - - int* body_parentid; - int* body_rootid; - int* body_weldid; - int* body_mocapid; - int* body_jntnum; - int* body_jntadr; - int* body_dofnum; - int* body_dofadr; - int* body_geomnum; - int* body_geomadr; - mjtNum* body_iquat; - mjtNum* body_mass; - mjtNum* body_inertia; - int* body_bvhadr; - int* body_bvhnum; - - int* bvh_depth; - int* bvh_child; - int* bvh_nodeid; - mjtNum* bvh_aabb; - - int* jnt_type; - int* jnt_bodyid; - int* jnt_group; - - int* geom_type; - int* geom_bodyid; - int* geom_contype; - int* geom_conaffinity; - int* geom_dataid; - int* geom_matid; - int* geom_group; - mjtNum* geom_size; - mjtNum* geom_aabb; - mjtNum* geom_rbound; - float* geom_rgba; - - int* site_type; - int* site_bodyid; - int* site_matid; - int* site_group; - mjtNum* site_size; - float* site_rgba; - - int* cam_orthographic; - mjtNum* cam_fovy; - mjtNum* cam_ipd; - int* cam_resolution; - float* cam_sensorsize; - float* cam_intrinsic; - - mjtByte* light_directional; - mjtByte* light_castshadow; - float* light_bulbradius; - mjtByte* light_active; - float* light_attenuation; - float* light_cutoff; - float* light_exponent; - float* light_ambient; - float* light_diffuse; - float* light_specular; - - mjtByte* flex_flatskin; - int* flex_dim; - int* flex_matid; - int* flex_group; - int* flex_interp; - int* flex_nodeadr; - int* flex_nodenum; - int* flex_nodebodyid; - int* flex_vertadr; - int* flex_vertnum; - int* flex_elem; - int* flex_elemtexcoord; - int* flex_elemlayer; - int* flex_elemadr; - int* flex_elemnum; - int* flex_elemdataadr; - int* flex_shell; - int* flex_shellnum; - int* flex_shelldataadr; - int* flex_texcoordadr; - int* flex_bvhadr; - int* flex_bvhnum; - mjtByte* flex_centered; - mjtNum* flex_node; - mjtNum* flex_radius; - float* flex_rgba; - float* flex_texcoord; - - int* hfield_pathadr; - - int* mesh_bvhadr; - int* mesh_bvhnum; - int* mesh_texcoordadr; - int* mesh_graphadr; - int* mesh_pathadr; - - int* skin_matid; - int* skin_group; - float* skin_rgba; - float* skin_inflate; - int* skin_vertadr; - int* skin_vertnum; - int* skin_texcoordadr; - int* skin_faceadr; - int* skin_facenum; - int* skin_boneadr; - int* skin_bonenum; - float* skin_vert; - int* skin_face; - int* skin_bonevertadr; - int* skin_bonevertnum; - float* skin_bonebindpos; - float* skin_bonebindquat; - int* skin_bonebodyid; - int* skin_bonevertid; - float* skin_bonevertweight; - int* skin_pathadr; - - int* tex_pathadr; - - int* mat_texid; - mjtByte* mat_texuniform; - float* mat_texrepeat; - float* mat_emission; - float* mat_specular; - float* mat_shininess; - float* mat_reflectance; - float* mat_metallic; - float* mat_roughness; - float* mat_rgba; - - int* eq_type; - int* eq_obj1id; - int* eq_obj2id; - int* eq_objtype; - mjtNum* eq_data; - - int* tendon_num; - int* tendon_matid; - int* tendon_group; - mjtByte* tendon_limited; - mjtByte* tendon_actfrclimited; - mjtNum* tendon_width; - mjtNum* tendon_range; - mjtNum* tendon_actfrcrange; - mjtNum* tendon_stiffness; - mjtNum* tendon_damping; - mjtNum* tendon_frictionloss; - mjtNum* tendon_lengthspring; - float* tendon_rgba; - - int* actuator_trntype; - int* actuator_dyntype; - int* actuator_trnid; - int* actuator_actadr; - int* actuator_actnum; - int* actuator_group; - mjtByte* actuator_ctrllimited; - mjtByte* actuator_actlimited; - mjtNum* actuator_ctrlrange; - mjtNum* actuator_actrange; - mjtNum* actuator_cranklength; - - int* sensor_type; - int* sensor_objid; - int* sensor_adr; - - int* name_bodyadr; - int* name_jntadr; - int* name_geomadr; - int* name_siteadr; - int* name_camadr; - int* name_lightadr; - int* name_eqadr; - int* name_tendonadr; - int* name_actuatoradr; - char* names; - char* paths; - } model; - - // fields in mjData that are necessary to re-render a scene - struct { - mjWarningStat warning[mjNWARNING]; - - int nefc; - int ncon; - int nisland; - - mjtNum time; - - mjtNum* act; - - mjtNum* ctrl; - mjtNum* xfrc_applied; - mjtByte* eq_active; - - mjtNum* sensordata; - - mjtNum* xpos; - mjtNum* xquat; - mjtNum* xmat; - mjtNum* xipos; - mjtNum* ximat; - mjtNum* xanchor; - mjtNum* xaxis; - mjtNum* geom_xpos; - mjtNum* geom_xmat; - mjtNum* site_xpos; - mjtNum* site_xmat; - mjtNum* cam_xpos; - mjtNum* cam_xmat; - mjtNum* light_xpos; - mjtNum* light_xdir; - - mjtNum* subtree_com; - - int* ten_wrapadr; - int* ten_wrapnum; - int* wrap_obj; - mjtNum* ten_length; - mjtNum* wrap_xpos; - - mjtNum* bvh_aabb_dyn; - mjtByte* bvh_active; - int* island_dofadr; - int* island_dofind; - int* dof_island; - int* efc_island; - int* tendon_efcadr; - - mjtNum* flexvert_xpos; - - mjContact* contact; - mjtNum* efc_force; - void* arena; - } data; -}; -typedef struct mjvSceneState_ mjvSceneState; - #endif // MUJOCO_MJVISUALIZE_H_ diff --git a/vendor/include/mujoco/mujoco.h b/vendor/include/mujoco/mujoco.h index b23f5d9..1fb936a 100644 --- a/vendor/include/mujoco/mujoco.h +++ b/vendor/include/mujoco/mujoco.h @@ -16,7 +16,7 @@ #define MUJOCO_MUJOCO_H_ // header version; should match the library version as returned by mj_version() -#define mjVERSION_HEADER 332 +#define mjVERSION_HEADER 340 // needed to define size_t, fabs and log10 #include @@ -90,28 +90,58 @@ MJAPI int mj_deleteFileVFS(mjVFS* vfs, const char* filename); // Delete all files from VFS and deallocates VFS internal memory. MJAPI void mj_deleteVFS(mjVFS* vfs); +//------------------------------------ Asset cache ------------------------------------------------- + +// Get the current size of the asset cache in bytes. +MJAPI size_t mj_getCacheSize(const mjCache* cache); + +// Get the capacity of the asset cache in bytes. +MJAPI size_t mj_getCacheCapacity(const mjCache* cache); + +// Set the capacity of the asset cache in bytes (0 to disable); returns the new capacity. +MJAPI size_t mj_setCacheCapacity(mjCache* cache, size_t size); + +// Get the internal asset cache used by the compiler. +MJAPI mjCache* mj_getCache(void); + +// Clear the asset cache. +MJAPI void mj_clearCache(mjCache* cache); //---------------------------------- Parse and compile --------------------------------------------- // Parse XML file in MJCF or URDF format, compile it, return low-level model. // If vfs is not NULL, look up files in vfs before reading from disk. // If error is not NULL, it must have size error_sz. +// Nullable: vfs, error MJAPI mjModel* mj_loadXML(const char* filename, const mjVFS* vfs, char* error, int error_sz); // Parse spec from XML file. +// Nullable: vfs, error MJAPI mjSpec* mj_parseXML(const char* filename, const mjVFS* vfs, char* error, int error_sz); // Parse spec from XML string. +// Nullable: vfs, error MJAPI mjSpec* mj_parseXMLString(const char* xml, const mjVFS* vfs, char* error, int error_sz); +// Parse spec from a file. +// Nullable: vfs, error +MJAPI mjSpec* mj_parse(const char* filename, const char* content_type, + const mjVFS* vfs, char* error, int error_sz); + // Compile spec to model. +// Nullable: vfs MJAPI mjModel* mj_compile(mjSpec* s, const mjVFS* vfs); +// Copy real-valued arrays from model to spec, returns 1 on success. +MJAPI int mj_copyBack(mjSpec* s, const mjModel* m); + // Recompile spec to model, preserving the state, return 0 on success. +// Nullable: vfs MJAPI int mj_recompile(mjSpec* s, const mjVFS* vfs, mjModel* m, mjData* d); // Update XML data structures with info from low-level model created with mj_loadXML, save as MJCF. // If error is not NULL, it must have size error_sz. +// Nullable: error MJAPI int mj_saveLastXML(const char* filename, const mjModel* m, char* error, int error_sz); // Free last XML model if loaded. Called internally at each load. @@ -119,11 +149,16 @@ MJAPI void mj_freeLastXML(void); // Save spec to XML string, return 0 on success, -1 on failure. // If length of the output buffer is too small, returns the required size. +// Nullable: error MJAPI int mj_saveXMLString(const mjSpec* s, char* xml, int xml_sz, char* error, int error_sz); // Save spec to XML file, return 0 on success, -1 otherwise. +// Nullable: error MJAPI int mj_saveXML(const mjSpec* s, const char* filename, char* error, int error_sz); +// Given MJCF filename, fills dependencies with a list of all other asset files it depends on. +// The search is recursive, and the list includes the filename itself. +MJAPI void mju_getXMLDependencies(const char* filename, mjStringVec* dependencies); //---------------------------------- Main simulation ----------------------------------------------- @@ -155,6 +190,7 @@ MJAPI void mj_inverseSkip(const mjModel* m, mjData* d, int skipstage, int skipse MJAPI void mj_defaultLROpt(mjLROpt* opt); // Set solver parameters to default values. +// Nullable: solref, solimp MJAPI void mj_defaultSolRefImp(mjtNum* solref, mjtNum* solimp); // Set physics options to default values. @@ -164,20 +200,23 @@ MJAPI void mj_defaultOption(mjOption* opt); MJAPI void mj_defaultVisual(mjVisual* vis); // Copy mjModel, allocate new if dest is NULL. +// Nullable: dest MJAPI mjModel* mj_copyModel(mjModel* dest, const mjModel* src); // Save model to binary MJB file or memory buffer; buffer has precedence when given. +// Nullable: filename, buffer MJAPI void mj_saveModel(const mjModel* m, const char* filename, void* buffer, int buffer_sz); // Load model from binary MJB file. // If vfs is not NULL, look up file in vfs before reading from disk. +// Nullable: vfs MJAPI mjModel* mj_loadModel(const char* filename, const mjVFS* vfs); // Free memory allocation in model. MJAPI void mj_deleteModel(mjModel* m); // Return size of buffer needed to hold model. -MJAPI int mj_sizeModel(const mjModel* m); +MJAPI mjtSize mj_sizeModel(const mjModel* m); // Allocate mjData corresponding to given model. // If the model buffer is unallocated the initial configuration will not be set. @@ -187,6 +226,9 @@ MJAPI mjData* mj_makeData(const mjModel* m); // m is only required to contain the size fields from MJMODEL_INTS. MJAPI mjData* mj_copyData(mjData* dest, const mjModel* m, const mjData* src); +// Copy mjData, skip large arrays not required for visualization. +MJAPI mjData* mjv_copyData(mjData* dest, const mjModel* m, const mjData* src); + // Reset data to defaults. MJAPI void mj_resetData(const mjModel* m, mjData* d); @@ -227,6 +269,7 @@ MJAPI void mj_resetCallbacks(void); MJAPI void mj_setConst(mjModel* m, mjData* d); // Set actuator_lengthrange for specified actuator; return 1 if ok, 0 if error. +// Nullable: error MJAPI int mj_setLengthRange(mjModel* m, mjData* d, int index, const mjLROpt* opt, char* error, int error_sz); @@ -256,7 +299,7 @@ MJAPI void mj_printFormattedModel(const mjModel* m, const char* filename, const MJAPI void mj_printModel(const mjModel* m, const char* filename); // Print mjData to text file, specifying format. -// float_format must be a valid printf-style format string for a single float value +// float_format must be a valid printf-style format string for a single float value. MJAPI void mj_printFormattedData(const mjModel* m, const mjData* d, const char* filename, const char* float_format); @@ -274,9 +317,20 @@ MJAPI void mju_printMatSparse(const mjtNum* mat, int nr, MJAPI int mj_printSchema(const char* filename, char* buffer, int buffer_sz, int flg_html, int flg_pad); +// Print scene to text file. +MJAPI void mj_printScene(const mjvScene* s, const char* filename); + +// Print scene to text file, specifying format. +// float_format must be a valid printf-style format string for a single float value. +MJAPI void mj_printFormattedScene(const mjvScene* s, const char* filename, + const char* float_format); + //---------------------------------- Components ---------------------------------------------------- +// Run all kinematics-like computations (kinematics, comPos, camlight, flex, tendon). +MJAPI void mj_fwdKinematics(const mjModel* m, mjData* d); + // Run position-dependent computations. MJAPI void mj_fwdPosition(const mjModel* m, mjData* d); @@ -361,6 +415,9 @@ MJAPI void mj_transmission(const mjModel* m, mjData* d); // Run composite rigid body inertia algorithm (CRB). MJAPI void mj_crb(const mjModel* m, mjData* d); +// Make inertia matrix. +MJAPI void mj_makeM(const mjModel* m, mjData* d); + // Compute sparse L'*D*L factorizaton of inertia matrix. MJAPI void mj_factorM(const mjModel* m, mjData* d); @@ -403,20 +460,28 @@ MJAPI void mj_referenceConstraint(const mjModel* m, mjData* d); // Compute efc_state, efc_force, qfrc_constraint, and (optionally) cone Hessians. // If cost is not NULL, set *cost = s(jar) where jar = Jac*qacc-aref. +// Nullable: cost MJAPI void mj_constraintUpdate(const mjModel* m, mjData* d, const mjtNum* jar, mjtNum cost[1], int flg_coneHessian); //---------------------------------- Support ------------------------------------------------------- -// Return size of state specification. -MJAPI int mj_stateSize(const mjModel* m, unsigned int spec); +// Return size of state signature. +MJAPI int mj_stateSize(const mjModel* m, unsigned int sig); // Get state. -MJAPI void mj_getState(const mjModel* m, const mjData* d, mjtNum* state, unsigned int spec); +MJAPI void mj_getState(const mjModel* m, const mjData* d, mjtNum* state, unsigned int sig); + +// Extract a subset of components from a state previously obtained via mj_getState. +MJAPI void mj_extractState(const mjModel* m, const mjtNum* src, unsigned int srcsig, + mjtNum* dst, unsigned int dstsig); // Set state. -MJAPI void mj_setState(const mjModel* m, mjData* d, const mjtNum* state, unsigned int spec); +MJAPI void mj_setState(const mjModel* m, mjData* d, const mjtNum* state, unsigned int sig); + +// Copy state from src to dst. +MJAPI void mj_copyState(const mjModel* m, const mjData* src, mjData* dst, unsigned int sig); // Copy current state to the k-th model keyframe. MJAPI void mj_setKeyframe(mjModel* m, const mjData* d, int k); @@ -440,29 +505,36 @@ MJAPI void mj_mulJacVec(const mjModel* m, const mjData* d, mjtNum* res, const mj MJAPI void mj_mulJacTVec(const mjModel* m, const mjData* d, mjtNum* res, const mjtNum* vec); // Compute 3/6-by-nv end-effector Jacobian of global point attached to given body. +// Nullable: jacp, jacr MJAPI void mj_jac(const mjModel* m, const mjData* d, mjtNum* jacp, mjtNum* jacr, const mjtNum point[3], int body); // Compute body frame end-effector Jacobian. +// Nullable: jacp, jacr MJAPI void mj_jacBody(const mjModel* m, const mjData* d, mjtNum* jacp, mjtNum* jacr, int body); // Compute body center-of-mass end-effector Jacobian. +// Nullable: jacp, jacr MJAPI void mj_jacBodyCom(const mjModel* m, const mjData* d, mjtNum* jacp, mjtNum* jacr, int body); // Compute subtree center-of-mass end-effector Jacobian. MJAPI void mj_jacSubtreeCom(const mjModel* m, mjData* d, mjtNum* jacp, int body); // Compute geom end-effector Jacobian. +// Nullable: jacp, jacr MJAPI void mj_jacGeom(const mjModel* m, const mjData* d, mjtNum* jacp, mjtNum* jacr, int geom); // Compute site end-effector Jacobian. +// Nullable: jacp, jacr MJAPI void mj_jacSite(const mjModel* m, const mjData* d, mjtNum* jacp, mjtNum* jacr, int site); // Compute translation end-effector Jacobian of point, and rotation Jacobian of axis. +// Nullable: jacPoint, jacAxis MJAPI void mj_jacPointAxis(const mjModel* m, mjData* d, mjtNum* jacPoint, mjtNum* jacAxis, const mjtNum point[3], const mjtNum axis[3], int body); // Compute 3/6-by-nv Jacobian time derivative of global point attached to given body. +// Nullable: jacp, jacr MJAPI void mj_jacDot(const mjModel* m, const mjData* d, mjtNum* jacp, mjtNum* jacr, const mjtNum point[3], int body); @@ -484,11 +556,13 @@ MJAPI void mj_mulM(const mjModel* m, const mjData* d, mjtNum* res, const mjtNum* // Multiply vector by (inertia matrix)^(1/2). MJAPI void mj_mulM2(const mjModel* m, const mjData* d, mjtNum* res, const mjtNum* vec); -// Add inertia matrix to destination matrix. -// Destination can be sparse uncompressed, or dense when all int* are NULL +// Add inertia matrix to destination matrix (lower triangle only). +// Destination can be sparse or dense when all int* are NULL. +// Nullable: rownnz, rowadr, colind MJAPI void mj_addM(const mjModel* m, mjData* d, mjtNum* dst, int* rownnz, int* rowadr, int* colind); // Apply Cartesian force and torque (outside xfrc_applied mechanism). +// Nullable: force, torque MJAPI void mj_applyFT(const mjModel* m, mjData* d, const mjtNum force[3], const mjtNum torque[3], const mjtNum point[3], int body, mjtNum* qfrc_target); @@ -501,6 +575,7 @@ MJAPI void mj_objectAcceleration(const mjModel* m, const mjData* d, int objtype, int objid, mjtNum res[6], int flg_local); // Returns smallest signed distance between two geoms and optionally segment from geom1 to geom2. +// Nullable: fromto MJAPI mjtNum mj_geomDistance(const mjModel* m, const mjData* d, int geom1, int geom2, mjtNum distmax, mjtNum fromto[6]); @@ -550,13 +625,15 @@ MJAPI const char* mj_versionString(void); // Intersect multiple rays emanating from a single point. // Similar semantics to mj_ray, but vec is an array of (nray x 3) directions. -MJAPI void mj_multiRay(const mjModel* m, mjData* d, const mjtNum pnt[3], const mjtNum* vec, +// Nullable: geomgroup +MJAPI void mj_multiRay(const mjModel* m, mjData* d, const mjtNum pnt[3], const mjtNum vec[3], const mjtByte* geomgroup, mjtByte flg_static, int bodyexclude, int* geomid, mjtNum* dist, int nray, mjtNum cutoff); // Intersect ray (pnt+x*vec, x>=0) with visible geoms, except geoms in bodyexclude. // Return distance (x) to nearest surface, or -1 if no intersection and output geomid. // geomgroup, flg_static are as in mjvOption; geomgroup==NULL skips group exclusion. +// Nullable: geomgroup, geomid MJAPI mjtNum mj_ray(const mjModel* m, const mjData* d, const mjtNum pnt[3], const mjtNum vec[3], const mjtByte* geomgroup, mjtByte flg_static, int bodyexclude, int geomid[1]); @@ -575,16 +652,17 @@ MJAPI mjtNum mju_rayGeom(const mjtNum pos[3], const mjtNum mat[9], const mjtNum // Intersect ray with flex, return nearest distance or -1 if no intersection, // and also output nearest vertex id. +// Nullable: vertid MJAPI mjtNum mju_rayFlex(const mjModel* m, const mjData* d, int flex_layer, mjtByte flg_vert, mjtByte flg_edge, mjtByte flg_face, mjtByte flg_skin, int flexid, - const mjtNum* pnt, const mjtNum* vec, int vertid[1]); + const mjtNum pnt[3], const mjtNum vec[3], int vertid[1]); // Intersect ray with skin, return nearest distance or -1 if no intersection, // and also output nearest vertex id. +// Nullable: vertid MJAPI mjtNum mju_raySkin(int nface, int nvert, const int* face, const float* vert, const mjtNum pnt[3], const mjtNum vec[3], int vertid[1]); - //---------------------------------- Interaction --------------------------------------------------- // Set default camera. @@ -622,20 +700,10 @@ MJAPI void mjv_alignToCamera(mjtNum res[3], const mjtNum vec[3], const mjtNum fo MJAPI void mjv_moveCamera(const mjModel* m, int action, mjtNum reldx, mjtNum reldy, const mjvScene* scn, mjvCamera* cam); -// Move camera with mouse given a scene state; action is mjtMouse. -MJAPI void mjv_moveCameraFromState(const mjvSceneState* scnstate, int action, - mjtNum reldx, mjtNum reldy, - const mjvScene* scn, mjvCamera* cam); - // Move perturb object with mouse; action is mjtMouse. MJAPI void mjv_movePerturb(const mjModel* m, const mjData* d, int action, mjtNum reldx, mjtNum reldy, const mjvScene* scn, mjvPerturb* pert); -// Move perturb object with mouse given a scene state; action is mjtMouse. -MJAPI void mjv_movePerturbFromState(const mjvSceneState* scnstate, int action, - mjtNum reldx, mjtNum reldy, - const mjvScene* scn, mjvPerturb* pert); - // Move model with mouse; action is mjtMouse. MJAPI void mjv_moveModel(const mjModel* m, int action, mjtNum reldx, mjtNum reldy, const mjtNum roomup[3], mjvScene* scn); @@ -655,6 +723,7 @@ MJAPI void mjv_applyPerturbForce(const mjModel* m, mjData* d, const mjvPerturb* MJAPI mjvGLCamera mjv_averageCamera(const mjvGLCamera* cam1, const mjvGLCamera* cam2); // Select geom, flex or skin with mouse, return bodyid; -1: none selected. +// Nullable: geomid, flexid, skinid MJAPI int mjv_select(const mjModel* m, const mjData* d, const mjvOption* vopt, mjtNum aspectratio, mjtNum relx, mjtNum rely, const mjvScene* scn, mjtNum selpnt[3], @@ -670,6 +739,7 @@ MJAPI void mjv_defaultOption(mjvOption* opt); MJAPI void mjv_defaultFigure(mjvFigure* fig); // Initialize given geom fields when not NULL, set the rest to their default values. +// Nullable: size, pos, mat, rgba MJAPI void mjv_initGeom(mjvGeom* geom, int type, const mjtNum size[3], const mjtNum pos[3], const mjtNum mat[9], const float rgba[4]); @@ -692,28 +762,10 @@ MJAPI void mjv_freeScene(mjvScene* scn); MJAPI void mjv_updateScene(const mjModel* m, mjData* d, const mjvOption* opt, const mjvPerturb* pert, mjvCamera* cam, int catmask, mjvScene* scn); -// Update entire scene from a scene state, return the number of new mjWARN_VGEOMFULL warnings. -MJAPI int mjv_updateSceneFromState(const mjvSceneState* scnstate, const mjvOption* opt, - const mjvPerturb* pert, mjvCamera* cam, int catmask, - mjvScene* scn); - // Copy mjModel, skip large arrays not required for abstract visualization. +// Nullable: dest MJAPI void mjv_copyModel(mjModel* dest, const mjModel* src); -// Set default scene state. -MJAPI void mjv_defaultSceneState(mjvSceneState* scnstate); - -// Allocate resources and initialize a scene state object. -MJAPI void mjv_makeSceneState(const mjModel* m, const mjData* d, - mjvSceneState* scnstate, int maxgeom); - -// Free scene state. -MJAPI void mjv_freeSceneState(mjvSceneState* scnstate); - -// Update a scene state from model and data. -MJAPI void mjv_updateSceneState(const mjModel* m, mjData* d, const mjvOption* opt, - mjvSceneState* scnstate); - // Add geoms from selected categories. MJAPI void mjv_addGeoms(const mjModel* m, mjData* d, const mjvOption* opt, const mjvPerturb* pert, int catmask, mjvScene* scn); @@ -727,6 +779,16 @@ MJAPI void mjv_updateCamera(const mjModel* m, const mjData* d, mjvCamera* cam, m // Update skins. MJAPI void mjv_updateSkin(const mjModel* m, const mjData* d, mjvScene* scn); +// Compute camera position and forward, up, and right vectors. +// Nullable: headpos, forward, up, right +MJAPI void mjv_cameraFrame(mjtNum headpos[3], mjtNum forward[3], mjtNum up[3], mjtNum right[3], + const mjData* d, const mjvCamera* cam); + +// Compute camera frustum: vertical, horizontal, and clip planes. +// Nullable: zver, zhor, zclip +MJAPI void mjv_cameraFrustum(float zver[2], float zhor[2], float zclip[2], const mjModel* m, + const mjvCamera* cam); + //---------------------------------- OpenGL rendering ---------------------------------------------- @@ -1070,6 +1132,7 @@ MJAPI void mju_sqrMatTD(mjtNum* res, const mjtNum* mat, const mjtNum* diag, int // Coordinate transform of 6D motion or force vector in rotation:translation format. // rotnew2old is 3-by-3, NULL means no rotation; flg_force specifies force or motion type. +// Nullable: rotnew2old MJAPI void mju_transformSpatial(mjtNum res[6], const mjtNum vec[6], int flg_force, const mjtNum newpos[3], const mjtNum oldpos[3], const mjtNum rotnew2old[9]); @@ -1212,6 +1275,7 @@ MJAPI int mju_eig3(mjtNum eigval[3], mjtNum eigvec[9], mjtNum quat[4], const mjt // index (if given) must have allocated size n, but only nfree values are used in output // only the lower triangles of H and R and are read from and written to, respectively // the convenience function mju_boxQPmalloc allocates the required data structures +// Nullable: index, lower, upper MJAPI int mju_boxQP(mjtNum* res, mjtNum* R, int* index, const mjtNum* H, const mjtNum* g, int n, const mjtNum* lower, const mjtNum* upper); @@ -1275,7 +1339,7 @@ MJAPI const char* mju_warningText(int warning, size_t info); MJAPI int mju_isBad(mjtNum x); // Return 1 if all elements are 0. -MJAPI int mju_isZero(mjtNum* vec, int n); +MJAPI int mju_isZero(const mjtNum* vec, int n); // Standard normal random number generator (optional second number). MJAPI mjtNum mju_standardNormal(mjtNum* num2); @@ -1308,6 +1372,19 @@ MJAPI char* mju_strncpy(char *dst, const char *src, int n); MJAPI mjtNum mju_sigmoid(mjtNum x); +//---------------------------------- Signed Distance Function -------------------------------------- + +// get sdf from geom id +MJAPI const mjpPlugin* mjc_getSDF(const mjModel* m, int id); + +// signed distance function +MJAPI mjtNum mjc_distance(const mjModel* m, const mjData* d, const mjSDF* s, const mjtNum x[3]); + +// gradient of sdf +MJAPI void mjc_gradient(const mjModel* m, const mjData* d, const mjSDF* s, mjtNum gradient[3], + const mjtNum x[3]); + + //---------------------------------- Derivatives --------------------------------------------------- // Finite differenced transition matrices (control theory notation) @@ -1318,6 +1395,7 @@ MJAPI mjtNum mju_sigmoid(mjtNum x); // B: (2*nv+na x nu) // D: (nsensordata x 2*nv+na) // C: (nsensordata x nu) +// Nullable: A, B, C, D MJAPI void mjd_transitionFD(const mjModel* m, mjData* d, mjtNum eps, mjtByte flg_centered, mjtNum* A, mjtNum* B, mjtNum* C, mjtNum* D); @@ -1336,15 +1414,18 @@ MJAPI void mjd_transitionFD(const mjModel* m, mjData* d, mjtNum eps, mjtByte flg // notes: // optionally computes mass matrix Jacobian DmDq // flg_actuation specifies whether to subtract qfrc_actuator from qfrc_inverse +// Nullable: DfDq, DfDv, DfDa, DsDq, DsDv, DsDa, DmDq MJAPI void mjd_inverseFD(const mjModel* m, mjData* d, mjtNum eps, mjtByte flg_actuation, mjtNum *DfDq, mjtNum *DfDv, mjtNum *DfDa, mjtNum *DsDq, mjtNum *DsDv, mjtNum *DsDa, mjtNum *DmDq); // Derivatives of mju_subQuat. +// Nullable: Da, Db MJAPI void mjd_subQuat(const mjtNum qa[4], const mjtNum qb[4], mjtNum Da[9], mjtNum Db[9]); // Derivatives of mju_quatIntegrate. +// Nullable: Dquat, Dvel, Dscale MJAPI void mjd_quatIntegrate(const mjtNum vel[3], mjtNum scale, mjtNum Dquat[9], mjtNum Dvel[9], mjtNum Dscale[3]); @@ -1390,6 +1471,17 @@ MJAPI const mjpResourceProvider* mjp_getResourceProvider(const char* resource_na // If invalid slot number, return NULL. MJAPI const mjpResourceProvider* mjp_getResourceProviderAtSlot(int slot); +// Globally register a decoder. This function is thread-safe. +// If an identical mjpDecoder is already registered, this function does nothing. +// If a non-identical mjpDecoder with the same name is already registered, an mju_error is raised. +MJAPI void mjp_registerDecoder(const mjpDecoder* decoder); + +// Set default resource decoder definition. +MJAPI void mjp_defaultDecoder(mjpDecoder* decoder); + +// Return the resource provider with the prefix that matches against the resource name. +// If no match, return NULL. +MJAPI const mjpDecoder* mjp_findDecoder(const mjResource* resource, const char* content_type); //---------------------------------- Threads ------------------------------------------------------- @@ -1418,45 +1510,47 @@ MJAPI void mju_taskJoin(mjTask* task); MJAPI mjsElement* mjs_attach(mjsElement* parent, const mjsElement* child, const char* prefix, const char* suffix); -// Delete body and descendants from mjSpec, remove all references, return 0 on success. -MJAPI int mjs_detachBody(mjSpec* s, mjsBody* b); - -// Delete default class and descendants from mjSpec, remove all references, return 0 on success. -MJAPI int mjs_detachDefault(mjSpec* s, mjsDefault* d); //---------------------------------- Tree elements ------------------------------------------------- // Add child body to body, return child. +// Nullable: def MJAPI mjsBody* mjs_addBody(mjsBody* body, const mjsDefault* def); // Add site to body, return site spec. +// Nullable: def MJAPI mjsSite* mjs_addSite(mjsBody* body, const mjsDefault* def); // Add joint to body. +// Nullable: def MJAPI mjsJoint* mjs_addJoint(mjsBody* body, const mjsDefault* def); // Add freejoint to body. MJAPI mjsJoint* mjs_addFreeJoint(mjsBody* body); // Add geom to body. +// Nullable: def MJAPI mjsGeom* mjs_addGeom(mjsBody* body, const mjsDefault* def); // Add camera to body. +// Nullable: def MJAPI mjsCamera* mjs_addCamera(mjsBody* body, const mjsDefault* def); // Add light to body. +// Nullable: def MJAPI mjsLight* mjs_addLight(mjsBody* body, const mjsDefault* def); // Add frame to body. MJAPI mjsFrame* mjs_addFrame(mjsBody* body, mjsFrame* parentframe); -// Delete object corresponding to the given element, return 0 on success. -MJAPI int mjs_delete(mjsElement* element); +// Remove object corresponding to the given element, return 0 on success. +MJAPI int mjs_delete(mjSpec* spec, mjsElement* element); //---------------------------------- Non-tree elements --------------------------------------------- // Add actuator. +// Nullable: def MJAPI mjsActuator* mjs_addActuator(mjSpec* s, const mjsDefault* def); // Add sensor. @@ -1466,15 +1560,18 @@ MJAPI mjsSensor* mjs_addSensor(mjSpec* s); MJAPI mjsFlex* mjs_addFlex(mjSpec* s); // Add contact pair. +// Nullable: def MJAPI mjsPair* mjs_addPair(mjSpec* s, const mjsDefault* def); // Add excluded body pair. MJAPI mjsExclude* mjs_addExclude(mjSpec* s); // Add equality. +// Nullable: def MJAPI mjsEquality* mjs_addEquality(mjSpec* s, const mjsDefault* def); // Add tendon. +// Nullable: def MJAPI mjsTendon* mjs_addTendon(mjSpec* s, const mjsDefault* def); // Wrap site using tendon. @@ -1505,12 +1602,46 @@ MJAPI mjsKey* mjs_addKey(mjSpec* s); MJAPI mjsPlugin* mjs_addPlugin(mjSpec* s); // Add default. +// Nullable: parent MJAPI mjsDefault* mjs_addDefault(mjSpec* s, const char* classname, const mjsDefault* parent); +//---------------------------------- Set actuator parameters --------------------------------------- + +// Set actuator to motor, return error if any. +MJAPI const char* mjs_setToMotor(mjsActuator* actuator); + +// Set actuator to position, return error if any. +MJAPI const char* mjs_setToPosition(mjsActuator* actuator, double kp, double kv[1], + double dampratio[1], double timeconst[1], double inheritrange); + +// Set actuator to integrated velocity, return error if any. +MJAPI const char* mjs_setToIntVelocity(mjsActuator* actuator, double kp, double kv[1], + double dampratio[1], double timeconst[1], double inheritrange); + +// Set actuator to velocity servo, return error if any. +MJAPI const char* mjs_setToVelocity(mjsActuator* actuator, double kv); + +// Set actuator to activate damper, return error if any. +MJAPI const char* mjs_setToDamper(mjsActuator* actuator, double kv); + +// Set actuator to hydraulic or pneumatic cylinder, return error if any. +MJAPI const char* mjs_setToCylinder(mjsActuator* actuator, double timeconst, + double bias, double area, double diameter); + +// Set actuator to muscle, return error if any.a +MJAPI const char* mjs_setToMuscle(mjsActuator* actuator, double timeconst[2], double tausmooth, + double range[2], double force, double scale, double lmin, + double lmax, double vmax, double fpmax, double fvmax); + +// Set actuator to active adhesion, return error if any. +MJAPI const char* mjs_setToAdhesion(mjsActuator* actuator, double gain); + + //---------------------------------- Assets -------------------------------------------------------- // Add mesh. +// Nullable: def MJAPI mjsMesh* mjs_addMesh(mjSpec* s, const mjsDefault* def); // Add height field. @@ -1523,8 +1654,11 @@ MJAPI mjsSkin* mjs_addSkin(mjSpec* s); MJAPI mjsTexture* mjs_addTexture(mjSpec* s); // Add material. +// Nullable: def MJAPI mjsMaterial* mjs_addMaterial(mjSpec* s, const mjsDefault* def); +// Sets the vertices and normals of a mesh. +MJAPI int mjs_makeMesh(mjsMesh* mesh, mjtMeshBuiltin builtin, double* params, int nparams); //---------------------------------- Find and get utilities ---------------------------------------- @@ -1577,9 +1711,23 @@ MJAPI mjsElement* mjs_firstElement(mjSpec* s, mjtObj type); // Return spec's next element; return NULL if element is last. MJAPI mjsElement* mjs_nextElement(mjSpec* s, mjsElement* element); +// Get wrapped element in tendon path. +MJAPI mjsElement* mjs_getWrapTarget(mjsWrap* wrap); + +// Get wrapped element side site in tendon path if it has one, nullptr otherwise. +MJAPI mjsSite* mjs_getWrapSideSite(mjsWrap* wrap); + +// Get divisor of mjsWrap wrapping a puller. +MJAPI double mjs_getWrapDivisor(mjsWrap* wrap); + +// Get coefficient of mjsWrap wrapping a joint. +MJAPI double mjs_getWrapCoef(mjsWrap* wrap); //---------------------------------- Attribute setters --------------------------------------------- +// Set element's name, return 0 on success. +MJAPI int mjs_setName(mjsElement* element, const char* name); + // Copy buffer. MJAPI void mjs_setBuffer(mjByteVec* dest, const void* array, int size); @@ -1616,12 +1764,25 @@ MJAPI void mjs_setPluginAttributes(mjsPlugin* plugin, void* attributes); //---------------------------------- Attribute getters --------------------------------------------- +// Get element's name. +MJAPI mjString* mjs_getName(mjsElement* element); + // Get string contents. MJAPI const char* mjs_getString(const mjString* source); // Get double array contents and optionally its size. +// Nullable: size MJAPI const double* mjs_getDouble(const mjDoubleVec* source, int* size); +// Get number of elements a tendon wraps. +MJAPI int mjs_getWrapNum(const mjsTendon* tendonspec); + +// Get mjsWrap element at position i in the tendon path. +MJAPI mjsWrap* mjs_getWrap(const mjsTendon* tendonspec, int i); + +// Get plugin attributes. +MJAPI const void* mjs_getPluginAttributes(const mjsPlugin* plugin); + //---------------------------------- Spec utilities ------------------------------------------------ @@ -1641,12 +1802,22 @@ MJAPI mjsFrame* mjs_bodyToFrame(mjsBody** body); // Set user payload, overriding the existing value for the specified key if present. MJAPI void mjs_setUserValue(mjsElement* element, const char* key, const void* data); +// Set user payload, overriding the existing value for the specified key if +// present. This version differs from mjs_setUserValue in that it takes a +// cleanup function that will be called when the user payload is deleted. +MJAPI void mjs_setUserValueWithCleanup(mjsElement* element, const char* key, + const void* data, + void (*cleanup)(const void*)); + // Return user payload or NULL if none found. MJAPI const void* mjs_getUserValue(mjsElement* element, const char* key); // Delete user payload. MJAPI void mjs_deleteUserValue(mjsElement* element, const char* key); +// Return sensor dimension. +MJAPI int mjs_sensorDim(const mjsSensor* sensor); + //---------------------------------- Element initialization --------------------------------------- // Default spec attributes.