CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_ESC_Telem/LogStructure.h
Views: 1798
1
#pragma once
2
3
#include <AP_Logger/LogStructure.h>
4
#include "AP_ESC_Telem_config.h"
5
6
#define LOG_IDS_FROM_ESC_TELEM \
7
LOG_ESC_MSG, \
8
LOG_EDT2_MSG
9
10
// @LoggerMessage: ESC
11
// @Description: Feedback received from ESCs
12
// @Field: TimeUS: microseconds since system startup
13
// @Field: Instance: ESC instance number
14
// @Field: RPM: reported motor rotation rate
15
// @Field: RawRPM: reported motor rotation rate without slew adjustment
16
// @Field: Volt: Perceived input voltage for the ESC
17
// @Field: Curr: Perceived current through the ESC
18
// @Field: Temp: ESC temperature in centi-degrees C
19
// @Field: CTot: current consumed total mAh
20
// @Field: MotTemp: measured motor temperature in centi-degrees C
21
// @Field: Err: error rate
22
struct PACKED log_Esc {
23
LOG_PACKET_HEADER;
24
uint64_t time_us;
25
uint8_t instance;
26
float rpm;
27
float raw_rpm;
28
float voltage;
29
float current;
30
int16_t esc_temp;
31
float current_tot;
32
int16_t motor_temp;
33
float error_rate;
34
};
35
36
enum class log_Edt2_Status : uint8_t {
37
HAS_STRESS_DATA = 1U<<0, // true if the message contains up-to-date stress data
38
HAS_STATUS_DATA = 1U<<1, // true if the message contains up-to-date status data
39
ALERT_BIT = 1U<<2, // true if the last status had the "alert" bit (e.g. demag)
40
WARNING_BIT = 1U<<3, // true if the last status had the "warning" bit (e.g. desync)
41
ERROR_BIT = 1U<<4, // true if the last status had the "error" bit (e.g. stall)
42
};
43
44
45
// @LoggerMessage: EDT2
46
// @Description: Status received from ESCs via Extended DShot telemetry v2
47
// @Field: TimeUS: microseconds since system startup
48
// @Field: Instance: ESC instance number
49
// @Field: Stress: current stress level (commutation effort), scaled to [0..255]
50
// @Field: MaxStress: maximum stress level (commutation effort) since arming, scaled to [0..15]
51
// @Field: Status: status bits
52
// @FieldBitmaskEnum: Status: log_Edt2_Status
53
struct PACKED log_Edt2 {
54
LOG_PACKET_HEADER;
55
uint64_t time_us;
56
uint8_t instance;
57
uint8_t stress;
58
uint8_t max_stress;
59
uint8_t status;
60
};
61
62
#if HAL_WITH_ESC_TELEM
63
#define LOG_STRUCTURE_FROM_ESC_TELEM \
64
{ LOG_ESC_MSG, sizeof(log_Esc), \
65
"ESC", "QBffffcfcf", "TimeUS,Instance,RPM,RawRPM,Volt,Curr,Temp,CTot,MotTemp,Err", "s#qqvAOaO%", "F-00--BCB-" , true }, \
66
{ LOG_EDT2_MSG, sizeof(log_Edt2), \
67
"EDT2", "QBBBB", "TimeUS,Instance,Stress,MaxStress,Status", "s#---", "F----" , true },
68
#else
69
#define LOG_STRUCTURE_FROM_ESC_TELEM
70
#endif
71
72