These are the changes I have done. They allow for
correct AGL in the GCS when there is no SRTM data.
conf/messages.xml
@@ -77,6 +77,7 @@
77 77 <field name="itow" type="uint32"
unit="ms"/>
78 78 <field name="utm_zone"
type="uint8"/>
79 79 <field name="gps_nb_err"
type="uint8"/>
80 + <field name="ground_alt"
type="float" unit="m"/>
80 81 </message>
81 82
82 83 <message name="NAVIGATION_REF" id="9">
conf/settings/control/rotorcraft_guidance.xml
@@ -27,6 +27,7 @@
27 27
28 28 <dl_settings NAME="NAV">
29 29 <dl_setting var="flight_altitude"
MIN="0" STEP="0.1" MAX="400" module="navigation" unit="m"
handler="SetFlightAltitude"/>
30 + <dl_setting MAX="4000" MIN="-260"
STEP="1" VAR="ground_alt"/>
30 31 <dl_setting var="nav_heading" MIN="0"
STEP="1" MAX="360" module="navigation" unit="1/2^12r"
alt_unit="deg" alt_unit_coef="0.0139882"/>
31 32 <dl_setting var="nav_radius"
MIN="-150" STEP="0.1" MAX="150" module="navigation"
unit="m"/>
32 33 </dl_settings>
conf/settings/fixedwing_basic.xml
@@ -6,6 +6,7 @@
6 6 <dl_settings>
7 7 <dl_settings NAME="flight params">
8 8 <dl_setting MAX="1000" MIN="0" STEP="10"
VAR="flight_altitude" shortname="altitude"/>
9 + <dl_setting MAX="4000" MIN="-260"
STEP="1" VAR="ground_alt"/>
9 10 <dl_setting MAX="360" MIN="0" STEP="1"
VAR="nav_course"/>
10 11 <dl_setting MAX="10" MIN="-10"
STEP="5" VAR="nav_shift" module="subsystems/nav"
handler="IncreaseShift" shortname="inc. shift"/>
11 12 <dl_setting MAX="0" MIN="0" STEP="1"
VAR="autopilot_flight_time" shortname="flight time"
module="autopilot" handler="ResetFlightTimeAndLaunch"/>
sw/airborne/subsystems/gps.c
@@ -44,7 +44,7 @@ static void send_gps(void) {
44 44 DOWNLINK_SEND_GPS(DefaultChannel,
DefaultDevice, &gps.fix,
45 45 &gps.utm_pos.east,
&gps.utm_pos.north,
46 46 &course, &gps.hmsl,
&gps.gspeed, &climb,
47 - &gps.week, &gps.tow,
&gps.utm_pos.zone, &i);
47 + &gps.week, &gps.tow,
&gps.utm_pos.zone, &i, &ground_alt);
48 48 if ((gps.fix != GPS_FIX_3D) && (i
>= gps.nb_channels)) i = 0;
49 49 if (i >= gps.nb_channels * 2) i = 0;
50 50 if (i < gps.nb_channels &&
((gps.fix != GPS_FIX_3D) || (gps.svinfos[i].cno > 0))) {
sw/ground_segment/tmtc/fw_server.ml
@@ -113,7 +113,11 @@ let log_and_parse = fun ac_name
(a:Aircraft.aircraft) msg values ->
113 113 a.course <- norm_course
((Deg>>Rad)(fvalue "course" /. 10.));
114 114 if !heading_from_course then
115 115 a.heading <- a.course;
116 - a.agl <- a.alt -. float (try
Srtm.of_wgs84 a.pos with _ -> 0);
116 + let srtmground = float (try
Srtm.of_wgs84 a.pos with _ -> 0) in
117 + if srtmground = 0. then
118 + a.agl <- a.alt -. fvalue
"ground_alt"
119 + else
120 + a.agl <- a.alt -. srtmground;
117 121 if a.gspeed > 3. &&
a.ap_mode = _AUTO2 then
118 122 Wind.update ac_name a.gspeed
a.course
119 123 end