Skip to content

Commit 43ae5e7

Browse files
committed
Copter: send terrain alt to AHRS
1 parent e17d002 commit 43ae5e7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ArduCopter/terrain.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ void Copter::terrain_update()
66
#if AP_TERRAIN_AVAILABLE
77
terrain.update();
88

9+
// send terrain altitude to AHRS so it can be used for optical flow
10+
Location veh_loc;
11+
if (ahrs.get_location(veh_loc)) {
12+
float terrain_alt_amsl_m;
13+
if (terrain.height_amsl(veh_loc, terrain_alt_amsl_m, true)) {
14+
ahrs.writeTerrainAMSL(terrain_alt_amsl_m);
15+
}
16+
}
17+
918
// tell the rangefinder our height, so it can go into power saving
1019
// mode if available
1120
#if AP_RANGEFINDER_ENABLED

0 commit comments

Comments
 (0)