mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-01 06:20:36 +08:00
ControlMath: index fix and scaling fix
This commit is contained in:
committed by
Beat Küng
parent
c9cd920642
commit
19d50f9511
@@ -75,12 +75,12 @@ matrix::Vector3f constrainTilt(const matrix::Vector3f &vec, const float &tilt_ma
|
||||
}
|
||||
|
||||
/* desired and maximum allowed horizontal magnitude */
|
||||
float xy_mag = matrix::Vector2f(vec(0), vec(0)).length();
|
||||
float xy_mag = matrix::Vector2f(vec(0), vec(1)).length();
|
||||
float xy_mag_max = fabsf(vec(2)) * tanf(tilt_max);
|
||||
|
||||
if (xy_mag_max < xy_mag) {
|
||||
float x0 = vec(0) * xy_mag / xy_mag_max;
|
||||
float x1 = vec(1) * xy_mag / xy_mag_max;
|
||||
float x0 = vec(0) * xy_mag_max / xy_mag;
|
||||
float x1 = vec(1) * xy_mag_max / xy_mag;
|
||||
return matrix::Vector3f(x0, x1, vec(2));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user