Ardupilot添加自定义日志(AP_LOG)

2023-05-16

1.在libraries/AP_Logger/LogStructure.h中添加自定义的结构体

struct PACKED log_HMSRV {
  LOG_PACKET_HEADER;
  uint64_t time_us;
  uint8_t srv_id;
  uint16_t pwm_input;
  float pos_cmd;
  float pos_sensor;
  float voltage;
  float current;
  float pcb_temp;
  float motor_temp;
  uint8_t status_info;
};

2.添加日志枚举类型(enum LogMessages)

在这里插入图片描述

3.在LOG_COMMON_STRUCTURES中添加日志数据格式

在这里插入图片描述
日志项格式为:

{type,len,name,format,label,unit,multiplier,streaming}

**加粗样式**
日志数据格式类型参考如下(在libraries/AP_Logger/README.MD)

# Logger Notes

## Format Types

The format type specifies the amount of storage required for the entry
and how the content should be interpreted.

| Char | C Type |
|------|--------|
|a   | int16_t[32]|
|b   | int8_t|
|B   | uint8_t|
|h   | int16_t|
|H   | uint16_t|
|i   | int32_t|
|I   | uint32_t|
|f   | float|
|d   | double|
|n   | char[4]|
|N   | char[16]|
|Z   | char[64]|
|L   | int32_t latitude/longitude (so -35.1332423 becomes -351332423)|
|M   | uint8_t flight mode|
|q   | int64_t|
|Q   | uint64_t|

Legacy field types - do not use.  These have been replaced by using  the base C type and an appropriate multiplier column entry.

| Char | CType+Mult   |
|------|--------------|
|  c   | int16_t * 100|
|  C   | uint16_t * 100|
|  e   | int32_t * 100|
|  E   | uint32_t * 100|

## Units

All units here should be base units. 
This means battery capacity uses "amp \* second" not "milliAmp \* hours". 
Please keep the names consistent with Tools/autotest/param_metadata/param.py:33

| Char | Unit Abbrev. | Description | Notes |
|-----|---|---|---|
| '-' | "" | no units e.g. Pi or a string |
| '?' | "UNKNOWN" | Units which haven't been worked out yet....|
| 'A' | "A" | Ampere|
| 'd' | "deg" | of the angular variety | -180 to 180|
| 'b' | "B" | bytes|
| 'k' | "deg/s" | degrees per second | Not an SI unit, but in some situations more user-friendly than radians per second|
| 'D' | "deglatitude" | degrees of latitude|
| 'e' | "deg/s/s" | degrees per second per second | Not an SI unit, but in some situations more user-friendly than radians per second^2|
| 'E' | "rad/s" | radians per second|
| 'G' | "Gauss" | Gauss | Not an SI unit, but 1 tesla = 10000 gauss so a simple replacement is not possible here|
| 'h' | "degheading" | 0.? to 359.?|
| 'i' | "A.s" | Ampere second|
| 'J' | "W.s" | Joule (Watt second)|
| 'l' | "l" | litres|
| 'L' | "rad/s/s" | radians per second per second|
| 'm' | "m" | metres|
| 'n' | "m/s" | metres per second|
| 'N' | "N" | Newton|
| 'o' | "m/s/s" | metres per second per second|
| 'O' | "degC" | degrees Celsius | Not an SI unit, but Kelvin is too cumbersome for most users|
| '%' | "%" | percent|
| 'S' | "satellites" | number of satellites|
| 's' | "s" | seconds|
| 'q' | "rpm" | revolutions per minute|  Not an SI unit, but sometimes more intuitive than Hertz|
| 'r' | "rad" | radians|
| 'U' | "deglongitude" | degrees of longitude|
| 'u' | "ppm" | pulses per minute|
| 'v' | "V" | Volt|
| 'P' | "Pa" | Pascal|
| 'w' | "Ohm" | Ohm|
| 'W' | "W" | watt |
| 'X' | "W.h" | watt hour |
| 'Y' | "us" | pulse width modulation in microseconds|
| 'z' | "Hz" | Hertz|
| '#' | "instance" | (e.g.)Sensor instance number|

## Multipliers

