Blackbox flight data recorder feature for Baseflight/Cleanflight - RC Groups
Thread Tools
Dec 07, 2014, 04:52 AM
Registered User
thenickdude's Avatar
New Product

Blackbox flight data recorder feature for Baseflight/Cleanflight


Hey everyone,

My Blackbox flight data recorder software for the Naze32 is now available for testing! This is a modified version of Baseflight/Cleanflight that sends flight data to an onboard OpenLog logging device to be saved to a MicroSD card. Data is logged on every iteration of the flight control loop, and includes PID intermediate calculations, RC command inputs, gyroscope and accelerometer data, and commands sent to motors. There's no approximation or loss of precision, it's pure raw data at the maximum sampling rate, so you can diagnose quite subtle problems.

Your captured flight logs can be converted using the included software to CSV for analysis, or rendered out as PNG frames which you can overlay onto your flight video with your favourite video editing software. Binaries for Windows and MacOSX are available, and the software can be built from sourcecode on Linux.

Here's an example video where I used the flight log to diagnose an oscillation problem with my Blackout 330:

Speed wobbles in super-slow motion: PID tuning on the Blackout 330 quadcopter (0 min 44 sec)


You can get all binaries and sourcecode for the blackbox, along with the instructions for installing and using it from GitHub:

Blackbox tweaked firmware for OpenLog: https://github.com/cleanflight/blackbox-firmware
Blackbox log CSV decoder and PNG rendering tools: https://github.com/cleanflight/blackbox-tools
Blackbox interactive log viewer for web browsers: https://github.com/cleanflight/blackbox-log-viewer

Baseflight firmware with blackbox added: https://github.com/thenickdude/blackbox/releases
Instructions for Baseflight: https://github.com/thenickdude/black...kbox/README.md

Cleanflight firmware (official release now includes blackbox!): https://github.com/cleanflight/cleanflight/releases
Instructions for Cleanflight: https://github.com/cleanflight/clean...cs/Blackbox.md

The blackbox also records GPS data. If you have a working GPS and you're able to send me a log with recording GPS data in-flight, that'd be great! (I've only seen recordings made on the ground so far).

I really want to see what it's like to be one of the pilots that zoom around carparks or dodge trees at high speed, so please share your flight videos!
Last edited by thenickdude; Jul 12, 2015 at 07:48 AM.
Sign up now
to remove ads between posts
Dec 07, 2014, 07:04 AM
Registered User
Wow!
Nice tool.
Great how advanced the hobby is becoming.

What a GREAT share!
Thanks,
Robert
Dec 07, 2014, 07:37 AM
Registered User
Ill gladly give it a go once its ready for cleanflight.
(Un) fortunatley Iv recently changed to kiss esc's with oneshot125 so i cant use baseflight anymore.
Dec 07, 2014, 10:29 AM
Registered User
What is the advantage about the solution below. No changes of the FC controller software is needed for this one. I have used this with Harakiri but this will likely also work with Baseflight and Cleanflight in the same way.

http://www.multiwii.com/forum/viewtopic.php?f=8&t=5273
Dec 07, 2014, 11:12 AM
Registered User
From what i understand, thenickdude has added extra data. So there's more relevant data logged.
The visualization is also very useful when troubleshooting pid tuning.
Dec 07, 2014, 01:54 PM
Registered User
thenickdude's Avatar
It looks like that data logger can only manage to log twice a second (judging from the example logs). That's not enough to spot any problems with the flight control algorithms, or notice any problems like oscillations or vibration. I log every single iteration of the flight control loop (416 times per second for a looptime of 2400).
Last edited by thenickdude; Dec 07, 2014 at 02:00 PM.
Dec 07, 2014, 07:30 PM
Zippa Flippa
nebbian's Avatar
My understanding is that there are some pages in the configurator that show the current values of the gyros and accelerometers, which are updated hundreds of times a second, and I think that this information is gleaned using the MSP protocol. So I think it should be possible just by modifying the Openlog firmware...

I'm also interested in a Cleanflight solution
Dec 07, 2014, 08:38 PM
Registered User
thenickdude's Avatar
PID intermediates and frame times aren't available over MSP. The data that is available is transmitted in a format that is too bulky to be sampled at full rate, even if you could sample every value on every loop, which you can't (you can't tell which loop iteration your requests for information actually ended up getting processed in, so you get a scrambled mess of data from different timestamps).

The absolute maximum available data rate at 115200 baud is 14400 bytes/sec. I use compression techniques that allow me to get down to about 24.5 bytes per sample for loop iteration, nanosecond timestamp, P, I and D per-axis, gyro per-axis, acc per axis, 4 RC channels, 4 motor outputs. At 416Hz (looptime 2400), that's 10192 bytes/sec.

Every MSP response incurs a 5 byte header, so to read the IMU, motors and RC you already take up 15 bytes in headers. The size of the response bodies for those requests sum to 18+16+16 bytes = 50 bytes. So each loop you need to log 65 bytes, which would be 27040 bytes/second, way more than 115200 baud can support.

I managed to get it running on Cleanflight today, but I need some calmer weather for my first testflight before it can be released.
Dec 07, 2014, 11:58 PM
Registered User
thenickdude's Avatar
Okay, I managed to find a gap in the weather to maiden the blackbox on Cleanflight, and it flew like a dream! I should be able to release the Cleanflight version within the next 12 hours or so.
Dec 08, 2014, 01:48 AM
Registered User
Awesome ill have to go make that openlog adapter so i can flash it.
Dec 08, 2014, 05:10 AM
Registered User
Boris B's Avatar
Good work!

Any explanations how to get the open logger working with SD?
Dec 08, 2014, 06:56 AM
Registered User
thenickdude's Avatar
I'm not sure what you mean, Boris, do you mean using it with a full-sized SD card instead of a micro one? Or are you just asking about how to use the OpenLog in general? Apart from my readme here:

https://github.com/thenickdude/black...kbox/README.md

You can also get more details about the OpenLog itself from the manufacturer's website:

https://www.sparkfun.com/tutorials/393
Dec 08, 2014, 07:07 AM
Registered User
Boris B's Avatar
Yeah I meant in general. Will check the links
Dec 08, 2014, 07:08 AM
Registered User
thenickdude's Avatar
I've now ported it over to the latest Cleanflight, so if you want to analyse the performance of the new "Oneshot" feature, this would be ideal! You can get the Cleanflight version from this repository:

https://github.com/sherlockflight/blackbox-cleanflight

Maiden flight:

Maiden flight of the Cleanflight port of my Blackbox flight data recorder (3 min 20 sec)
Last edited by thenickdude; Dec 08, 2014 at 08:24 AM.
Dec 08, 2014, 10:45 AM
Registered User
Man, now i really have to get around to making that adapter so i can flash my openlog.
Im in the middle of finetuning my mini tricopter with oneshot/kiss esc's.

Whats the fastest looptime the logger can handle? With kiss escs & oneshot125 you supposedly can go as low as 1200-1600.

Edit: is the openlog lite hex fil i got ~8 days ago still ok? i just soldered, plastidipped and shrink wrapped my openlog with that hex file.

Edit2: is servo output logged for the tricopter mix? a tricopter has a tail servo for yaw.
Last edited by Xermalk; Dec 08, 2014 at 04:57 PM.


Thread Tools