Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_DAL/AP_DAL_VisualOdom.cpp
9386 views
1
#include "AP_DAL_VisualOdom.h"
2
3
#include <AP_VisualOdom/AP_VisualOdom.h>
4
5
#if HAL_VISUALODOM_ENABLED
6
7
#include <AP_Logger/AP_Logger.h>
8
#include "AP_DAL.h"
9
#include <AP_Vehicle/AP_Vehicle_Type.h>
10
11
/*
12
update position offsets to align to AHRS position
13
should only be called when this library is not being used as the position source
14
This function does not change EKF state, so does not need to be logged
15
*/
16
void AP_DAL_VisualOdom::align_position_to_ahrs(bool align_xy, bool align_z)
17
{
18
#if !APM_BUILD_TYPE(APM_BUILD_AP_DAL_Standalone)
19
auto *vo = AP::visualodom();
20
vo->align_position_to_ahrs(align_xy, align_z);
21
#endif
22
}
23
24
void AP_DAL_VisualOdom::start_frame()
25
{
26
const auto *vo = AP::visualodom();
27
28
const log_RVOH old = RVOH;
29
if (vo != nullptr) {
30
RVOH.pos_offset = vo->get_pos_offset();
31
RVOH.delay_ms = vo->get_delay_ms();
32
RVOH.healthy = vo->healthy();
33
RVOH.enabled = vo->enabled();
34
}
35
36
WRITE_REPLAY_BLOCK_IFCHANGED(RVOH, RVOH, old);
37
}
38
39
#endif // HAL_VISUALODOM_ENABLED
40
41