DataLogging for APM1
Hi,
For a while I wanted to record my flights for analyzing it later. The problem was that the current recording system is not working well. So I decided to rebuild the whole recording method.
The first problem was to determent what parameters/variables I need…. I came up with this list:
Servos In
Servos Out
IMU: 3 Gyros
3 Accelerometers
3 Attitudes
3 Compasses
Air speed
Barometer
GPS: Time in ms
GPS fix
Number of satellites
Latitude
Longitude
Altitude
Ground speed
Ground course
Of course I've added headers and end bytes. To have a relevant data that I could analyze I wanted to record at 50Hz (even though that the GPS is only 10Hz). This presented quite a challenge.
The second problem was the amount of flash memory that I have… In APM1 we are using the Atmel 45DB161D as our data logger and it has only 16Mb = 16Mbits (NOT 16MB=16MBytes as written everywhere!!!) it means that I had a very limited amount of space to save the data that I mentioned above. So I've build in the GUI couple of extra buttons so I could control when I start recording and when do I stop it in order to save space.
The third problem was to synchronize the samples. I decided to use the GPS ms time as a reference to all the variables and parameters but the current MTK GPS library didn’t contain the time in ms – it has a bug... so I've changed that as well to output the GPS time in ms.
The forth problem was the very buggy file system that currently exists. I tried to use it and eventually decided to not use it. I wrote the data straight to the memory for now. Later on I'll create/repair the file system
It means now that I have about 7 minute of complete accurate on board recording of my flight. I can make the code more costly effective regarding space consuming (for example the GPS is only 10Hz and I write in to the flash in 50Hz) and eventually convert the method of writing, to and from the flash, from ascii to binary – that will save A LOT of time/space.
To support all this I had to add the AMP GUI some features like start/stop record buttons to decide when to start/strop the record because of the space/time samples, I created a bar which displays how much space capacity remains, how the log is created and stop etc. All is done via MAVLink.
The download of the log is being done like it used to be – the output is a CSV file (Hurray!) that I can view and make graphs out of it on Excel.
I'm planning to add some more stuff like temperature sensors, RPM etc..
I would like you (the diydrones community) to look at it.. both sides of software – in the APM and the Mission Planner and tell me what you think of it.
Do you find it helpful? Do you think we could integrate it into Ardupilot/Arducopter and the mission planner?
Maayan Dreamer