Commit Graph

36 Commits

Author SHA1 Message Date
Andrew Tridgell 09aff03edc AP_Logger: support new replay system
added allow_start_ekf and block write method for replay

Co-authored-by: Peter Barker <pbarker@barker.dropbear.id.au>
2020-11-10 16:15:45 +11:00
Andrew Tridgell 66596dcf25 AP_Logger: allow for retry of log open with LOG_DISARMED=1
if booting without a microSD and with LOG_DISARMED=1 then this allows
for a retry of opening the log every 5s
2020-10-27 20:35:56 +11:00
Patrick José Pereira 258083a6f2 AP_Logger: AP_Logger_File: Set custom log directory in init
`_log_directory` was used before `ensure_log_directory_exists`,
to fetch the log path

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-10-20 09:31:49 +11:00
Andy Piper ccb583d092 AP_Logger: make block logger conform to mavlink expectations of numbering
add support for log time to block logger
refactor rotation into backed. Don't start logs when erasing
correct log start logic
separate read and write points so that requesting log information does not corrupt the current log
when starting a new log stop logging first
clear the write buffer when starting a new log
insert utc time when requesting info for the current log
stop logging and request formats again when starting a new log
cope with erase happening while we are logging
keep pushing out startup messages even when format messages are done
don't log to the gcs in the io thread
don't start new logs in the io thread
don't validate logs while erasing
flush logs when stopping logging
account for page header when calculating logs sizes
don't return data when asked for more data than in the log
optimize locking and use separate semaphore to mediate ring buffer access
stop logging when the chip is full and send a notification
calculate logs sizes correctly even when they wrap
read log data correctly even when it wraps
add stats support to block logger
reset dropped when starting a new log
fail logging when the chip is full
refactor critical bufferspace checks
increase messagewriter budget to 250us and to 300us for FMT
2020-09-05 10:20:39 +10:00
Peter Barker 0c5d31f40f AP_Logger: ensure log directory exists before opening log
This will help with starting logs when inserting a fresh SD card which
doesn't have the ardupilot log directory on it
2020-06-16 12:03:21 +10:00
Peter Barker 66f8359c6b AP_Logger: factor out an ensure_log_directory_exists method 2020-06-16 12:03:21 +10:00
Iampete1 fee5b998bf AP_Logger: add min MB free param 2020-06-09 09:23:25 +10:00
Peter Barker 115751833b AP_Logger: process pending rotate on arming
If the user arms the vehicle during the logging-persist-timeout we
should rotate the log immediately.
2020-05-15 16:02:09 +10:00
Peter Barker ca4af94833 AP_Logger: prevent potential infinite recursion in log-open codepath
If anything in start_new_log did logging (for example, by sending a
statustext), we end up infinitely recursing.

With the patch:

diff --git a/libraries/AP_Logger/AP_Logger_File.cpp b/libraries/AP_Logger/AP_Logger_File.cpp
index 69b8ef0431..eb422d10f8 100644
--- a/libraries/AP_Logger/AP_Logger_File.cpp
+++ b/libraries/AP_Logger/AP_Logger_File.cpp
@@ -778,6 +778,7 @@ void AP_Logger_File::PrepForArming()
  */
 void AP_Logger_File::start_new_log(void)
 {
+    gcs().send_text(MAV_SEVERITY_WARNING, "Starting new log");
     stop_logging();

     start_new_log_reset_variables();
pbarker@bluebottle:~/rc/ardupilot(master)$

We see:

    at ../../libraries/AP_Logger/AP_Logger_File.cpp:781
    this=0x555555ad9d30, pBuffer=0x7fffff8209d0, size=75, is_critical=true)
    at ../../libraries/AP_Logger/AP_Logger_Backend.cpp:372
    this=0x555555ad9d30, pBuffer=0x7fffff8209d0, size=75)
    at ../../libraries/AP_Logger/AP_Logger_Backend.h:32
    this=0x555555ad9d30, message=0x7fffff820b10 "Starting new log")
    at ../../libraries/AP_Logger/LogFile.cpp:466
    this=0x555555a6d758 <copter+11384>,
    message=0x7fffff820b10 "Starting new log")
    at ../../libraries/AP_Logger/AP_Logger.cpp:752
    this=0x555555a6e708 <copter+15400>, severity=MAV_SEVERITY_WARNING,
    fmt=0x5555557d64d0 "Starting new log", arg_list=0x7fffff820be0,
    dest_bitmask=1 '\001') at ../../libraries/GCS_MAVLink/GCS_Common.cpp:1847
    this=0x555555a6e708 <copter+15400>, severity=MAV_SEVERITY_WARNING,
    fmt=0x5555557d64d0 "Starting new log", arg_list=0x7fffff820be0)
    at ../../libraries/GCS_MAVLink/GCS.cpp:53
    this=0x555555a6e708 <copter+15400>, severity=MAV_SEVERITY_WARNING,
    fmt=0x5555557d64d0 "Starting new log")
    at ../../libraries/GCS_MAVLink/GCS.cpp:60
    at ../../libraries/AP_Logger/AP_Logger_File.cpp:781
    this=0x555555ad9d30, pBuffer=0x7fffff820dc0, size=75, is_critical=true)
    at ../../libraries/AP_Logger/AP_Logger_Backend.cpp:372

