51template <
typename Type>
52Type
expo(Type value, Type e) {
53 const Type x = std::clamp(value, Type(-1), Type(1));
54 const Type ec = std::clamp(e, Type(0), Type(1));
55 return (1 - ec) * x + ec * x * x * x;
66template <
typename Type>
68 const Type x = std::clamp(value, Type(-1), Type(1));
69 const Type dzc = std::clamp(dz, Type(0), Type(0.99));
70 if (std::abs(x) <= dzc) {
73 return (x - std::copysign(dzc, x)) / (1 - dzc);
Type deadzone(Type value, Type dz)
Zeroes stick inputs within the deadzone and rescales the rest back to [-1, 1], as in PX4 (mathlib Fun...
Definition stick_shaping.hpp:67
Type expo(Type value, Type e)
Blends a linear and a cubic stick response, as in PX4 (mathlib Functions.hpp)
Definition stick_shaping.hpp:52