Introduce trilinear flex parametrization.

These flexes use only 24 DOFs (3 per vertex of the bounding box), while colliding with the full high resolution mesh.

On an 8x8x8 cube, the performance using DOFs at all vertices is

```
 Simulation time      : 18.74 s
 Steps per second     : 533
 Realtime factor      : 0.53 x
 Time per step        : 1874.4 µs

 Contacts per step    : 114.88
 Constraints per step : 3322.51
 Degrees of freedom   : 1536
```

With the new implementation, it is the following:

```
 Simulation time      : 1.82 s
 Steps per second     : 5507
 Realtime factor      : 5.51 x
 Time per step        : 181.6 µs

 Contacts per step    : 38.84
 Constraints per step : 155.36
 Degrees of freedom   : 24
```

PiperOrigin-RevId: 721008829
Change-Id: I833df027527db578d86667cc4b24295bcf6f7d22
This commit is contained in:
Alessio Quaglino
2025-01-29 09:37:37 -08:00
committed by Copybara-Service
parent 1a4b821b6b
commit 7cdf180641
47 changed files with 8967 additions and 96 deletions
+14
View File
@@ -41,6 +41,7 @@ public const double mjMINIMP = 0.0001;
public const double mjMAXIMP = 0.9999;
public const int mjMAXCONPAIR = 50;
public const int mjMAXTREEDEPTH = 50;
public const int mjMAXFLEXNODES = 27;
public const int mjNEQDATA = 11;
public const int mjNDYN = 10;
public const int mjNGAIN = 10;
@@ -5191,6 +5192,7 @@ public unsafe struct mjModel_ {
public int ncam;
public int nlight;
public int nflex;
public int nflexnode;
public int nflexvert;
public int nflexedge;
public int nflexelem;
@@ -5411,6 +5413,9 @@ public unsafe struct mjModel_ {
public int* flex_dim;
public int* flex_matid;
public int* flex_group;
public int* flex_interp;
public int* flex_nodeadr;
public int* flex_nodenum;
public int* flex_vertadr;
public int* flex_vertnum;
public int* flex_edgeadr;
@@ -5424,6 +5429,7 @@ public unsafe struct mjModel_ {
public int* flex_evpairadr;
public int* flex_evpairnum;
public int* flex_texcoordadr;
public int* flex_nodebodyid;
public int* flex_vertbodyid;
public int* flex_edge;
public int* flex_elem;
@@ -5433,6 +5439,8 @@ public unsafe struct mjModel_ {
public int* flex_evpair;
public double* flex_vert;
public double* flex_vert0;
public double* flex_node;
public double* flex_node0;
public double* flexedge_length0;
public double* flexedge_invweight0;
public double* flex_radius;
@@ -6296,6 +6304,10 @@ public unsafe struct model {
public int* flex_dim;
public int* flex_matid;
public int* flex_group;
public int* flex_interp;
public int* flex_nodeadr;
public int* flex_nodenum;
public int* flex_nodebodyid;
public int* flex_vertadr;
public int* flex_vertnum;
public int* flex_elem;
@@ -6309,6 +6321,8 @@ public unsafe struct model {
public int* flex_texcoordadr;
public int* flex_bvhadr;
public int* flex_bvhnum;
public byte* flex_centered;
public double* flex_node;
public double* flex_radius;
public float* flex_rgba;
public int* hfield_pathadr;