I am currently trying to learn how to set up custom log files within the Ardupilot code. I want to be able to manually record the flight sensor data, like the magnetometer orientations, accelerometers, gyroscopes, etc. I started off by building and running the AP_Logger_test.cpp example script on a Pixhawk1, but I got the following output:
Logger Log Test 1.0
TOGCS: Preparing log system
Failed to create log directory /APM/LOGS : ENOSPC
AP_Logger_File: buffer size=16384
TOGCS: Prepared log system
Unable to fetch Log File Size: ENOSPC
Log open fail for /APM/LOGS/00000001.BIN - ENOSPC
Log open fail for /APM/LOGS/00000001.BIN - ENOSPC
Using log number 0
Writing to flash… wait…
Successfully mounted SDCard (slowdown=0)
Average write time 0.1 usec/byte
Testing Write
Testing WriteCritical
Test complete.
No log file was generated, and it looks like the logger failed to open a log file on the sd card. I am not exactly sure what is wrong or how to fix it. I also tried it on a Pixhawk 4 with the same result Does anyone know how to get this code to work, or have any advice on how to record the sensor data in a log file? Thanks
Still don’t know why the library example doesn’t work, but I found a different method for writing plain files on the Pixhawk1 with Ardupilot using the posix_compat.h from the AP_Filesystem library. Adding these lines of code to my script:
I was able to write a text file test.txt containing the string “Hello” to the sd card. While this isn’t the same as using the logging system demonstrated in the library example AP_Logger_test.cpp, this might actually serve my purposes better rather than trying to work with the logger data. I know that the flight data logging works fine with ArduPlane, so if someone figures out what is wrong with the library example, I’d be interested to know.
No, I never got an answer, but the solution that I outlined in my previous post actually served my needs better. It doesn’t follow the same system as the ardupilot log file, but it is a more basic way of writing data to a file, which is all i wanted to do for my project.