Add control plugin API.
PiperOrigin-RevId: 493311715 Change-Id: Iccd99fb26004f39832818e378f01f9149a0e3e3b
This commit is contained in:
committed by
Copybara-Service
parent
60fbb77b2a
commit
e4f1d584ad
@@ -1148,18 +1148,19 @@ struct mjModel_ {
|
||||
char* names; // names of all objects, 0-terminated (nnames x 1)
|
||||
};
|
||||
typedef struct mjModel_ mjModel;
|
||||
typedef enum mjtPluginTypeBit_ {
|
||||
typedef enum mjtPluginCapabilityBit_ {
|
||||
mjPLUGIN_ACTUATOR = 1<<0,
|
||||
mjPLUGIN_SENSOR = 1<<1,
|
||||
mjPLUGIN_PASSIVE = 1<<2,
|
||||
} mjtPluginTypeBit;
|
||||
mjPLUGIN_CONTROL = 1<<3,
|
||||
} mjtPluginCapabilityBit;
|
||||
struct mjpPlugin_ {
|
||||
const char* name; // globally unique name identifying the plugin
|
||||
|
||||
int nattribute; // number of configuration attributes
|
||||
const char* const* attributes; // name of configuration attributes
|
||||
|
||||
int type; // bitfield of mjtPluginTypeBits specifying the plugin type
|
||||
int capabilities; // bitfield of mjtPluginCapabilityBit specifying optional plugin capabilities
|
||||
int needstage; // an mjtStage enum value specifying the sensor computation stage
|
||||
|
||||
// number of mjtNums needed to store the state of a plugin instance (required)
|
||||
@@ -1181,10 +1182,13 @@ struct mjpPlugin_ {
|
||||
void (*reset)(const mjModel* m, mjData* d, int instance);
|
||||
|
||||
// called when the plugin needs to update its outputs (required)
|
||||
void (*compute)(const mjModel* m, mjData* d, int instance, int type);
|
||||
void (*compute)(const mjModel* m, mjData* d, int instance, int capability_bit);
|
||||
|
||||
// called when time integration occurs (optional)
|
||||
void (*advance)(const mjModel* m, mjData* d, int instance);
|
||||
|
||||
// called by mjv_updateScene (optional)
|
||||
void (*visualize)(const mjModel*m, mjData* d, mjvScene* scn, int instance);
|
||||
};
|
||||
typedef struct mjpPlugin_ mjpPlugin;
|
||||
typedef enum mjtGridPos_ { // grid position for overlay
|
||||
|
||||
Reference in New Issue
Block a user