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_DAL/AP_DAL_Airspeed.h
Views: 1798
1
#pragma once
2
3
#include <AP_Logger/LogStructure.h>
4
5
#include <AP_Airspeed/AP_Airspeed.h>
6
7
class AP_DAL_Airspeed {
8
public:
9
10
// Airspeed-like methods:
11
12
// return health status of sensor
13
bool healthy(uint8_t i) const {
14
return _RASI[i].healthy;
15
}
16
// return health status of primary sensor
17
bool healthy() const {
18
return healthy(get_primary());
19
}
20
21
// return true if airspeed is enabled, and airspeed use is set
22
bool use(uint8_t i) const {
23
return _RASI[i].use;
24
}
25
bool use() const {
26
return use(get_primary());
27
}
28
29
// return the current airspeed in m/s
30
float get_airspeed(uint8_t i) const {
31
return _RASI[i].airspeed;
32
}
33
float get_airspeed() const {
34
return get_airspeed(get_primary());
35
}
36
37
// return time in ms of last update
38
uint32_t last_update_ms(uint8_t i) const { return _RASI[i].last_update_ms; }
39
uint32_t last_update_ms() const { return last_update_ms(get_primary()); }
40
41
// get number of sensors
42
uint8_t get_num_sensors(void) const { return _RASH.num_sensors; }
43
44
// get current primary sensor
45
uint8_t get_primary(void) const { return _RASH.primary; }
46
47
// AP_DAL methods:
48
AP_DAL_Airspeed();
49
50
void start_frame();
51
52
void handle_message(const log_RASH &msg) {
53
_RASH = msg;
54
}
55
void handle_message(const log_RASI &msg) {
56
_RASI[msg.instance] = msg;
57
}
58
59
private:
60
61
struct log_RASH _RASH;
62
struct log_RASI _RASI[AIRSPEED_MAX_SENSORS];
63
};
64
65