renamed geofence_max_agl to geofence_max_height

This commit is contained in:
podhrmic
2016-07-27 12:59:36 -07:00
parent 33e775acdf
commit 2d23f5fc87
4 changed files with 16 additions and 15 deletions
@@ -1,6 +1,6 @@
<!DOCTYPE flight_plan SYSTEM "../flight_plan.dtd">
<flight_plan alt="1550" ground_alt="1350" lat0="41.815562" lon0="-111.982437" max_dist_from_home="3000" name="BasicTuning" security_height="25" home_mode_height="-200" qfu="90" geofence_sector="FlightArea" geofence_max_alt="2000" geofence_max_agl="500">
<flight_plan alt="1550" ground_alt="1350" lat0="41.815562" lon0="-111.982437" max_dist_from_home="3000" name="BasicTuning" security_height="25" home_mode_height="-200" qfu="90" geofence_sector="FlightArea" geofence_max_alt="2000" geofence_max_height="500">
<header>
#include "subsystems/datalink/datalink.h"
</header>
+1 -1
View File
@@ -68,7 +68,7 @@ alt CDATA #REQUIRED
qfu CDATA #IMPLIED
home_mode_height CDATA #IMPLIED
geofence_max_alt CDATA #IMPLIED
geofence_max_agl CDATA #IMPLIED
geofence_max_height CDATA #IMPLIED
geofence_sector CDATA #IMPLIED>
<!ATTLIST waypoints
+5 -4
View File
@@ -25,6 +25,7 @@
* Optional exceptions triggeringg HOME_MODE
* 1) GEOFENCE_DATALINK_LOST_TIME: go to HOME mode if datalink lost for GEOFENCE_DATALINK_LOST_TIME
* 2) GEOFENCE_MAX_ALTITUDE: go HOME if airplane higher than the max altitude
* 3) GEOFENCE_MAX_HEIGHT: go HOME if airplane higher than the max height
*
* home_mode_max_alt is (optionally) defined in the flight plan
* GEOFENCE_DATALINK_LOST_TIME is defined in the airframe config file
@@ -49,7 +50,7 @@ static inline bool datalink_lost(void)
#endif /* GEOFENCE_DATALINK_LOST_TIME */
#if defined GEOFENCE_MAX_ALTITUDE || defined GEOFENCE_MAX_AGL// user defined geofence_max_altitude (or AGL) in the flight plan
#if defined GEOFENCE_MAX_ALTITUDE || defined GEOFENCE_MAX_HEIGHT// user defined geofence_max_altitude (or AGL) in the flight plan
static inline bool higher_than_max_altitude(void)
{
bool above_max_alt = false;
@@ -57,9 +58,9 @@ static inline bool higher_than_max_altitude(void)
above_max_alt = above_max_alt || (GetPosAlt() > GEOFENCE_MAX_ALTITUDE);
#endif /* GEOFENCE_MAX_ALTITUDE */
#ifdef GEOFENCE_MAX_AGL
above_max_alt = above_max_alt || (GetPosAlt() > ( GetAltRef() + GEOFENCE_MAX_AGL));
#endif /* GEOFENCE_MAX_AGL */
#ifdef GEOFENCE_MAX_HEIGHT
above_max_alt = above_max_alt || (GetPosAlt() > ( GetAltRef() + GEOFENCE_MAX_HEIGHT));
#endif /* GEOFENCE_MAX_HEIGHT */
return above_max_alt;
}
#else // we dont have max altitude specified, so the condition is never true
+9 -9
View File
@@ -1021,21 +1021,21 @@ let () =
begin
try
let geofence_max_agl = get_float "geofence_max_agl" in
if geofence_max_agl < !security_height then
let geofence_max_height = get_float "geofence_max_height" in
if geofence_max_height < !security_height then
begin
fprintf stderr "\nError: Geofence max AGL below security height (%.0f < %.0f)\n" geofence_max_agl !security_height;
fprintf stderr "\nError: Geofence max height below security height (%.0f < %.0f)\n" geofence_max_height !security_height;
exit 1;
end
else if geofence_max_agl < home_mode_height then
else if geofence_max_height < home_mode_height then
begin
fprintf stderr "\nError: Geofence max AGL below home mode height (%.0f < %.0f)\n" geofence_max_agl home_mode_height;
fprintf stderr "\nError: Geofence max height below home mode height (%.0f < %.0f)\n" geofence_max_height home_mode_height;
exit 1;
end
else if (geofence_max_agl +. !ground_alt) < (float_of_string alt) then
fprintf stderr "\nWarning: Geofence max AGL below default waypoint AGL (%.0f < %.0f)\n" (geofence_max_agl +. !ground_alt) (float_of_string alt);
Xml2h.define "GEOFENCE_MAX_AGL" (sof geofence_max_agl);
fprintf stderr "\nWarning: Geofence max AGL set to %.0f\n" geofence_max_agl;
else if (geofence_max_height +. !ground_alt) < (float_of_string alt) then
fprintf stderr "\nWarning: Geofence max AGL below default waypoint AGL (%.0f < %.0f)\n" (geofence_max_height +. !ground_alt) (float_of_string alt);
Xml2h.define "GEOFENCE_MAX_HEIGHT" (sof geofence_max_height);
fprintf stderr "\nWarning: Geofence max AGL set to %.0f\n" geofence_max_height;
with
_ -> ()
end;