Remove MuJoCo stack calls in nativeccd.
1. There is now thread local static memory for use with a conservative max number of iterations needed for contact. 2. For possible needs of high precision contact recovery with large iteration numbers (i.e. ellipsoid-ellipsoid collisions), there are callbacks to allocate memory when needed. PiperOrigin-RevId: 739187134 Change-Id: I3d210f75218922d969c78465da3fe50da4fe3080
This commit is contained in:
committed by
Copybara-Service
parent
dc96ed6bdb
commit
12b40b948e
@@ -15,6 +15,8 @@
|
||||
#ifndef MUJOCO_SRC_ENGINE_ENGINE_COLLISION_GJK_H_
|
||||
#define MUJOCO_SRC_ENGINE_ENGINE_COLLISION_GJK_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <mujoco/mjexport.h>
|
||||
#include <mujoco/mjmodel.h>
|
||||
#include <mujoco/mjtnum.h>
|
||||
@@ -25,6 +27,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// max number of EPA iterations
|
||||
#define mjMAX_EPA_ITERATIONS 170
|
||||
|
||||
// tolerance for normal alignment of two faces (cosine of 1.6e-3)
|
||||
#define mjFACE_TOL 0.99999872
|
||||
|
||||
@@ -60,10 +65,17 @@ typedef struct {
|
||||
|
||||
// configuration for convex collision detection
|
||||
typedef struct {
|
||||
int max_iterations; // the maximum number of iterations for GJK and EPA
|
||||
mjtNum tolerance; // tolerance used by GJK and EPA
|
||||
int max_contacts; // set to max number of contact points to recover
|
||||
mjtNum dist_cutoff; // set to max geom distance to recover
|
||||
int max_iterations; // the maximum number of iterations for GJK and EPA
|
||||
mjtNum tolerance; // tolerance used by GJK and EPA
|
||||
int max_contacts; // set to max number of contact points to recover
|
||||
mjtNum dist_cutoff; // set to max geom distance to recover
|
||||
void* context; // opaque data pointer passed to callbacks
|
||||
|
||||
// callback to allocate memory for polytope (only needed for penetration recovery)
|
||||
void*(*alloc)(void* context, size_t nbytes);
|
||||
|
||||
// callback to free memory from alloc callback
|
||||
void(*free)(void* context, void* buffer);
|
||||
} mjCCDConfig;
|
||||
|
||||
// data produced from running GJK and EPA
|
||||
|
||||
Reference in New Issue
Block a user