- Added passive forces plugins

- Added new `cable` composite type:
  * The `initial` parameter specifies the joint at the starting boundary: `free`, `ball`, or `none`.
  * The boundary bodies are exposed with the names:`B_left` and `B_right`.
  * The vertex initial positions can be specified directly in the XML with the parameter `vertex`.
  * The orientation of the body frame **is** the orientation of the material frame of the curve.

- Added new `cable` passive force plugin:
  * Twist and bending stiffness can be set separately with the parameters `twist` and `bend`.
  * The stress-free configuration can be set to be the initial one or flat with the flag `flat`.
  * New cable example showing the formation of plectoneme.
  * New coil example.
  * New belt example showing interaction between twist and anisotropy.
  * Added test using cantilever exact solution.

PiperOrigin-RevId: 480033694
Change-Id: I491271bce8fccb185961477e903e5a72d172c8a3
This commit is contained in:
Alessio Quaglino
2022-10-10 02:45:59 -07:00
committed by Copybara-Service
parent 794ef0b771
commit e250ff0d5a
34 changed files with 1564 additions and 72 deletions
+4 -2
View File
@@ -632,6 +632,7 @@ struct mjModel_ {
mjtNum* body_inertia; // diagonal inertia in ipos/iquat frame (nbody x 3)
mjtNum* body_invweight0; // mean inv inert in qpos0 (trn, rot) (nbody x 2)
mjtNum* body_user; // user data (nbody x nuser_body)
int* body_plugin; // plugin instance id (-1 if not in use) (nbody x 1)
// joints
int* jnt_type; // type of joint (mjtJoint) (njnt x 1)
@@ -864,7 +865,7 @@ struct mjModel_ {
mjtNum* actuator_length0; // actuator length in qpos0 (nu x 1)
mjtNum* actuator_lengthrange; // feasible actuator length range (nu x 2)
mjtNum* actuator_user; // user data (nu x nuser_actuator)
int* actuator_plugin; // plugin instance id; -1: not a plugin actuator (nu x 1)
int* actuator_plugin; // plugin instance id; -1: not a plugin (nu x 1)
// sensors
int* sensor_type; // sensor type (mjtSensor) (nsensor x 1)
@@ -879,11 +880,12 @@ struct mjModel_ {
mjtNum* sensor_cutoff; // cutoff for real and positive; 0: ignore (nsensor x 1)
mjtNum* sensor_noise; // noise standard deviation (nsensor x 1)
mjtNum* sensor_user; // user data (nsensor x nuser_sensor)
int* sensor_plugin; // plugin instance id; -1: not a plugin sensor (nsensor x 1)
int* sensor_plugin; // plugin instance id; -1: not a plugin (nsensor x 1)
// plugin instances
int* plugin; // globally registered plugin slot number (nplugin x 1)
int* plugin_stateadr; // address in the plugin state array (nplugin x 1)
int* plugin_statenum; // number of states in the plugin instance (nplugin x 1)
char* plugin_attr; // config attributes of plugin instances (npluginattr x 1)
int* plugin_attradr; // address to each instance's config attrib (nplugin x 1)
+4 -3
View File
@@ -20,7 +20,8 @@
typedef enum mjtPluginTypeBit_ {
mjPLUGIN_ACTUATOR = 1<<0,
mjPLUGIN_SENSOR = 1<<1
mjPLUGIN_SENSOR = 1<<1,
mjPLUGIN_PASSIVE = 1<<2,
} mjtPluginTypeBit;
struct mjpPlugin_ {
@@ -38,8 +39,8 @@ struct mjpPlugin_ {
// dimension of the specified sensor's output (required only for sensor plugins)
int (*nsensordata)(const mjModel* m, int instance, int sensor_id);
// called when a new mjData is being created (required)
void (*init)(const mjModel* m, mjData* d, int instance);
// called when a new mjData is being created (required), returns 0 on success or -1 on failure
int (*init)(const mjModel* m, mjData* d, int instance);
// called when an mjData is being freed (optional)
void (*destroy)(mjData* d, int instance);
+2
View File
@@ -171,6 +171,7 @@
X( mjtNum, body_inertia, nbody, 3 ) \
X( mjtNum, body_invweight0, nbody, 2 ) \
X( mjtNum, body_user, nbody, MJ_M(nuser_body) ) \
X( int, body_plugin, nbody, 1 ) \
X( int, jnt_type, njnt, 1 ) \
X( int, jnt_qposadr, njnt, 1 ) \
X( int, jnt_dofadr, njnt, 1 ) \
@@ -385,6 +386,7 @@
X( int, sensor_plugin, nsensor, 1 ) \
X( int, plugin, nplugin, 1 ) \
X( int, plugin_stateadr, nplugin, 1 ) \
X( int, plugin_statenum, nplugin, 1 ) \
X( char, plugin_attr, npluginattr, 1 ) \
X( int, plugin_attradr, nplugin, 1 ) \
X( int, numeric_adr, nnumeric, 1 ) \