Add SDF functions to public API.
PiperOrigin-RevId: 757829339 Change-Id: I81ee7c3f33acf234835bf34cbb632e23cb9e284e
This commit is contained in:
committed by
Copybara-Service
parent
d77126dc58
commit
8a7c42c747
@@ -407,6 +407,14 @@ typedef enum mjtFlexSelf_ { // mode for flex selfcollide
|
||||
} mjtFlexSelf;
|
||||
|
||||
|
||||
typedef enum mjtSDFType_ { // signed distance function (SDF) type
|
||||
mjSDFTYPE_SINGLE = 0, // single SDF
|
||||
mjSDFTYPE_INTERSECTION, // max(A, B)
|
||||
mjSDFTYPE_MIDSURFACE, // A - B
|
||||
mjSDFTYPE_COLLISION, // A + B + abs(max(A, B))
|
||||
} mjtSDFType;
|
||||
|
||||
|
||||
//---------------------------------- mjLROpt -------------------------------------------------------
|
||||
|
||||
struct mjLROpt_ { // options for mj_setLengthRange()
|
||||
|
||||
@@ -135,6 +135,16 @@ struct mjpPlugin_ {
|
||||
};
|
||||
typedef struct mjpPlugin_ mjpPlugin;
|
||||
|
||||
struct mjSDF_ {
|
||||
const mjpPlugin** plugin;
|
||||
int* id;
|
||||
mjtSDFType type;
|
||||
mjtNum* relpos;
|
||||
mjtNum* relmat;
|
||||
mjtGeom* geomtype;
|
||||
};
|
||||
typedef struct mjSDF_ mjSDF;
|
||||
|
||||
#if defined(__has_attribute)
|
||||
|
||||
#if __has_attribute(constructor)
|
||||
|
||||
@@ -1308,6 +1308,19 @@ MJAPI char* mju_strncpy(char *dst, const char *src, int n);
|
||||
MJAPI mjtNum mju_sigmoid(mjtNum x);
|
||||
|
||||
|
||||
//---------------------------------- Signed Distance Function --------------------------------------
|
||||
|
||||
// get sdf from geom id
|
||||
MJAPI const mjpPlugin* mjc_getSDF(const mjModel* m, int id);
|
||||
|
||||
// signed distance function
|
||||
MJAPI mjtNum mjc_distance(const mjModel* m, const mjData* d, const mjSDF* s, const mjtNum x[3]);
|
||||
|
||||
// gradient of sdf
|
||||
MJAPI void mjc_gradient(const mjModel* m, const mjData* d, const mjSDF* s, mjtNum gradient[3],
|
||||
const mjtNum x[3]);
|
||||
|
||||
|
||||
//---------------------------------- Derivatives ---------------------------------------------------
|
||||
|
||||
// Finite differenced transition matrices (control theory notation)
|
||||
|
||||
Reference in New Issue
Block a user