Add defaults to SDF plugin attributes.

Expose diameter and number of teeth for the gear SDF.

PiperOrigin-RevId: 577779297
Change-Id: Iec5890ab7f39080b395cf06a76f9c2216f4f39ed
This commit is contained in:
Alessio Quaglino
2023-10-30 03:08:41 -07:00
committed by Copybara-Service
parent c921c3956e
commit 50843cad30
18 changed files with 341 additions and 97 deletions
+7 -1
View File
@@ -28,6 +28,12 @@ namespace mujoco::plugin::sdf {
// this plugin implements a modification of the signed distance function
// from https://www.shadertoy.com/view/XtffzX of a bolt with a hexagonal head
struct BoltAttribute {
static constexpr int nattribute = 1;
static constexpr char const* names[nattribute] = {"radius"};
static constexpr mjtNum defaults[nattribute] = {0.26};
};
class Bolt {
public:
// Creates a new Bolt instance (allocated with `new`) or
@@ -45,7 +51,7 @@ class Bolt {
static void RegisterPlugin();
mjtNum radius;
mjtNum attribute[BoltAttribute::nattribute];
private:
Bolt(const mjModel* m, mjData* d, int instance);