Migrate mjtByte to mjtBool for boolean-valued fields.
PiperOrigin-RevId: 921408093 Change-Id: Icb00457836359779f0f72fc02d6a7c0dc9f6bd23
This commit is contained in:
committed by
Copybara-Service
parent
3cabb2eb8e
commit
393c1e4217
@@ -21,6 +21,8 @@ General
|
||||
:ref:`mj_compile`, per-category timings (total, assets, mesh loading, convex hull, normals, inertia, BVH, octree,
|
||||
textures) are available via ``mjs_getTimer(spec)``. The :ref:`compile<saCompile>` sample prints a detailed timing
|
||||
breakdown when run without an output file.
|
||||
- Added :ref:`mjtBool` to represent boolean variables, replacing :ref:`mjtByte` across all boolean fields in
|
||||
:ref:`mjModel`, :ref:`mjData`, and public C API function signatures.
|
||||
|
||||
.. admonition:: Breaking API changes
|
||||
:class: attention
|
||||
|
||||
+33
-33
@@ -123,10 +123,10 @@ struct mjData_ {
|
||||
int nv_awake; // number of awake dofs
|
||||
|
||||
// flags marking lazily evaluated stages
|
||||
mjtByte flg_energypos; // has mj_energyPos been called
|
||||
mjtByte flg_energyvel; // has mj_energyVel been called
|
||||
mjtByte flg_subtreevel; // has mj_subtreeVel been called
|
||||
mjtByte flg_rnepost; // has mj_rnePostConstraint been called
|
||||
mjtBool flg_energypos; // has mj_energyPos been called
|
||||
mjtBool flg_energyvel; // has mj_energyVel been called
|
||||
mjtBool flg_subtreevel; // has mj_subtreeVel been called
|
||||
mjtBool flg_rnepost; // has mj_rnePostConstraint been called
|
||||
|
||||
// global properties
|
||||
mjtNum time; // simulation time
|
||||
@@ -152,7 +152,7 @@ struct mjData_ {
|
||||
mjtNum* ctrl; // control (nu x 1)
|
||||
mjtNum* qfrc_applied; // applied generalized force (nv x 1)
|
||||
mjtNum* xfrc_applied; // applied Cartesian force/torque (nbody x 6)
|
||||
mjtByte* eq_active; // enable/disable constraints (neq x 1)
|
||||
mjtBool* eq_active; // enable/disable constraints (neq x 1)
|
||||
|
||||
// mocap data
|
||||
mjtNum* mocap_pos; // positions of mocap bodies (nmocap x 3)
|
||||
@@ -233,7 +233,7 @@ struct mjData_ {
|
||||
mjtNum* qLDiagInv; // 1/diag(D) (nv x 1)
|
||||
|
||||
// computed by mj_collision/mj_collideTree
|
||||
mjtByte* bvh_active; // was bounding volume checked for collision (nbvh x 1)
|
||||
mjtBool* 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)
|
||||
@@ -741,9 +741,9 @@ struct mjModel_ {
|
||||
int* jnt_bodyid; // id of joint's body (njnt x 1)
|
||||
int* jnt_actuatorid; // actuator contributing damping / armature (njnt x 1)
|
||||
int* jnt_group; // group for visibility (njnt x 1)
|
||||
mjtByte* jnt_limited; // does joint have limits (njnt x 1)
|
||||
mjtByte* jnt_actfrclimited; // does joint have actuator force limits (njnt x 1)
|
||||
mjtByte* jnt_actgravcomp; // is gravcomp force applied via actuators (njnt x 1)
|
||||
mjtBool* jnt_limited; // does joint have limits (njnt x 1)
|
||||
mjtBool* jnt_actfrclimited; // does joint have actuator force limits (njnt x 1)
|
||||
mjtBool* jnt_actgravcomp; // is gravcomp force applied via actuators (njnt x 1)
|
||||
mjtNum* jnt_solref; // constraint solver reference: limit (njnt x mjNREF)
|
||||
mjtNum* jnt_solimp; // constraint solver impedance: limit (njnt x mjNIMP)
|
||||
mjtNum* jnt_pos; // local anchor position (njnt x 3)
|
||||
@@ -842,11 +842,11 @@ struct mjModel_ {
|
||||
int* light_targetbodyid; // id of targeted body; -1: none (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)
|
||||
mjtBool* 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)
|
||||
mjtBool* 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)
|
||||
mjtNum* light_poscom0; // global position rel. to sub-com in qpos0 (nlight x 3)
|
||||
@@ -870,7 +870,7 @@ struct mjModel_ {
|
||||
mjtNum* flex_friction; // friction for (slide, spin, roll) (nflex x 3)
|
||||
mjtNum* flex_margin; // geometric inflation for contact (nflex x 1)
|
||||
mjtNum* flex_gap; // additional contact detection buffer (nflex x 1)
|
||||
mjtByte* flex_internal; // internal flex collision enabled (nflex x 1)
|
||||
mjtBool* 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)
|
||||
@@ -926,10 +926,10 @@ struct mjModel_ {
|
||||
mjtNum* flex_edgestiffness; // edge stiffness (nflex x 1)
|
||||
mjtNum* flex_edgedamping; // edge damping (nflex x 1)
|
||||
int* flex_edgeequality; // 0:none, 1:edges, 2:vertices, 3:strain (nflex x 1)
|
||||
mjtByte* flex_rigid; // are all vertices in the same body (nflex x 1)
|
||||
mjtByte* flexedge_rigid; // are both edge vertices in same body (nflexedge x 1)
|
||||
mjtByte* flex_centered; // are all vertex coordinates (0,0,0) (nflex x 1)
|
||||
mjtByte* flex_flatskin; // render flex skin with flat shading (nflex x 1)
|
||||
mjtBool* flex_rigid; // are all vertices in the same body (nflex x 1)
|
||||
mjtBool* flexedge_rigid; // are both edge vertices in same body (nflexedge x 1)
|
||||
mjtBool* flex_centered; // are all vertex coordinates (0,0,0) (nflex x 1)
|
||||
mjtBool* flex_flatskin; // render flex skin with flat shading (nflex x 1)
|
||||
int* flex_bvhadr; // address of bvh root; -1: no bvh (nflex x 1)
|
||||
int* flex_bvhnum; // number of bounding volumes (nflex x 1)
|
||||
int* flexedge_J_rownnz; // number of non-zeros in Jacobian row (nflexedge x 1)
|
||||
@@ -1020,7 +1020,7 @@ struct mjModel_ {
|
||||
|
||||
// materials
|
||||
int* mat_texid; // indices of textures; -1: none (nmat x mjNTEXROLE)
|
||||
mjtByte* mat_texuniform; // make texture cube uniform (nmat x 1)
|
||||
mjtBool* mat_texuniform; // make texture cube uniform (nmat x 1)
|
||||
float* mat_texrepeat; // texture repetition for 2d mapping (nmat x 2)
|
||||
float* mat_emission; // emission (x rgb) (nmat x 1)
|
||||
float* mat_specular; // specular (x white) (nmat x 1)
|
||||
@@ -1050,7 +1050,7 @@ struct mjModel_ {
|
||||
int* eq_obj1id; // id of object 1 (neq x 1)
|
||||
int* eq_obj2id; // id of object 2 (neq x 1)
|
||||
int* eq_objtype; // type of both objects (mjtObj) (neq x 1)
|
||||
mjtByte* eq_active0; // initial enable/disable constraint state (neq x 1)
|
||||
mjtBool* eq_active0; // initial enable/disable constraint state (neq x 1)
|
||||
mjtNum* eq_solref; // constraint solver reference (neq x mjNREF)
|
||||
mjtNum* eq_solimp; // constraint solver impedance (neq x mjNIMP)
|
||||
mjtNum* eq_data; // numeric data for constraint (neq x mjNEQDATA)
|
||||
@@ -1066,8 +1066,8 @@ struct mjModel_ {
|
||||
int* ten_J_rownnz; // number of non-zeros in Jacobian row (ntendon x 1)
|
||||
int* ten_J_rowadr; // row start address in colind array (ntendon x 1)
|
||||
int* ten_J_colind; // column indices in sparse Jacobian (nJten x 1)
|
||||
mjtByte* tendon_limited; // does tendon have length limits (ntendon x 1)
|
||||
mjtByte* tendon_actfrclimited; // does tendon have actuator force limits (ntendon x 1)
|
||||
mjtBool* tendon_limited; // does tendon have length limits (ntendon x 1)
|
||||
mjtBool* tendon_actfrclimited; // does tendon have actuator force limits (ntendon x 1)
|
||||
mjtNum* tendon_width; // width for rendering (ntendon x 1)
|
||||
mjtNum* tendon_solref_lim; // constraint solver reference: limit (ntendon x mjNREF)
|
||||
mjtNum* tendon_solimp_lim; // constraint solver impedance: limit (ntendon x mjNIMP)
|
||||
@@ -1108,13 +1108,13 @@ struct mjModel_ {
|
||||
int* actuator_history; // history buffer: [nsample, interp] (nu x 2)
|
||||
int* actuator_historyadr; // address in history buffer; -1: none (nu x 1)
|
||||
mjtNum* actuator_delay; // delay time in seconds; 0: no delay (nu x 1)
|
||||
mjtByte* actuator_ctrllimited; // is control limited (nu x 1)
|
||||
mjtByte* actuator_forcelimited;// is force limited (nu x 1)
|
||||
mjtByte* actuator_actlimited; // is activation limited (nu x 1)
|
||||
mjtBool* actuator_ctrllimited; // is control limited (nu x 1)
|
||||
mjtBool* actuator_forcelimited;// is force limited (nu x 1)
|
||||
mjtBool* actuator_actlimited; // is activation limited (nu x 1)
|
||||
mjtNum* actuator_dynprm; // dynamics parameters (nu x mjNDYN)
|
||||
mjtNum* actuator_gainprm; // gain parameters (nu x mjNGAIN)
|
||||
mjtNum* actuator_biasprm; // bias parameters (nu x mjNBIAS)
|
||||
mjtByte* actuator_actearly; // step activation before force (nu x 1)
|
||||
mjtBool* actuator_actearly; // step activation before force (nu x 1)
|
||||
mjtNum* actuator_ctrlrange; // range of controls (nu x 2)
|
||||
mjtNum* actuator_forcerange; // range of forces (nu x 2)
|
||||
mjtNum* actuator_actrange; // range of activations (nu x 2)
|
||||
@@ -3373,10 +3373,10 @@ void mj_loadAllPluginLibraries(const char* directory, mjfPluginLibraryLoadCallba
|
||||
int mj_version(void);
|
||||
const char* mj_versionString(void);
|
||||
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,
|
||||
const mjtByte* geomgroup, mjtBool flg_static, int bodyexclude,
|
||||
int geomid[1], mjtNum normal[3]);
|
||||
void mj_multiRay(const mjModel* m, mjData* d, const mjtNum pnt[3], const mjtNum* vec,
|
||||
const mjtByte* geomgroup, mjtByte flg_static, int bodyexclude,
|
||||
const mjtByte* geomgroup, mjtBool flg_static, int bodyexclude,
|
||||
int* geomid, mjtNum* dist, mjtNum* normal, int nray, mjtNum cutoff);
|
||||
mjtNum mj_rayHfield(const mjModel* m, const mjData* d, int geomid,
|
||||
const mjtNum pnt[3], const mjtNum vec[3], mjtNum normal[3]);
|
||||
@@ -3386,8 +3386,8 @@ mjtNum mju_rayGeom(const mjtNum pos[3], const mjtNum mat[9], const mjtNum size[3
|
||||
const mjtNum pnt[3], const mjtNum vec[3], int geomtype,
|
||||
mjtNum normal[3]);
|
||||
mjtNum mj_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[3],
|
||||
mjtBool flg_vert, mjtBool flg_edge, mjtBool flg_face,
|
||||
mjtBool flg_skin, int flexid, const mjtNum pnt[3],
|
||||
const mjtNum vec[3], int vertid[1], mjtNum normal[3]);
|
||||
mjtNum mju_raySkin(int nface, int nvert, const int* face, const float* vert,
|
||||
const mjtNum pnt[3], const mjtNum vec[3], int vertid[1]);
|
||||
@@ -3582,10 +3582,10 @@ mjtNum mju_cholFactorBand(mjtNum* mat, int ntotal, int nband, int ndense,
|
||||
void mju_cholSolveBand(mjtNum* res, const mjtNum* mat, const mjtNum* vec,
|
||||
int ntotal, int nband, int ndense);
|
||||
void mju_band2Dense(mjtNum* res, const mjtNum* mat, int ntotal, int nband, int ndense,
|
||||
mjtByte flg_sym);
|
||||
mjtBool flg_sym);
|
||||
void mju_dense2Band(mjtNum* res, const mjtNum* mat, int ntotal, int nband, int ndense);
|
||||
void mju_bandMulMatVec(mjtNum* res, const mjtNum* mat, const mjtNum* vec,
|
||||
int ntotal, int nband, int ndense, int nvec, mjtByte flg_sym);
|
||||
int ntotal, int nband, int ndense, int nvec, mjtBool flg_sym);
|
||||
int mju_bandDiag(int i, int ntotal, int nband, int ndense);
|
||||
int mju_eig3(mjtNum eigval[3], mjtNum eigvec[9], mjtNum quat[4], const mjtNum mat[9]);
|
||||
int mju_boxQP(mjtNum* res, mjtNum* R, int* index, const mjtNum* H, const mjtNum* g, int n,
|
||||
@@ -3625,9 +3625,9 @@ const mjpPlugin* mjc_getSDF(const mjModel* m, int id);
|
||||
mjtNum mjc_distance(const mjModel* m, const mjData* d, const mjSDF* s, const mjtNum x[3]);
|
||||
void mjc_gradient(const mjModel* m, const mjData* d, const mjSDF* s, mjtNum gradient[3],
|
||||
const mjtNum x[3]);
|
||||
void mjd_transitionFD(const mjModel* m, mjData* d, mjtNum eps, mjtByte flg_centered,
|
||||
void mjd_transitionFD(const mjModel* m, mjData* d, mjtNum eps, mjtBool flg_centered,
|
||||
mjtNum* A, mjtNum* B, mjtNum* C, mjtNum* D);
|
||||
void mjd_inverseFD(const mjModel* m, mjData* d, mjtNum eps, mjtByte flg_actuation,
|
||||
void mjd_inverseFD(const mjModel* m, mjData* d, mjtNum eps, mjtBool flg_actuation,
|
||||
mjtNum *DfDq, mjtNum *DfDv, mjtNum *DfDa,
|
||||
mjtNum *DsDq, mjtNum *DsDv, mjtNum *DsDa,
|
||||
mjtNum *DmDq);
|
||||
@@ -3741,7 +3741,7 @@ int mjs_setName(mjsElement* element, const char* name);
|
||||
void mjs_setBuffer(mjByteVec* dest, const void* array, int size);
|
||||
void mjs_setString(mjString* dest, const char* text);
|
||||
void mjs_setStringVec(mjStringVec* dest, const char* text);
|
||||
mjtByte mjs_setInStringVec(mjStringVec* dest, int i, const char* text);
|
||||
mjtBool mjs_setInStringVec(mjStringVec* dest, int i, const char* text);
|
||||
void mjs_appendString(mjStringVec* dest, const char* text);
|
||||
void mjs_setInt(mjIntVec* dest, const int* array, int size);
|
||||
void mjs_appendIntVec(mjIntVecVec* dest, const int* array, int size);
|
||||
|
||||
@@ -146,10 +146,10 @@ struct mjData_ {
|
||||
int nv_awake; // number of awake dofs
|
||||
|
||||
// flags marking lazily evaluated stages
|
||||
mjtByte flg_energypos; // has mj_energyPos been called
|
||||
mjtByte flg_energyvel; // has mj_energyVel been called
|
||||
mjtByte flg_subtreevel; // has mj_subtreeVel been called
|
||||
mjtByte flg_rnepost; // has mj_rnePostConstraint been called
|
||||
mjtBool flg_energypos; // has mj_energyPos been called
|
||||
mjtBool flg_energyvel; // has mj_energyVel been called
|
||||
mjtBool flg_subtreevel; // has mj_subtreeVel been called
|
||||
mjtBool flg_rnepost; // has mj_rnePostConstraint been called
|
||||
|
||||
// global properties
|
||||
mjtNum time; // simulation time
|
||||
@@ -175,7 +175,7 @@ struct mjData_ {
|
||||
mjtNum* ctrl; // control (nu x 1)
|
||||
mjtNum* qfrc_applied; // applied generalized force (nv x 1)
|
||||
mjtNum* xfrc_applied; // applied Cartesian force/torque (nbody x 6)
|
||||
mjtByte* eq_active; // enable/disable constraints (neq x 1)
|
||||
mjtBool* eq_active; // enable/disable constraints (neq x 1)
|
||||
|
||||
// mocap data
|
||||
mjtNum* mocap_pos; // positions of mocap bodies (nmocap x 3)
|
||||
@@ -256,7 +256,7 @@ struct mjData_ {
|
||||
mjtNum* qLDiagInv; // 1/diag(D) (nv x 1)
|
||||
|
||||
// computed by mj_collision/mj_collideTree
|
||||
mjtByte* bvh_active; // was bounding volume checked for collision (nbvh x 1)
|
||||
mjtBool* 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)
|
||||
|
||||
+18
-18
@@ -411,9 +411,9 @@ struct mjModel_ {
|
||||
int* jnt_bodyid; // id of joint's body (njnt x 1)
|
||||
int* jnt_actuatorid; // actuator contributing damping / armature (njnt x 1)
|
||||
int* jnt_group; // group for visibility (njnt x 1)
|
||||
mjtByte* jnt_limited; // does joint have limits (njnt x 1)
|
||||
mjtByte* jnt_actfrclimited; // does joint have actuator force limits (njnt x 1)
|
||||
mjtByte* jnt_actgravcomp; // is gravcomp force applied via actuators (njnt x 1)
|
||||
mjtBool* jnt_limited; // does joint have limits (njnt x 1)
|
||||
mjtBool* jnt_actfrclimited; // does joint have actuator force limits (njnt x 1)
|
||||
mjtBool* jnt_actgravcomp; // is gravcomp force applied via actuators (njnt x 1)
|
||||
mjtNum* jnt_solref; // constraint solver reference: limit (njnt x mjNREF)
|
||||
mjtNum* jnt_solimp; // constraint solver impedance: limit (njnt x mjNIMP)
|
||||
mjtNum* jnt_pos; // local anchor position (njnt x 3)
|
||||
@@ -512,11 +512,11 @@ struct mjModel_ {
|
||||
int* light_targetbodyid; // id of targeted body; -1: none (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)
|
||||
mjtBool* 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)
|
||||
mjtBool* 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)
|
||||
mjtNum* light_poscom0; // global position rel. to sub-com in qpos0 (nlight x 3)
|
||||
@@ -540,7 +540,7 @@ struct mjModel_ {
|
||||
mjtNum* flex_friction; // friction for (slide, spin, roll) (nflex x 3)
|
||||
mjtNum* flex_margin; // geometric inflation for contact (nflex x 1)
|
||||
mjtNum* flex_gap; // additional contact detection buffer (nflex x 1)
|
||||
mjtByte* flex_internal; // internal flex collision enabled (nflex x 1)
|
||||
mjtBool* 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)
|
||||
@@ -596,10 +596,10 @@ struct mjModel_ {
|
||||
mjtNum* flex_edgestiffness; // edge stiffness (nflex x 1)
|
||||
mjtNum* flex_edgedamping; // edge damping (nflex x 1)
|
||||
int* flex_edgeequality; // 0:none, 1:edges, 2:vertices, 3:strain (nflex x 1)
|
||||
mjtByte* flex_rigid; // are all vertices in the same body (nflex x 1)
|
||||
mjtByte* flexedge_rigid; // are both edge vertices in same body (nflexedge x 1)
|
||||
mjtByte* flex_centered; // are all vertex coordinates (0,0,0) (nflex x 1)
|
||||
mjtByte* flex_flatskin; // render flex skin with flat shading (nflex x 1)
|
||||
mjtBool* flex_rigid; // are all vertices in the same body (nflex x 1)
|
||||
mjtBool* flexedge_rigid; // are both edge vertices in same body (nflexedge x 1)
|
||||
mjtBool* flex_centered; // are all vertex coordinates (0,0,0) (nflex x 1)
|
||||
mjtBool* flex_flatskin; // render flex skin with flat shading (nflex x 1)
|
||||
int* flex_bvhadr; // address of bvh root; -1: no bvh (nflex x 1)
|
||||
int* flex_bvhnum; // number of bounding volumes (nflex x 1)
|
||||
int* flexedge_J_rownnz; // number of non-zeros in Jacobian row (nflexedge x 1)
|
||||
@@ -690,7 +690,7 @@ struct mjModel_ {
|
||||
|
||||
// materials
|
||||
int* mat_texid; // indices of textures; -1: none (nmat x mjNTEXROLE)
|
||||
mjtByte* mat_texuniform; // make texture cube uniform (nmat x 1)
|
||||
mjtBool* mat_texuniform; // make texture cube uniform (nmat x 1)
|
||||
float* mat_texrepeat; // texture repetition for 2d mapping (nmat x 2)
|
||||
float* mat_emission; // emission (x rgb) (nmat x 1)
|
||||
float* mat_specular; // specular (x white) (nmat x 1)
|
||||
@@ -720,7 +720,7 @@ struct mjModel_ {
|
||||
int* eq_obj1id; // id of object 1 (neq x 1)
|
||||
int* eq_obj2id; // id of object 2 (neq x 1)
|
||||
int* eq_objtype; // type of both objects (mjtObj) (neq x 1)
|
||||
mjtByte* eq_active0; // initial enable/disable constraint state (neq x 1)
|
||||
mjtBool* eq_active0; // initial enable/disable constraint state (neq x 1)
|
||||
mjtNum* eq_solref; // constraint solver reference (neq x mjNREF)
|
||||
mjtNum* eq_solimp; // constraint solver impedance (neq x mjNIMP)
|
||||
mjtNum* eq_data; // numeric data for constraint (neq x mjNEQDATA)
|
||||
@@ -736,8 +736,8 @@ struct mjModel_ {
|
||||
int* ten_J_rownnz; // number of non-zeros in Jacobian row (ntendon x 1)
|
||||
int* ten_J_rowadr; // row start address in colind array (ntendon x 1)
|
||||
int* ten_J_colind; // column indices in sparse Jacobian (nJten x 1)
|
||||
mjtByte* tendon_limited; // does tendon have length limits (ntendon x 1)
|
||||
mjtByte* tendon_actfrclimited; // does tendon have actuator force limits (ntendon x 1)
|
||||
mjtBool* tendon_limited; // does tendon have length limits (ntendon x 1)
|
||||
mjtBool* tendon_actfrclimited; // does tendon have actuator force limits (ntendon x 1)
|
||||
mjtNum* tendon_width; // width for rendering (ntendon x 1)
|
||||
mjtNum* tendon_solref_lim; // constraint solver reference: limit (ntendon x mjNREF)
|
||||
mjtNum* tendon_solimp_lim; // constraint solver impedance: limit (ntendon x mjNIMP)
|
||||
@@ -778,13 +778,13 @@ struct mjModel_ {
|
||||
int* actuator_history; // history buffer: [nsample, interp] (nu x 2)
|
||||
int* actuator_historyadr; // address in history buffer; -1: none (nu x 1)
|
||||
mjtNum* actuator_delay; // delay time in seconds; 0: no delay (nu x 1)
|
||||
mjtByte* actuator_ctrllimited; // is control limited (nu x 1)
|
||||
mjtByte* actuator_forcelimited;// is force limited (nu x 1)
|
||||
mjtByte* actuator_actlimited; // is activation limited (nu x 1)
|
||||
mjtBool* actuator_ctrllimited; // is control limited (nu x 1)
|
||||
mjtBool* actuator_forcelimited;// is force limited (nu x 1)
|
||||
mjtBool* actuator_actlimited; // is activation limited (nu x 1)
|
||||
mjtNum* actuator_dynprm; // dynamics parameters (nu x mjNDYN)
|
||||
mjtNum* actuator_gainprm; // gain parameters (nu x mjNGAIN)
|
||||
mjtNum* actuator_biasprm; // bias parameters (nu x mjNBIAS)
|
||||
mjtByte* actuator_actearly; // step activation before force (nu x 1)
|
||||
mjtBool* actuator_actearly; // step activation before force (nu x 1)
|
||||
mjtNum* actuator_ctrlrange; // range of controls (nu x 2)
|
||||
mjtNum* actuator_forcerange; // range of forces (nu x 2)
|
||||
mjtNum* actuator_actrange; // range of activations (nu x 2)
|
||||
|
||||
+24
-24
@@ -318,9 +318,9 @@
|
||||
X ( int, jnt_bodyid, njnt, 1 ) \
|
||||
X ( int, jnt_actuatorid, njnt, 1 ) \
|
||||
X ( int, jnt_group, njnt, 1 ) \
|
||||
X ( mjtByte, jnt_limited, njnt, 1 ) \
|
||||
X ( mjtByte, jnt_actfrclimited, njnt, 1 ) \
|
||||
X ( mjtByte, jnt_actgravcomp, njnt, 1 ) \
|
||||
X ( mjtBool, jnt_limited, njnt, 1 ) \
|
||||
X ( mjtBool, jnt_actfrclimited, njnt, 1 ) \
|
||||
X ( mjtBool, jnt_actgravcomp, njnt, 1 ) \
|
||||
X ( mjtNum, jnt_solref, njnt, mjNREF ) \
|
||||
X ( mjtNum, jnt_solimp, njnt, mjNIMP ) \
|
||||
X ( mjtNum, jnt_pos, njnt, 3 ) \
|
||||
@@ -419,11 +419,11 @@
|
||||
X ( int, light_targetbodyid, nlight, 1 ) \
|
||||
X ( int, light_type, nlight, 1 ) \
|
||||
X ( int, light_texid, nlight, 1 ) \
|
||||
X ( mjtByte, light_castshadow, nlight, 1 ) \
|
||||
X ( mjtBool, light_castshadow, nlight, 1 ) \
|
||||
X ( float, light_bulbradius, nlight, 1 ) \
|
||||
X ( float, light_intensity, nlight, 1 ) \
|
||||
X ( float, light_range, nlight, 1 ) \
|
||||
X ( mjtByte, light_active, nlight, 1 ) \
|
||||
X ( mjtBool, light_active, nlight, 1 ) \
|
||||
X ( mjtNum, light_pos, nlight, 3 ) \
|
||||
X ( mjtNum, light_dir, nlight, 3 ) \
|
||||
X ( mjtNum, light_poscom0, nlight, 3 ) \
|
||||
@@ -447,7 +447,7 @@
|
||||
X ( mjtNum, flex_friction, nflex, 3 ) \
|
||||
X ( mjtNum, flex_margin, nflex, 1 ) \
|
||||
X ( mjtNum, flex_gap, nflex, 1 ) \
|
||||
X ( mjtByte, flex_internal, nflex, 1 ) \
|
||||
X ( mjtBool, flex_internal, nflex, 1 ) \
|
||||
X ( int, flex_selfcollide, nflex, 1 ) \
|
||||
X ( int, flex_activelayers, nflex, 1 ) \
|
||||
X ( int, flex_passive, nflex, 1 ) \
|
||||
@@ -501,10 +501,10 @@
|
||||
X ( mjtNum, flex_edgestiffness, nflex, 1 ) \
|
||||
X ( mjtNum, flex_edgedamping, nflex, 1 ) \
|
||||
X ( int, flex_edgeequality, nflex, 1 ) \
|
||||
X ( mjtByte, flex_rigid, nflex, 1 ) \
|
||||
X ( mjtByte, flexedge_rigid, nflexedge, 1 ) \
|
||||
X ( mjtByte, flex_centered, nflex, 1 ) \
|
||||
X ( mjtByte, flex_flatskin, nflex, 1 ) \
|
||||
X ( mjtBool, flex_rigid, nflex, 1 ) \
|
||||
X ( mjtBool, flexedge_rigid, nflexedge, 1 ) \
|
||||
X ( mjtBool, flex_centered, nflex, 1 ) \
|
||||
X ( mjtBool, flex_flatskin, nflex, 1 ) \
|
||||
X ( int, flex_bvhadr, nflex, 1 ) \
|
||||
X ( int, flex_bvhnum, nflex, 1 ) \
|
||||
X ( int, flexedge_J_rownnz, nflexedge, 1 ) \
|
||||
@@ -595,7 +595,7 @@
|
||||
|
||||
#define MJMODEL_POINTERS_MATERIAL \
|
||||
X ( int, mat_texid, nmat, mjNTEXROLE ) \
|
||||
X ( mjtByte, mat_texuniform, nmat, 1 ) \
|
||||
X ( mjtBool, mat_texuniform, nmat, 1 ) \
|
||||
X ( float, mat_texrepeat, nmat, 2 ) \
|
||||
X ( float, mat_emission, nmat, 1 ) \
|
||||
X ( float, mat_specular, nmat, 1 ) \
|
||||
@@ -625,7 +625,7 @@
|
||||
X ( int, eq_obj1id, neq, 1 ) \
|
||||
X ( int, eq_obj2id, neq, 1 ) \
|
||||
X ( int, eq_objtype, neq, 1 ) \
|
||||
X ( mjtByte, eq_active0, neq, 1 ) \
|
||||
X ( mjtBool, eq_active0, neq, 1 ) \
|
||||
X ( mjtNum, eq_solref, neq, mjNREF ) \
|
||||
X ( mjtNum, eq_solimp, neq, mjNIMP ) \
|
||||
X ( mjtNum, eq_data, neq, mjNEQDATA )
|
||||
@@ -641,8 +641,8 @@
|
||||
X ( int, ten_J_rownnz, ntendon, 1 ) \
|
||||
X ( int, ten_J_rowadr, ntendon, 1 ) \
|
||||
X ( int, ten_J_colind, nJten, 1 ) \
|
||||
X ( mjtByte, tendon_limited, ntendon, 1 ) \
|
||||
X ( mjtByte, tendon_actfrclimited, ntendon, 1 ) \
|
||||
X ( mjtBool, tendon_limited, ntendon, 1 ) \
|
||||
X ( mjtBool, tendon_actfrclimited, ntendon, 1 ) \
|
||||
X ( mjtNum, tendon_width, ntendon, 1 ) \
|
||||
X ( mjtNum, tendon_solref_lim, ntendon, mjNREF ) \
|
||||
X ( mjtNum, tendon_solimp_lim, ntendon, mjNIMP ) \
|
||||
@@ -678,13 +678,13 @@
|
||||
X ( int, actuator_history, nu, 2 ) \
|
||||
X ( int, actuator_historyadr, nu, 1 ) \
|
||||
X ( mjtNum, actuator_delay, nu, 1 ) \
|
||||
X ( mjtByte, actuator_ctrllimited, nu, 1 ) \
|
||||
X ( mjtByte, actuator_forcelimited, nu, 1 ) \
|
||||
X ( mjtByte, actuator_actlimited, nu, 1 ) \
|
||||
X ( mjtBool, actuator_ctrllimited, nu, 1 ) \
|
||||
X ( mjtBool, actuator_forcelimited, nu, 1 ) \
|
||||
X ( mjtBool, actuator_actlimited, nu, 1 ) \
|
||||
X ( mjtNum, actuator_dynprm, nu, mjNDYN ) \
|
||||
X ( mjtNum, actuator_gainprm, nu, mjNGAIN ) \
|
||||
X ( mjtNum, actuator_biasprm, nu, mjNBIAS ) \
|
||||
X ( mjtByte, actuator_actearly, nu, 1 ) \
|
||||
X ( mjtBool, actuator_actearly, nu, 1 ) \
|
||||
X ( mjtNum, actuator_ctrlrange, nu, 2 ) \
|
||||
X ( mjtNum, actuator_forcerange, nu, 2 ) \
|
||||
X ( mjtNum, actuator_actrange, nu, 2 ) \
|
||||
@@ -828,7 +828,7 @@
|
||||
X ( mjtNum, ctrl, nu, 1 ) \
|
||||
X ( mjtNum, qfrc_applied, nv, 1 ) \
|
||||
X ( mjtNum, xfrc_applied, nbody, 6 ) \
|
||||
X ( mjtByte, eq_active, neq, 1 ) \
|
||||
X ( mjtBool, eq_active, neq, 1 ) \
|
||||
X ( mjtNum, mocap_pos, nmocap, 3 ) \
|
||||
X ( mjtNum, mocap_quat, nmocap, 4 ) \
|
||||
X ( mjtNum, qacc, nv, 1 ) \
|
||||
@@ -879,7 +879,7 @@
|
||||
XNV ( mjtNum, M, nC, 1 ) \
|
||||
XNV ( mjtNum, qLD, nC, 1 ) \
|
||||
X ( mjtNum, qLDiagInv, nv, 1 ) \
|
||||
X ( mjtByte, bvh_active, nbvh, 1 ) \
|
||||
X ( mjtBool, bvh_active, nbvh, 1 ) \
|
||||
X ( int, tree_awake, ntree, 1 ) \
|
||||
X ( int, body_awake, nbody, 1 ) \
|
||||
X ( int, body_awake_ind, nbody, 1 ) \
|
||||
@@ -1032,10 +1032,10 @@
|
||||
X( int, nbody_awake ) \
|
||||
X( int, nparent_awake ) \
|
||||
X( int, nv_awake ) \
|
||||
X( mjtByte, flg_energypos ) \
|
||||
X( mjtByte, flg_energyvel ) \
|
||||
X( mjtByte, flg_subtreevel ) \
|
||||
X( mjtByte, flg_rnepost ) \
|
||||
X( mjtBool, flg_energypos ) \
|
||||
X( mjtBool, flg_energyvel ) \
|
||||
X( mjtBool, flg_subtreevel ) \
|
||||
X( mjtBool, flg_rnepost ) \
|
||||
X( mjtNum, time ) \
|
||||
X( uintptr_t, threadpool )
|
||||
|
||||
|
||||
@@ -680,7 +680,7 @@ MJAPI const char* mj_versionString(void);
|
||||
// geomgroup, flg_static are as in mjvOption; geomgroup==NULL skips group exclusion.
|
||||
// Nullable: geomgroup, geomid, normal
|
||||
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,
|
||||
const mjtByte* geomgroup, mjtBool flg_static, int bodyexclude,
|
||||
int geomid[1], mjtNum normal[3]);
|
||||
|
||||
// Intersect multiple rays emanating from a single point, compute normals if given.
|
||||
@@ -688,7 +688,7 @@ MJAPI mjtNum mj_ray(const mjModel* m, const mjData* d, const mjtNum pnt[3], cons
|
||||
// Geoms further than cutoff are ignored.
|
||||
// Nullable: geomgroup, geomid, normal
|
||||
MJAPI void mj_multiRay(const mjModel* m, mjData* d, const mjtNum pnt[3], const mjtNum* vec,
|
||||
const mjtByte* geomgroup, mjtByte flg_static, int bodyexclude,
|
||||
const mjtByte* geomgroup, mjtBool flg_static, int bodyexclude,
|
||||
int* geomid, mjtNum* dist, mjtNum* normal, int nray, mjtNum cutoff);
|
||||
|
||||
// Intersect ray with hfield; return nearest distance or -1 if no intersection.
|
||||
@@ -711,8 +711,8 @@ MJAPI mjtNum mju_rayGeom(const mjtNum pos[3], const mjtNum mat[9], const mjtNum
|
||||
// and also output nearest vertex id and surface normal.
|
||||
// Nullable: vertid, normal
|
||||
MJAPI mjtNum mj_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[3],
|
||||
mjtBool flg_vert, mjtBool flg_edge, mjtBool flg_face,
|
||||
mjtBool flg_skin, int flexid, const mjtNum pnt[3],
|
||||
const mjtNum vec[3], int vertid[1], mjtNum normal[3]);
|
||||
|
||||
// Intersect ray with skin; return nearest distance or -1 if no intersection,
|
||||
@@ -1304,14 +1304,14 @@ MJAPI void mju_cholSolveBand(mjtNum* res, const mjtNum* mat, const mjtNum* vec,
|
||||
|
||||
// Convert banded matrix to dense matrix, fill upper triangle if flg_sym>0.
|
||||
MJAPI void mju_band2Dense(mjtNum* res, const mjtNum* mat, int ntotal, int nband, int ndense,
|
||||
mjtByte flg_sym);
|
||||
mjtBool flg_sym);
|
||||
|
||||
// Convert dense matrix to banded matrix.
|
||||
MJAPI void mju_dense2Band(mjtNum* res, const mjtNum* mat, int ntotal, int nband, int ndense);
|
||||
|
||||
// Multiply band-diagonal matrix with nvec vectors, include upper triangle if flg_sym>0.
|
||||
MJAPI void mju_bandMulMatVec(mjtNum* res, const mjtNum* mat, const mjtNum* vec,
|
||||
int ntotal, int nband, int ndense, int nvec, mjtByte flg_sym);
|
||||
int ntotal, int nband, int ndense, int nvec, mjtBool flg_sym);
|
||||
|
||||
// Address of diagonal element i in band-dense matrix representation.
|
||||
MJAPI int mju_bandDiag(int i, int ntotal, int nband, int ndense);
|
||||
@@ -1461,7 +1461,7 @@ MJAPI void mjc_gradient(const mjModel* m, const mjData* d, const mjSDF* s, mjtNu
|
||||
// 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,
|
||||
MJAPI void mjd_transitionFD(const mjModel* m, mjData* d, mjtNum eps, mjtBool flg_centered,
|
||||
mjtNum* A, mjtNum* B, mjtNum* C, mjtNum* D);
|
||||
|
||||
// Finite differenced Jacobians of (force, sensors) = mj_inverse(state, acceleration)
|
||||
@@ -1480,7 +1480,7 @@ MJAPI void mjd_transitionFD(const mjModel* m, mjData* d, mjtNum eps, mjtByte flg
|
||||
// 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,
|
||||
MJAPI void mjd_inverseFD(const mjModel* m, mjData* d, mjtNum eps, mjtBool flg_actuation,
|
||||
mjtNum *DfDq, mjtNum *DfDv, mjtNum *DfDa,
|
||||
mjtNum *DsDq, mjtNum *DsDv, mjtNum *DsDa,
|
||||
mjtNum *DmDq);
|
||||
@@ -1860,7 +1860,7 @@ MJAPI void mjs_setString(mjString* dest, const char* text);
|
||||
MJAPI void mjs_setStringVec(mjStringVec* dest, const char* text);
|
||||
|
||||
// Set entry in string vector.
|
||||
MJAPI mjtByte mjs_setInStringVec(mjStringVec* dest, int i, const char* text);
|
||||
MJAPI mjtBool mjs_setInStringVec(mjStringVec* dest, int i, const char* text);
|
||||
|
||||
// Append text entry to string vector.
|
||||
MJAPI void mjs_appendString(mjStringVec* dest, const char* text);
|
||||
|
||||
@@ -136,6 +136,7 @@ C_TO_CS_TYPE = {
|
||||
'void': 'void',
|
||||
'mjtNum': 'double',
|
||||
'mjtByte': 'byte',
|
||||
'mjtBool': 'byte',
|
||||
'mjtSize': 'UInt64' if ctypes.sizeof(ctypes.c_size_t) == 8 else 'UInt32',
|
||||
}
|
||||
|
||||
|
||||
@@ -732,7 +732,7 @@ PYBIND11_MODULE(_functions, pymodule) {
|
||||
Eigen::Ref<const EigenVectorX> vec,
|
||||
std::optional<Eigen::Ref<const Eigen::Vector<mjtByte, mjNGROUP>>>
|
||||
geomgroup,
|
||||
mjtByte flg_static, int bodyexclude, Eigen::Ref<EigenVectorI> geomid,
|
||||
mjtBool flg_static, int bodyexclude, Eigen::Ref<EigenVectorI> geomid,
|
||||
Eigen::Ref<EigenVectorX> dist,
|
||||
std::optional<Eigen::Ref<EigenVectorX>> normal,
|
||||
int nray, mjtNum cutoff) {
|
||||
@@ -758,7 +758,7 @@ PYBIND11_MODULE(_functions, pymodule) {
|
||||
const mjtNum(*vec)[3],
|
||||
std::optional<Eigen::Ref<const Eigen::Vector<mjtByte, mjNGROUP>>>
|
||||
geomgroup,
|
||||
mjtByte flg_static, int bodyexclude,
|
||||
mjtBool flg_static, int bodyexclude,
|
||||
std::optional<Eigen::Ref<Eigen::Vector<int, 1>>> geomid,
|
||||
std::optional<Eigen::Ref<Eigen::Vector<mjtNum, 3>>> normal) {
|
||||
return mj_ray(m, d, &(*pnt)[0], &(*vec)[0],
|
||||
@@ -817,8 +817,8 @@ PYBIND11_MODULE(_functions, pymodule) {
|
||||
"mj_rayFlex",
|
||||
util::UnwrapArgs(
|
||||
[](const raw::MjModel* m, const raw::MjData* d, int flex_layer,
|
||||
mjtByte flg_vert, mjtByte flg_edge, mjtByte flg_face,
|
||||
mjtByte flg_skin, int flexid, const mjtNum(*pnt)[3],
|
||||
mjtBool flg_vert, mjtBool flg_edge, mjtBool flg_face,
|
||||
mjtBool flg_skin, int flexid, const mjtNum(*pnt)[3],
|
||||
const mjtNum(*vec)[3],
|
||||
std::optional<Eigen::Ref<Eigen::Vector<int, 1>>> vertid,
|
||||
std::optional<Eigen::Ref<Eigen::Vector<mjtNum, 3>>> normal) {
|
||||
@@ -1370,7 +1370,7 @@ PYBIND11_MODULE(_functions, pymodule) {
|
||||
Def<traits::mju_band2Dense>(
|
||||
pymodule,
|
||||
[](Eigen::Ref<EigenArrayXX> res, Eigen::Ref<const EigenVectorX> mat,
|
||||
int ntotal, int nband, int ndense, mjtByte flg_sym) {
|
||||
int ntotal, int nband, int ndense, mjtBool flg_sym) {
|
||||
int nMat = (ntotal - ndense) * nband + ndense * ntotal;
|
||||
if (mat.size() != nMat) {
|
||||
throw py::type_error(
|
||||
@@ -1406,7 +1406,7 @@ PYBIND11_MODULE(_functions, pymodule) {
|
||||
pymodule,
|
||||
[](Eigen::Ref<EigenVectorX> res, Eigen::Ref<const EigenArrayXX> mat,
|
||||
Eigen::Ref<const EigenArrayXX> vec, int ntotal, int nband, int ndense,
|
||||
int nVec, mjtByte flg_sym) {
|
||||
int nVec, mjtBool flg_sym) {
|
||||
int nMat = (ntotal - ndense) * nband + ndense * ntotal;
|
||||
if (mat.size() != nMat) {
|
||||
throw py::type_error(
|
||||
@@ -1576,7 +1576,7 @@ PYBIND11_MODULE(_functions, pymodule) {
|
||||
Def<traits::mjd_transitionFD>(
|
||||
pymodule,
|
||||
[](const raw::MjModel* m, raw::MjData* d,
|
||||
mjtNum eps, mjtByte flg_centered,
|
||||
mjtNum eps, mjtBool flg_centered,
|
||||
std::optional<Eigen::Ref<EigenArrayXX>> A,
|
||||
std::optional<Eigen::Ref<EigenArrayXX>> B,
|
||||
std::optional<Eigen::Ref<EigenArrayXX>> C,
|
||||
@@ -1607,7 +1607,7 @@ PYBIND11_MODULE(_functions, pymodule) {
|
||||
Def<traits::mjd_inverseFD>(
|
||||
pymodule,
|
||||
[](const raw::MjModel* m, raw::MjData* d,
|
||||
mjtNum eps, mjtByte flg_actuation,
|
||||
mjtNum eps, mjtBool flg_actuation,
|
||||
std::optional<Eigen::Ref<EigenArrayXX>> DfDq,
|
||||
std::optional<Eigen::Ref<EigenArrayXX>> DfDv,
|
||||
std::optional<Eigen::Ref<EigenArrayXX>> DfDa,
|
||||
|
||||
@@ -4088,7 +4088,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='flg_static',
|
||||
type=ValueType(name='mjtByte'),
|
||||
type=ValueType(name='mjtBool'),
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='bodyexclude',
|
||||
@@ -4152,7 +4152,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='flg_static',
|
||||
type=ValueType(name='mjtByte'),
|
||||
type=ValueType(name='mjtBool'),
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='bodyexclude',
|
||||
@@ -4359,19 +4359,19 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='flg_vert',
|
||||
type=ValueType(name='mjtByte'),
|
||||
type=ValueType(name='mjtBool'),
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='flg_edge',
|
||||
type=ValueType(name='mjtByte'),
|
||||
type=ValueType(name='mjtBool'),
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='flg_face',
|
||||
type=ValueType(name='mjtByte'),
|
||||
type=ValueType(name='mjtBool'),
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='flg_skin',
|
||||
type=ValueType(name='mjtByte'),
|
||||
type=ValueType(name='mjtBool'),
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='flexid',
|
||||
@@ -8479,7 +8479,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='flg_sym',
|
||||
type=ValueType(name='mjtByte'),
|
||||
type=ValueType(name='mjtBool'),
|
||||
),
|
||||
),
|
||||
doc='Convert banded matrix to dense matrix, fill upper triangle if flg_sym>0.', # pylint: disable=line-too-long
|
||||
@@ -8557,7 +8557,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='flg_sym',
|
||||
type=ValueType(name='mjtByte'),
|
||||
type=ValueType(name='mjtBool'),
|
||||
),
|
||||
),
|
||||
doc='Multiply band-diagonal matrix with nvec vectors, include upper triangle if flg_sym>0.', # pylint: disable=line-too-long
|
||||
@@ -9404,7 +9404,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='flg_centered',
|
||||
type=ValueType(name='mjtByte'),
|
||||
type=ValueType(name='mjtBool'),
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='A',
|
||||
@@ -9460,7 +9460,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='flg_actuation',
|
||||
type=ValueType(name='mjtByte'),
|
||||
type=ValueType(name='mjtBool'),
|
||||
),
|
||||
FunctionParameterDecl(
|
||||
name='DfDq',
|
||||
@@ -11627,7 +11627,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
|
||||
('mjs_setInStringVec',
|
||||
FunctionDecl(
|
||||
name='mjs_setInStringVec',
|
||||
return_type=ValueType(name='mjtByte'),
|
||||
return_type=ValueType(name='mjtBool'),
|
||||
parameters=(
|
||||
FunctionParameterDecl(
|
||||
name='dest',
|
||||
|
||||
@@ -1692,7 +1692,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='jnt_limited',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='does joint have limits',
|
||||
array_extent=('njnt',),
|
||||
@@ -1700,7 +1700,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='jnt_actfrclimited',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='does joint have actuator force limits',
|
||||
array_extent=('njnt',),
|
||||
@@ -1708,7 +1708,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='jnt_actgravcomp',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='is gravcomp force applied via actuators',
|
||||
array_extent=('njnt',),
|
||||
@@ -2404,7 +2404,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='light_castshadow',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='does light cast shadows',
|
||||
array_extent=('nlight',),
|
||||
@@ -2436,7 +2436,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='light_active',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='is light on',
|
||||
array_extent=('nlight',),
|
||||
@@ -2612,7 +2612,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='flex_internal',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='internal flex collision enabled',
|
||||
array_extent=('nflex',),
|
||||
@@ -3044,7 +3044,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='flex_rigid',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='are all vertices in the same body',
|
||||
array_extent=('nflex',),
|
||||
@@ -3052,7 +3052,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='flexedge_rigid',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='are both edge vertices in same body',
|
||||
array_extent=('nflexedge',),
|
||||
@@ -3060,7 +3060,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='flex_centered',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='are all vertex coordinates (0,0,0)',
|
||||
array_extent=('nflex',),
|
||||
@@ -3068,7 +3068,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='flex_flatskin',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='render flex skin with flat shading',
|
||||
array_extent=('nflex',),
|
||||
@@ -3716,7 +3716,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='mat_texuniform',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='make texture cube uniform',
|
||||
array_extent=('nmat',),
|
||||
@@ -3908,7 +3908,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='eq_active0',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='initial enable/disable constraint state',
|
||||
array_extent=('neq',),
|
||||
@@ -4020,7 +4020,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='tendon_limited',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='does tendon have length limits',
|
||||
array_extent=('ntendon',),
|
||||
@@ -4028,7 +4028,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='tendon_actfrclimited',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='does tendon have actuator force limits',
|
||||
array_extent=('ntendon',),
|
||||
@@ -4324,7 +4324,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='actuator_ctrllimited',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='is control limited',
|
||||
array_extent=('nu',),
|
||||
@@ -4332,7 +4332,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='actuator_forcelimited',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='is force limited',
|
||||
array_extent=('nu',),
|
||||
@@ -4340,7 +4340,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='actuator_actlimited',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='is activation limited',
|
||||
array_extent=('nu',),
|
||||
@@ -4372,7 +4372,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='actuator_actearly',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='step activation before force',
|
||||
array_extent=('nu',),
|
||||
@@ -5570,22 +5570,22 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='flg_energypos',
|
||||
type=ValueType(name='mjtByte'),
|
||||
type=ValueType(name='mjtBool'),
|
||||
doc='has mj_energyPos been called',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='flg_energyvel',
|
||||
type=ValueType(name='mjtByte'),
|
||||
type=ValueType(name='mjtBool'),
|
||||
doc='has mj_energyVel been called',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='flg_subtreevel',
|
||||
type=ValueType(name='mjtByte'),
|
||||
type=ValueType(name='mjtBool'),
|
||||
doc='has mj_subtreeVel been called',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='flg_rnepost',
|
||||
type=ValueType(name='mjtByte'),
|
||||
type=ValueType(name='mjtBool'),
|
||||
doc='has mj_rnePostConstraint been called',
|
||||
),
|
||||
StructFieldDecl(
|
||||
@@ -5690,7 +5690,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='eq_active',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='enable/disable constraints',
|
||||
array_extent=('neq',),
|
||||
@@ -6098,7 +6098,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
StructFieldDecl(
|
||||
name='bvh_active',
|
||||
type=PointerType(
|
||||
inner_type=ValueType(name='mjtByte'),
|
||||
inner_type=ValueType(name='mjtBool'),
|
||||
),
|
||||
doc='was bounding volume checked for collision',
|
||||
array_extent=('nbvh',),
|
||||
|
||||
@@ -843,10 +843,10 @@ typedef struct {
|
||||
int mj_collideOBB(const mjtNum aabb1[6], const mjtNum aabb2[6],
|
||||
const mjtNum xpos1[3], const mjtNum xmat1[9],
|
||||
const mjtNum xpos2[3], const mjtNum xmat2[9], mjtNum margin,
|
||||
mjtNum product[36], mjtNum offset[12], mjtByte* initialize) {
|
||||
mjtNum product[36], mjtNum offset[12], mjtBool* initialize) {
|
||||
// get infinite dimensions (planes only)
|
||||
mjtByte inf1[3] = {aabb1[3] >= mjMAXVAL, aabb1[4] >= mjMAXVAL, aabb1[5] >= mjMAXVAL};
|
||||
mjtByte inf2[3] = {aabb2[3] >= mjMAXVAL, aabb2[4] >= mjMAXVAL, aabb2[5] >= mjMAXVAL};
|
||||
mjtBool inf1[3] = {aabb1[3] >= mjMAXVAL, aabb1[4] >= mjMAXVAL, aabb1[5] >= mjMAXVAL};
|
||||
mjtBool inf2[3] = {aabb2[3] >= mjMAXVAL, aabb2[4] >= mjMAXVAL, aabb2[5] >= mjMAXVAL};
|
||||
|
||||
// if a bounding box is infinite, there must be a collision
|
||||
if ((inf1[0] && inf1[1] && inf1[2]) || (inf2[0] && inf2[1] && inf2[2])) {
|
||||
@@ -858,7 +858,7 @@ int mj_collideOBB(const mjtNum aabb1[6], const mjtNum aabb2[6],
|
||||
const mjtNum *xpos[2] = {xpos1, xpos2};
|
||||
mjtNum xcenter[2][3], normal[2][3][3];
|
||||
mjtNum proj[2], radius[2];
|
||||
mjtByte infinite[2] = {inf1[0] || inf1[1] || inf1[2], inf2[0] || inf2[1] || inf2[2]};
|
||||
mjtBool infinite[2] = {inf1[0] || inf1[1] || inf1[2], inf2[0] || inf2[1] || inf2[2]};
|
||||
|
||||
// compute centers in local coordinates
|
||||
if (product == NULL) {
|
||||
@@ -940,8 +940,8 @@ int mj_collideOBB(const mjtNum aabb1[6], const mjtNum aabb2[6],
|
||||
void mj_collideTree(const mjModel* m, mjData* d, int bf1, int bf2,
|
||||
int merged, int startadr, int pairadr) {
|
||||
int nbody = m->nbody, nbvhstatic = m->nbvhstatic;
|
||||
mjtByte isbody1 = (bf1 < nbody);
|
||||
mjtByte isbody2 = (bf2 < nbody);
|
||||
mjtBool isbody1 = (bf1 < nbody);
|
||||
mjtBool isbody2 = (bf2 < nbody);
|
||||
int f1 = isbody1 ? -1 : bf1 - nbody;
|
||||
int f2 = isbody2 ? -1 : bf2 - nbody;
|
||||
int mark_active = m->vis.global.bvactive;
|
||||
@@ -957,7 +957,7 @@ void mj_collideTree(const mjModel* m, mjData* d, int bf1, int bf2,
|
||||
// used with rotated bounding boxes (when bodies are involved)
|
||||
mjtNum product[36]; // 2 bb x 2 bb x 3 axes (body) x 3 axes (world)
|
||||
mjtNum offset[12]; // 2 bb x 2 bb x 3 axes (world)
|
||||
mjtByte initialize = 1;
|
||||
mjtBool initialize = true;
|
||||
|
||||
// bitmask filter for bodyflex pair
|
||||
if (!canCollide2(m, bf1, bf2)) {
|
||||
@@ -997,8 +997,8 @@ void mj_collideTree(const mjModel* m, mjData* d, int bf1, int bf2,
|
||||
nstack--;
|
||||
int node1 = stack[nstack].node1;
|
||||
int node2 = stack[nstack].node2;
|
||||
mjtByte isleaf1 = (child1[2*node1] < 0) && (child1[2*node1+1] < 0);
|
||||
mjtByte isleaf2 = (child2[2*node2] < 0) && (child2[2*node2+1] < 0);
|
||||
mjtBool isleaf1 = (child1[2*node1] < 0) && (child1[2*node1+1] < 0);
|
||||
mjtBool isleaf2 = (child2[2*node2] < 0) && (child2[2*node2+1] < 0);
|
||||
int nodeid1 = m->bvh_nodeid[bvhadr1 + node1];
|
||||
int nodeid2 = m->bvh_nodeid[bvhadr2 + node2];
|
||||
|
||||
@@ -1035,8 +1035,8 @@ void mj_collideTree(const mjModel* m, mjData* d, int bf1, int bf2,
|
||||
mj_narrowphase(m, d, pair, 1, 0);
|
||||
}
|
||||
if (mark_active) {
|
||||
d->bvh_active[node1 + bvhadr1] = 1;
|
||||
d->bvh_active[node2 + bvhadr2] = 1;
|
||||
d->bvh_active[node1 + bvhadr1] = true;
|
||||
d->bvh_active[node2 + bvhadr2] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1074,8 +1074,8 @@ void mj_collideTree(const mjModel* m, mjData* d, int bf1, int bf2,
|
||||
mj_collideGeomElem(m, d, nodeid1, f2, nodeid2);
|
||||
}
|
||||
if (mark_active) {
|
||||
d->bvh_active[node1 + bvhadr1] = 1;
|
||||
d->bvh_active[node2 + bvhadr2] = 1;
|
||||
d->bvh_active[node1 + bvhadr1] = true;
|
||||
d->bvh_active[node2 + bvhadr2] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1104,8 +1104,8 @@ void mj_collideTree(const mjModel* m, mjData* d, int bf1, int bf2,
|
||||
if (isleaf1 && isleaf2) {
|
||||
mj_collideElems(m, d, f1, nodeid1, f2, nodeid2);
|
||||
if (mark_active) {
|
||||
d->bvh_active[node1 + bvhadr1] = 1;
|
||||
d->bvh_active[node2 + bvhadr2] = 1;
|
||||
d->bvh_active[node1 + bvhadr1] = true;
|
||||
d->bvh_active[node2 + bvhadr2] = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -1118,8 +1118,8 @@ void mj_collideTree(const mjModel* m, mjData* d, int bf1, int bf2,
|
||||
}
|
||||
|
||||
if (mark_active) {
|
||||
d->bvh_active[node1 + bvhadr1] = 1;
|
||||
d->bvh_active[node2 + bvhadr2] = 1;
|
||||
d->bvh_active[node1 + bvhadr1] = true;
|
||||
d->bvh_active[node2 + bvhadr2] = true;
|
||||
}
|
||||
|
||||
// keep traversing the tree
|
||||
|
||||
@@ -39,7 +39,7 @@ MJAPI void mj_collision(const mjModel* m, mjData* d);
|
||||
MJAPI int mj_collideOBB(const mjtNum aabb1[6], const mjtNum aabb2[6],
|
||||
const mjtNum xpos1[3], const mjtNum xmat1[9],
|
||||
const mjtNum xpos2[3], const mjtNum xmat2[9], mjtNum margin,
|
||||
mjtNum product[36], mjtNum offset[12], mjtByte* initialize);
|
||||
mjtNum product[36], mjtNum offset[12], mjtBool* initialize);
|
||||
|
||||
// is element active (for collisions)
|
||||
MJAPI int mj_isElemActive(const mjModel* m, int f, int e);
|
||||
|
||||
@@ -772,7 +772,7 @@ static int selectFPS(const mjtNum* candidate, const mjtNum* dist, int ncandidate
|
||||
int* selected_indices, int max_select) {
|
||||
if (ncandidate <= 0) return 0;
|
||||
|
||||
mjtByte selected[mjMAXCONPAIR] = {0};
|
||||
mjtBool selected[mjMAXCONPAIR] = {false};
|
||||
mjtNum min_dist2[mjMAXCONPAIR];
|
||||
for (int i = 0; i < ncandidate; i++) {
|
||||
min_dist2[i] = mjMAXVAL;
|
||||
@@ -791,7 +791,7 @@ static int selectFPS(const mjtNum* candidate, const mjtNum* dist, int ncandidate
|
||||
// iteratively select contacts using FPS
|
||||
int nselected = 0;
|
||||
while (nselected < max_select && nselected < mjMAXCONPAIR && best >= 0) {
|
||||
selected[best] = 1;
|
||||
selected[best] = true;
|
||||
selected_indices[nselected] = best;
|
||||
nselected++;
|
||||
|
||||
@@ -882,7 +882,7 @@ typedef struct {
|
||||
} MeshSDFContext;
|
||||
|
||||
// process a single mesh face inline during BVH traversal
|
||||
static void processOneFace(int faceid, mjtByte* bvh_active, int node,
|
||||
static void processOneFace(int faceid, mjtBool* bvh_active, int node,
|
||||
MeshSDFContext* ctx) {
|
||||
mjtNum corners[9];
|
||||
const mjModel* m = ctx->m;
|
||||
@@ -903,7 +903,7 @@ static void processOneFace(int faceid, mjtByte* bvh_active, int node,
|
||||
processSdfCorners(corners, m, ctx->d, ctx->sdf, ctx->nstartpts,
|
||||
ctx->candidate, ctx->dist, ctx->ncandidate);
|
||||
|
||||
if (bvh_active && *(ctx->ncandidate) > 0) bvh_active[node] = 1;
|
||||
if (bvh_active && *(ctx->ncandidate) > 0) bvh_active[node] = true;
|
||||
}
|
||||
|
||||
// Callback type for leaf node processing during BVH traversal
|
||||
@@ -920,7 +920,7 @@ typedef int (*BVHLeafCallback)(int leaf_id, int node, void* ctx);
|
||||
// callback: function called for each leaf node
|
||||
// ctx: user context passed to callback
|
||||
static void traverseBVH(const mjtNum* bvh, const int* nodeid, const int* child,
|
||||
mjtByte* bvh_active, const mjtNum* offset, const mjtNum* rotation,
|
||||
mjtBool* bvh_active, const mjtNum* offset, const mjtNum* rotation,
|
||||
const mjModel* m, const mjData* d, const mjSDF* sdf,
|
||||
BVHLeafCallback callback, void* ctx) {
|
||||
int stack[64];
|
||||
@@ -934,7 +934,7 @@ static void traverseBVH(const mjtNum* bvh, const int* nodeid, const int* child,
|
||||
if (nodeid[node] != -1) {
|
||||
if (boxIntersect(bvh + 6*node, offset, rotation, m, sdf, d)) {
|
||||
int active = callback(nodeid[node], node, ctx);
|
||||
if (bvh_active && active) bvh_active[node] = 1;
|
||||
if (bvh_active && active) bvh_active[node] = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -944,7 +944,7 @@ static void traverseBVH(const mjtNum* bvh, const int* nodeid, const int* child,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bvh_active) bvh_active[node] = 1;
|
||||
if (bvh_active) bvh_active[node] = true;
|
||||
|
||||
// push children
|
||||
for (int i = 0; i < 2; i++) {
|
||||
@@ -1026,7 +1026,7 @@ int mjc_MeshSDF(const mjModel* m, mjData* d, mjPreContact* con, int g1, int g2,
|
||||
const int* nodeid = m->bvh_nodeid + bvhadr;
|
||||
const mjtNum* bvh = m->bvh_aabb + 6*bvhadr;
|
||||
const int* child = m->bvh_child + 2*bvhadr;
|
||||
mjtByte* bvh_active = m->vis.global.bvactive ? d->bvh_active + bvhadr : NULL;
|
||||
mjtBool* bvh_active = m->vis.global.bvactive ? d->bvh_active + bvhadr : NULL;
|
||||
|
||||
traverseBVH(bvh, nodeid, child, bvh_active, ctx.offset, ctx.rotation,
|
||||
m, d, ctx.sdf, meshFaceCallback, &ctx);
|
||||
@@ -1354,7 +1354,7 @@ int mjc_FlexSDF(const mjModel* m, const mjData* d, mjContact* con,
|
||||
const int nbvhstatic = m->nbvhstatic;
|
||||
const mjtNum* bvh = d->bvh_aabb_dyn + 6*(bvhadr - nbvhstatic);
|
||||
const int* child = m->bvh_child + 2*bvhadr;
|
||||
mjtByte* bvh_active = m->vis.global.bvactive ? d->bvh_active + bvhadr : NULL;
|
||||
mjtBool* bvh_active = m->vis.global.bvactive ? d->bvh_active + bvhadr : NULL;
|
||||
|
||||
// set up context for flex element processing
|
||||
FlexSDFContext fctx;
|
||||
|
||||
@@ -292,7 +292,7 @@ void mjd_smooth_velFD(const mjModel* m, mjData* d, mjtNum eps) {
|
||||
// single-letter shortcuts:
|
||||
// inputs: q=qpos, v=qvel, a=act, u=ctrl
|
||||
// outputs: y=next_state (concatenated next qpos, qvel, act), s=sensordata
|
||||
void mjd_stepFD(const mjModel* m, mjData* d, mjtNum eps, mjtByte flg_centered,
|
||||
void mjd_stepFD(const mjModel* m, mjData* d, mjtNum eps, mjtBool flg_centered,
|
||||
mjtNum* DyDq, mjtNum* DyDv, mjtNum* DyDa, mjtNum* DyDu,
|
||||
mjtNum* DsDq, mjtNum* DsDv, mjtNum* DsDa, mjtNum* DsDu) {
|
||||
if (m->nhistory) {
|
||||
@@ -539,7 +539,7 @@ void mjd_stepFD(const mjModel* m, mjData* d, mjtNum eps, mjtByte flg_centered,
|
||||
// B: (2*nv+na x nu)
|
||||
// C: (nsensordata x 2*nv+na)
|
||||
// D: (nsensordata x nu)
|
||||
void mjd_transitionFD(const mjModel* m, mjData* d, mjtNum eps, mjtByte flg_centered,
|
||||
void mjd_transitionFD(const mjModel* m, mjData* d, mjtNum eps, mjtBool flg_centered,
|
||||
mjtNum* A, mjtNum* B, mjtNum* C, mjtNum* D) {
|
||||
if (m->opt.integrator == mjINT_RK4) {
|
||||
mjERROR("RK4 integrator is not supported");
|
||||
@@ -605,7 +605,7 @@ void mjd_transitionFD(const mjModel* m, mjData* d, mjtNum eps, mjtByte flg_cente
|
||||
// notes:
|
||||
// optionally compute mass matrix Jacobian DmDq
|
||||
// flg_actuation specifies whether to subtract qfrc_actuator from qfrc_inverse
|
||||
void mjd_inverseFD(const mjModel* m, mjData* d, mjtNum eps, mjtByte flg_actuation,
|
||||
void mjd_inverseFD(const mjModel* m, mjData* d, mjtNum eps, mjtBool flg_actuation,
|
||||
mjtNum *DfDq, mjtNum *DfDv, mjtNum *DfDa,
|
||||
mjtNum *DsDq, mjtNum *DsDv, mjtNum *DsDa,
|
||||
mjtNum *DmDq) {
|
||||
|
||||
@@ -33,11 +33,11 @@ MJAPI void mjd_passive_velFD(const mjModel* m, mjData* d, mjtNum eps);
|
||||
MJAPI void mj_stepSkip(const mjModel* m, mjData* d, int skipstage, int skipsensor);
|
||||
|
||||
// finite differenced transition matrices (control theory notation)
|
||||
MJAPI void mjd_transitionFD(const mjModel* m, mjData* d, mjtNum eps, mjtByte centered,
|
||||
MJAPI void mjd_transitionFD(const mjModel* m, mjData* d, mjtNum eps, mjtBool centered,
|
||||
mjtNum* A, mjtNum* B, mjtNum* C, mjtNum* D);
|
||||
|
||||
// finite differenced Jacobian of (force, sensors) = mj_inverse(state, acceleration)
|
||||
MJAPI void mjd_inverseFD(const mjModel* m, mjData* d, mjtNum eps, mjtByte flg_actuation,
|
||||
MJAPI void mjd_inverseFD(const mjModel* m, mjData* d, mjtNum eps, mjtBool flg_actuation,
|
||||
mjtNum *DfDq, mjtNum *DfDv, mjtNum *DfDa,
|
||||
mjtNum *DsDq, mjtNum *DsDv, mjtNum *DsDa,
|
||||
mjtNum *DmDq);
|
||||
|
||||
@@ -297,7 +297,7 @@ static mjtNum dcmotorVoltage(mjtNum ctrl, mjtNum length, mjtNum velocity,
|
||||
|
||||
|
||||
// clamp vector to range
|
||||
static void clampVec(mjtNum* vec, const mjtNum* range, const mjtByte* limited, int n,
|
||||
static void clampVec(mjtNum* vec, const mjtNum* range, const mjtBool* limited, int n,
|
||||
const int* index) {
|
||||
for (int i=0; i < n; i++) {
|
||||
int j = index ? index[i] : i;
|
||||
|
||||
@@ -766,6 +766,7 @@ void mj_printFormattedModel(const mjModel* m, const char* filename, const char*
|
||||
float: float_format, \
|
||||
int: INT_FORMAT, \
|
||||
mjtByte: INT_FORMAT, \
|
||||
mjtBool: INT_FORMAT, \
|
||||
mjtSize: SIZE_FORMAT, \
|
||||
default: NULL); \
|
||||
if (format) { \
|
||||
@@ -1270,6 +1271,7 @@ void mj_printFormattedData(const mjModel* m, const mjData* d, const char* filena
|
||||
int : INT_FORMAT, \
|
||||
mjtSize : SIZE_FORMAT, \
|
||||
mjtByte : INT_FORMAT, \
|
||||
mjtBool : INT_FORMAT, \
|
||||
default : NULL); \
|
||||
if (format) { \
|
||||
fprintf(fp, " "); \
|
||||
|
||||
@@ -66,7 +66,7 @@ static mjtNum latitude(const mjtNum vec[3]) {
|
||||
|
||||
// eliminate geom
|
||||
static int ray_eliminate(const mjModel* m, const mjData* d, int geomid,
|
||||
const mjtByte* geomgroup, mjtByte flg_static, int bodyexclude) {
|
||||
const mjtByte* geomgroup, mjtBool flg_static, int bodyexclude) {
|
||||
// body exclusion
|
||||
if (m->geom_bodyid[geomid] == bodyexclude) {
|
||||
return 1;
|
||||
@@ -850,14 +850,14 @@ mjtNum mju_rayTree(const mjModel* m, const mjData* d, int id, const mjtNum pnt[3
|
||||
if (sol >= 0 && (x < 0 || sol < x)) {
|
||||
x = sol;
|
||||
if (normal) mju_copy3(normal, normal_local);
|
||||
if (mark_active) d->bvh_active[node + bvhadr] = 1;
|
||||
if (mark_active) d->bvh_active[node + bvhadr] = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// used for rendering
|
||||
if (mark_active) {
|
||||
d->bvh_active[node + bvhadr] = 1;
|
||||
d->bvh_active[node + bvhadr] = true;
|
||||
}
|
||||
|
||||
// add children to the stack
|
||||
@@ -1000,8 +1000,8 @@ mjtNum mju_rayGeom(const mjtNum pos[3], const mjtNum mat[9], const mjtNum size[3
|
||||
|
||||
// intersect ray with flex, return nearest vertex id, compute normal if given
|
||||
mjtNum mj_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[3],
|
||||
mjtBool flg_vert, mjtBool flg_edge, mjtBool flg_face,
|
||||
mjtBool flg_skin, int flexid, const mjtNum pnt[3],
|
||||
const mjtNum vec[3], int vertid[1], mjtNum normal[3]) {
|
||||
int dim = m->flex_dim[flexid];
|
||||
|
||||
@@ -1306,7 +1306,7 @@ static int point_in_box(const mjtNum aabb[6], const mjtNum xpos[3],
|
||||
// return geomid and distance (x) to nearest surface, or -1 if no intersection
|
||||
// geomgroup, flg_static are as in mjvOption; geomgroup==NULL skips group exclusion
|
||||
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,
|
||||
const mjtByte* geomgroup, mjtBool flg_static, int bodyexclude,
|
||||
int geomid[1], mjtNum normal[3]) {
|
||||
int ngeom = m->ngeom;
|
||||
mjtNum dist, newdist;
|
||||
@@ -1353,7 +1353,7 @@ mjtNum mj_ray(const mjModel* m, const mjData* d, const mjtNum pnt[3], const mjtN
|
||||
|
||||
// Initializes spherical bounding angles (geom_ba) and flag vector for a given source
|
||||
void mju_multiRayPrepare(const mjModel* m, const mjData* d, const mjtNum pnt[3],
|
||||
const mjtNum ray_xmat[9], const mjtByte* geomgroup, mjtByte flg_static,
|
||||
const mjtNum ray_xmat[9], const mjtByte* geomgroup, mjtBool flg_static,
|
||||
int bodyexclude, mjtNum cutoff, mjtNum* geom_ba, int* geom_eliminate) {
|
||||
if (ray_xmat) {
|
||||
mjERROR("ray_xmat is currently unused, should be NULL");
|
||||
@@ -1542,7 +1542,7 @@ static mjtNum mju_singleRay(const mjModel* m, mjData* d, const mjtNum pnt[3], co
|
||||
|
||||
// performs multiple ray intersections, compute normals if given
|
||||
void mj_multiRay(const mjModel* m, mjData* d, const mjtNum pnt[3], const mjtNum* vec,
|
||||
const mjtByte* geomgroup, mjtByte flg_static, int bodyexclude,
|
||||
const mjtByte* geomgroup, mjtBool flg_static, int bodyexclude,
|
||||
int* geomid, mjtNum* dist, mjtNum* normal, int nray, mjtNum cutoff) {
|
||||
mj_markStack(d);
|
||||
|
||||
|
||||
@@ -25,14 +25,14 @@ extern "C" {
|
||||
|
||||
MJAPI void mju_multiRayPrepare(const mjModel* m, const mjData* d,
|
||||
const mjtNum pnt[3], const mjtNum ray_xmat[9],
|
||||
const mjtByte* geomgroup, mjtByte flg_static,
|
||||
const mjtByte* geomgroup, mjtBool flg_static,
|
||||
int bodyexclude, mjtNum cutoff, mjtNum* geom_ba,
|
||||
int* geom_eliminate);
|
||||
|
||||
// intersect multiple rays emanating from a single source, compute normals if given
|
||||
// similar semantics to mj_ray, but vec, normal and dist are arrays
|
||||
MJAPI void mj_multiRay(const mjModel* m, mjData* d, const mjtNum pnt[3], const mjtNum* vec,
|
||||
const mjtByte* geomgroup, mjtByte flg_static, int bodyexclude,
|
||||
const mjtByte* geomgroup, mjtBool flg_static, int bodyexclude,
|
||||
int* geomid, mjtNum* dist, mjtNum* normal, int nray, mjtNum cutoff);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ MJAPI void mj_multiRay(const mjModel* m, mjData* d, const mjtNum pnt[3], const m
|
||||
// return geomid and distance (x) to nearest surface, or -1 if no intersection
|
||||
// geomgroup, flg_static are as in mjvOption; geomgroup==NULL skips group exclusion
|
||||
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,
|
||||
const mjtByte* geomgroup, mjtBool flg_static, int bodyexclude,
|
||||
int geomid[1], mjtNum normal[3]);
|
||||
|
||||
// intersect ray with hfield, compute normal if given
|
||||
@@ -62,8 +62,8 @@ MJAPI mjtNum mju_rayGeom(const mjtNum pos[3], const mjtNum mat[9], const mjtNum
|
||||
|
||||
// intersect ray with flex, return nearest vertex id, compute normal if given
|
||||
MJAPI mjtNum mj_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[3],
|
||||
mjtBool flg_vert, mjtBool flg_edge, mjtBool flg_face,
|
||||
mjtBool flg_skin, int flexid, const mjtNum pnt[3],
|
||||
const mjtNum vec[3], int vertid[1], mjtNum normal[3]);
|
||||
|
||||
// intersect ray with skin, return nearest vertex id
|
||||
|
||||
@@ -220,7 +220,7 @@ void mj_getState(const mjModel* m, const mjData* d, mjtNum* state, int sig) {
|
||||
if (element & sig) {
|
||||
int size = mj_stateElemSize(m, element);
|
||||
|
||||
// special handling of eq_active (mjtByte)
|
||||
// special handling of eq_active (mjtBool)
|
||||
if (element == mjSTATE_EQ_ACTIVE) {
|
||||
int neq = m->neq;
|
||||
for (int j=0; j < neq; j++) {
|
||||
@@ -288,7 +288,7 @@ void mj_setState(const mjModel* m, mjData* d, const mjtNum* state, int sig) {
|
||||
if (element & sig) {
|
||||
int size = mj_stateElemSize(m, element);
|
||||
|
||||
// special handling of eq_active (mjtByte)
|
||||
// special handling of eq_active (mjtBool)
|
||||
if (element == mjSTATE_EQ_ACTIVE) {
|
||||
int neq = m->neq;
|
||||
for (int j=0; j < neq; j++) {
|
||||
@@ -324,7 +324,7 @@ void mj_copyState(const mjModel* m, const mjData* src, mjData* dst, int sig) {
|
||||
if (element & sig) {
|
||||
int size = mj_stateElemSize(m, element);
|
||||
|
||||
// special handling of eq_active (mjtByte)
|
||||
// special handling of eq_active (mjtBool)
|
||||
if (element == mjSTATE_EQ_ACTIVE) {
|
||||
int neq = m->neq;
|
||||
for (int j=0; j < neq; j++) {
|
||||
|
||||
@@ -33,21 +33,21 @@
|
||||
//------------------------------ tendon wrapping ---------------------------------------------------
|
||||
|
||||
// check for intersection of two 2D line segments
|
||||
static mjtByte is_intersect(const mjtNum* p1, const mjtNum* p2,
|
||||
static mjtBool is_intersect(const mjtNum* p1, const mjtNum* p2,
|
||||
const mjtNum* p3, const mjtNum* p4) {
|
||||
mjtNum a, b;
|
||||
|
||||
// compute determinant, check
|
||||
mjtNum det = (p4[1]-p3[1])*(p2[0]-p1[0]) - (p4[0]-p3[0])*(p2[1]-p1[1]);
|
||||
if (mju_abs(det) < mjMINVAL) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// compute intersection point on each line
|
||||
a = ((p4[0]-p3[0])*(p1[1]-p3[1]) - (p4[1]-p3[1])*(p1[0]-p3[0])) / det;
|
||||
b = ((p2[0]-p1[0])*(p1[1]-p3[1]) - (p2[1]-p1[1])*(p1[0]-p3[0])) / det;
|
||||
|
||||
return ((a >= 0 && a <= 1 && b >= 0 && b <= 1) ? 1 : 0);
|
||||
return ((a >= 0 && a <= 1 && b >= 0 && b <= 1) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -664,7 +664,7 @@ int mju_bandDiag(int i, int ntotal, int nband, int ndense) {
|
||||
|
||||
// convert band matrix to dense matrix
|
||||
void mju_band2Dense(mjtNum* res, const mjtNum* mat, int ntotal, int nband, int ndense,
|
||||
mjtByte flg_sym) {
|
||||
mjtBool flg_sym) {
|
||||
int nsparse = ntotal-ndense;
|
||||
|
||||
// clear all
|
||||
@@ -717,7 +717,7 @@ void mju_dense2Band(mjtNum* res, const mjtNum* mat, int ntotal, int nband, int n
|
||||
|
||||
// multiply band-diagonal matrix with vector
|
||||
void mju_bandMulMatVec(mjtNum* res, const mjtNum* mat, const mjtNum* vec,
|
||||
int ntotal, int nband, int ndense, int nvec, mjtByte flg_sym) {
|
||||
int ntotal, int nband, int ndense, int nvec, mjtBool flg_sym) {
|
||||
int nsparse = ntotal-ndense;
|
||||
|
||||
// handle multiple vectors
|
||||
|
||||
@@ -82,14 +82,14 @@ MJAPI void mju_cholSolveBand(mjtNum* res, const mjtNum* mat, const mjtNum* vec,
|
||||
|
||||
// convert banded matrix to dense matrix, fill upper triangle if flg_sym>0
|
||||
MJAPI void mju_band2Dense(mjtNum* res, const mjtNum* mat, int ntotal, int nband, int ndense,
|
||||
mjtByte flg_sym);
|
||||
mjtBool flg_sym);
|
||||
|
||||
// convert dense matrix to banded matrix
|
||||
MJAPI void mju_dense2Band(mjtNum* res, const mjtNum* mat, int ntotal, int nband, int ndense);
|
||||
|
||||
// multiply band-diagonal matrix with vector, include upper triangle if flg_sym>0
|
||||
MJAPI void mju_bandMulMatVec(mjtNum* res, const mjtNum* mat, const mjtNum* vec,
|
||||
int ntotal, int nband, int ndense, int nvec, mjtByte flg_sym);
|
||||
int ntotal, int nband, int ndense, int nvec, mjtBool flg_sym);
|
||||
|
||||
// address of diagonal element i in band-dense matrix representation
|
||||
MJAPI int mju_bandDiag(int i, int ntotal, int nband, int ndense);
|
||||
|
||||
@@ -103,6 +103,14 @@ void ImGui_DataPtrTable::DataPtr(const char* label, const mjtByte* ptr,
|
||||
}
|
||||
}
|
||||
|
||||
void ImGui_DataPtrTable::DataPtr(const char* label, const mjtBool* ptr,
|
||||
int index, int n) {
|
||||
for (int i = 0; i < n; ++i) {
|
||||
MakeLabel(label, i, n);
|
||||
ImGui::Text("%s", ptr[index + i] ? "true" : "false");
|
||||
}
|
||||
}
|
||||
|
||||
void ImGui_DataPtrTable::DataPtr(const char* label, const mjtSize* ptr,
|
||||
int index, int n) {
|
||||
Numeric(label, ptr, index, n);
|
||||
|
||||
@@ -174,6 +174,7 @@ class ImGui_DataPtrTable {
|
||||
// dimensionality of n.
|
||||
void DataPtr(const char* label, const char* ptr, int index, int n);
|
||||
void DataPtr(const char* label, const mjtByte* ptr, int index, int n);
|
||||
void DataPtr(const char* label, const mjtBool* ptr, int index, int n);
|
||||
void DataPtr(const char* label, const mjtSize* ptr, int index, int n);
|
||||
void DataPtr(const char* label, const int* ptr, int index, int n);
|
||||
void DataPtr(const char* label, const float* ptr, int index, int n);
|
||||
@@ -299,7 +300,7 @@ class ImGui_SpecElementTable : public ImGui_DataPtrTable {
|
||||
|
||||
ImGui::PushID(&val);
|
||||
ImGui::SetNextItemWidth(-1.0f);
|
||||
if constexpr (std::is_same_v<T, mjtByte>) {
|
||||
if constexpr (std::is_same_v<T, mjtByte> || std::is_same_v<T, mjtBool>) {
|
||||
if (read_only_) {
|
||||
ImGui::Text("%s", val ? "true" : "false");
|
||||
} else {
|
||||
|
||||
@@ -2024,13 +2024,13 @@ void mjs_setString(mjString* dest, const char* text) {
|
||||
|
||||
|
||||
// Set specific entry in destination string vector.
|
||||
mjtByte mjs_setInStringVec(mjStringVec* dest, int i, const char* text) {
|
||||
mjtBool mjs_setInStringVec(mjStringVec* dest, int i, const char* text) {
|
||||
if (dest->size() <= i) {
|
||||
mju_error("Requested index in mjs_setInStringVec is out of bounds");
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
dest->at(i) = std::string(text);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -377,7 +377,7 @@ MJAPI void mjs_setString(mjString* dest, const char* text);
|
||||
MJAPI void mjs_setStringVec(mjStringVec* dest, const char* text);
|
||||
|
||||
// Set entry in string vector.
|
||||
MJAPI mjtByte mjs_setInStringVec(mjStringVec* dest, int i, const char* text);
|
||||
MJAPI mjtBool mjs_setInStringVec(mjStringVec* dest, int i, const char* text);
|
||||
|
||||
// Append text entry to string vector.
|
||||
MJAPI void mjs_appendString(mjStringVec* dest, const char* text);
|
||||
|
||||
@@ -2800,8 +2800,8 @@ void mjCModel::CopyTree(mjModel* m) {
|
||||
// set joint fields
|
||||
m->jnt_type[jid] = pj->type;
|
||||
m->jnt_group[jid] = pj->group;
|
||||
m->jnt_limited[jid] = (mjtByte)pj->is_limited();
|
||||
m->jnt_actfrclimited[jid] = (mjtByte)pj->is_actfrclimited();
|
||||
m->jnt_limited[jid] = (mjtBool)pj->is_limited();
|
||||
m->jnt_actfrclimited[jid] = (mjtBool)pj->is_actfrclimited();
|
||||
m->jnt_actgravcomp[jid] = pj->actgravcomp;
|
||||
m->jnt_qposadr[jid] = pj->qposadr_;
|
||||
m->jnt_dofadr[jid] = pj->dofadr_;
|
||||
@@ -3016,8 +3016,8 @@ void mjCModel::CopyTree(mjModel* m) {
|
||||
m->light_targetbodyid[lid] = pl->targetbodyid;
|
||||
m->light_type[lid] = pl->type;
|
||||
m->light_texid[lid] = pl->texid;
|
||||
m->light_castshadow[lid] = (mjtByte)pl->castshadow;
|
||||
m->light_active[lid] = (mjtByte)pl->active;
|
||||
m->light_castshadow[lid] = (mjtBool)pl->castshadow;
|
||||
m->light_active[lid] = (mjtBool)pl->active;
|
||||
mjuu_copyvec(m->light_pos+3*lid, pl->pos, 3);
|
||||
mjuu_copyvec(m->light_dir+3*lid, pl->dir, 3);
|
||||
m->light_bulbradius[lid] = pl->bulbradius;
|
||||
@@ -3822,8 +3822,8 @@ void mjCModel::CopyObjects(mjModel* m) {
|
||||
m->tendon_num[i] = (int)pte->path.size();
|
||||
m->tendon_matid[i] = pte->matid;
|
||||
m->tendon_group[i] = pte->group;
|
||||
m->tendon_limited[i] = (mjtByte)pte->is_limited();
|
||||
m->tendon_actfrclimited[i] = (mjtByte)pte->is_actfrclimited();
|
||||
m->tendon_limited[i] = (mjtBool)pte->is_limited();
|
||||
m->tendon_actfrclimited[i] = (mjtBool)pte->is_actfrclimited();
|
||||
m->tendon_width[i] = (mjtNum)pte->width;
|
||||
mjuu_copyvec(m->tendon_solref_lim+mjNREF*i, pte->solref_limit, mjNREF);
|
||||
mjuu_copyvec(m->tendon_solimp_lim+mjNIMP*i, pte->solimp_limit, mjNIMP);
|
||||
@@ -3891,9 +3891,9 @@ void mjCModel::CopyObjects(mjModel* m) {
|
||||
m->actuator_historyadr[i] = -1;
|
||||
}
|
||||
|
||||
m->actuator_ctrllimited[i] = (mjtByte)pac->is_ctrllimited();
|
||||
m->actuator_forcelimited[i] = (mjtByte)pac->is_forcelimited();
|
||||
m->actuator_actlimited[i] = (mjtByte)pac->is_actlimited();
|
||||
m->actuator_ctrllimited[i] = (mjtBool)pac->is_ctrllimited();
|
||||
m->actuator_forcelimited[i] = (mjtBool)pac->is_forcelimited();
|
||||
m->actuator_actlimited[i] = (mjtBool)pac->is_actlimited();
|
||||
m->actuator_actearly[i] = pac->actearly;
|
||||
m->actuator_cranklength[i] = (mjtNum)pac->cranklength;
|
||||
mjuu_copyvec(m->actuator_gear + 6*i, pac->gear, 6);
|
||||
|
||||
@@ -203,6 +203,10 @@ auto Compare(unsigned char val1, unsigned char val2) {
|
||||
return val1 != val2;
|
||||
}
|
||||
|
||||
auto Compare(bool val1, bool val2) {
|
||||
return val1 != val2;
|
||||
}
|
||||
|
||||
auto Compare(mjtSize val1, mjtSize val2) {
|
||||
return val1 > val2 ? val1 - val2 : val2 - val1;
|
||||
}
|
||||
|
||||
@@ -2002,7 +2002,7 @@ TEST_F(LimitedTest, JointLimited) {
|
||||
|
||||
// see `user/testdata/auto_limits.xml` for expected values
|
||||
for (int i = 0; i < model->njnt; i++) {
|
||||
EXPECT_EQ(model->jnt_limited[i], (mjtByte)model->jnt_user[i])
|
||||
EXPECT_EQ(model->jnt_limited[i], (mjtBool)model->jnt_user[i])
|
||||
<< i << " " << (int)model->jnt_limited[i] << " "
|
||||
<< (int)model->jnt_user[i];
|
||||
}
|
||||
|
||||
@@ -2481,7 +2481,7 @@ TEST_F(ActuatorTest, ReadsByte) {
|
||||
std::array<char, 1024> error;
|
||||
mjModel* model = LoadModelFromString(xml, error.data(), error.size());
|
||||
ASSERT_THAT(model, NotNull());
|
||||
EXPECT_EQ(*(model->actuator_actlimited), (mjtByte)(1 & 0xFF));
|
||||
EXPECT_EQ(*(model->actuator_actlimited), true);
|
||||
mj_deleteModel(model);
|
||||
}
|
||||
|
||||
|
||||
@@ -6575,28 +6575,28 @@ struct MjData {
|
||||
void set_nv_awake(int value) {
|
||||
ptr_->nv_awake = value;
|
||||
}
|
||||
mjtByte flg_energypos() const {
|
||||
mjtBool flg_energypos() const {
|
||||
return ptr_->flg_energypos;
|
||||
}
|
||||
void set_flg_energypos(mjtByte value) {
|
||||
void set_flg_energypos(mjtBool value) {
|
||||
ptr_->flg_energypos = value;
|
||||
}
|
||||
mjtByte flg_energyvel() const {
|
||||
mjtBool flg_energyvel() const {
|
||||
return ptr_->flg_energyvel;
|
||||
}
|
||||
void set_flg_energyvel(mjtByte value) {
|
||||
void set_flg_energyvel(mjtBool value) {
|
||||
ptr_->flg_energyvel = value;
|
||||
}
|
||||
mjtByte flg_subtreevel() const {
|
||||
mjtBool flg_subtreevel() const {
|
||||
return ptr_->flg_subtreevel;
|
||||
}
|
||||
void set_flg_subtreevel(mjtByte value) {
|
||||
void set_flg_subtreevel(mjtBool value) {
|
||||
ptr_->flg_subtreevel = value;
|
||||
}
|
||||
mjtByte flg_rnepost() const {
|
||||
mjtBool flg_rnepost() const {
|
||||
return ptr_->flg_rnepost;
|
||||
}
|
||||
void set_flg_rnepost(mjtByte value) {
|
||||
void set_flg_rnepost(mjtBool value) {
|
||||
ptr_->flg_rnepost = value;
|
||||
}
|
||||
mjtNum time() const {
|
||||
@@ -8977,7 +8977,7 @@ void mj_mulM2_wrapper(const MjModel& m, const MjData& d, const val& res, const N
|
||||
mj_mulM2(m.get(), d.get(), res_.data(), vec_.data());
|
||||
}
|
||||
|
||||
void mj_multiRay_wrapper(const MjModel& m, MjData& d, const NumberArray& pnt, const NumberArray& vec, const NumberArray& geomgroup, mjtByte flg_static, int bodyexclude, const val& geomid, const val& dist, const val& normal, int nray, mjtNum cutoff) {
|
||||
void mj_multiRay_wrapper(const MjModel& m, MjData& d, const NumberArray& pnt, const NumberArray& vec, const NumberArray& geomgroup, mjtBool flg_static, int bodyexclude, const val& geomid, const val& dist, const val& normal, int nray, mjtNum cutoff) {
|
||||
UNPACK_ARRAY(mjtNum, pnt);
|
||||
UNPACK_ARRAY(mjtNum, vec);
|
||||
UNPACK_NULLABLE_ARRAY(mjtByte, geomgroup);
|
||||
@@ -9052,7 +9052,7 @@ void mj_projectConstraint_wrapper(const MjModel& m, MjData& d) {
|
||||
mj_projectConstraint(m.get(), d.get());
|
||||
}
|
||||
|
||||
mjtNum mj_ray_wrapper(const MjModel& m, const MjData& d, const NumberArray& pnt, const NumberArray& vec, const NumberArray& geomgroup, mjtByte flg_static, int bodyexclude, const val& geomid, const val& normal) {
|
||||
mjtNum mj_ray_wrapper(const MjModel& m, const MjData& d, const NumberArray& pnt, const NumberArray& vec, const NumberArray& geomgroup, mjtBool flg_static, int bodyexclude, const val& geomid, const val& normal) {
|
||||
UNPACK_ARRAY(mjtNum, pnt);
|
||||
UNPACK_ARRAY(mjtNum, vec);
|
||||
UNPACK_NULLABLE_ARRAY(mjtByte, geomgroup);
|
||||
@@ -9061,7 +9061,7 @@ mjtNum mj_ray_wrapper(const MjModel& m, const MjData& d, const NumberArray& pnt,
|
||||
return mj_ray(m.get(), d.get(), pnt_.data(), vec_.data(), geomgroup_.data(), flg_static, bodyexclude, geomid_.data(), normal_.data());
|
||||
}
|
||||
|
||||
mjtNum mj_rayFlex_wrapper(const MjModel& m, const MjData& d, int flex_layer, mjtByte flg_vert, mjtByte flg_edge, mjtByte flg_face, mjtByte flg_skin, int flexid, const NumberArray& pnt, const NumberArray& vec, const val& vertid, const val& normal) {
|
||||
mjtNum mj_rayFlex_wrapper(const MjModel& m, const MjData& d, int flex_layer, mjtBool flg_vert, mjtBool flg_edge, mjtBool flg_face, mjtBool flg_skin, int flexid, const NumberArray& pnt, const NumberArray& vec, const val& vertid, const val& normal) {
|
||||
UNPACK_ARRAY(mjtNum, pnt);
|
||||
UNPACK_ARRAY(mjtNum, vec);
|
||||
UNPACK_NULLABLE_VALUE(int, vertid);
|
||||
@@ -9199,7 +9199,7 @@ std::string mj_versionString_wrapper() {
|
||||
return std::string(mj_versionString());
|
||||
}
|
||||
|
||||
void mjd_inverseFD_wrapper(const MjModel& m, MjData& d, mjtNum eps, mjtByte flg_actuation, const val& DfDq, const val& DfDv, const val& DfDa, const val& DsDq, const val& DsDv, const val& DsDa, const val& DmDq) {
|
||||
void mjd_inverseFD_wrapper(const MjModel& m, MjData& d, mjtNum eps, mjtBool flg_actuation, const val& DfDq, const val& DfDv, const val& DfDa, const val& DsDq, const val& DsDv, const val& DsDa, const val& DmDq) {
|
||||
UNPACK_NULLABLE_VALUE(mjtNum, DfDq);
|
||||
UNPACK_NULLABLE_VALUE(mjtNum, DfDv);
|
||||
UNPACK_NULLABLE_VALUE(mjtNum, DfDa);
|
||||
@@ -9237,7 +9237,7 @@ void mjd_subQuat_wrapper(const NumberArray& qa, const NumberArray& qb, const val
|
||||
mjd_subQuat(qa_.data(), qb_.data(), Da_.data(), Db_.data());
|
||||
}
|
||||
|
||||
void mjd_transitionFD_wrapper(const MjModel& m, MjData& d, mjtNum eps, mjtByte flg_centered, const val& A, const val& B, const val& C, const val& D) {
|
||||
void mjd_transitionFD_wrapper(const MjModel& m, MjData& d, mjtNum eps, mjtBool flg_centered, const val& A, const val& B, const val& C, const val& D) {
|
||||
UNPACK_NULLABLE_VALUE(mjtNum, A);
|
||||
UNPACK_NULLABLE_VALUE(mjtNum, B);
|
||||
UNPACK_NULLABLE_VALUE(mjtNum, C);
|
||||
@@ -10161,7 +10161,7 @@ void mju_axisAngle2Quat_wrapper(const val& res, const NumberArray& axis, mjtNum
|
||||
mju_axisAngle2Quat(res_.data(), axis_.data(), angle);
|
||||
}
|
||||
|
||||
void mju_band2Dense_wrapper(const val& res, const NumberArray& mat, int ntotal, int nband, int ndense, mjtByte flg_sym) {
|
||||
void mju_band2Dense_wrapper(const val& res, const NumberArray& mat, int ntotal, int nband, int ndense, mjtBool flg_sym) {
|
||||
UNPACK_VALUE(mjtNum, res);
|
||||
UNPACK_ARRAY(mjtNum, mat);
|
||||
CHECK_SIZE(mat, (ntotal - ndense) * nband + ndense * ntotal);
|
||||
@@ -10169,7 +10169,7 @@ void mju_band2Dense_wrapper(const val& res, const NumberArray& mat, int ntotal,
|
||||
mju_band2Dense(res_.data(), mat_.data(), ntotal, nband, ndense, flg_sym);
|
||||
}
|
||||
|
||||
void mju_bandMulMatVec_wrapper(const val& res, const NumberArray& mat, const NumberArray& vec, int ntotal, int nband, int ndense, int nvec, mjtByte flg_sym) {
|
||||
void mju_bandMulMatVec_wrapper(const val& res, const NumberArray& mat, const NumberArray& vec, int ntotal, int nband, int ndense, int nvec, mjtBool flg_sym) {
|
||||
UNPACK_VALUE(mjtNum, res);
|
||||
UNPACK_ARRAY(mjtNum, mat);
|
||||
UNPACK_ARRAY(mjtNum, vec);
|
||||
|
||||
@@ -514,7 +514,7 @@ describe('MuJoCo WASM Bindings', () => {
|
||||
|
||||
it('should compute finite-differenced transition matrices', () => {
|
||||
const eps = 1e-6;
|
||||
const flg_centered = 0;
|
||||
const flg_centered = false;
|
||||
const dim = 2 * model!.nv + model!.na;
|
||||
const A = new mujoco.DoubleBuffer(dim * dim);
|
||||
const B = new mujoco.DoubleBuffer(dim * model!.nu);
|
||||
@@ -1290,7 +1290,7 @@ describe('MuJoCo WASM Bindings', () => {
|
||||
// Corresponds to bindings_test.py:test_inverse_fd_none
|
||||
it('should compute inverse dynamics derivatives with null outputs', () => {
|
||||
const eps = 1e-6;
|
||||
const flg_centered = 0;
|
||||
const flg_centered = false;
|
||||
expect(
|
||||
() => mujoco.mjd_inverseFD(
|
||||
model!, data!, eps, flg_centered, null, null, null, null, null,
|
||||
@@ -1301,7 +1301,7 @@ describe('MuJoCo WASM Bindings', () => {
|
||||
// Corresponds to bindings_test.py:test_inverse_fd
|
||||
it('should compute inverse dynamics derivatives', () => {
|
||||
const eps = 1e-6;
|
||||
const flg_centered = 0;
|
||||
const flg_centered = false;
|
||||
|
||||
const nv = model!.nv;
|
||||
const nsensordata = model!.nsensordata;
|
||||
@@ -1427,7 +1427,7 @@ describe('MuJoCo WASM Bindings', () => {
|
||||
expect(band.GetView()[index]).toEqual(i + 1);
|
||||
}
|
||||
const dense2 = new mujoco.DoubleBuffer(nTotal * nTotal);
|
||||
const flgSym = 1;
|
||||
const flgSym = true;
|
||||
mujoco.mju_band2Dense(
|
||||
dense2, band.GetView(), nTotal, nBand, nDense, flgSym);
|
||||
expectArraysEqual(new Float64Array(dense), dense2.GetView());
|
||||
|
||||
Reference in New Issue
Block a user