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_Compass/AP_Compass_SITL.h
Views: 1798
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
#define MAX_SITL_COMPASSES 3
15
16
class AP_Compass_SITL : public AP_Compass_Backend {
17
public:
18
AP_Compass_SITL();
19
20
void read(void) override;
21
22
private:
23
uint8_t _compass_instance[MAX_SITL_COMPASSES];
24
uint8_t _num_compass;
25
SITL::SIM *_sitl;
26
27
// delay buffer variables
28
struct readings_compass {
29
uint32_t time;
30
Vector3f data;
31
};
32
uint8_t store_index;
33
uint32_t last_store_time;
34
static const uint8_t buffer_length = 50;
35
VectorN<readings_compass,buffer_length> buffer;
36
37
void _timer();
38
uint32_t _last_sample_time;
39
40
void _setup_eliptical_correcion(uint8_t i);
41
42
Matrix3f _eliptical_corr;
43
Vector3f _last_dia;
44
Vector3f _last_odi;
45
Vector3f _last_data[MAX_SITL_COMPASSES];
46
};
47
#endif // AP_COMPASS_SITL_ENABLED
48
49