Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_Compass/AP_Compass_SITL.h
9593 views
1
#pragma once
2
3
#include "AP_Compass.h"
4
5
#if AP_COMPASS_SITL_ENABLED
6
7
#include "AP_Compass_Backend.h"
8
9
#include <AP_Math/vectorN.h>
10
#include <AP_Math/AP_Math.h>
11
#include <AP_Declination/AP_Declination.h>
12
#include <SITL/SITL.h>
13
14
class AP_Compass_SITL : public AP_Compass_Backend {
15
public:
16
AP_Compass_SITL(uint8_t sitl_instance);
17
18
void read(void) override;
19
20
private:
21
SITL::SIM *_sitl;
22
23
// delay buffer variables
24
struct readings_compass {
25
uint32_t time;
26
Vector3f data;
27
};
28
uint8_t store_index;
29
uint32_t last_store_time;
30
static const uint8_t buffer_length = 50;
31
VectorN<readings_compass,buffer_length> buffer;
32
33
void _timer();
34
uint32_t _last_sample_time;
35
36
void _setup_eliptical_correcion();
37
38
uint8_t sitl_instance; // offset into SITL state structure arrays
39
Matrix3f _eliptical_corr;
40
Vector3f _last_dia;
41
Vector3f _last_odi;
42
Vector3f _last_data;
43
};
44
#endif // AP_COMPASS_SITL_ENABLED
45
46