aboutsummaryrefslogtreecommitdiff
path: root/src/modules/fw_pos_control_l1/landingslope.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/fw_pos_control_l1/landingslope.cpp')
-rw-r--r--src/modules/fw_pos_control_l1/landingslope.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/modules/fw_pos_control_l1/landingslope.cpp b/src/modules/fw_pos_control_l1/landingslope.cpp
index ecf51b740..a2d8525b9 100644
--- a/src/modules/fw_pos_control_l1/landingslope.cpp
+++ b/src/modules/fw_pos_control_l1/landingslope.cpp
@@ -47,6 +47,7 @@
#include <errno.h>
#include <math.h>
#include <unistd.h>
+#include <mathlib/mathlib.h>
void Landingslope::update(float landing_slope_angle_rad,
float flare_relative_alt,
@@ -76,3 +77,8 @@ float Landingslope::getLandingSlopeAbsoluteAltitude(float wp_distance, float wp_
return (wp_distance - _horizontal_slope_displacement) * tanf(_landing_slope_angle_rad) + wp_altitude; //flare_relative_alt is negative
}
+float Landingslope::getFlarceCurveAltitude(float wp_distance, float wp_altitude)
+{
+ return wp_altitude + _H0 * expf(-math::max(0.0f, _flare_length - wp_distance)/_flare_constant) - _H1_virt;
+}
+