5iMX宗旨:分享遥控模型兴趣爱好

5iMX.com 我爱模型 玩家论坛 ——专业遥控模型和无人机玩家论坛(玩模型就上我爱模型,创始于2003年)
查看: 1383|回复: 0
打印 上一主题 下一主题

Pixhawk学习笔记(5)--飞行日志

[复制链接]
跳转到指定楼层
楼主
发表于 2018-7-17 17:04 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

Pixhawk的飞行日志由固件中的sd2log模块记录在SD卡的log文件中,目前版本的格式为*.px4log(曾经是*.bin),根据sd2log的设置不同,包含飞行日志的文件夹的名字可能是sess***或者具体日期时间。

sd2log:

sd2log在pixhawk固件中是标准启动的,如果需要单独启动,可在sd卡的中建立一个etc文件夹,并在里面建立一个extras.txt文件,然后通过以下不同的设置对sd2log记录的方式进行修改。

Sdlog2的基本用法:

sdlog2 {start|stop|status|on|off} [-r ] [-b ] -e -a -t -x

-r Log rate in Hz, 0 means unlimited rate

设置记录的频率,0为不限,最好不要用,会占据很多cpu时间

-b Log buffer size in KiB, default is 8

设置缓存大小,默认为8KB,

-e Enable logging by default (if not, can be started by command)

开机自动开始记录,如果没有自动开始记录,仍然可以通过命令开始

-a Log only when armed (can be still overriden by command)

只有arm后才开始记录,可以通过命令更改。

-t Use date/time for naming log directories and files

用日期和时间命名日志文件夹和文件

-x Extended logging

拓展记录,可以记录更多的数据


例1:如果想在arm后以16KB缓存100Hz速率记录数据,并以时间命名文件和文件夹,则可以在extras.txt中添加以下命令:

sdlog2 stop

sdlog2 start -r 100 -b 16 -t -a

例2:如果想在开机后以8KB缓存50Hz速率记录拓展数据,则可以在extras.txt中添加以下命令:

sdlog2 stop

sdlog2 start -r 50 -e -x


FlightPlot:

支持的日志类型:

  • PX4 autopilot log (.px4log generated by sdlog2)
  • APM binary logs (.bin files stored on SD card) (added in v.0.2.6)
  • ULog (.ulg files, supported by new PX4 logger)
  • Support for mavlink logs coming (already implemented in separate branch, needs some cleanup and testing)
windows下运行:
双击FlightPlot.jar即可(需先安装java环境)
linux/Mac下运行:
在命令行里进入FlightPlot.jar的文件夹,然后输入以下命令: java -jar FlightPlot.jar

读取和查看飞行日志:
1. 点击open log,然后选择要查看的文件



2. 点击Fields List,点选你想查看的额数据,然后确认。(可以通过ctrl+鼠标进行多个数据的同时点选和显示,但是之后不能单独移除,必须所以一次性点选的一起移除,所以也可以分别点选进行显示。)

下图中,我点选了飞行日志里的俯仰的参考输入和实际测量(输出)



其他一些细节的操作可以查看下面的官方说明。



Usage

To open a log just drop file to FlightPlot window or use the toolbar button Open Log or menu item File→Open Log…. APM and PX4 log formats are almost compatible, FlightPlot will autodetect format and handle it as needed.

FlightPlot's plot area can contain multiple graphs. To make plotting more flexible, raw data from the log can be processed before plotting. Processors can filter or combine various data, e.g. calculate ground speed as speed = sqrt(GPS.VelN^2 + GPS.VelE^2). For now, you can choose one of the existing processors. Future versions will add an interface for custom processors.

To add a processor click the Add button in Plot section and select the title and type of processor. (See below for descriptions of currently available processors). Each processor has some parameters, e.g. Fields to select fields to display and Scale to scale output.

A list of available fields can be opened by clicking the Field List button on the toolbar. Processor for selected fields can be added quickly with Add button.


Presets

The current set of plots with their parameters can be saved to a preset. To add a preset just write a name for it into the Preset combo box and press Enter. When changing a preset, it's name in the combo box becomes gray. Select the combo box and press Enter again to save your changes.

Presets can be imported and exported using the menu item File→Import Preset…/File→Export Preset…. Preset files contain data in JSON format and can be edited by hand.

Note that presets are independent from source files, i.e. if you open another file, all presets and current set of plots will remain.

Zooming

Interesting parts of the plot can be zoomed in by dragging a rectangle from top-left to bottom-right using the mouse. Drawing a rectangle in another direction will reset the zoom to fit all data. The mouse wheel can be also used for zooming.

Processors

The following processors are currently available:

  • Simple - Simply display the data, can accept multiple fields, scale and shift are common for all displayed fields, data can be filtered with LPF (set cut-off frequency in LPF parameter, 0 means no filtering) and delayed on specified interval.
  • Abs - Get absolute value of vector with components listed in Fields parameter: output = sqrt(field1^2 + field2^2 + …)
  • ATan2 - Get atan(y, x), can be used to extract direction from components of vector, e.g. velocity
  • Battery - Battery charge estimator
  • Derivative - Take derivative for specified data.
  • EulerFromQuaternion - Takes Quaternion data (EST0.s0 .. EST0.s3) and returns roll, pitch and yaw.
  • Expresson- Resolves the arithmetic expresson given. eg. output = field1 + sin(field2)^2.
  • GlobalPositionProjection - project latitude/longitude to local frame, reference point can be specified else the first point used as reference
  • Integral - Displays the integral of the specified data.
  • LandDetector -
  • NEDFromBodyProjection - project any vector from body frame to NED or back using attitude estimate
  • PosPIDControlSimulator - Simulate single loop PID controller
  • PosRatePIDControlSimulator - Simulate 2-loops PID controller, may be used for attitude controller tuning
  • PositionEstimator - Complementary position estimator similar to inav_position_estimator in PX4
  • PositionEstimatorKF - Experimental position estimator based on Kalman filter
Export track

FlightPlot lets you export your flight as tracks in the following formats:

Use File → Export Track…

Export Options

Split track by flight mode

Outcome depends on the export format:

  • KML: Splits track by using multiple placemarks with different color for each flight mode: auto: red, stabilized: blue, manual / no mode: yellow
  • GPX: Splits track in multiple track segments.

Further options

  • Specify number of samples per second to export
  • Specify the time range to export data from


您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

关闭

【站内推荐】上一条 /1 下一条

快速回复 返回顶部 返回列表