fix(control_allocator): fix confusion between decision thresholds

The previous version classified a vector as poinging along axis i if
component i is above 0.5 and other components are below 0.1. This was
erroneously swapped when refactoring.
This commit is contained in:
Balduin
2026-03-16 08:54:39 +01:00
parent b42e294655
commit c1a9ab46b9
2 changed files with 8 additions and 3 deletions
@@ -265,15 +265,14 @@ ActuatorBitmask ActuatorEffectivenessRotors::getMotors() const
return motors;
}
// Helper to check if a vector is primarily aligned with a specific axis index
bool ActuatorEffectivenessRotors::isAlignedWithAxis(const Vector3f &axis_abs, int primary_idx)
{
for (int i = 0; i < 3; ++i) {
if (i == primary_idx) {
if (axis_abs(i) <= MAX_AXIS_NEGLIGIBLE) { return false; }
if (axis_abs(i) < MIN_AXIS_DOMINANT) { return false; }
} else {
if (axis_abs(i) >= MIN_AXIS_DOMINANT) { return false; }
if (axis_abs(i) > MAX_AXIS_NEGLIGIBLE) { return false; }
}
}
@@ -141,6 +141,12 @@ private:
const AxisConfiguration _axis_config;
const bool _tilt_support; ///< if true, tilt servo assignment params are loaded
/**
* Helper to check if a unit vector is primarily aligned with a specific axis index, meaning:
* | component along that axis | >= MIN_AXIS_DOMINANT
* | component along other axes | <= MAX_AXIS_NEGLIGIBLE
*/
bool isAlignedWithAxis(const Vector3f &axis_abs, int primary_idx);
struct ParamHandles {