|
|
|
@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
|
|
|
|
|
/****************************************************************************
|
|
|
|
|
* |
|
|
|
|
* Copyright (c) 2012-2016 PX4 Development Team. All rights reserved. |
|
|
|
|
* Copyright (c) 2012-2017 PX4 Development Team. All rights reserved. |
|
|
|
|
* |
|
|
|
|
* Redistribution and use in source and binary forms, with or without |
|
|
|
|
* modification, are permitted provided that the following conditions |
|
|
|
@ -41,28 +41,26 @@
@@ -41,28 +41,26 @@
|
|
|
|
|
#define LANDINGSLOPE_H_ |
|
|
|
|
|
|
|
|
|
#include <math.h> |
|
|
|
|
#include <systemlib/err.h> |
|
|
|
|
|
|
|
|
|
class Landingslope |
|
|
|
|
{ |
|
|
|
|
private: |
|
|
|
|
/* see Documentation/fw_landing.png for a plot of the landing slope */ |
|
|
|
|
float _landing_slope_angle_rad; /**< phi in the plot */ |
|
|
|
|
float _flare_relative_alt; /**< h_flare,rel in the plot */ |
|
|
|
|
float _motor_lim_relative_alt; |
|
|
|
|
float _H1_virt; /**< H1 in the plot */ |
|
|
|
|
float _H0; /**< h_flare,rel + H1 in the plot */ |
|
|
|
|
float _d1; /**< d1 in the plot */ |
|
|
|
|
float _flare_constant; |
|
|
|
|
float _flare_length; /**< d1 + delta d in the plot */ |
|
|
|
|
float _horizontal_slope_displacement; /**< delta d in the plot */ |
|
|
|
|
float _landing_slope_angle_rad{0.0f}; /**< phi in the plot */ |
|
|
|
|
float _flare_relative_alt{0.0f}; /**< h_flare,rel in the plot */ |
|
|
|
|
float _motor_lim_relative_alt{0.0f}; |
|
|
|
|
float _H1_virt{0.0f}; /**< H1 in the plot */ |
|
|
|
|
float _H0{0.0f}; /**< h_flare,rel + H1 in the plot */ |
|
|
|
|
float _d1{0.0f}; /**< d1 in the plot */ |
|
|
|
|
float _flare_constant{0.0f}; |
|
|
|
|
float _flare_length{0.0f}; /**< d1 + delta d in the plot */ |
|
|
|
|
float _horizontal_slope_displacement{0.0f}; /**< delta d in the plot */ |
|
|
|
|
|
|
|
|
|
void calculateSlopeValues(); |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
Landingslope(); |
|
|
|
|
~Landingslope() {} |
|
|
|
|
|
|
|
|
|
Landingslope() = default; |
|
|
|
|
~Landingslope() = default; |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* |
|
|
|
@ -78,21 +76,6 @@ public:
@@ -78,21 +76,6 @@ public:
|
|
|
|
|
float getLandingSlopeRelativeAltitudeSave(float wp_landing_distance, float bearing_lastwp_currwp, |
|
|
|
|
float bearing_airplane_currwp); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* |
|
|
|
|
* @return Absolute altitude of point on landing slope at distance to landing waypoint=wp_landing_distance |
|
|
|
|
*/ |
|
|
|
|
float getLandingSlopeAbsoluteAltitude(float wp_landing_distance, float wp_altitude); |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* |
|
|
|
|
* @return Absolute altitude of point on landing slope at distance to landing waypoint=wp_landing_distance |
|
|
|
|
* Performs check if aircraft is in front of waypoint to avoid climbout |
|
|
|
|
*/ |
|
|
|
|
float getLandingSlopeAbsoluteAltitudeSave(float wp_landing_distance, float bearing_lastwp_currwp, |
|
|
|
|
float bearing_airplane_currwp, float wp_landing_altitude); |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* |
|
|
|
|
* @return Relative altitude of point on landing slope at distance to landing waypoint=wp_landing_distance |
|
|
|
@ -100,8 +83,8 @@ public:
@@ -100,8 +83,8 @@ public:
|
|
|
|
|
__EXPORT static float getLandingSlopeRelativeAltitude(float wp_landing_distance, float horizontal_slope_displacement, |
|
|
|
|
float landing_slope_angle_rad) |
|
|
|
|
{ |
|
|
|
|
return (wp_landing_distance - horizontal_slope_displacement) * tanf( |
|
|
|
|
landing_slope_angle_rad); //flare_relative_alt is negative
|
|
|
|
|
// flare_relative_alt is negative
|
|
|
|
|
return (wp_landing_distance - horizontal_slope_displacement) * tanf(landing_slope_angle_rad); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -128,24 +111,17 @@ public:
@@ -128,24 +111,17 @@ public:
|
|
|
|
|
|
|
|
|
|
float getFlareCurveRelativeAltitudeSave(float wp_distance, float bearing_lastwp_currwp, float bearing_airplane_currwp); |
|
|
|
|
|
|
|
|
|
float getFlareCurveAbsoluteAltitudeSave(float wp_distance, float bearing_lastwp_currwp, float bearing_airplane_currwp, |
|
|
|
|
float wp_altitude); |
|
|
|
|
|
|
|
|
|
void update(float landing_slope_angle_rad_new, |
|
|
|
|
float flare_relative_alt_new, |
|
|
|
|
float motor_lim_relative_alt_new, |
|
|
|
|
float H1_virt_new); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline float landing_slope_angle_rad() {return _landing_slope_angle_rad;} |
|
|
|
|
inline float flare_relative_alt() {return _flare_relative_alt;} |
|
|
|
|
inline float motor_lim_relative_alt() {return _motor_lim_relative_alt;} |
|
|
|
|
inline float H1_virt() {return _H1_virt;} |
|
|
|
|
inline float H0() {return _H0;} |
|
|
|
|
inline float d1() {return _d1;} |
|
|
|
|
inline float flare_constant() {return _flare_constant;} |
|
|
|
|
inline float flare_length() {return _flare_length;} |
|
|
|
|
inline float horizontal_slope_displacement() {return _horizontal_slope_displacement;} |
|
|
|
|
float landing_slope_angle_rad() { return _landing_slope_angle_rad; } |
|
|
|
|
float flare_relative_alt() { return _flare_relative_alt; } |
|
|
|
|
float motor_lim_relative_alt() { return _motor_lim_relative_alt; } |
|
|
|
|
float flare_length() { return _flare_length; } |
|
|
|
|
float horizontal_slope_displacement() { return _horizontal_slope_displacement; } |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|