diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-10-19 13:23:59 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-10-19 13:23:59 +0300 |
commit | 1912da3f23badec22149ed25a67979718ee469a7 (patch) | |
tree | 465dac6f245f8f18d4090407dc09be197d5e7c32 /src/Movement | |
parent | 464da53736da3a25370cbd55252d2d85effb71fc (diff) |
Added input shaper amplitudes and durations to OM
Diffstat (limited to 'src/Movement')
-rw-r--r-- | src/Movement/AxisShaper.cpp | 20 | ||||
-rw-r--r-- | src/Movement/AxisShaper.h | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/Movement/AxisShaper.cpp b/src/Movement/AxisShaper.cpp index 5549c361..f7dc64b9 100644 --- a/src/Movement/AxisShaper.cpp +++ b/src/Movement/AxisShaper.cpp @@ -21,17 +21,35 @@ #define OBJECT_MODEL_FUNC(...) OBJECT_MODEL_FUNC_BODY(AxisShaper, __VA_ARGS__) #define OBJECT_MODEL_FUNC_IF(...) OBJECT_MODEL_FUNC_IF_BODY(AxisShaper, __VA_ARGS__) +constexpr ObjectModelArrayDescriptor AxisShaper::amplitudesArrayDescriptor = +{ + nullptr, // no lock needed + [] (const ObjectModel *self, const ObjectExplorationContext& context) noexcept -> size_t { return ((const AxisShaper*)self)->numExtraImpulses; }, + [] (const ObjectModel *self, ObjectExplorationContext& context) noexcept + -> ExpressionValue { return ExpressionValue(((const AxisShaper*)self)->coefficients[context.GetIndex(0)], 3); } +}; + +constexpr ObjectModelArrayDescriptor AxisShaper::durationsArrayDescriptor = +{ + nullptr, // no lock needed + [] (const ObjectModel *self, const ObjectExplorationContext& context) noexcept -> size_t { return ((const AxisShaper*)self)->numExtraImpulses; }, + [] (const ObjectModel *self, ObjectExplorationContext& context) noexcept + -> ExpressionValue { return ExpressionValue(((const AxisShaper*)self)->durations[context.GetIndex(0)] * (1.0/StepClockRate), 5); } +}; + constexpr ObjectModelTableEntry AxisShaper::objectModelTable[] = { // Within each group, these entries must be in alphabetical order // 0. InputShaper members + { "amplitudes", OBJECT_MODEL_FUNC_NOSELF(&litudesArrayDescriptor), ObjectModelEntryFlags::none }, { "damping", OBJECT_MODEL_FUNC(self->zeta, 2), ObjectModelEntryFlags::none }, + { "durations", OBJECT_MODEL_FUNC_NOSELF(&durationsArrayDescriptor), ObjectModelEntryFlags::none }, { "frequency", OBJECT_MODEL_FUNC(self->frequency, 2), ObjectModelEntryFlags::none }, { "minAcceleration", OBJECT_MODEL_FUNC(self->minimumAcceleration, 1), ObjectModelEntryFlags::none }, { "type", OBJECT_MODEL_FUNC(self->type.ToString()), ObjectModelEntryFlags::none }, }; -constexpr uint8_t AxisShaper::objectModelTableDescriptor[] = { 1, 4 }; +constexpr uint8_t AxisShaper::objectModelTableDescriptor[] = { 1, 6 }; DEFINE_GET_OBJECT_MODEL_TABLE(AxisShaper) diff --git a/src/Movement/AxisShaper.h b/src/Movement/AxisShaper.h index 54ef3218..18ee9e02 100644 --- a/src/Movement/AxisShaper.h +++ b/src/Movement/AxisShaper.h @@ -49,6 +49,8 @@ public: protected: DECLARE_OBJECT_MODEL + OBJECT_MODEL_ARRAY(amplitudes) + OBJECT_MODEL_ARRAY(durations) private: MoveSegment *GetAccelerationSegments(const DDA& dda, PrepParams& params) const noexcept; |