mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-01 04:46:51 +08:00
renamed geofence_max_agl to geofence_max_height
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<!DOCTYPE flight_plan SYSTEM "../flight_plan.dtd">
|
<!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>
|
<header>
|
||||||
#include "subsystems/datalink/datalink.h"
|
#include "subsystems/datalink/datalink.h"
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ alt CDATA #REQUIRED
|
|||||||
qfu CDATA #IMPLIED
|
qfu CDATA #IMPLIED
|
||||||
home_mode_height CDATA #IMPLIED
|
home_mode_height CDATA #IMPLIED
|
||||||
geofence_max_alt CDATA #IMPLIED
|
geofence_max_alt CDATA #IMPLIED
|
||||||
geofence_max_agl CDATA #IMPLIED
|
geofence_max_height CDATA #IMPLIED
|
||||||
geofence_sector CDATA #IMPLIED>
|
geofence_sector CDATA #IMPLIED>
|
||||||
|
|
||||||
<!ATTLIST waypoints
|
<!ATTLIST waypoints
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
* Optional exceptions triggeringg HOME_MODE
|
* Optional exceptions triggeringg HOME_MODE
|
||||||
* 1) GEOFENCE_DATALINK_LOST_TIME: go to HOME mode if datalink lost for GEOFENCE_DATALINK_LOST_TIME
|
* 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
|
* 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
|
* home_mode_max_alt is (optionally) defined in the flight plan
|
||||||
* GEOFENCE_DATALINK_LOST_TIME is defined in the airframe config file
|
* 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 */
|
#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)
|
static inline bool higher_than_max_altitude(void)
|
||||||
{
|
{
|
||||||
bool above_max_alt = false;
|
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);
|
above_max_alt = above_max_alt || (GetPosAlt() > GEOFENCE_MAX_ALTITUDE);
|
||||||
#endif /* GEOFENCE_MAX_ALTITUDE */
|
#endif /* GEOFENCE_MAX_ALTITUDE */
|
||||||
|
|
||||||
#ifdef GEOFENCE_MAX_AGL
|
#ifdef GEOFENCE_MAX_HEIGHT
|
||||||
above_max_alt = above_max_alt || (GetPosAlt() > ( GetAltRef() + GEOFENCE_MAX_AGL));
|
above_max_alt = above_max_alt || (GetPosAlt() > ( GetAltRef() + GEOFENCE_MAX_HEIGHT));
|
||||||
#endif /* GEOFENCE_MAX_AGL */
|
#endif /* GEOFENCE_MAX_HEIGHT */
|
||||||
return above_max_alt;
|
return above_max_alt;
|
||||||
}
|
}
|
||||||
#else // we dont have max altitude specified, so the condition is never true
|
#else // we dont have max altitude specified, so the condition is never true
|
||||||
|
|||||||
@@ -1021,21 +1021,21 @@ let () =
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
let geofence_max_agl = get_float "geofence_max_agl" in
|
let geofence_max_height = get_float "geofence_max_height" in
|
||||||
if geofence_max_agl < !security_height then
|
if geofence_max_height < !security_height then
|
||||||
begin
|
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;
|
exit 1;
|
||||||
end
|
end
|
||||||
else if geofence_max_agl < home_mode_height then
|
else if geofence_max_height < home_mode_height then
|
||||||
begin
|
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;
|
exit 1;
|
||||||
end
|
end
|
||||||
else if (geofence_max_agl +. !ground_alt) < (float_of_string alt) then
|
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_agl +. !ground_alt) (float_of_string alt);
|
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_AGL" (sof geofence_max_agl);
|
Xml2h.define "GEOFENCE_MAX_HEIGHT" (sof geofence_max_height);
|
||||||
fprintf stderr "\nWarning: Geofence max AGL set to %.0f\n" geofence_max_agl;
|
fprintf stderr "\nWarning: Geofence max AGL set to %.0f\n" geofence_max_height;
|
||||||
with
|
with
|
||||||
_ -> ()
|
_ -> ()
|
||||||
end;
|
end;
|
||||||
|
|||||||
Reference in New Issue
Block a user