Get the flight altitude using LUA

How to get altitude in LUA scripts without gps, because there is a barometer on board

You can get the height of the barometer using the get_altitude() function, it is not available in the documentation on the site Lua Scripts — Plane documentation I found this function in the bind file, ardupilot/libraries/AP_Scripting/generator/description/bindings.desc at master · ArduPilot/ardupilot · GitHub

2 Likes

I’m having the same problem. When using the get_altitude() function the gcs displays the error: "call a nil value (method ‘get_altitude’)

Use ArduPilot 4.4 or newer and call it like this:

baro:get_altitude()

1 Like