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_Baro.h
Views: 1798
1
#pragma once
2
3
#include <AP_Baro/AP_Baro.h>
4
5
#include <AP_Logger/LogStructure.h>
6
7
class AP_DAL_Baro {
8
public:
9
// methods so we look like AP_Baro:
10
uint8_t get_primary() const {
11
return _RBRH.primary;
12
}
13
uint8_t num_instances() const {
14
return _RBRH.num_instances;
15
}
16
bool healthy(uint8_t sensor_id) const {
17
return _RBRI[sensor_id].healthy;
18
}
19
uint32_t get_last_update(uint8_t sensor_id) const {
20
return _RBRI[sensor_id].last_update_ms;
21
}
22
uint32_t get_last_update() const {
23
return get_last_update(get_primary());
24
}
25
float get_altitude(uint8_t sensor_id) const {
26
return _RBRI[sensor_id].altitude;
27
}
28
float get_altitude() const {
29
return get_altitude(get_primary());
30
}
31
32
// update_calibration is a no-op in Replay as it simply modifies the data
33
// which we'll be logging for input to the EKF.
34
void update_calibration();
35
36
// methods for being part of AP_DAL:
37
AP_DAL_Baro();
38
39
void start_frame();
40
41
void handle_message(const log_RBRH &msg) {
42
_RBRH = msg;
43
}
44
void handle_message(const log_RBRI &msg) {
45
_RBRI[msg.instance] = msg;
46
}
47
48
private:
49
50
struct log_RBRH _RBRH;
51
struct log_RBRI _RBRI[BARO_MAX_INSTANCES];
52
};
53
54
55