This multiplier information applies to the raw value present in the
log. Any adjustment implied by the format field (e.g. the "centi"
in "centidegrees" is *IGNORED* for the purposes of scaling.
Essentially "format" simply tells you the C-type, and format-type h
(int16_t) is equivalent to format-type c (int16_t*100)
tl;dr a GCS shouldn't/mustn't infer any scaling from the unit name

| Char | Multiplier | Description |
|------|------------|---|
| '-' | 0 | no multiplier e.g. char[4] |
| '?' | 1 | multipliers which haven't been worked out yet |
| '2' | 1e2 ||
| '1' | 1e1 ||
| '0' | 1e0 | x1 |
| 'A' | 1e-1 ||
| 'B' | 1e-2 ||
| 'C' | 1e-3 ||
| 'D' | 1e-4 ||
| 'E' | 1e-5 ||
| 'F' | 1e-6 ||
| 'G' | 1e-7 ||
| '!' | 3.6 | (milliampere \* hour => ampere \* second) and (km/h => m/s)|
| '/' | 3600 | (ampere \* hour => ampere \* second)|

4.在LogFile.cpp文件中添加日志记录入口函数,在AP_Logger类中添加成员

在这里插入图片描述
至此添加自定义日志项已完成,调用自定义的日志记录接口即可记录日志。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Ardupilot添加自定义日志(AP_LOG) 的相关文章

  • 【踩坑实录】Mission planner+Ardupilot飞控固件配置教程

    写在前面 飞控 xff1a 雷迅CUAV V5 43 固件 xff1a Arudupilot Arduplane Stable 地面站 xff1a Mission Planner 1 3 74 之前为飞控刷写了px4固件 xff0c 并采用
  • ardupilot之mavlink消息--从飞控发出--单向

    飞控采用mavlink消息进行数据的传输 普遍说法是 xff0c 现有的mavlink消息几乎已经涵盖了所有你的能想象到的内容 xff0c 完全可以覆盖多处需求 无奈科研总是要定义一些新鲜玩意 xff0c 所以总是有无法完全满足需求 xff
  • ArduPilot日志系统探索(一)

    先把官方网站上日志相关的说明翻译下来 xff1a ArduPilot Documentation ArduPilot documentation 页面 xff1a Logs Copter documentation 与日志记录和分析相关的主
  • leveldb之log文件

    leveldb之log文件 1 log文件在LevelDb中的主要作用是系统故障恢复时 xff0c 能够保证不会丢失数据 因为在将记录写入内存的Memtable之前 xff0c 会先写入Log文件 xff0c 这样即使系统发生故障 xff0
  • Ardupilot SITL(Software in the Loop)软件仿真

    参考 xff1a http ardupilot org dev docs sitl native on windows html sitl native on windows 第一步 xff1a 下载MAVProxy 第二步 xff1a 下
  • Ardupilot与T265配置

    摘自 xff1a https www jianshu com p ce91fdec7235 我现在发现这篇文章的原文在这 https www cnblogs com hellocxz p 12104290 html Ardupilot与T2
  • 无人机飞控平台ArduPilot源码入门教程 - 首页

    原文链接 简介 ArduPilot代码库有点大 核心的ardupilot git树大概有70万行代码 对新人来说这有点吓人 这个文档打算给出一点建议 关于如何快速上手相关代码 我们假设你熟悉C 43 43 的关键概念 另外好多例子都是假设你
  • SITL Simulator —— ArduPilot —— Windows

    版权声明 xff1a 本文为博主原创博文 xff0c 未经允许不得转载 xff0c 若要转载 xff0c 请说明出处并给出博文链接 参考网页 xff1a http ardupilot org dev docs sitl native on
  • springboot开启access_log日志输出

    由于在调试时需要查看access log日志 xff0c 但是springboot默认并没有开启 xff0c 因此查看了一下文档 xff0c 在springboot的配置文件中添加如下设置 xff0c 即可将日志输出当磁盘文件中以供查看 日
  • ArduPilot/APM源码学习笔记(一)

    最近开始学习ArduPilot APM飞控的源码 xff0c 源码托管在github上 源码链接 xff1a https github com diydrones ardupilot 飞控主页 xff1a http ardupilot co
  • Ardupilot飞控编译环境搭建

    构建环境 Ardupilot具有完整的开发库 xff0c 其编译代码可以直接下载 xff0c 在Windows上 xff0c 可以利用Cygwin编译器来进行下载并编译 xff0c 对此怒飞垂云的教程中有详细的下载方法 xff1a 飞控固件
  • Ardupilot-SITL仿真模拟调试

    1 配置SITL仿真调试 span class token punctuation span span class token operator span waf configure span class token operator sp
  • Ardupilot SITL——arducopter 操作步骤

    打开cygwin输入 cd ardupilot ArduCopter Tools autotest sim vehicle py map console xff08 默认master下版本arducopter xff0c 默认模拟 四轴 x
  • Git 版本回退与前进(03)

    现在 你已经学会了修改文件 然后把修改提交到Git版本库 现在 再练习一次 修改readme txt文件如下 Git is a distributed version control system Git is free software
  • 【mmdetection 】analyze_logs.py等工具测试

    绘制一些运行的分类损失 python tools analyze logs py plot curve work dirs faster rcnn r50 fpn 1x 20200306 175509 log json keys loss
  • idea 运行日志查看

    help gt Show Log in Explorer 打开后的文件夹 如果有一些运行错误提示导入至中查看的可以在这里找到 比如在idea执行maven的reimport入时报错 打开后会有对应的记录 日志是按时间顺序追加的 可以直接最下
  • springboot 注解实现AOP记录日志

    AOP AOP为Aspect Oriented Programming的缩写 意为 面向切面编程 通过预编译方式和运行期动态代理实现程序功能的统一维护的一种技术 在日常开发当中经常用来记录日志 方法跟踪 事务 权限等 切面方法说明 Aspe
  • c#中日志NLog配置问题

    Failed obtaining configuration for Common Logging from configuration section common logging 在配置中没有配置对 另外很有可能是NLog 的配置文件没
  • 04-Qt软件加入Log文件输出与终端彩色打印(包含行号)

    一 目的与需求 在开发qt应用程序中 经常使用打印调试软件 qt自己的qDebug 就满足了需求 但是当需要把一部分log记录到文件的时候qt就没有提供了 这个时候可以使用qDebug 的qInstallMsgHandler来指定打印回掉函
  • python pyplot logscale 画图对数

    原文来自公众号 工程师看海 事情的起因是我要在公众号 工程师看海 更新一篇文章 介绍电感 磁珠的区别 需要画阻抗 频率曲线 横坐标频率要按照log对数尺度缩放 就写了python代码 废话不多说 先看结果 公众号后台回复 python lo

随机推荐

  • 解决AndroidStudio 控制台编译输出中文乱码,黑方块+问号之类的

    100 有效 解决AndroidStudio 控制台编译输出中文乱码 xff08 黑色方框问号 xff09 xff0c 亲测解决 xff01 xff08 转载 xff09 Pdx 666的博客 CSDN博客 背景在AndroidStudio
  • sphinx安装及简单使用

    sphinx安装及简单使用 如果你要编写技术文档 可以用 reStructuredText 或 Markdown 格式编辑文件 xff0c 然后使用 Sphinx 工具转换成 html PDF ePub等格式 xff0c 或者托管到 git
  • cmake之CMakelist.txt的使用

    文章目录 常用命令1 指定 cmake 的最小版本2 打印信息2 1 打印普通信息2 2 打印告警2 3 打印错误 3 项目名称4 设置变量5 查找指定的库文件6 设置包含的目录7 设置链接库搜索目录8 指定编译包含的源文件8 1 明确指定
  • python爬虫 记录一次爬取淘宝的过程

    淘宝可以说是一个检验爬虫技术是否过关的最强关卡了 xff0c 下面来打破它吧 淘宝的所有操作差不多都是在登录的状态下进行的 xff0c 这时候想要对淘宝进行请求获取信息就必须在登录的状态下进行了 方式一 xff1a xff08 seleni
  • 问题tensorflow.python.framework.errors_impl.ResourceExhaustedError:OOM

    tensorflow python framework errors impl ResourceExhaustedError 2 root error s found 0 Resource exhausted OOM when alloca
  • ROS安装超详细保姆级教程

    1 版本选择 ROS与Ubuntu版本是有着对应关系的 xff0c 其中Ubuntu1604 43 ROS Kinetic xff1b Ubuntu1804 43 ROS Melodic xff1b Ubuntu2004 43 ROS No
  • 2021年9月22号,实战烧写树莓派sd卡的系统

    1 下载格式化u盘的软件 xff0c 软件地址 xff0c 阿里云盘地址 xff1a https www aliyundrive com s ux2re9FFxd2 2 将有sd卡的读写盘插入电脑接口 3 打开软件 xff0c 点击格式化即
  • 工作流与BPM的区别

    一 工作流是什么 xff1f 根据国际工作流管理联盟 Workflow Management Coalition xff0c WFMC 的定义 xff0c 工作流就是 一类能够完全或者部分自动执行的经营过程 xff0c 它根据一系列过程规则
  • 被遗忘的软件产品形态

    从2010年以后 xff0c 很多公司开发的软件产品 xff0c 很少有客户端了 xff0c web2 0之后 xff0c 主流的业务系统基本上都是基于Web去构建业务系统 这几年见到的业务应用系统都是基于Web的构建的 而在To C市场
  • C端产品工作流程

    文章目录 发现需求需求分析用户需求定义产品需求定义构建产品方案收集需求确定产品功能 产品需求分类产品目标分解产品版本规划需求评审产品功能设计需求评审确定执行计划测试验收发布上线 发现需求 通过自身的体验发现需求 通过间接的体验发现需求 1
  • STM32cubeMX将STM32F767+LAN8720+LwIP+FreeRTOS的以太网实现

    通过STM32cubeMX将STM32F767 43 LAN8720 43 LwIP 43 FreeRTOS的以太网实现 本文使用了正点原子的阿波罗开发板 xff0c 接下来我将粗略的对STM32F767通过STM32cubeMX进行以太网
  • 数据产品经理有哪些

    文章目录 数据分析产品经理数据挖掘产品经理策略产品经理数据工程类产品 首先希望大家能重新认识经理这份工作 xff1a 大数据产品经理并不一定要数学能力强或者编程能力强 xff0c 只要你有用数据思考的方式 xff0c 有相信数据的信念 xf
  • 产品经理必备的20个常用工具

    原型设计工具 xff1a Axure 墨刀 思维导图工具 xff1a Xmind MindManager 流程图绘制工具 xff1a Viso ProcessOn 数据处理与分析工具 xff1a Excel Tableau 问卷调研工具 x
  • Hibernate根据实体类自动生成表的方法

    文章目录 第一种方法第二种方法参考 第一种方法 这种方法需要配置 hibernate cfg xml 的属性 hibernate hbm2ddl auto xff0c 该属性值的具体说明如下 xff1a 值说明update实体对应的表如果不
  • 微信账户如何解除对第三方应用的授权

    参考文章 xff1a https baijiahao baidu com s id 61 1754354599985802723 amp wfr 61 spider amp for 61 pc amp searchword 61 E5 B0
  • 进程间通信

    现在的嵌入式系统往往有并发的特征 xff0c 就像多任务操作系统的多进程一样 xff0c 其内核会提供几种机制处理任务间通信 xff0c 本文对四种常见通信模式进行了分析 xff0c 并对其各自的优劣作较细致的比较 目前 xff0c 越来越
  • HTTP请求返回状态码的不同含义

    用户通过 HTTP 访问一台正在运行Internet信息服务的服务器上的内容时 xff0c 会返回一个表示该请求的状态的数字代码 状态代码可以指明具体请求是否已成功 xff0c 还可以揭示请求失败的确切原因 1 信息提示 这些状态代码表示临
  • 异常检测及其分布集成

    异常检测算法种类繁多 xff0c 包括聚类 xff0c 树 xff0c 统计分布 xff0c 机器学习 xff0c 深度学习等多种形式 xff0c 下面对一些常见问题进行了自己的总结 xff1a 1 如何选型 xff1f 主要看算法原理和数
  • 关于FreeRTOS 任务运行中卡死在临界区vPortExitCritical()

    FreeRTOS创建任务正常运行 xff0c 偶尔出现任务卡死状态 xff0c 通过在线调试 xff0c 程序卡在vPortExitCritical 函数中 xff0c 在IAR Call Stack中观察到各任务都可能回调该接口 span
  • Ardupilot添加自定义日志(AP_LOG)

    1 在libraries AP Logger LogStructure h中添加自定义的结构体 span class token keyword struct span span class token class name PACKED