130迷你穿越机之黑匣子

pasted_image007

硬件连接

 

img_20161110_172129

软件设置

 

更新OpenLog固件

cleanflight的文档推荐使用基于OpenLog Light V3 改版的固件,我想尝试一下OpenLog Light V4原版,不过更新步骤是一样的。

  • 连接OpenLog和FTDI

pasted_image004

检查OpenLog固件版本

  • 将下面内容放在SD卡根目录下的CONFIG.TXT文件中
 115200,26,3,0,1,0,1

baud,escape,esc#,mode,verb,echo,ignoreRX 
  • 连接FTDI到电脑
# connect serial port
screen /dev/ttyUSB0 115200 8N1

# expect: 12<
# press Ctrl-z three times, until got > character
# now we are in command mode
# if it doesn't work, maybe you have light/mini version firmware
?
# OpenLog v3.3

 

更新固件

# OpenLog dependency
git clone https://github.com/greiman/SdFat-beta.git
cp -r SdFat-beta/SDFat ~/Arduino/libraries

git clone https://github.com/greiman//.git
cp -r  SerialPort/SerialPort ~/Arduino/libraries

mkdir OpenLog_Light
cd OpenLog_Light
wget https://raw.githubusercontent.com/sparkfun/OpenLog/master/firmware/OpenLog_Firmware/OpenLog_Light/OpenLog_Light.ino

arduino OpenLog_Light.ino
# set board to "Arduino Uno"
# upload!


## error? maybe your OpenLog doesn't have Arduino bootloader (for example, these from banggood)
## please first install bootloader, check http://forum.banggood.com/forum-topic-99975.html
## special note for Linux user: due to auto-reset, this method doesn't work on Mac and Linux
## note and workaround: http://laclefyoshi.blogspot.de/2011/01/note-of-caution-for-arduino-isp.html 
## Windows did the job for me.

 

配置config.txt 如下

 250000,26,0,0,1,0,1 baud,escape,esc#,mode,verb,echo,ignoreRX 

设置cleanflight

选择UART2作为黑匣子端口,波特率设为250000

pasted_image006

格式化SD卡

在linux下格式SD卡后,需要建立dos文件系统:

sudo mkdosfs /dev/mmcblk0p1

 

注意:SD卡的质量影响记录数据的速度,简单测试:

  • Transcend 16GB microSDHC Class 10 UHS-I 丢帧率 0.56%
  • SanDisk 2GB 丢帧率 15.69%

后期处理

 

拷贝数据文件

  • OpenLog 每次通电之后会新建一个LOG12345.TXT文件
  • 每次arm之后,cleanflight开始输出log,数据被记录到这个文件中

数据导出

虽然文件后缀名为TXT,但是其中的数据并不是文本格式,而是是以二进制存储的,为了调高效率嘛。所以需要使用blackbox-tools 转换成其它格式,如cvs;还可以生成图像序列,与视频合成。

# download source code and compile
git clone https://github.com/cleanflight/blackbox-tools.git
cd blackbox-tools
make

# export to CSV
./obj/blackbox_decode path_to_LOG12345.TXT  # --&amp;amp;amp;gt; LOG12345.01.csv

# export image sequences
./obj/blackbox_render path_to_LOG12345.TXT  # --&amp;amp;amp;gt; LOG12345.01/LOG12345.01.000000.png

 

方法一:使用blackbox-log-viewer

从chrome web store 安装 blackbox-log-viewer ,然后分别打开log文件和video就可以,界面如开头的图,需要作一些手动同步。
缺点:

  • 只能导出webm格式,不含音频
  • 导出速度慢

方法二:使用OpenShot同步回放视频和数据

官方文档中使用商业软件来做后期处理,其实开源视频编辑软件做这个处理也是很轻松的。

导入视频

 

导入log图像

File Name Pattern: LOG00492.01.%06d.png
pasted_image

同步

将视频和图像序列分别放入track,然收手动调整时间轴,达到同步的效果
pasted_image002

导出视频

pasted_image003

参考

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.