mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-13 14:13:34 +08:00
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:
+2
-3
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user