From 5cbbe656ba2d2d591ab4ad836f6fe386e8883489 Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Sat, 25 Jul 2020 13:13:56 +0100 Subject: [PATCH] AP_Scripting: add units and multipliers to logging example --- libraries/AP_Scripting/examples/logging.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Scripting/examples/logging.lua b/libraries/AP_Scripting/examples/logging.lua index 5485d29c98..ccfd450d84 100644 --- a/libraries/AP_Scripting/examples/logging.lua +++ b/libraries/AP_Scripting/examples/logging.lua @@ -27,9 +27,13 @@ local function write_to_dataflash() -- care must be taken when selecting a name, must be less than four characters and not clash with an existing log type -- format characters specify the type of variable to be logged, see AP_Logger/README.md + -- https://github.com/ArduPilot/ardupilot/tree/master/libraries/AP_Logger -- not all format types are supported by scripting only: i, L, e, f, n, M, B, I, E, and N -- lua automatically adds a timestamp in micro seconds - logger.write('SCR','roll(deg),pitch(deg),yaw(deg)','fff',interesting_data[roll],interesting_data[pitch],interesting_data[yaw]) + logger.write('SCR1','roll(deg),pitch(deg),yaw(deg)','fff',interesting_data[roll],interesting_data[pitch],interesting_data[yaw]) + + -- it is also possible to give units and multipliers + logger.write('SCR2','roll,pitch,yaw','fff','ddd','---',interesting_data[roll],interesting_data[pitch],interesting_data[yaw]) end