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/examples/AP_DAL_Standalone/main.cpp
Views: 1800
1
//
2
// Ensure that AP_NavEKF libraries can be compiled when not linked to
3
// anything except the DAL.
4
//
5
6
#include <AP_DAL/AP_DAL.h>
7
#include <AP_NavEKF2/AP_NavEKF2.h>
8
#include <AP_NavEKF3/AP_NavEKF3.h>
9
#include <AP_Logger/AP_Logger.h>
10
11
void AP_Param::setup_object_defaults(void const*, AP_Param::GroupInfo const*) {}
12
13
template<typename T, ap_var_type PT>
14
void AP_ParamT<T, PT>::set_and_default(const T &v) {}
15
template class AP_ParamT<int8_t, AP_PARAM_INT8>;
16
17
18
int AP_HAL::Util::vsnprintf(char*, size_t, char const*, va_list) { return -1; }
19
20
void *nologger = nullptr;
21
AP_Logger &AP::logger() {
22
return *((AP_Logger*)nologger); // this is not usually a good idea...
23
}
24
void AP_Logger::WriteBlock(void const*, unsigned short) {}
25
26
class AP_HAL_DAL_Standalone : public AP_HAL::HAL {
27
public:
28
AP_HAL_DAL_Standalone() :
29
AP_HAL::HAL(
30
nullptr,
31
nullptr,
32
nullptr,
33
nullptr,
34
nullptr,
35
nullptr,
36
nullptr,
37
nullptr,
38
nullptr,
39
nullptr,
40
nullptr,
41
nullptr,
42
nullptr,
43
nullptr,
44
nullptr,
45
nullptr,
46
nullptr,
47
nullptr,
48
nullptr,
49
nullptr,
50
nullptr,
51
nullptr,
52
nullptr,
53
nullptr,
54
nullptr
55
) {}
56
void run(int argc, char* const argv[], Callbacks* callbacks) const override {}
57
void setup() { }
58
void loop() { }
59
};
60
61
AP_HAL_DAL_Standalone _hal;
62
const AP_HAL::HAL &hal = _hal;
63
64
NavEKF2 navekf2;
65
NavEKF3 navekf3;
66
67
int main(int argc, const char *argv[])
68
{
69
navekf2.InitialiseFilter();
70
navekf3.InitialiseFilter();
71
navekf2.UpdateFilter();
72
navekf3.UpdateFilter();
73
return navekf2.healthy() && navekf3.healthy()?0:1;
74
}
75
76