Saturday, January 26, 2008

Pavlov's Pilot

After two outings where I hit the altitude hold switch and I crashed, I was hesitant to test again. I reluctantly went out to test fly the helicopter today and on the second flight I got up the courage to hit the altitude hold switch and things seemed to work. I failed to get data from the second flight for some reason, probably has to do with the software in the Telemetry box not logging restarts correctly, but I'm not exactly sure why I got no data. I'm ready to test again in the morning.


John Carmack said...

I used to have problems with losing data in the early days when I had an explicit "save log" command. I eventually got fed up with it and had my laptop pilot program save every single packet to disk, whether it is in flight or sitting on the pad. This wastes hundreds of megs of storage when we are in the field with the systems on for hours at a time, but... so what. There have been several times when I have pulled useful data out of some random time the vehicle was sitting on the pad.

Storngly reccomended.

John Carmack

Paul Breed said...

I hunted this one down yesterday.
I have a suitcase with my telmetry receiver and an ethernet hub. It receives telemtry annd turns it into UDP broadcast packets.

It also logs everything going in both directions to SD card.

It tries to be smart, if more than 30 seconds have gone by without any data in either direction is closes the telemetry file and unmounts the SD card. then if it sees telemetry again it internally buffers this remounts the SD card and reopens the log. The idea being that if telemetry is off for 30 seconds you can just pull the SD card and get the data. I have a batch of SD cards numbered, and the flight log notebook gets a comment on the SD card number that goes with my comments on the flight. When you are doing things in close proximity 30 seconds is longer than it seems , after loosing data a number of times I added an LED next to the SD card that tell's me if it is still mounted. I went and flew 4 times between rain showers on Sunday and lost no data, but on two occasions I was about to pull the SD card and the mount LED was still on. So I was not waiting enough time. I wanted a telemetry recording system with no UI I just wanted it to happen. I've achieved that, but it now has a UI of three leds, power,receiving telemetry and file system mounted.

Peter Lund said...

Can't you do better by using explicit flushing and syncing in your program? Then you should be able to pull out the SD card at any time and simply not care about unmounting it.

I'm thinking of something along the lines of first using fflush(NULL) or something like that to get the data down to the OS and then using fsync(fd) or maybe fdatasync(fd) to flush it to disk. (I'm assuming Linux here.)

Or switch to using a laptop to do the logging, like John Carmack seems to do... may require bigger/extra batteries, depending on the laptop, of course.