- Debugging/Logging - 飞行日志分析
- Debugging/Logging - ULog文件格式
- 教程
- 教程 - 地面站
- 教程 - 编写应用程序
- 教程 - QGC的视频流
- 教程 - 远距离视频流
- 教程 - u-blox M8P RTK
- 新手上路
- 新手上路 - 初始设置
- 新手上路 - 安装工具链
- 安装工具链 - Mac OS
- 安装工具链 - Linux
- Linux - Advanced Linux
- 安装工具链 - Windows
- 新手上路 - Fast RTPS installation
- 新手上路 - 代码编译
- 新手上路 - 高级配置
- 新手上路 - 贡献& 开发者电话会议
- 贡献& 开发者电话会议 - GIT例程
- 贡献& 开发者电话会议 - Documentation
- 新手上路 - Licenses
- 概念解读
- 概念解读 - 飞行模式
- 概念解读 - 结构概述
- 概念解读 - 飞行控制栈
- 概念解读 - 中间件
- 概念解读 - 混控和执行器
- 概念解读 - PWM限制状态机
- Hardware
- Hardware - 自驾仪硬件
- 机型 - 统一的基础代码
- 机型 - 参考机型
- 机型 - 添加一个新的机型
- Data Links - SiK Radio
- Data Links - Wifi数传
- Data Links - 数传
- I2C总线 - SF1XX lidar
- 传感器和执行机构总线 - UAVCAN总线
- UAVCAN总线 - UAVCAN Bootloader
- UAVCAN总线 - UAVCAN固件升级
- UAVCAN总线 - UAVCAN配置
- UAVCAN总线 - UAVCAN 的各种笔记
- 传感器和执行机构总线 - UART
- UART - uLanding Radar
- 传感器和执行机构总线 - 设置云台控制
- 传感器和执行机构总线 - 相机触发器
- Hardware - 协同电脑
- 仿真
- 仿真 - 基本仿真
- 仿真 - Gazebo仿真
- 仿真 - HITL仿真
- 仿真 - 连接到ROS
- 仿真 - AirSim仿真
- 仿真 - 多机仿真
- 中间件及架构
- 中间件及架构 - uORB消息机制
- 中间件及架构 - MAVLink消息机制
- 中间件及架构 - 守护程序
- 中间件及架构 - 驱动框架
- 模块 & 命令
- 模块 & 命令 - 命令
- 模块 & 命令 - 通信
- 模块 & 命令 - 驱动
- 模块 & 命令 - 系统
- Robotics
- Robotics - 用Linux进行外部控制
- Robotics - ROS
- ROS - 在RPi上安装ROS
- ROS - MAVROS (ROS上的MAVLink)
- ROS - MAVROS外部控制例程
- ROS - 外部位置估计
- ROS - Gazebo Octomap
- Robotics - DroneKit
- Debugging/Logging
- Debugging/Logging - FAQ
- Debugging/Logging - 系统控制台
- Debugging/Logging - 自驾仪调试
- Debugging/Logging - Sensor/Topic Debugging
- Debugging/Logging - 仿真调试
- Debugging/Logging - System-wide Replay
- Debugging/Logging - 发送调试的值
- Debugging/Logging - Profiling
- Debugging/Logging - 日志记录
- 教程 - 光流
- 教程 - ecl EKF
- 教程 - 飞行前检查
- 教程 - 着陆检测
- 教程 - Linux系统下使用S.Bus驱动
- Advanced Topics
- Advanced Topics - 系统启动
- Advanced Topics - 参数&配置
- Advanced Topics - 参考参数
- Advanced Topics - 安装Intel RealSense R200的驱动
- Advanced Topics - 切换状态估计器
- Advanced Topics - 外部模块
- Advanced Topics - STM32 Bootloader
- 测试和持续集成
- 测试和持续集成 - 持续集成
- 测试和持续集成 - Jenkins持续集成环境
- 测试和持续集成 - 综合测试
- 测试和持续集成 - Docker容器
- 测试和持续集成 - 维护
Debugging/Logging - System-wide Replay
Based on ORB messages, it’s possible to record and replay arbitrary parts of the
system. For this to work, the new logger needs to be enabled (SYS_LOGGER
set
to 1).
Replay is useful to test the effect of different parameter values based on real
data, compare different estimators, etc.
Prerequisites
The first thing that needs to be done is to identify the module or modules that
should be replayed. Then, all the inputs to these modules, i.e. subscribed ORB
topics. For system-wide replay, this consists of all hardware input: sensors, RC
input, mavlink commands and file system.
All identified topics need to be logged at full rate (see
logging). For ekf2
this is already the case with the
default set of logged topics.
It is important that all replayed topics contain only a single absolute
timestamp, which is the automatically generated field timestamp
. Should there
be more timestamps, then they must be relative with respect to the main
timestamp. For an example, see
sensor_combined.msg.
Reasons for this are given below.
Usage
- First, choose the file to replay, and build the target (from within the
Firmware directory):
This will create the output in a separate build directoryexport replay=<absolute_path_to_log_file.ulg>
make posix_sitl_default
build/posix_sitl_default_replay
(so that the parameters don’t interfere with
normal builds). It’s possible to choose any posix SITL build target for
replay, the build system knows through thereplay
environment variable that
it’s in replay mode. Add ORB publisher rules file in
build/posix_sitl_default_replay/tmp/rootfs/orb_publisher.rules
.
This file defines which module is allowed to publish which messages. It has
the following format:restrict_topics: <topic1>, <topic2>, ..., <topicN>
module: <module>
ignore_others: <true/false>
It means that the given list of topics should only be published by
<module>
(which is the command name). Publications to any of these topics from another
module are silently ignored. Ifignore_others
istrue
, then publications
to other topics from<module>
are ignored.For replay, we only want the
replay
module to be able to publish the
previously identified list of opics. So for replayingekf2
, the rules file
looks like this:restrict_topics: sensor_combined, vehicle_gps_position, vehicle_land_detected
module: replay
ignore_others: true
This allows that the modules, which usually publish these topics, don’t need
to be disabled for replay.Optional: setup parameter overrides in the file
build/posix_sitl_default_replay/tmp/rootfs/replay_params.txt
.
This file should contain a list of<param_name> <value>
, like:EKF2_GB_NOISE 0.001
By default, all parameters from the log file are applied. When a parameter
changed during recording, it will be changed as well at the right time during
replay. A parameter in thereplay_params.txt
will override the value and
changes to it from the log file will not be applied.- Optional: copy
dataman
missions file from the SD card to the build
directory. Only necessary if a mission should be replayed. Start the replay:
make posix_sitl_default jmavsim
This will automatically open the log file, apply the parameters and start
to replay. Once done, it will be reported and the process can be exited. Then
the newly generated log file can be analyzed, it has_replayed
appended to
its file name.Note that the above command will show the simulator as well, but depending on
what is being replayed, it will not show what’s actually going on. It’s
possible to connect via QGC and e.g. view the changing attitude during replay.Finally, unset the environment variable, so that the normal build targets
are used again:unset replay
Important Notes
- During replay, all dropouts in the log file are reported. These have a
negative effect on replay and thus it should be taken care that dropouts are
avoided during recording. - It is currently only possible to replay in ‘real-time’, meaning as fast as the
recording was done. This is planned to be extended in the future. - A message that has a timestamp of 0 will be considered invalid and not be
replayed.
EKF2 Replay
This is a specialization of the system-wide replay for fast EKF2 replay. It will
automatically create the ORB publisher rules and works as following:
- Optionally set
SDLOG_MODE
to 1 to start logging from boot - Record the log
- To replay:
export replay_mode=ekf2
export replay=<abs_path_to_log.ulg>
make posix none
You can stop it after there’s an output like:
INFO [replay] Replay done (published 9917 msgs, 2.136 s)
The parameters can be adjusted as well. They can be extracted from the log with
(install pyulog with sudo pip install pyulog
first):
ulog_params -i $replay -d ' ' | grep -e '^EKF2' > build/posix_sitl_default_replay/tmp/rootfs/replay_params.txt
Then edit the parameters in the file as needed and restart the replay process
with make posix none
. This will create a new log file.
The location of the generated log is printed with a message like this:
INFO [logger] Opened log file: rootfs/fs/microsd/log/2017-03-01/13_30_51_replayed.ulg
When finished, use unset replay; unset replay_mode
to exit the replay mode.
Behind the Scenes
Replay is split into 3 components:
- a replay module
- ORB publisher rules
- time handling
The replay module reads the log and publishes the messages with the same speed
as they were recorded. A constant offset is added to the timestamp of each
message to match the current system time (this is the reason why all other
timestamps need to be relative). The command replay tryapplyparams
is executed
before all other modules are loaded and applies the parameters from the log and
user-set parameters. Then as the last command, replay trystart
will again
apply the parameters and start the actual replay. Both commands do nothing if
the environment variable replay
is not set.
The ORB publisher rules allow to select which part of the system is replayed, as
described above. They are only compiled for the posix SITL targets.
The time handling is still an open point, and needs to be implemented.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论