Replace name attribute with setters and getters in the C API of mjSpec.
PiperOrigin-RevId: 778816015 Change-Id: Ieffb7a5bce37e887ff009f9a02d2434435e79ca1
This commit is contained in:
committed by
Copybara-Service
parent
1c5d47c94b
commit
594e17074a
@@ -4228,6 +4228,15 @@ Return spec's next element; return NULL if element is last.
|
||||
|
||||
Attribute setters
|
||||
^^^^^^^^^^^^^^^^^
|
||||
.. _mjs_setName:
|
||||
|
||||
`mjs_setName <#mjs_setName>`__
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mjs_setName
|
||||
|
||||
Set element's name.
|
||||
|
||||
.. _mjs_setBuffer:
|
||||
|
||||
`mjs_setBuffer <#mjs_setBuffer>`__
|
||||
@@ -4331,6 +4340,15 @@ Set plugin attributes.
|
||||
|
||||
Attribute getters
|
||||
^^^^^^^^^^^^^^^^^
|
||||
.. _mjs_getName:
|
||||
|
||||
`mjs_getName <#mjs_getName>`__
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mjs_getName
|
||||
|
||||
Get element's name.
|
||||
|
||||
.. _mjs_getString:
|
||||
|
||||
`mjs_getString <#mjs_getString>`__
|
||||
|
||||
@@ -1875,7 +1875,6 @@ typedef struct mjsPlugin_ { // plugin specification
|
||||
} mjsPlugin;
|
||||
typedef struct mjsBody_ { // body specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjString* childclass; // childclass name
|
||||
|
||||
// body frame
|
||||
@@ -1901,7 +1900,6 @@ typedef struct mjsBody_ { // body specification
|
||||
} mjsBody;
|
||||
typedef struct mjsFrame_ { // frame specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjString* childclass; // childclass name
|
||||
double pos[3]; // position
|
||||
double quat[4]; // orientation
|
||||
@@ -1910,7 +1908,6 @@ typedef struct mjsFrame_ { // frame specification
|
||||
} mjsFrame;
|
||||
typedef struct mjsJoint_ { // joint specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjtJoint type; // joint type
|
||||
|
||||
// kinematics
|
||||
@@ -1948,7 +1945,6 @@ typedef struct mjsJoint_ { // joint specification
|
||||
} mjsJoint;
|
||||
typedef struct mjsGeom_ { // geom specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjtGeom type; // geom type
|
||||
|
||||
// frame, size
|
||||
@@ -1994,7 +1990,6 @@ typedef struct mjsGeom_ { // geom specification
|
||||
} mjsGeom;
|
||||
typedef struct mjsSite_ { // site specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
|
||||
// frame, size
|
||||
double pos[3]; // position
|
||||
@@ -2015,7 +2010,6 @@ typedef struct mjsSite_ { // site specification
|
||||
} mjsSite;
|
||||
typedef struct mjsCamera_ { // camera specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
|
||||
// extrinsics
|
||||
double pos[3]; // position
|
||||
@@ -2042,7 +2036,6 @@ typedef struct mjsCamera_ { // camera specification
|
||||
} mjsCamera;
|
||||
typedef struct mjsLight_ { // light specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
|
||||
// frame
|
||||
double pos[3]; // position
|
||||
@@ -2070,7 +2063,6 @@ typedef struct mjsLight_ { // light specification
|
||||
} mjsLight;
|
||||
typedef struct mjsFlex_ { // flex specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
|
||||
// contact properties
|
||||
int contype; // contact type
|
||||
@@ -2117,7 +2109,6 @@ typedef struct mjsFlex_ { // flex specification
|
||||
} mjsFlex;
|
||||
typedef struct mjsMesh_ { // mesh specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjString* content_type; // content type of file
|
||||
mjString* file; // mesh file
|
||||
double refpos[3]; // reference position
|
||||
@@ -2136,7 +2127,6 @@ typedef struct mjsMesh_ { // mesh specification
|
||||
} mjsMesh;
|
||||
typedef struct mjsHField_ { // height field specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjString* content_type; // content type of file
|
||||
mjString* file; // file: (nrow, ncol, [elevation data])
|
||||
double size[4]; // hfield size (ignore referencing geom size)
|
||||
@@ -2147,7 +2137,6 @@ typedef struct mjsHField_ { // height field specification
|
||||
} mjsHField;
|
||||
typedef struct mjsSkin_ { // skin specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjString* file; // skin file
|
||||
mjString* material; // name of material used for rendering
|
||||
float rgba[4]; // rgba when material is omitted
|
||||
@@ -2171,7 +2160,6 @@ typedef struct mjsSkin_ { // skin specification
|
||||
} mjsSkin;
|
||||
typedef struct mjsTexture_ { // texture specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjtTexture type; // texture type
|
||||
mjtColorSpace colorspace; // colorspace
|
||||
|
||||
@@ -2207,7 +2195,6 @@ typedef struct mjsTexture_ { // texture specification
|
||||
} mjsTexture;
|
||||
typedef struct mjsMaterial_ { // material specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjStringVec* textures; // names of textures (empty: none)
|
||||
mjtByte texuniform; // make texture cube uniform
|
||||
float texrepeat[2]; // texture repetition for 2D mapping
|
||||
@@ -2222,7 +2209,6 @@ typedef struct mjsMaterial_ { // material specification
|
||||
} mjsMaterial;
|
||||
typedef struct mjsPair_ { // pair specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjString* geomname1; // name of geom 1
|
||||
mjString* geomname2; // name of geom 2
|
||||
|
||||
@@ -2238,14 +2224,12 @@ typedef struct mjsPair_ { // pair specification
|
||||
} mjsPair;
|
||||
typedef struct mjsExclude_ { // exclude specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjString* bodyname1; // name of geom 1
|
||||
mjString* bodyname2; // name of geom 2
|
||||
mjString* info; // message appended to errors
|
||||
} mjsExclude;
|
||||
typedef struct mjsEquality_ { // equality specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjtEq type; // constraint type
|
||||
double data[mjNEQDATA]; // type-dependent data
|
||||
mjtByte active; // is equality initially active
|
||||
@@ -2258,7 +2242,6 @@ typedef struct mjsEquality_ { // equality specification
|
||||
} mjsEquality;
|
||||
typedef struct mjsTendon_ { // tendon specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
|
||||
// stiffness, damping, friction, armature
|
||||
double stiffness; // stiffness coefficient
|
||||
@@ -2294,7 +2277,6 @@ typedef struct mjsWrap_ { // wrapping object specification
|
||||
} mjsWrap;
|
||||
typedef struct mjsActuator_ { // actuator specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
|
||||
// gain, bias
|
||||
mjtGain gaintype; // gain type
|
||||
@@ -2334,7 +2316,6 @@ typedef struct mjsActuator_ { // actuator specification
|
||||
} mjsActuator;
|
||||
typedef struct mjsSensor_ { // sensor specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
|
||||
// sensor definition
|
||||
mjtSensor type; // type of sensor
|
||||
@@ -2359,20 +2340,17 @@ typedef struct mjsSensor_ { // sensor specification
|
||||
} mjsSensor;
|
||||
typedef struct mjsNumeric_ { // custom numeric field specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjDoubleVec* data; // initialization data
|
||||
int size; // array size, can be bigger than data size
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsNumeric;
|
||||
typedef struct mjsText_ { // custom text specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjString* data; // text string
|
||||
mjString* info; // message appended to compiler errors
|
||||
} mjsText;
|
||||
typedef struct mjsTuple_ { // tuple specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
mjIntVec* objtype; // object types
|
||||
mjStringVec* objname; // object names
|
||||
mjDoubleVec* objprm; // object parameters
|
||||
@@ -2380,7 +2358,6 @@ typedef struct mjsTuple_ { // tuple specification
|
||||
} mjsTuple;
|
||||
typedef struct mjsKey_ { // keyframe specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // name
|
||||
double time; // time
|
||||
mjDoubleVec* qpos; // qpos
|
||||
mjDoubleVec* qvel; // qvel
|
||||
@@ -2392,7 +2369,6 @@ typedef struct mjsKey_ { // keyframe specification
|
||||
} mjsKey;
|
||||
typedef struct mjsDefault_ { // default specification
|
||||
mjsElement* element; // element type
|
||||
mjString* name; // class name
|
||||
mjsJoint* joint; // joint defaults
|
||||
mjsGeom* geom; // geom defaults
|
||||
mjsSite* site; // site defaults
|
||||
@@ -3480,6 +3456,7 @@ mjsElement* mjs_firstChild(mjsBody* body, mjtObj type, int recurse);
|
||||
mjsElement* mjs_nextChild(mjsBody* body, mjsElement* child, int recurse);
|
||||
mjsElement* mjs_firstElement(mjSpec* s, mjtObj type);
|
||||
mjsElement* mjs_nextElement(mjSpec* s, mjsElement* element);
|
||||
void 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);
|
||||
@@ -3491,6 +3468,7 @@ void mjs_setFloat(mjFloatVec* dest, const float* array, int size);
|
||||
void mjs_appendFloatVec(mjFloatVecVec* dest, const float* array, int size);
|
||||
void mjs_setDouble(mjDoubleVec* dest, const double* array, int size);
|
||||
void mjs_setPluginAttributes(mjsPlugin* plugin, void* attributes);
|
||||
mjString* mjs_getName(mjsElement* element);
|
||||
const char* mjs_getString(const mjString* source);
|
||||
const double* mjs_getDouble(const mjDoubleVec* source, int* size);
|
||||
const void* mjs_getPluginAttributes(const mjsPlugin* plugin);
|
||||
|
||||
Reference in New Issue
Block a user