How do you work with logs?
I had to repeat tests few times as can’t get logs out of copter.
Twice I had 2 or 3 bigger files but it hangs on download. After reboot I find it with 500 smaller files.
That’s complicated it’s hard to remove.
The point is it’s 500 short logs… I wrote a script to combine them but they are not sorted in it finally.
Have no idea why log numbers are not growing with time.
On your picture above all logfiles show 01.01.1980, Only last shows 01.01.1970
All this happens so far I have seen if your FC has no valid time information. It seems that your FC had multiple resets.
Is your LOG_DISARMED enabled?
Here is a script I used to combine 500 log into one file.
import os
import re
def get_sort_key(filename):
# Extract the digit before the dot in the filename
match = re.search(r'(\d+)\.', filename)
if match:
return int(match.group(1))
return 0
def combine_files(directory, extension, output_file, name_starting_with):
# Get the list of files in the directory with the given extension and starting with 'log'
files = sorted([f for f in os.listdir(directory) if f.startswith(name_starting_with) and f.endswith(extension) and os.path.isfile(os.path.join(directory, f))])
# Sort the files by the digit in their name after 'log' and before the dot
files.sort(key=get_sort_key)
output_file = os.path.join(directory, output_file)
# Open the output file in binary write mode
with open(output_file, 'wb') as outfile:
for filename in files:
filepath = os.path.join(directory, filename)
print(f'Combining {filename}...')
# Open each file in binary read mode and write its contents to the output file
with open(filepath, 'rb') as infile:
outfile.write(infile.read())
# Usage example
directory = 'C:\\Users\\xxx\\Desktop\\LOGS'
# name_starting_with = 'log'
# extension = '.bin' # Replace with the desired extension
name_starting_with = '00'
extension = '.BIN' # Replace with the desired extension
output_file = 'combined_log.bin'
combine_files(directory, extension, output_file, name_starting_with)
Better for others to follow is to show your combined logfile instead of just a screen shot.
I am still not sure if the root cause is based on the SD-card side or the FC side as the normally the FC creates the filenames not the SD-card. The FC should normally the same filename from start of a logged session logging until the end of this session and don’t create in between a new filename. So something must happen to change the filename.
Will post log later but for me it looks like defective SD interface. Once the flight controller loses communication with the SD card, it appears to create a new file. I hope it is merely a card issue.
Hm, I am not sure, but the “link” to the SD card is not like a radio link which can got loss. Normally it is a short hardwired SPI. So I don’t think that there is continously a “link” is monitored. I believe more than it is used like normal filesystem. It opens a file, append the log data and close the file. And if this not work I don’t think that than a new file will be created. In case of a connection failure also a new file will not work.
Just my thoughts but I don’t checked ardupilot SW