Version 2.1.2: Python bindings, OBJ assets support, bugfixes.
PiperOrigin-RevId: 434731612 Change-Id: I0cfda3e7a3d1c72036764986efc252ffa1b8c6b0
This commit is contained in:
+8
-7
@@ -15,7 +15,8 @@
|
||||
#ifndef MUJOCO_MJDATA_H_
|
||||
#define MUJOCO_MJDATA_H_
|
||||
|
||||
#include "mjmodel.h"
|
||||
#include <mjtnum.h>
|
||||
#include <mjmodel.h>
|
||||
|
||||
//---------------------------------- primitive types (mjt) -----------------------------------------
|
||||
|
||||
@@ -169,19 +170,19 @@ struct mjData_ {
|
||||
mjtNum* qfrc_applied; // applied generalized force (nv x 1)
|
||||
mjtNum* xfrc_applied; // applied Cartesian force/torque (nbody x 6)
|
||||
|
||||
// mocap data
|
||||
mjtNum* mocap_pos; // positions of mocap bodies (nmocap x 3)
|
||||
mjtNum* mocap_quat; // orientations of mocap bodies (nmocap x 4)
|
||||
|
||||
// dynamics
|
||||
mjtNum* qacc; // acceleration (nv x 1)
|
||||
mjtNum* act_dot; // time-derivative of actuator activation (na x 1)
|
||||
|
||||
// mocap data
|
||||
mjtNum* mocap_pos; // positions of mocap bodies (nmocap x 3)
|
||||
mjtNum* mocap_quat; // orientations of mocap bodies (nmocap x 4)
|
||||
|
||||
// user data
|
||||
mjtNum* userdata; // user data, not touched by engine (nuserdata x 1)
|
||||
mjtNum* userdata; // user data, not touched by engine (nuserdata x 1)
|
||||
|
||||
// sensors
|
||||
mjtNum* sensordata; // sensor data array (nsensordata x 1)
|
||||
mjtNum* sensordata; // sensor data array (nsensordata x 1)
|
||||
|
||||
//-------------------------------- POSITION dependent
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_MUJOCO_EXPORT_H_
|
||||
#define MUJOCO_MUJOCO_EXPORT_H_
|
||||
#ifndef MUJOCO_MJEXPORT_H_
|
||||
#define MUJOCO_MJEXPORT_H_
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#define MUJOCO_HELPER_DLL_IMPORT __declspec(dllimport)
|
||||
@@ -44,4 +44,4 @@
|
||||
#define MJLOCAL MUJOCO_HELPER_DLL_LOCAL
|
||||
#endif
|
||||
|
||||
#endif // MUJOCO_MUJOCO_EXPORT_H_
|
||||
#endif // MUJOCO_MJEXPORT_H_
|
||||
+5
-15
@@ -15,21 +15,7 @@
|
||||
#ifndef MUJOCO_MJMODEL_H_
|
||||
#define MUJOCO_MJMODEL_H_
|
||||
|
||||
//---------------------------------- floating-point definitions ------------------------------------
|
||||
|
||||
// compile-time configuration options
|
||||
#define mjUSEDOUBLE // single or double precision for mjtNum
|
||||
|
||||
|
||||
// floating point data type and minval
|
||||
#ifdef mjUSEDOUBLE
|
||||
typedef double mjtNum;
|
||||
#define mjMINVAL 1E-15 // minimum value in any denominator
|
||||
#else
|
||||
typedef float mjtNum;
|
||||
#define mjMINVAL 1E-15f
|
||||
#endif
|
||||
|
||||
#include <mjtnum.h>
|
||||
|
||||
// global constants
|
||||
#define mjPI 3.14159265358979323846
|
||||
@@ -48,6 +34,7 @@
|
||||
#define mjNDYN 10 // number of actuator dynamics parameters
|
||||
#define mjNGAIN 10 // number of actuator gain parameters
|
||||
#define mjNBIAS 10 // number of actuator bias parameters
|
||||
#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 mjNSOLVER 1000 // size of mjData.solver_XXX arrays
|
||||
@@ -677,6 +664,7 @@ struct mjModel_ {
|
||||
mjtNum* geom_friction; // friction for (slide, spin, roll) (ngeom x 3)
|
||||
mjtNum* geom_margin; // detect contact if dist<margin (ngeom x 1)
|
||||
mjtNum* geom_gap; // include in solver if dist<margin-gap (ngeom x 1)
|
||||
mjtNum* geom_fluid; // fluid interaction parameters (ngeom x mjNFLUID)
|
||||
mjtNum* geom_user; // user data (ngeom x nuser_geom)
|
||||
float* geom_rgba; // rgba when material is omitted (ngeom x 4)
|
||||
|
||||
@@ -860,6 +848,8 @@ struct mjModel_ {
|
||||
int* sensor_needstage; // required compute stage (mjtStage) (nsensor x 1)
|
||||
int* sensor_objtype; // type of sensorized object (mjtObj) (nsensor x 1)
|
||||
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_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)
|
||||
|
||||
+8
-1
@@ -15,7 +15,11 @@
|
||||
#ifndef MUJOCO_MJRENDER_H_
|
||||
#define MUJOCO_MJRENDER_H_
|
||||
|
||||
#include "mjmodel.h"
|
||||
#include <mjmodel.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define mjNAUX 10 // number of auxiliary buffers
|
||||
#define mjMAXTEXTURE 1000 // maximum number of textures
|
||||
@@ -148,4 +152,7 @@ struct mjrContext_ { // custom OpenGL context
|
||||
};
|
||||
typedef struct mjrContext_ mjrContext;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif // MUJOCO_MJRENDER_H_
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// Copyright 2021 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef MUJOCO_INCLUDE_MJTNUM_H_
|
||||
#define MUJOCO_INCLUDE_MJTNUM_H_
|
||||
|
||||
//---------------------------------- floating-point definitions ------------------------------------
|
||||
|
||||
// compile-time configuration options
|
||||
#define mjUSEDOUBLE // single or double precision for mjtNum
|
||||
|
||||
|
||||
// floating point data type and minval
|
||||
#ifdef mjUSEDOUBLE
|
||||
typedef double mjtNum;
|
||||
#define mjMINVAL 1E-15 // minimum value in any denominator
|
||||
#else
|
||||
typedef float mjtNum;
|
||||
#define mjMINVAL 1E-15f
|
||||
#endif
|
||||
|
||||
|
||||
#endif // MUJOCO_INCLUDE_MJTNUM_H_
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
#ifndef MUJOCO_MJUI_H_
|
||||
#define MUJOCO_MJUI_H_
|
||||
|
||||
#include "mjrender.h"
|
||||
#include <mjrender.h>
|
||||
|
||||
#define mjMAXUISECT 10 // maximum number of sections
|
||||
#define mjMAXUIITEM 80 // maximum number of items per section
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
#ifndef MUJOCO_MJVISUALIZE_H_
|
||||
#define MUJOCO_MJVISUALIZE_H_
|
||||
|
||||
#include "mjmodel.h"
|
||||
#include <mjtnum.h>
|
||||
#include <mjmodel.h>
|
||||
|
||||
#define mjNGROUP 6 // number of geom, site, joint groups with visflags
|
||||
#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
|
||||
@@ -278,7 +280,7 @@ struct mjvScene_ { // abstract scene passed to OpenGL renderer
|
||||
|
||||
// OpenGL lights
|
||||
int nlight; // number of lights currently in buffer
|
||||
mjvLight lights[8]; // buffer for lights
|
||||
mjvLight lights[mjMAXLIGHT]; // buffer for lights
|
||||
|
||||
// OpenGL cameras
|
||||
mjvGLCamera camera[2]; // left and right camera
|
||||
|
||||
+414
-407
@@ -15,50 +15,50 @@
|
||||
#ifndef MUJOCO_MJXMACRO_H_
|
||||
#define MUJOCO_MJXMACRO_H_
|
||||
|
||||
//-------------------------------- mjOption ---------------------------------------------
|
||||
|
||||
//-------------------------------- mjOption --------------------------------------------------------
|
||||
|
||||
// scalar fields of mjOption
|
||||
#define MJOPTION_FLOATS \
|
||||
X( mjtNum, timestep ) \
|
||||
X( mjtNum, apirate ) \
|
||||
X( mjtNum, impratio ) \
|
||||
X( mjtNum, tolerance ) \
|
||||
X( mjtNum, noslip_tolerance ) \
|
||||
X( mjtNum, mpr_tolerance ) \
|
||||
X( mjtNum, density ) \
|
||||
X( mjtNum, viscosity ) \
|
||||
X( mjtNum, o_margin ) \
|
||||
#define MJOPTION_FLOATS \
|
||||
X( mjtNum, timestep ) \
|
||||
X( mjtNum, apirate ) \
|
||||
X( mjtNum, impratio ) \
|
||||
X( mjtNum, tolerance ) \
|
||||
X( mjtNum, noslip_tolerance ) \
|
||||
X( mjtNum, mpr_tolerance ) \
|
||||
X( mjtNum, density ) \
|
||||
X( mjtNum, viscosity ) \
|
||||
X( mjtNum, o_margin ) \
|
||||
|
||||
|
||||
#define MJOPTION_INTS \
|
||||
X( int, integrator ) \
|
||||
X( int, collision ) \
|
||||
X( int, cone ) \
|
||||
X( int, jacobian ) \
|
||||
X( int, solver ) \
|
||||
X( int, iterations ) \
|
||||
#define MJOPTION_INTS \
|
||||
X( int, integrator ) \
|
||||
X( int, collision ) \
|
||||
X( int, cone ) \
|
||||
X( int, jacobian ) \
|
||||
X( int, solver ) \
|
||||
X( int, iterations ) \
|
||||
X( int, noslip_iterations ) \
|
||||
X( int, mpr_iterations ) \
|
||||
X( int, disableflags ) \
|
||||
X( int, mpr_iterations ) \
|
||||
X( int, disableflags ) \
|
||||
X( int, enableflags )
|
||||
|
||||
|
||||
#define MJOPTION_SCALARS \
|
||||
MJOPTION_FLOATS \
|
||||
#define MJOPTION_SCALARS \
|
||||
MJOPTION_FLOATS \
|
||||
MJOPTION_INTS
|
||||
|
||||
|
||||
// vector fields of mjOption
|
||||
#define MJOPTION_VECTORS \
|
||||
X( gravity, 3 ) \
|
||||
X( wind, 3 ) \
|
||||
X( magnetic, 3 ) \
|
||||
X( o_solref, mjNREF ) \
|
||||
#define MJOPTION_VECTORS \
|
||||
X( gravity, 3 ) \
|
||||
X( wind, 3 ) \
|
||||
X( magnetic, 3 ) \
|
||||
X( o_solref, mjNREF ) \
|
||||
X( o_solimp, mjNIMP )
|
||||
|
||||
|
||||
|
||||
//-------------------------------- mjModel ----------------------------------------------
|
||||
//-------------------------------- mjModel ---------------------------------------------------------
|
||||
|
||||
// int fields of mjModel
|
||||
#define MJMODEL_INTS \
|
||||
@@ -122,396 +122,402 @@
|
||||
|
||||
|
||||
// define symbols needed in MJMODEL_POINTERS (corresponding to number of columns)
|
||||
#define MJMODEL_POINTERS_PREAMBLE( m ) \
|
||||
int nuser_body = m->nuser_body; \
|
||||
int nuser_jnt = m->nuser_jnt; \
|
||||
int nuser_geom = m->nuser_geom; \
|
||||
int nuser_site = m->nuser_site; \
|
||||
int nuser_cam = m->nuser_cam; \
|
||||
int nuser_tendon = m->nuser_tendon; \
|
||||
#define MJMODEL_POINTERS_PREAMBLE( m ) \
|
||||
int nuser_body = m->nuser_body; \
|
||||
int nuser_jnt = m->nuser_jnt; \
|
||||
int nuser_geom = m->nuser_geom; \
|
||||
int nuser_site = m->nuser_site; \
|
||||
int nuser_cam = m->nuser_cam; \
|
||||
int nuser_tendon = m->nuser_tendon; \
|
||||
int nuser_actuator = m->nuser_actuator; \
|
||||
int nuser_sensor = m->nuser_sensor; \
|
||||
int nq = m->nq; \
|
||||
int nv = m->nv; \
|
||||
int na = m->na; \
|
||||
int nmocap3 = 3*m->nmocap; \
|
||||
int nmocap4 = 4*m->nmocap;
|
||||
int nuser_sensor = m->nuser_sensor; \
|
||||
int nq = m->nq; \
|
||||
int nv = m->nv; \
|
||||
int na = m->na; \
|
||||
int nmocap = m->nmocap;
|
||||
|
||||
|
||||
// macro for annotating that an array size in an X macro is a member of mjModel
|
||||
// by default this macro does nothing, but users can redefine it as necessary
|
||||
#define MJ_M(n) n
|
||||
|
||||
|
||||
// pointer fields of mjModel
|
||||
#define MJMODEL_POINTERS \
|
||||
X( mjtNum, qpos0, nq, 1 ) \
|
||||
X( mjtNum, qpos_spring, nq, 1 ) \
|
||||
X( int, body_parentid, nbody, 1 ) \
|
||||
X( int, body_rootid, nbody, 1 ) \
|
||||
X( int, body_weldid, nbody, 1 ) \
|
||||
X( int, body_mocapid, nbody, 1 ) \
|
||||
X( int, body_jntnum, nbody, 1 ) \
|
||||
X( int, body_jntadr, nbody, 1 ) \
|
||||
X( int, body_dofnum, nbody, 1 ) \
|
||||
X( int, body_dofadr, nbody, 1 ) \
|
||||
X( int, body_geomnum, nbody, 1 ) \
|
||||
X( int, body_geomadr, nbody, 1 ) \
|
||||
X( mjtByte, body_simple, nbody, 1 ) \
|
||||
X( mjtByte, body_sameframe, nbody, 1 ) \
|
||||
X( mjtNum, body_pos, nbody, 3 ) \
|
||||
X( mjtNum, body_quat, nbody, 4 ) \
|
||||
X( mjtNum, body_ipos, nbody, 3 ) \
|
||||
X( mjtNum, body_iquat, nbody, 4 ) \
|
||||
X( mjtNum, body_mass, nbody, 1 ) \
|
||||
X( mjtNum, body_subtreemass, nbody, 1 ) \
|
||||
X( mjtNum, body_inertia, nbody, 3 ) \
|
||||
X( mjtNum, body_invweight0, nbody, 2 ) \
|
||||
X( mjtNum, body_user, nbody, nuser_body ) \
|
||||
X( int, jnt_type, njnt, 1 ) \
|
||||
X( int, jnt_qposadr, njnt, 1 ) \
|
||||
X( int, jnt_dofadr, njnt, 1 ) \
|
||||
X( int, jnt_bodyid, njnt, 1 ) \
|
||||
X( int, jnt_group, njnt, 1 ) \
|
||||
X( mjtByte, jnt_limited, njnt, 1 ) \
|
||||
X( mjtNum, jnt_solref, njnt, mjNREF ) \
|
||||
X( mjtNum, jnt_solimp, njnt, mjNIMP ) \
|
||||
X( mjtNum, jnt_pos, njnt, 3 ) \
|
||||
X( mjtNum, jnt_axis, njnt, 3 ) \
|
||||
X( mjtNum, jnt_stiffness, njnt, 1 ) \
|
||||
X( mjtNum, jnt_range, njnt, 2 ) \
|
||||
X( mjtNum, jnt_margin, njnt, 1 ) \
|
||||
X( mjtNum, jnt_user, njnt, nuser_jnt ) \
|
||||
X( int, dof_bodyid, nv, 1 ) \
|
||||
X( int, dof_jntid, nv, 1 ) \
|
||||
X( int, dof_parentid, nv, 1 ) \
|
||||
X( int, dof_Madr, nv, 1 ) \
|
||||
X( int, dof_simplenum, nv, 1 ) \
|
||||
X( mjtNum, dof_solref, nv, mjNREF ) \
|
||||
X( mjtNum, dof_solimp, nv, mjNIMP ) \
|
||||
X( mjtNum, dof_frictionloss, nv, 1 ) \
|
||||
X( mjtNum, dof_armature, nv, 1 ) \
|
||||
X( mjtNum, dof_damping, nv, 1 ) \
|
||||
X( mjtNum, dof_invweight0, nv, 1 ) \
|
||||
X( mjtNum, dof_M0, nv, 1 ) \
|
||||
X( int, geom_type, ngeom, 1 ) \
|
||||
X( int, geom_contype, ngeom, 1 ) \
|
||||
X( int, geom_conaffinity, ngeom, 1 ) \
|
||||
X( int, geom_condim, ngeom, 1 ) \
|
||||
X( int, geom_bodyid, ngeom, 1 ) \
|
||||
X( int, geom_dataid, ngeom, 1 ) \
|
||||
X( int, geom_matid, ngeom, 1 ) \
|
||||
X( int, geom_group, ngeom, 1 ) \
|
||||
X( int, geom_priority, ngeom, 1 ) \
|
||||
X( mjtByte, geom_sameframe, ngeom, 1 ) \
|
||||
X( mjtNum, geom_solmix, ngeom, 1 ) \
|
||||
X( mjtNum, geom_solref, ngeom, mjNREF ) \
|
||||
X( mjtNum, geom_solimp, ngeom, mjNIMP ) \
|
||||
X( mjtNum, geom_size, ngeom, 3 ) \
|
||||
X( mjtNum, geom_rbound, ngeom, 1 ) \
|
||||
X( mjtNum, geom_pos, ngeom, 3 ) \
|
||||
X( mjtNum, geom_quat, ngeom, 4 ) \
|
||||
X( mjtNum, geom_friction, ngeom, 3 ) \
|
||||
X( mjtNum, geom_margin, ngeom, 1 ) \
|
||||
X( mjtNum, geom_gap, ngeom, 1 ) \
|
||||
X( mjtNum, geom_user, ngeom, nuser_geom ) \
|
||||
X( float, geom_rgba, ngeom, 4 ) \
|
||||
X( int, site_type, nsite, 1 ) \
|
||||
X( int, site_bodyid, nsite, 1 ) \
|
||||
X( int, site_matid, nsite, 1 ) \
|
||||
X( int, site_group, nsite, 1 ) \
|
||||
X( mjtByte, site_sameframe, nsite, 1 ) \
|
||||
X( mjtNum, site_size, nsite, 3 ) \
|
||||
X( mjtNum, site_pos, nsite, 3 ) \
|
||||
X( mjtNum, site_quat, nsite, 4 ) \
|
||||
X( mjtNum, site_user, nsite, nuser_site ) \
|
||||
X( float, site_rgba, nsite, 4 ) \
|
||||
X( int, cam_mode, ncam, 1 ) \
|
||||
X( int, cam_bodyid, ncam, 1 ) \
|
||||
X( int, cam_targetbodyid, ncam, 1 ) \
|
||||
X( mjtNum, cam_pos, ncam, 3 ) \
|
||||
X( mjtNum, cam_quat, ncam, 4 ) \
|
||||
X( mjtNum, cam_poscom0, ncam, 3 ) \
|
||||
X( mjtNum, cam_pos0, ncam, 3 ) \
|
||||
X( mjtNum, cam_mat0, ncam, 9 ) \
|
||||
X( mjtNum, cam_fovy, ncam, 1 ) \
|
||||
X( mjtNum, cam_ipd, ncam, 1 ) \
|
||||
X( mjtNum, cam_user, ncam, nuser_cam ) \
|
||||
X( int, light_mode, nlight, 1 ) \
|
||||
X( int, light_bodyid, nlight, 1 ) \
|
||||
X( int, light_targetbodyid, nlight, 1 ) \
|
||||
X( mjtByte, light_directional, nlight, 1 ) \
|
||||
X( mjtByte, light_castshadow, nlight, 1 ) \
|
||||
X( mjtByte, light_active, nlight, 1 ) \
|
||||
X( mjtNum, light_pos, nlight, 3 ) \
|
||||
X( mjtNum, light_dir, nlight, 3 ) \
|
||||
X( mjtNum, light_poscom0, nlight, 3 ) \
|
||||
X( mjtNum, light_pos0, nlight, 3 ) \
|
||||
X( mjtNum, light_dir0, nlight, 3 ) \
|
||||
X( float, light_attenuation, nlight, 3 ) \
|
||||
X( float, light_cutoff, nlight, 1 ) \
|
||||
X( float, light_exponent, nlight, 1 ) \
|
||||
X( float, light_ambient, nlight, 3 ) \
|
||||
X( float, light_diffuse, nlight, 3 ) \
|
||||
X( float, light_specular, nlight, 3 ) \
|
||||
X( int, mesh_vertadr, nmesh, 1 ) \
|
||||
X( int, mesh_vertnum, nmesh, 1 ) \
|
||||
X( int, mesh_texcoordadr, nmesh, 1 ) \
|
||||
X( int, mesh_faceadr, nmesh, 1 ) \
|
||||
X( int, mesh_facenum, nmesh, 1 ) \
|
||||
X( int, mesh_graphadr, nmesh, 1 ) \
|
||||
X( float, mesh_vert, nmeshvert, 3 ) \
|
||||
X( float, mesh_normal, nmeshvert, 3 ) \
|
||||
X( float, mesh_texcoord, nmeshtexvert, 2 ) \
|
||||
X( int, mesh_face, nmeshface, 3 ) \
|
||||
X( int, mesh_graph, nmeshgraph,1 ) \
|
||||
X( int, skin_matid, nskin, 1 ) \
|
||||
X( float, skin_rgba, nskin, 4 ) \
|
||||
X( float, skin_inflate, nskin, 1 ) \
|
||||
X( int, skin_vertadr, nskin, 1 ) \
|
||||
X( int, skin_vertnum, nskin, 1 ) \
|
||||
X( int, skin_texcoordadr, nskin, 1 ) \
|
||||
X( int, skin_faceadr, nskin, 1 ) \
|
||||
X( int, skin_facenum, nskin, 1 ) \
|
||||
X( int, skin_boneadr, nskin, 1 ) \
|
||||
X( int, skin_bonenum, nskin, 1 ) \
|
||||
X( float, skin_vert, nskinvert, 3 ) \
|
||||
X( float, skin_texcoord, nskintexvert, 2 ) \
|
||||
X( int, skin_face, nskinface, 3 ) \
|
||||
X( int, skin_bonevertadr, nskinbone, 1 ) \
|
||||
X( int, skin_bonevertnum, nskinbone, 1 ) \
|
||||
X( float, skin_bonebindpos, nskinbone, 3 ) \
|
||||
X( float, skin_bonebindquat, nskinbone, 4 ) \
|
||||
X( int, skin_bonebodyid, nskinbone, 1 ) \
|
||||
X( int, skin_bonevertid, nskinbonevert, 1 ) \
|
||||
X( float, skin_bonevertweight, nskinbonevert, 1 ) \
|
||||
X( mjtNum, hfield_size, nhfield, 4 ) \
|
||||
X( int, hfield_nrow, nhfield, 1 ) \
|
||||
X( int, hfield_ncol, nhfield, 1 ) \
|
||||
X( int, hfield_adr, nhfield, 1 ) \
|
||||
X( float, hfield_data, nhfielddata, 1 ) \
|
||||
X( int, tex_type, ntex, 1 ) \
|
||||
X( int, tex_height, ntex, 1 ) \
|
||||
X( int, tex_width, ntex, 1 ) \
|
||||
X( int, tex_adr, ntex, 1 ) \
|
||||
X( mjtByte, tex_rgb, ntexdata, 1 ) \
|
||||
X( int, mat_texid, nmat, 1 ) \
|
||||
X( mjtByte, mat_texuniform, nmat, 1 ) \
|
||||
X( float, mat_texrepeat, nmat, 2 ) \
|
||||
X( float, mat_emission, nmat, 1 ) \
|
||||
X( float, mat_specular, nmat, 1 ) \
|
||||
X( float, mat_shininess, nmat, 1 ) \
|
||||
X( float, mat_reflectance, nmat, 1 ) \
|
||||
X( float, mat_rgba, nmat, 4 ) \
|
||||
X( int, pair_dim, npair, 1 ) \
|
||||
X( int, pair_geom1, npair, 1 ) \
|
||||
X( int, pair_geom2, npair, 1 ) \
|
||||
X( int, pair_signature, npair, 1 ) \
|
||||
X( mjtNum, pair_solref, npair, mjNREF ) \
|
||||
X( mjtNum, pair_solimp, npair, mjNIMP ) \
|
||||
X( mjtNum, pair_margin, npair, 1 ) \
|
||||
X( mjtNum, pair_gap, npair, 1 ) \
|
||||
X( mjtNum, pair_friction, npair, 5 ) \
|
||||
X( int, exclude_signature, nexclude, 1 ) \
|
||||
X( int, eq_type, neq, 1 ) \
|
||||
X( int, eq_obj1id, neq, 1 ) \
|
||||
X( int, eq_obj2id, neq, 1 ) \
|
||||
X( mjtByte, eq_active, neq, 1 ) \
|
||||
X( mjtNum, eq_solref, neq, mjNREF ) \
|
||||
X( mjtNum, eq_solimp, neq, mjNIMP ) \
|
||||
X( mjtNum, eq_data, neq, mjNEQDATA ) \
|
||||
X( int, tendon_adr, ntendon, 1 ) \
|
||||
X( int, tendon_num, ntendon, 1 ) \
|
||||
X( int, tendon_matid, ntendon, 1 ) \
|
||||
X( int, tendon_group, ntendon, 1 ) \
|
||||
X( mjtByte, tendon_limited, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_width, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_solref_lim, ntendon, mjNREF ) \
|
||||
X( mjtNum, tendon_solimp_lim, ntendon, mjNIMP ) \
|
||||
X( mjtNum, tendon_solref_fri, ntendon, mjNREF ) \
|
||||
X( mjtNum, tendon_solimp_fri, ntendon, mjNIMP ) \
|
||||
X( mjtNum, tendon_range, ntendon, 2 ) \
|
||||
X( mjtNum, tendon_margin, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_stiffness, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_damping, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_frictionloss, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_lengthspring, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_length0, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_invweight0, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_user, ntendon, nuser_tendon) \
|
||||
X( float, tendon_rgba, ntendon, 4 ) \
|
||||
X( int, wrap_type, nwrap, 1 ) \
|
||||
X( int, wrap_objid, nwrap, 1 ) \
|
||||
X( mjtNum, wrap_prm, nwrap, 1 ) \
|
||||
X( int, actuator_trntype, nu, 1 ) \
|
||||
X( int, actuator_dyntype, nu, 1 ) \
|
||||
X( int, actuator_gaintype, nu, 1 ) \
|
||||
X( int, actuator_biastype, nu, 1 ) \
|
||||
X( int, actuator_trnid, nu, 2 ) \
|
||||
X( int, actuator_group, nu, 1 ) \
|
||||
X( mjtByte, actuator_ctrllimited, nu, 1 ) \
|
||||
X( mjtByte, actuator_forcelimited, nu, 1 ) \
|
||||
X( mjtNum, actuator_dynprm, nu, mjNDYN ) \
|
||||
X( mjtNum, actuator_gainprm, nu, mjNGAIN ) \
|
||||
X( mjtNum, actuator_biasprm, nu, mjNBIAS ) \
|
||||
X( mjtNum, actuator_ctrlrange, nu, 2 ) \
|
||||
X( mjtNum, actuator_forcerange, nu, 2 ) \
|
||||
X( mjtNum, actuator_gear, nu, 6 ) \
|
||||
X( mjtNum, actuator_cranklength, nu, 1 ) \
|
||||
X( mjtNum, actuator_acc0, nu, 1 ) \
|
||||
X( mjtNum, actuator_length0, nu, 1 ) \
|
||||
X( mjtNum, actuator_lengthrange, nu, 2 ) \
|
||||
X( mjtNum, actuator_user, nu, nuser_actuator) \
|
||||
X( int, sensor_type, nsensor, 1 ) \
|
||||
X( int, sensor_datatype, nsensor, 1 ) \
|
||||
X( int, sensor_needstage, nsensor, 1 ) \
|
||||
X( int, sensor_objtype, nsensor, 1 ) \
|
||||
X( int, sensor_objid, nsensor, 1 ) \
|
||||
X( int, sensor_dim, nsensor, 1 ) \
|
||||
X( int, sensor_adr, nsensor, 1 ) \
|
||||
X( mjtNum, sensor_cutoff, nsensor, 1 ) \
|
||||
X( mjtNum, sensor_noise, nsensor, 1 ) \
|
||||
X( mjtNum, sensor_user, nsensor, nuser_sensor) \
|
||||
X( int, numeric_adr, nnumeric, 1 ) \
|
||||
X( int, numeric_size, nnumeric, 1 ) \
|
||||
X( mjtNum, numeric_data, nnumericdata, 1 ) \
|
||||
X( int, text_adr, ntext, 1 ) \
|
||||
X( int, text_size, ntext, 1 ) \
|
||||
X( char, text_data, ntextdata, 1 ) \
|
||||
X( int, tuple_adr, ntuple, 1 ) \
|
||||
X( int, tuple_size, ntuple, 1 ) \
|
||||
X( int, tuple_objtype, ntupledata, 1 ) \
|
||||
X( int, tuple_objid, ntupledata, 1 ) \
|
||||
X( mjtNum, tuple_objprm, ntupledata, 1 ) \
|
||||
X( mjtNum, key_time, nkey, 1 ) \
|
||||
X( mjtNum, key_qpos, nkey, nq ) \
|
||||
X( mjtNum, key_qvel, nkey, nv ) \
|
||||
X( mjtNum, key_act, nkey, na ) \
|
||||
X( mjtNum, key_mpos, nkey, nmocap3 ) \
|
||||
X( mjtNum, key_mquat, nkey, nmocap4 ) \
|
||||
X( int, name_bodyadr, nbody, 1 ) \
|
||||
X( int, name_jntadr, njnt, 1 ) \
|
||||
X( int, name_geomadr, ngeom, 1 ) \
|
||||
X( int, name_siteadr, nsite, 1 ) \
|
||||
X( int, name_camadr, ncam, 1 ) \
|
||||
X( int, name_lightadr, nlight, 1 ) \
|
||||
X( int, name_meshadr, nmesh, 1 ) \
|
||||
X( int, name_skinadr, nskin, 1 ) \
|
||||
X( int, name_hfieldadr, nhfield, 1 ) \
|
||||
X( int, name_texadr, ntex, 1 ) \
|
||||
X( int, name_matadr, nmat, 1 ) \
|
||||
X( int, name_pairadr, npair, 1 ) \
|
||||
X( int, name_excludeadr, nexclude, 1 ) \
|
||||
X( int, name_eqadr, neq, 1 ) \
|
||||
X( int, name_tendonadr, ntendon, 1 ) \
|
||||
X( int, name_actuatoradr, nu, 1 ) \
|
||||
X( int, name_sensoradr, nsensor, 1 ) \
|
||||
X( int, name_numericadr, nnumeric, 1 ) \
|
||||
X( int, name_textadr, ntext, 1 ) \
|
||||
X( int, name_tupleadr, ntuple, 1 ) \
|
||||
X( int, name_keyadr, nkey, 1 ) \
|
||||
X( char, names, nnames, 1 )
|
||||
#define MJMODEL_POINTERS \
|
||||
X( mjtNum, qpos0, nq, 1 ) \
|
||||
X( mjtNum, qpos_spring, nq, 1 ) \
|
||||
X( int, body_parentid, nbody, 1 ) \
|
||||
X( int, body_rootid, nbody, 1 ) \
|
||||
X( int, body_weldid, nbody, 1 ) \
|
||||
X( int, body_mocapid, nbody, 1 ) \
|
||||
X( int, body_jntnum, nbody, 1 ) \
|
||||
X( int, body_jntadr, nbody, 1 ) \
|
||||
X( int, body_dofnum, nbody, 1 ) \
|
||||
X( int, body_dofadr, nbody, 1 ) \
|
||||
X( int, body_geomnum, nbody, 1 ) \
|
||||
X( int, body_geomadr, nbody, 1 ) \
|
||||
X( mjtByte, body_simple, nbody, 1 ) \
|
||||
X( mjtByte, body_sameframe, nbody, 1 ) \
|
||||
X( mjtNum, body_pos, nbody, 3 ) \
|
||||
X( mjtNum, body_quat, nbody, 4 ) \
|
||||
X( mjtNum, body_ipos, nbody, 3 ) \
|
||||
X( mjtNum, body_iquat, nbody, 4 ) \
|
||||
X( mjtNum, body_mass, nbody, 1 ) \
|
||||
X( mjtNum, body_subtreemass, nbody, 1 ) \
|
||||
X( mjtNum, body_inertia, nbody, 3 ) \
|
||||
X( mjtNum, body_invweight0, nbody, 2 ) \
|
||||
X( mjtNum, body_user, nbody, MJ_M(nuser_body) ) \
|
||||
X( int, jnt_type, njnt, 1 ) \
|
||||
X( int, jnt_qposadr, njnt, 1 ) \
|
||||
X( int, jnt_dofadr, njnt, 1 ) \
|
||||
X( int, jnt_bodyid, njnt, 1 ) \
|
||||
X( int, jnt_group, njnt, 1 ) \
|
||||
X( mjtByte, jnt_limited, njnt, 1 ) \
|
||||
X( mjtNum, jnt_solref, njnt, mjNREF ) \
|
||||
X( mjtNum, jnt_solimp, njnt, mjNIMP ) \
|
||||
X( mjtNum, jnt_pos, njnt, 3 ) \
|
||||
X( mjtNum, jnt_axis, njnt, 3 ) \
|
||||
X( mjtNum, jnt_stiffness, njnt, 1 ) \
|
||||
X( mjtNum, jnt_range, njnt, 2 ) \
|
||||
X( mjtNum, jnt_margin, njnt, 1 ) \
|
||||
X( mjtNum, jnt_user, njnt, MJ_M(nuser_jnt) ) \
|
||||
X( int, dof_bodyid, nv, 1 ) \
|
||||
X( int, dof_jntid, nv, 1 ) \
|
||||
X( int, dof_parentid, nv, 1 ) \
|
||||
X( int, dof_Madr, nv, 1 ) \
|
||||
X( int, dof_simplenum, nv, 1 ) \
|
||||
X( mjtNum, dof_solref, nv, mjNREF ) \
|
||||
X( mjtNum, dof_solimp, nv, mjNIMP ) \
|
||||
X( mjtNum, dof_frictionloss, nv, 1 ) \
|
||||
X( mjtNum, dof_armature, nv, 1 ) \
|
||||
X( mjtNum, dof_damping, nv, 1 ) \
|
||||
X( mjtNum, dof_invweight0, nv, 1 ) \
|
||||
X( mjtNum, dof_M0, nv, 1 ) \
|
||||
X( int, geom_type, ngeom, 1 ) \
|
||||
X( int, geom_contype, ngeom, 1 ) \
|
||||
X( int, geom_conaffinity, ngeom, 1 ) \
|
||||
X( int, geom_condim, ngeom, 1 ) \
|
||||
X( int, geom_bodyid, ngeom, 1 ) \
|
||||
X( int, geom_dataid, ngeom, 1 ) \
|
||||
X( int, geom_matid, ngeom, 1 ) \
|
||||
X( int, geom_group, ngeom, 1 ) \
|
||||
X( int, geom_priority, ngeom, 1 ) \
|
||||
X( mjtByte, geom_sameframe, ngeom, 1 ) \
|
||||
X( mjtNum, geom_solmix, ngeom, 1 ) \
|
||||
X( mjtNum, geom_solref, ngeom, mjNREF ) \
|
||||
X( mjtNum, geom_solimp, ngeom, mjNIMP ) \
|
||||
X( mjtNum, geom_size, ngeom, 3 ) \
|
||||
X( mjtNum, geom_rbound, ngeom, 1 ) \
|
||||
X( mjtNum, geom_pos, ngeom, 3 ) \
|
||||
X( mjtNum, geom_quat, ngeom, 4 ) \
|
||||
X( mjtNum, geom_friction, ngeom, 3 ) \
|
||||
X( mjtNum, geom_margin, ngeom, 1 ) \
|
||||
X( mjtNum, geom_gap, ngeom, 1 ) \
|
||||
X( mjtNum, geom_fluid, ngeom, mjNFLUID ) \
|
||||
X( mjtNum, geom_user, ngeom, MJ_M(nuser_geom) ) \
|
||||
X( float, geom_rgba, ngeom, 4 ) \
|
||||
X( int, site_type, nsite, 1 ) \
|
||||
X( int, site_bodyid, nsite, 1 ) \
|
||||
X( int, site_matid, nsite, 1 ) \
|
||||
X( int, site_group, nsite, 1 ) \
|
||||
X( mjtByte, site_sameframe, nsite, 1 ) \
|
||||
X( mjtNum, site_size, nsite, 3 ) \
|
||||
X( mjtNum, site_pos, nsite, 3 ) \
|
||||
X( mjtNum, site_quat, nsite, 4 ) \
|
||||
X( mjtNum, site_user, nsite, MJ_M(nuser_site) ) \
|
||||
X( float, site_rgba, nsite, 4 ) \
|
||||
X( int, cam_mode, ncam, 1 ) \
|
||||
X( int, cam_bodyid, ncam, 1 ) \
|
||||
X( int, cam_targetbodyid, ncam, 1 ) \
|
||||
X( mjtNum, cam_pos, ncam, 3 ) \
|
||||
X( mjtNum, cam_quat, ncam, 4 ) \
|
||||
X( mjtNum, cam_poscom0, ncam, 3 ) \
|
||||
X( mjtNum, cam_pos0, ncam, 3 ) \
|
||||
X( mjtNum, cam_mat0, ncam, 9 ) \
|
||||
X( mjtNum, cam_fovy, ncam, 1 ) \
|
||||
X( mjtNum, cam_ipd, ncam, 1 ) \
|
||||
X( mjtNum, cam_user, ncam, MJ_M(nuser_cam) ) \
|
||||
X( int, light_mode, nlight, 1 ) \
|
||||
X( int, light_bodyid, nlight, 1 ) \
|
||||
X( int, light_targetbodyid, nlight, 1 ) \
|
||||
X( mjtByte, light_directional, nlight, 1 ) \
|
||||
X( mjtByte, light_castshadow, nlight, 1 ) \
|
||||
X( mjtByte, light_active, nlight, 1 ) \
|
||||
X( mjtNum, light_pos, nlight, 3 ) \
|
||||
X( mjtNum, light_dir, nlight, 3 ) \
|
||||
X( mjtNum, light_poscom0, nlight, 3 ) \
|
||||
X( mjtNum, light_pos0, nlight, 3 ) \
|
||||
X( mjtNum, light_dir0, nlight, 3 ) \
|
||||
X( float, light_attenuation, nlight, 3 ) \
|
||||
X( float, light_cutoff, nlight, 1 ) \
|
||||
X( float, light_exponent, nlight, 1 ) \
|
||||
X( float, light_ambient, nlight, 3 ) \
|
||||
X( float, light_diffuse, nlight, 3 ) \
|
||||
X( float, light_specular, nlight, 3 ) \
|
||||
X( int, mesh_vertadr, nmesh, 1 ) \
|
||||
X( int, mesh_vertnum, nmesh, 1 ) \
|
||||
X( int, mesh_texcoordadr, nmesh, 1 ) \
|
||||
X( int, mesh_faceadr, nmesh, 1 ) \
|
||||
X( int, mesh_facenum, nmesh, 1 ) \
|
||||
X( int, mesh_graphadr, nmesh, 1 ) \
|
||||
X( float, mesh_vert, nmeshvert, 3 ) \
|
||||
X( float, mesh_normal, nmeshvert, 3 ) \
|
||||
X( float, mesh_texcoord, nmeshtexvert, 2 ) \
|
||||
X( int, mesh_face, nmeshface, 3 ) \
|
||||
X( int, mesh_graph, nmeshgraph, 1 ) \
|
||||
X( int, skin_matid, nskin, 1 ) \
|
||||
X( float, skin_rgba, nskin, 4 ) \
|
||||
X( float, skin_inflate, nskin, 1 ) \
|
||||
X( int, skin_vertadr, nskin, 1 ) \
|
||||
X( int, skin_vertnum, nskin, 1 ) \
|
||||
X( int, skin_texcoordadr, nskin, 1 ) \
|
||||
X( int, skin_faceadr, nskin, 1 ) \
|
||||
X( int, skin_facenum, nskin, 1 ) \
|
||||
X( int, skin_boneadr, nskin, 1 ) \
|
||||
X( int, skin_bonenum, nskin, 1 ) \
|
||||
X( float, skin_vert, nskinvert, 3 ) \
|
||||
X( float, skin_texcoord, nskintexvert, 2 ) \
|
||||
X( int, skin_face, nskinface, 3 ) \
|
||||
X( int, skin_bonevertadr, nskinbone, 1 ) \
|
||||
X( int, skin_bonevertnum, nskinbone, 1 ) \
|
||||
X( float, skin_bonebindpos, nskinbone, 3 ) \
|
||||
X( float, skin_bonebindquat, nskinbone, 4 ) \
|
||||
X( int, skin_bonebodyid, nskinbone, 1 ) \
|
||||
X( int, skin_bonevertid, nskinbonevert, 1 ) \
|
||||
X( float, skin_bonevertweight, nskinbonevert, 1 ) \
|
||||
X( mjtNum, hfield_size, nhfield, 4 ) \
|
||||
X( int, hfield_nrow, nhfield, 1 ) \
|
||||
X( int, hfield_ncol, nhfield, 1 ) \
|
||||
X( int, hfield_adr, nhfield, 1 ) \
|
||||
X( float, hfield_data, nhfielddata, 1 ) \
|
||||
X( int, tex_type, ntex, 1 ) \
|
||||
X( int, tex_height, ntex, 1 ) \
|
||||
X( int, tex_width, ntex, 1 ) \
|
||||
X( int, tex_adr, ntex, 1 ) \
|
||||
X( mjtByte, tex_rgb, ntexdata, 1 ) \
|
||||
X( int, mat_texid, nmat, 1 ) \
|
||||
X( mjtByte, mat_texuniform, nmat, 1 ) \
|
||||
X( float, mat_texrepeat, nmat, 2 ) \
|
||||
X( float, mat_emission, nmat, 1 ) \
|
||||
X( float, mat_specular, nmat, 1 ) \
|
||||
X( float, mat_shininess, nmat, 1 ) \
|
||||
X( float, mat_reflectance, nmat, 1 ) \
|
||||
X( float, mat_rgba, nmat, 4 ) \
|
||||
X( int, pair_dim, npair, 1 ) \
|
||||
X( int, pair_geom1, npair, 1 ) \
|
||||
X( int, pair_geom2, npair, 1 ) \
|
||||
X( int, pair_signature, npair, 1 ) \
|
||||
X( mjtNum, pair_solref, npair, mjNREF ) \
|
||||
X( mjtNum, pair_solimp, npair, mjNIMP ) \
|
||||
X( mjtNum, pair_margin, npair, 1 ) \
|
||||
X( mjtNum, pair_gap, npair, 1 ) \
|
||||
X( mjtNum, pair_friction, npair, 5 ) \
|
||||
X( int, exclude_signature, nexclude, 1 ) \
|
||||
X( int, eq_type, neq, 1 ) \
|
||||
X( int, eq_obj1id, neq, 1 ) \
|
||||
X( int, eq_obj2id, neq, 1 ) \
|
||||
X( mjtByte, eq_active, neq, 1 ) \
|
||||
X( mjtNum, eq_solref, neq, mjNREF ) \
|
||||
X( mjtNum, eq_solimp, neq, mjNIMP ) \
|
||||
X( mjtNum, eq_data, neq, mjNEQDATA ) \
|
||||
X( int, tendon_adr, ntendon, 1 ) \
|
||||
X( int, tendon_num, ntendon, 1 ) \
|
||||
X( int, tendon_matid, ntendon, 1 ) \
|
||||
X( int, tendon_group, ntendon, 1 ) \
|
||||
X( mjtByte, tendon_limited, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_width, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_solref_lim, ntendon, mjNREF ) \
|
||||
X( mjtNum, tendon_solimp_lim, ntendon, mjNIMP ) \
|
||||
X( mjtNum, tendon_solref_fri, ntendon, mjNREF ) \
|
||||
X( mjtNum, tendon_solimp_fri, ntendon, mjNIMP ) \
|
||||
X( mjtNum, tendon_range, ntendon, 2 ) \
|
||||
X( mjtNum, tendon_margin, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_stiffness, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_damping, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_frictionloss, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_lengthspring, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_length0, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_invweight0, ntendon, 1 ) \
|
||||
X( mjtNum, tendon_user, ntendon, MJ_M(nuser_tendon) ) \
|
||||
X( float, tendon_rgba, ntendon, 4 ) \
|
||||
X( int, wrap_type, nwrap, 1 ) \
|
||||
X( int, wrap_objid, nwrap, 1 ) \
|
||||
X( mjtNum, wrap_prm, nwrap, 1 ) \
|
||||
X( int, actuator_trntype, nu, 1 ) \
|
||||
X( int, actuator_dyntype, nu, 1 ) \
|
||||
X( int, actuator_gaintype, nu, 1 ) \
|
||||
X( int, actuator_biastype, nu, 1 ) \
|
||||
X( int, actuator_trnid, nu, 2 ) \
|
||||
X( int, actuator_group, nu, 1 ) \
|
||||
X( mjtByte, actuator_ctrllimited, nu, 1 ) \
|
||||
X( mjtByte, actuator_forcelimited, nu, 1 ) \
|
||||
X( mjtNum, actuator_dynprm, nu, mjNDYN ) \
|
||||
X( mjtNum, actuator_gainprm, nu, mjNGAIN ) \
|
||||
X( mjtNum, actuator_biasprm, nu, mjNBIAS ) \
|
||||
X( mjtNum, actuator_ctrlrange, nu, 2 ) \
|
||||
X( mjtNum, actuator_forcerange, nu, 2 ) \
|
||||
X( mjtNum, actuator_gear, nu, 6 ) \
|
||||
X( mjtNum, actuator_cranklength, nu, 1 ) \
|
||||
X( mjtNum, actuator_acc0, nu, 1 ) \
|
||||
X( mjtNum, actuator_length0, nu, 1 ) \
|
||||
X( mjtNum, actuator_lengthrange, nu, 2 ) \
|
||||
X( mjtNum, actuator_user, nu, MJ_M(nuser_actuator) ) \
|
||||
X( int, sensor_type, nsensor, 1 ) \
|
||||
X( int, sensor_datatype, nsensor, 1 ) \
|
||||
X( int, sensor_needstage, nsensor, 1 ) \
|
||||
X( int, sensor_objtype, nsensor, 1 ) \
|
||||
X( int, sensor_objid, nsensor, 1 ) \
|
||||
X( int, sensor_reftype, nsensor, 1 ) \
|
||||
X( int, sensor_refid, nsensor, 1 ) \
|
||||
X( int, sensor_dim, nsensor, 1 ) \
|
||||
X( int, sensor_adr, nsensor, 1 ) \
|
||||
X( mjtNum, sensor_cutoff, nsensor, 1 ) \
|
||||
X( mjtNum, sensor_noise, nsensor, 1 ) \
|
||||
X( mjtNum, sensor_user, nsensor, MJ_M(nuser_sensor) ) \
|
||||
X( int, numeric_adr, nnumeric, 1 ) \
|
||||
X( int, numeric_size, nnumeric, 1 ) \
|
||||
X( mjtNum, numeric_data, nnumericdata, 1 ) \
|
||||
X( int, text_adr, ntext, 1 ) \
|
||||
X( int, text_size, ntext, 1 ) \
|
||||
X( char, text_data, ntextdata, 1 ) \
|
||||
X( int, tuple_adr, ntuple, 1 ) \
|
||||
X( int, tuple_size, ntuple, 1 ) \
|
||||
X( int, tuple_objtype, ntupledata, 1 ) \
|
||||
X( int, tuple_objid, ntupledata, 1 ) \
|
||||
X( mjtNum, tuple_objprm, ntupledata, 1 ) \
|
||||
X( mjtNum, key_time, nkey, 1 ) \
|
||||
X( mjtNum, key_qpos, nkey, MJ_M(nq) ) \
|
||||
X( mjtNum, key_qvel, nkey, MJ_M(nv) ) \
|
||||
X( mjtNum, key_act, nkey, MJ_M(na) ) \
|
||||
X( mjtNum, key_mpos, nkey, MJ_M(nmocap)*3 ) \
|
||||
X( mjtNum, key_mquat, nkey, MJ_M(nmocap)*4 ) \
|
||||
X( int, name_bodyadr, nbody, 1 ) \
|
||||
X( int, name_jntadr, njnt, 1 ) \
|
||||
X( int, name_geomadr, ngeom, 1 ) \
|
||||
X( int, name_siteadr, nsite, 1 ) \
|
||||
X( int, name_camadr, ncam, 1 ) \
|
||||
X( int, name_lightadr, nlight, 1 ) \
|
||||
X( int, name_meshadr, nmesh, 1 ) \
|
||||
X( int, name_skinadr, nskin, 1 ) \
|
||||
X( int, name_hfieldadr, nhfield, 1 ) \
|
||||
X( int, name_texadr, ntex, 1 ) \
|
||||
X( int, name_matadr, nmat, 1 ) \
|
||||
X( int, name_pairadr, npair, 1 ) \
|
||||
X( int, name_excludeadr, nexclude, 1 ) \
|
||||
X( int, name_eqadr, neq, 1 ) \
|
||||
X( int, name_tendonadr, ntendon, 1 ) \
|
||||
X( int, name_actuatoradr, nu, 1 ) \
|
||||
X( int, name_sensoradr, nsensor, 1 ) \
|
||||
X( int, name_numericadr, nnumeric, 1 ) \
|
||||
X( int, name_textadr, ntext, 1 ) \
|
||||
X( int, name_tupleadr, ntuple, 1 ) \
|
||||
X( int, name_keyadr, nkey, 1 ) \
|
||||
X( char, names, nnames, 1 )
|
||||
|
||||
|
||||
|
||||
//-------------------------------- mjData -----------------------------------------------
|
||||
|
||||
//-------------------------------- mjData ----------------------------------------------------------
|
||||
|
||||
// define symbols needed in MJDATA_POINTERS (corresponding to number of columns)
|
||||
#define MJDATA_POINTERS_PREAMBLE( m ) \
|
||||
int nv = m->nv; \
|
||||
int nv = m->nv; \
|
||||
int njmax = m->njmax;
|
||||
|
||||
|
||||
// pointer fields of mjData
|
||||
#define MJDATA_POINTERS \
|
||||
X( mjtNum, qpos, nq, 1 ) \
|
||||
X( mjtNum, qvel, nv, 1 ) \
|
||||
X( mjtNum, act, na, 1 ) \
|
||||
X( mjtNum, qacc_warmstart, nv, 1 ) \
|
||||
X( mjtNum, ctrl, nu, 1 ) \
|
||||
X( mjtNum, qfrc_applied, nv, 1 ) \
|
||||
X( mjtNum, xfrc_applied, nbody, 6 ) \
|
||||
X( mjtNum, qacc, nv, 1 ) \
|
||||
X( mjtNum, act_dot, na, 1 ) \
|
||||
X( mjtNum, mocap_pos, nmocap, 3 ) \
|
||||
X( mjtNum, mocap_quat, nmocap, 4 ) \
|
||||
X( mjtNum, userdata, nuserdata, 1 ) \
|
||||
X( mjtNum, sensordata, nsensordata,1 ) \
|
||||
X( mjtNum, xpos, nbody, 3 ) \
|
||||
X( mjtNum, xquat, nbody, 4 ) \
|
||||
X( mjtNum, xmat, nbody, 9 ) \
|
||||
X( mjtNum, xipos, nbody, 3 ) \
|
||||
X( mjtNum, ximat, nbody, 9 ) \
|
||||
X( mjtNum, xanchor, njnt, 3 ) \
|
||||
X( mjtNum, xaxis, njnt, 3 ) \
|
||||
X( mjtNum, geom_xpos, ngeom, 3 ) \
|
||||
X( mjtNum, geom_xmat, ngeom, 9 ) \
|
||||
X( mjtNum, site_xpos, nsite, 3 ) \
|
||||
X( mjtNum, site_xmat, nsite, 9 ) \
|
||||
X( mjtNum, cam_xpos, ncam, 3 ) \
|
||||
X( mjtNum, cam_xmat, ncam, 9 ) \
|
||||
X( mjtNum, light_xpos, nlight, 3 ) \
|
||||
X( mjtNum, light_xdir, nlight, 3 ) \
|
||||
X( mjtNum, subtree_com, nbody, 3 ) \
|
||||
X( mjtNum, cdof, nv, 6 ) \
|
||||
X( mjtNum, cinert, nbody, 10 ) \
|
||||
X( int, ten_wrapadr, ntendon, 1 ) \
|
||||
X( int, ten_wrapnum, ntendon, 1 ) \
|
||||
X( int, ten_J_rownnz, ntendon, 1 ) \
|
||||
X( int, ten_J_rowadr, ntendon, 1 ) \
|
||||
X( int, ten_J_colind, ntendon, nv ) \
|
||||
X( mjtNum, ten_length, ntendon, 1 ) \
|
||||
X( mjtNum, ten_J, ntendon, nv ) \
|
||||
X( int, wrap_obj, nwrap, 2 ) \
|
||||
X( mjtNum, wrap_xpos, nwrap, 6 ) \
|
||||
X( mjtNum, actuator_length, nu, 1 ) \
|
||||
X( mjtNum, actuator_moment, nu, nv ) \
|
||||
X( mjtNum, crb, nbody, 10 ) \
|
||||
X( mjtNum, qM, nM, 1 ) \
|
||||
X( mjtNum, qLD, nM, 1 ) \
|
||||
X( mjtNum, qLDiagInv, nv, 1 ) \
|
||||
X( mjtNum, qLDiagSqrtInv, nv, 1 ) \
|
||||
X( mjContact, contact, nconmax, 1 ) \
|
||||
X( int, efc_type, njmax, 1 ) \
|
||||
X( int, efc_id, njmax, 1 ) \
|
||||
X( int, efc_J_rownnz, njmax, 1 ) \
|
||||
X( int, efc_J_rowadr, njmax, 1 ) \
|
||||
X( int, efc_J_rowsuper, njmax, 1 ) \
|
||||
X( int, efc_J_colind, njmax, nv ) \
|
||||
X( int, efc_JT_rownnz, nv, 1 ) \
|
||||
X( int, efc_JT_rowadr, nv, 1 ) \
|
||||
X( int, efc_JT_rowsuper, nv, 1 ) \
|
||||
X( int, efc_JT_colind, nv, njmax ) \
|
||||
X( mjtNum, efc_J, njmax, nv ) \
|
||||
X( mjtNum, efc_JT, nv, njmax ) \
|
||||
X( mjtNum, efc_pos, njmax, 1 ) \
|
||||
X( mjtNum, efc_margin, njmax, 1 ) \
|
||||
X( mjtNum, efc_frictionloss, njmax, 1 ) \
|
||||
X( mjtNum, efc_diagApprox, njmax, 1 ) \
|
||||
X( mjtNum, efc_KBIP, njmax, 4 ) \
|
||||
X( mjtNum, efc_D, njmax, 1 ) \
|
||||
X( mjtNum, efc_R, njmax, 1 ) \
|
||||
X( int, efc_AR_rownnz, njmax, 1 ) \
|
||||
X( int, efc_AR_rowadr, njmax, 1 ) \
|
||||
X( int, efc_AR_colind, njmax, njmax ) \
|
||||
X( mjtNum, efc_AR, njmax, njmax ) \
|
||||
X( mjtNum, ten_velocity, ntendon, 1 ) \
|
||||
X( mjtNum, actuator_velocity, nu, 1 ) \
|
||||
X( mjtNum, cvel, nbody, 6 ) \
|
||||
X( mjtNum, cdof_dot, nv, 6 ) \
|
||||
X( mjtNum, qfrc_bias, nv, 1 ) \
|
||||
X( mjtNum, qfrc_passive, nv, 1 ) \
|
||||
X( mjtNum, efc_vel, njmax, 1 ) \
|
||||
X( mjtNum, efc_aref, njmax, 1 ) \
|
||||
X( mjtNum, subtree_linvel, nbody, 3 ) \
|
||||
X( mjtNum, subtree_angmom, nbody, 3 ) \
|
||||
X( mjtNum, actuator_force, nu, 1 ) \
|
||||
X( mjtNum, qfrc_actuator, nv, 1 ) \
|
||||
X( mjtNum, qfrc_unc, nv, 1 ) \
|
||||
X( mjtNum, qacc_unc, nv, 1 ) \
|
||||
X( mjtNum, efc_b, njmax, 1 ) \
|
||||
X( mjtNum, efc_force, njmax, 1 ) \
|
||||
X( int, efc_state, njmax, 1 ) \
|
||||
X( mjtNum, qfrc_constraint, nv, 1 ) \
|
||||
X( mjtNum, qfrc_inverse, nv, 1 ) \
|
||||
X( mjtNum, cacc, nbody, 6 ) \
|
||||
X( mjtNum, cfrc_int, nbody, 6 ) \
|
||||
X( mjtNum, cfrc_ext, nbody, 6 )
|
||||
#define MJDATA_POINTERS \
|
||||
X( mjtNum, qpos, nq, 1 ) \
|
||||
X( mjtNum, qvel, nv, 1 ) \
|
||||
X( mjtNum, act, na, 1 ) \
|
||||
X( mjtNum, qacc_warmstart, nv, 1 ) \
|
||||
X( mjtNum, ctrl, nu, 1 ) \
|
||||
X( mjtNum, qfrc_applied, nv, 1 ) \
|
||||
X( mjtNum, xfrc_applied, nbody, 6 ) \
|
||||
X( mjtNum, mocap_pos, nmocap, 3 ) \
|
||||
X( mjtNum, mocap_quat, nmocap, 4 ) \
|
||||
X( mjtNum, qacc, nv, 1 ) \
|
||||
X( mjtNum, act_dot, na, 1 ) \
|
||||
X( mjtNum, userdata, nuserdata, 1 ) \
|
||||
X( mjtNum, sensordata, nsensordata, 1 ) \
|
||||
X( mjtNum, xpos, nbody, 3 ) \
|
||||
X( mjtNum, xquat, nbody, 4 ) \
|
||||
X( mjtNum, xmat, nbody, 9 ) \
|
||||
X( mjtNum, xipos, nbody, 3 ) \
|
||||
X( mjtNum, ximat, nbody, 9 ) \
|
||||
X( mjtNum, xanchor, njnt, 3 ) \
|
||||
X( mjtNum, xaxis, njnt, 3 ) \
|
||||
X( mjtNum, geom_xpos, ngeom, 3 ) \
|
||||
X( mjtNum, geom_xmat, ngeom, 9 ) \
|
||||
X( mjtNum, site_xpos, nsite, 3 ) \
|
||||
X( mjtNum, site_xmat, nsite, 9 ) \
|
||||
X( mjtNum, cam_xpos, ncam, 3 ) \
|
||||
X( mjtNum, cam_xmat, ncam, 9 ) \
|
||||
X( mjtNum, light_xpos, nlight, 3 ) \
|
||||
X( mjtNum, light_xdir, nlight, 3 ) \
|
||||
X( mjtNum, subtree_com, nbody, 3 ) \
|
||||
X( mjtNum, cdof, nv, 6 ) \
|
||||
X( mjtNum, cinert, nbody, 10 ) \
|
||||
X( int, ten_wrapadr, ntendon, 1 ) \
|
||||
X( int, ten_wrapnum, ntendon, 1 ) \
|
||||
X( int, ten_J_rownnz, ntendon, 1 ) \
|
||||
X( int, ten_J_rowadr, ntendon, 1 ) \
|
||||
X( int, ten_J_colind, ntendon, MJ_M(nv) ) \
|
||||
X( mjtNum, ten_length, ntendon, 1 ) \
|
||||
X( mjtNum, ten_J, ntendon, MJ_M(nv) ) \
|
||||
X( int, wrap_obj, nwrap, 2 ) \
|
||||
X( mjtNum, wrap_xpos, nwrap, 6 ) \
|
||||
X( mjtNum, actuator_length, nu, 1 ) \
|
||||
X( mjtNum, actuator_moment, nu, MJ_M(nv) ) \
|
||||
X( mjtNum, crb, nbody, 10 ) \
|
||||
X( mjtNum, qM, nM, 1 ) \
|
||||
X( mjtNum, qLD, nM, 1 ) \
|
||||
X( mjtNum, qLDiagInv, nv, 1 ) \
|
||||
X( mjtNum, qLDiagSqrtInv, nv, 1 ) \
|
||||
X( mjContact, contact, nconmax, 1 ) \
|
||||
X( int, efc_type, njmax, 1 ) \
|
||||
X( int, efc_id, njmax, 1 ) \
|
||||
X( int, efc_J_rownnz, njmax, 1 ) \
|
||||
X( int, efc_J_rowadr, njmax, 1 ) \
|
||||
X( int, efc_J_rowsuper, njmax, 1 ) \
|
||||
X( int, efc_J_colind, njmax, MJ_M(nv) ) \
|
||||
X( int, efc_JT_rownnz, nv, 1 ) \
|
||||
X( int, efc_JT_rowadr, nv, 1 ) \
|
||||
X( int, efc_JT_rowsuper, nv, 1 ) \
|
||||
X( int, efc_JT_colind, nv, MJ_M(njmax) ) \
|
||||
X( mjtNum, efc_J, njmax, MJ_M(nv) ) \
|
||||
X( mjtNum, efc_JT, nv, MJ_M(njmax) ) \
|
||||
X( mjtNum, efc_pos, njmax, 1 ) \
|
||||
X( mjtNum, efc_margin, njmax, 1 ) \
|
||||
X( mjtNum, efc_frictionloss, njmax, 1 ) \
|
||||
X( mjtNum, efc_diagApprox, njmax, 1 ) \
|
||||
X( mjtNum, efc_KBIP, njmax, 4 ) \
|
||||
X( mjtNum, efc_D, njmax, 1 ) \
|
||||
X( mjtNum, efc_R, njmax, 1 ) \
|
||||
X( int, efc_AR_rownnz, njmax, 1 ) \
|
||||
X( int, efc_AR_rowadr, njmax, 1 ) \
|
||||
X( int, efc_AR_colind, njmax, MJ_M(njmax) ) \
|
||||
X( mjtNum, efc_AR, njmax, MJ_M(njmax) ) \
|
||||
X( mjtNum, ten_velocity, ntendon, 1 ) \
|
||||
X( mjtNum, actuator_velocity, nu, 1 ) \
|
||||
X( mjtNum, cvel, nbody, 6 ) \
|
||||
X( mjtNum, cdof_dot, nv, 6 ) \
|
||||
X( mjtNum, qfrc_bias, nv, 1 ) \
|
||||
X( mjtNum, qfrc_passive, nv, 1 ) \
|
||||
X( mjtNum, efc_vel, njmax, 1 ) \
|
||||
X( mjtNum, efc_aref, njmax, 1 ) \
|
||||
X( mjtNum, subtree_linvel, nbody, 3 ) \
|
||||
X( mjtNum, subtree_angmom, nbody, 3 ) \
|
||||
X( mjtNum, actuator_force, nu, 1 ) \
|
||||
X( mjtNum, qfrc_actuator, nv, 1 ) \
|
||||
X( mjtNum, qfrc_unc, nv, 1 ) \
|
||||
X( mjtNum, qacc_unc, nv, 1 ) \
|
||||
X( mjtNum, efc_b, njmax, 1 ) \
|
||||
X( mjtNum, efc_force, njmax, 1 ) \
|
||||
X( int, efc_state, njmax, 1 ) \
|
||||
X( mjtNum, qfrc_constraint, nv, 1 ) \
|
||||
X( mjtNum, qfrc_inverse, nv, 1 ) \
|
||||
X( mjtNum, cacc, nbody, 6 ) \
|
||||
X( mjtNum, cfrc_int, nbody, 6 ) \
|
||||
X( mjtNum, cfrc_ext, nbody, 6 )
|
||||
|
||||
|
||||
// scalar fields of mjData
|
||||
@@ -539,4 +545,5 @@
|
||||
X( mjtNum, solver_fwdinv, 2, 1 ) \
|
||||
X( mjtNum, energy, 2, 1 )
|
||||
|
||||
|
||||
#endif // MUJOCO_MJXMACRO_H_
|
||||
|
||||
+48
-39
@@ -15,7 +15,7 @@
|
||||
#ifndef MUJOCO_MUJOCO_H_
|
||||
#define MUJOCO_MUJOCO_H_
|
||||
|
||||
#include "mujoco_export.h"
|
||||
#include <mjexport.h>
|
||||
|
||||
|
||||
// this is a C-API
|
||||
@@ -24,7 +24,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
// header version; should match the library version as returned by mj_version()
|
||||
#define mjVERSION_HEADER 211
|
||||
#define mjVERSION_HEADER 212
|
||||
|
||||
// needed to define size_t, fabs and log10
|
||||
#include "stdlib.h"
|
||||
@@ -32,11 +32,12 @@ extern "C" {
|
||||
|
||||
|
||||
// type definitions
|
||||
#include "mjmodel.h"
|
||||
#include "mjdata.h"
|
||||
#include "mjvisualize.h"
|
||||
#include "mjrender.h"
|
||||
#include "mjui.h"
|
||||
#include <mjdata.h>
|
||||
#include <mjmodel.h>
|
||||
#include <mjrender.h>
|
||||
#include <mjtnum.h>
|
||||
#include <mjui.h>
|
||||
#include <mjvisualize.h>
|
||||
|
||||
|
||||
// macros
|
||||
@@ -186,9 +187,11 @@ MJAPI void mj_deleteModel(mjModel* m);
|
||||
MJAPI int mj_sizeModel(const mjModel* m);
|
||||
|
||||
// Allocate mjData correponding to given model.
|
||||
// If the model buffer is unallocated the initial configuration will not be set.
|
||||
MJAPI mjData* mj_makeData(const mjModel* m);
|
||||
|
||||
// Copy mjData.
|
||||
// m is only required to contain the size fields from MJMODEL_INTS.
|
||||
MJAPI mjData* mj_copyData(mjData* dest, const mjModel* m, const mjData* src);
|
||||
|
||||
// Reset data to defaults.
|
||||
@@ -220,13 +223,18 @@ MJAPI int mj_setLengthRange(mjModel* m, mjData* d, int index,
|
||||
//---------------------------------- Printing ------------------------------------------------------
|
||||
|
||||
// Print mjModel to text file, specifying format.
|
||||
// float_format_str 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_printFormattedModel(const mjModel* m, const char* filename,
|
||||
const char* float_format_str);
|
||||
const char* float_format);
|
||||
|
||||
// Print model to text file.
|
||||
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
|
||||
MJAPI void mj_printFormattedData(const mjModel* m, mjData* d, const char* filename,
|
||||
const char* float_format);
|
||||
|
||||
// Print data to text file.
|
||||
MJAPI void mj_printData(const mjModel* m, mjData* d, const char* filename);
|
||||
|
||||
@@ -358,7 +366,7 @@ 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.
|
||||
MJAPI void mj_constraintUpdate(const mjModel* m, mjData* d, const mjtNum* jar,
|
||||
mjtNum* cost, int flg_coneHessian);
|
||||
mjtNum cost[1], int flg_coneHessian);
|
||||
|
||||
|
||||
//---------------------------------- Support -------------------------------------------------------
|
||||
@@ -429,19 +437,19 @@ MJAPI void mj_addM(const mjModel* m, mjData* d, mjtNum* dst,
|
||||
|
||||
// Apply cartesian force and torque (outside xfrc_applied mechanism).
|
||||
MJAPI void mj_applyFT(const mjModel* m, mjData* d,
|
||||
const mjtNum* force, const mjtNum* torque,
|
||||
const mjtNum* point, int body, mjtNum* qfrc_target);
|
||||
const mjtNum force[3], const mjtNum torque[3],
|
||||
const mjtNum point[3], int body, mjtNum* qfrc_target);
|
||||
|
||||
// Compute object 6D velocity in object-centered frame, world/local orientation.
|
||||
MJAPI void mj_objectVelocity(const mjModel* m, const mjData* d,
|
||||
int objtype, int objid, mjtNum* res, int flg_local);
|
||||
int objtype, int objid, mjtNum res[6], int flg_local);
|
||||
|
||||
// Compute object 6D acceleration in object-centered frame, world/local orientation.
|
||||
MJAPI void mj_objectAcceleration(const mjModel* m, const mjData* d,
|
||||
int objtype, int objid, mjtNum* res, int flg_local);
|
||||
int objtype, int objid, mjtNum res[6], int flg_local);
|
||||
|
||||
// Extract 6D force:torque given contact id, in the contact frame.
|
||||
MJAPI void mj_contactForce(const mjModel* m, const mjData* d, int id, mjtNum* result);
|
||||
MJAPI void mj_contactForce(const mjModel* m, const mjData* d, int id, mjtNum result[6]);
|
||||
|
||||
// Compute velocity by finite-differencing two positions.
|
||||
MJAPI void mj_differentiatePos(const mjModel* m, mjtNum* qvel, mjtNum dt,
|
||||
@@ -454,8 +462,8 @@ MJAPI void mj_integratePos(const mjModel* m, mjtNum* qpos, const mjtNum* qvel, m
|
||||
MJAPI void mj_normalizeQuat(const mjModel* m, mjtNum* qpos);
|
||||
|
||||
// Map from body local to global Cartesian coordinates.
|
||||
MJAPI void mj_local2Global(mjData* d, mjtNum* xpos, mjtNum* xmat,
|
||||
const mjtNum* pos, const mjtNum* quat,
|
||||
MJAPI void mj_local2Global(mjData* d, mjtNum xpos[3], mjtNum xmat[9],
|
||||
const mjtNum pos[3], const mjtNum quat[4],
|
||||
int body, mjtByte sameframe);
|
||||
|
||||
// Sum all body masses.
|
||||
@@ -474,27 +482,28 @@ MJAPI const char* mj_versionString();
|
||||
//---------------------------------- Ray collisions ------------------------------------------------
|
||||
|
||||
// Intersect ray (pnt+x*vec, x>=0) with visible geoms, except geoms in bodyexclude.
|
||||
// Return geomid and distance (x) to nearest surface, or -1 if no intersection.
|
||||
// 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.
|
||||
MJAPI mjtNum mj_ray(const mjModel* m, const mjData* d, const mjtNum* pnt, const mjtNum* vec,
|
||||
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);
|
||||
int geomid[1]);
|
||||
|
||||
// Interect ray with hfield, return nearest distance or -1 if no intersection.
|
||||
MJAPI mjtNum mj_rayHfield(const mjModel* m, const mjData* d, int geomid,
|
||||
const mjtNum* pnt, const mjtNum* vec);
|
||||
const mjtNum pnt[3], const mjtNum vec[3]);
|
||||
|
||||
// Interect ray with mesh, return nearest distance or -1 if no intersection.
|
||||
MJAPI mjtNum mj_rayMesh(const mjModel* m, const mjData* d, int geomid,
|
||||
const mjtNum* pnt, const mjtNum* vec);
|
||||
const mjtNum pnt[3], const mjtNum vec[3]);
|
||||
|
||||
// Interect ray with pure geom, return nearest distance or -1 if no intersection.
|
||||
MJAPI mjtNum mju_rayGeom(const mjtNum* pos, const mjtNum* mat, const mjtNum* size,
|
||||
const mjtNum* pnt, const mjtNum* vec, int geomtype);
|
||||
MJAPI 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);
|
||||
|
||||
// Interect ray with skin, return nearest vertex id.
|
||||
// Interect ray with skin, return nearest distance or -1 if no intersection,
|
||||
// and also output nearest vertex id.
|
||||
MJAPI mjtNum mju_raySkin(int nface, int nvert, const int* face, const float* vert,
|
||||
const mjtNum* pnt, const mjtNum* vec, int* vertid);
|
||||
const mjtNum pnt[3], const mjtNum vec[3], int vertid[1]);
|
||||
|
||||
|
||||
//---------------------------------- Interaction ---------------------------------------------------
|
||||
@@ -506,26 +515,26 @@ MJAPI void mjv_defaultCamera(mjvCamera* cam);
|
||||
MJAPI void mjv_defaultPerturb(mjvPerturb* pert);
|
||||
|
||||
// Transform pose from room to model space.
|
||||
MJAPI void mjv_room2model(mjtNum* modelpos, mjtNum* modelquat, const mjtNum* roompos,
|
||||
const mjtNum* roomquat, const mjvScene* scn);
|
||||
MJAPI void mjv_room2model(mjtNum modelpos[3], mjtNum modelquat[4], const mjtNum roompos[3],
|
||||
const mjtNum roomquat[4], const mjvScene* scn);
|
||||
|
||||
// Transform pose from model to room space.
|
||||
MJAPI void mjv_model2room(mjtNum* roompos, mjtNum* roomquat, const mjtNum* modelpos,
|
||||
const mjtNum* modelquat, const mjvScene* scn);
|
||||
MJAPI void mjv_model2room(mjtNum roompos[3], mjtNum roomquat[4], const mjtNum modelpos[3],
|
||||
const mjtNum modelquat[4], const mjvScene* scn);
|
||||
|
||||
// Get camera info in model space; average left and right OpenGL cameras.
|
||||
MJAPI void mjv_cameraInModel(mjtNum* headpos, mjtNum* forward, mjtNum* up,
|
||||
MJAPI void mjv_cameraInModel(mjtNum headpos[3], mjtNum forward[3], mjtNum up[3],
|
||||
const mjvScene* scn);
|
||||
|
||||
// Get camera info in room space; average left and right OpenGL cameras.
|
||||
MJAPI void mjv_cameraInRoom(mjtNum* headpos, mjtNum* forward, mjtNum* up,
|
||||
MJAPI void mjv_cameraInRoom(mjtNum headpos[3], mjtNum forward[3], mjtNum up[3],
|
||||
const mjvScene* scn);
|
||||
|
||||
// Get frustum height at unit distance from camera; average left and right OpenGL cameras.
|
||||
MJAPI mjtNum mjv_frustumHeight(const mjvScene* scn);
|
||||
|
||||
// Rotate 3D vec in horizontal plane by angle between (0,1) and (forward_x,forward_y).
|
||||
MJAPI void mjv_alignToCamera(mjtNum* res, const mjtNum* vec, const mjtNum* forward);
|
||||
MJAPI void mjv_alignToCamera(mjtNum res[3], const mjtNum vec[3], const mjtNum forward[3]);
|
||||
|
||||
// Move camera with mouse; action is mjtMouse.
|
||||
MJAPI void mjv_moveCamera(const mjModel* m, int action, mjtNum reldx, mjtNum reldy,
|
||||
@@ -537,7 +546,7 @@ MJAPI void mjv_movePerturb(const mjModel* m, const mjData* d, int action, mjtNum
|
||||
|
||||
// Move model with mouse; action is mjtMouse.
|
||||
MJAPI void mjv_moveModel(const mjModel* m, int action, mjtNum reldx, mjtNum reldy,
|
||||
const mjtNum* roomup, mjvScene* scn);
|
||||
const mjtNum roomup[3], mjvScene* scn);
|
||||
|
||||
// Copy perturb pos,quat from selected body; set scale for perturbation.
|
||||
MJAPI void mjv_initPerturb(const mjModel* m, const mjData* d,
|
||||
@@ -557,7 +566,7 @@ MJAPI mjvGLCamera mjv_averageCamera(const mjvGLCamera* cam1, const mjvGLCamera*
|
||||
// Select geom or skin with mouse, return bodyid; -1: none selected.
|
||||
MJAPI int mjv_select(const mjModel* m, const mjData* d, const mjvOption* vopt,
|
||||
mjtNum aspectratio, mjtNum relx, mjtNum rely,
|
||||
const mjvScene* scn, mjtNum* selpnt, int* geomid, int* skinid);
|
||||
const mjvScene* scn, mjtNum selpnt[3], int geomid[1], int skinid[1]);
|
||||
|
||||
|
||||
//---------------------------------- Visualization -------------------------------------------------
|
||||
@@ -569,8 +578,8 @@ 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.
|
||||
MJAPI void mjv_initGeom(mjvGeom* geom, int type, const mjtNum* size,
|
||||
const mjtNum* pos, const mjtNum* mat, const float* 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]);
|
||||
|
||||
// Set (type, size, pos, mat) for connector-type geom between given points.
|
||||
// Assume that mjv_initGeom was already called to set all other properties.
|
||||
@@ -994,7 +1003,7 @@ MJAPI void mju_trnVecPose(mjtNum res[3], const mjtNum pos[3], const mjtNum quat[
|
||||
|
||||
//--------------------------------- Decompositions -------------------------------------------------
|
||||
|
||||
// Cholesky decomposition: mat = L*L'; return rank.
|
||||
// Cholesky decomposition: mat = L*L'; return rank, decomposition performed in-place into mat.
|
||||
MJAPI int mju_cholFactor(mjtNum* mat, int n, mjtNum mindiag);
|
||||
|
||||
// Solve mat * res = vec, where mat is Cholesky-factorized
|
||||
@@ -1004,7 +1013,7 @@ MJAPI void mju_cholSolve(mjtNum* res, const mjtNum* mat, const mjtNum* vec, int
|
||||
MJAPI int mju_cholUpdate(mjtNum* mat, mjtNum* x, int n, int flg_plus);
|
||||
|
||||
// Eigenvalue decomposition of symmetric 3x3 matrix.
|
||||
MJAPI int mju_eig3(mjtNum* eigval, mjtNum* eigvec, mjtNum* quat, const mjtNum* mat);
|
||||
MJAPI int mju_eig3(mjtNum eigval[3], mjtNum eigvec[9], mjtNum quat[4], const mjtNum mat[9]);
|
||||
|
||||
|
||||
//---------------------- Miscellaneous --------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user