I'm not aware of any instances in the code where this will actually
happen - but it could easily sneak in.
2020-05-11 15:12:36 +10:00
Peter Barker 7befe84f0c AP_Logger: create and use INTERNAL_ERROR macro so we get line numbers 2020-04-30 13:21:36 +10:00
Andrew Tridgell b5cc1f236a AP_Logger: use new DirHandle for directory listings 2020-03-28 15:28:03 +11:00
murata f6595a41ae AP_Logger: Change the type of a method 2020-01-22 12:45:27 +11:00
Andrew Tridgell 25f5069b58 AP_Logger: removed old NuttX hack 2020-01-16 22:16:30 +11:00
Andrew Tridgell 3ebc69320c AP_Logger: fixed LOG_FILE_DSRMROT with delayed log stop
now that we persist logging for 15s after disarm we need to also delay
the log rotation if LOG_FILE_DSRMROT=1. Otherwise we will put the log
data into the next log, which defeats the purpose of the 15s
persistance
2019-10-03 07:17:16 +10:00
Andrew Tridgell 3bf3ebb703 AP_Logger: try harder to use close to user buffer size
this stops us drastically reducing buffer size when low on memory
2019-10-01 09:29:55 +10:00
Andrew Tridgell d40835c666 AP_Logger: use AP::FS().set_mtime() 2019-08-27 15:40:43 +10:00
Andrew Tridgell df4cb00970 AP_Logger: added LOG_FILE_TIMEOUT parameter
this allows for cards to be removed and re-inserted while continuing
logging
2019-08-27 15:40:43 +10:00
Andrew Tridgell 667b4e045a AP_Logger: convert to use AP_Filesystem 2019-08-27 15:40:43 +10:00
Andrew Tridgell 66dc36ef88 AP_Logger: ifdef out _need_rtc_update 2019-08-26 15:41:44 +10:00
Andrew Tridgell 4418495c99 AP_Logger: use UNUSED_RESULT
Co-Authored-By: Francisco Ferreira <OXINARF@users.noreply.github.com>
2019-08-26 15:41:44 +10:00
Andrew Tridgell 8e58cb993d AP_Logger: fix timestamp on log files opened before GPS lock 2019-08-26 15:41:44 +10:00
Peter Barker 3d91547039 AP_Logger: add missing include for AP_RTC 2019-07-04 13:57:40 +10:00
Andrew Tridgell 91f80613dd AP_Logger: removed internal error for logging without sem 2019-06-06 16:35:22 +10:00
Andrew Tridgell 6fa69c2297 AP_Logger: rename to EXPECT_DELAY_MS() 2019-05-15 15:33:48 +10:00
Andrew Tridgell 4cdfe6bac3 AP_Logger: use EXPECT_DELAY() macro 2019-05-15 15:33:48 +10:00
Andrew Tridgell 0b20d972cd AP_Logger: prevent log erase from triggering watchdog 2019-04-22 16:53:35 +10:00
Andrew Tridgell 24c5bf42ae AP_Logger: force logging on an armed watchdog reset
and don't clear sdcard space
2019-04-22 16:53:35 +10:00
Andrew Tridgell 215c41dbb1 AP_Logger: handle long delays in opening log files 2019-04-22 16:53:35 +10:00
Tom Pittenger 027f9afcf8 AP_logger: rename dataflash to logger and refactor the filename logger.bin 2019-03-28 16:40:58 +11:00
Peter Barker ee690e7ab9 AP_Logger: use AP_InternalError for tracking internal errors 2019-03-21 21:34:33 +11:00
Andrew Tridgell 5b762711fd AP_Logger: handle EEXIST for log dir create 2019-03-01 11:39:12 +11:00
Andrew Tridgell e3c9f10e91 AP_Logger: revived block based logging 2019-01-21 21:57:21 +11:00
Peter Barker 78be3880ee AP_Logger: remove VRBRAIN-HAL-specific code 2019-01-19 19:44:19 +11:00
Peter Barker 6fc76a32af GLOBAL: use AP::logger() and strip redundant Log_ from methods 2019-01-18 18:08:20 +11:00
Peter Barker b47733142f GLOBAL: rename DataFlash_Class to AP_Logger 2019-01-18 18:08:20 +11:00
Peter Barker 6a59dd04a7 DataFlash: rename to AP_Logger 2019-01-18 18:08:20 +11:00