2020-11-05 19:22:38 -04:00
|
|
|
#include "AP_DAL_VisualOdom.h"
|
|
|
|
|
|
|
|
#include <AP_VisualOdom/AP_VisualOdom.h>
|
|
|
|
|
2020-11-06 06:21:46 -04:00
|
|
|
#if HAL_VISUALODOM_ENABLED
|
|
|
|
|
2020-11-05 19:22:38 -04:00
|
|
|
#include <AP_Logger/AP_Logger.h>
|
|
|
|
#include "AP_DAL.h"
|
2022-10-27 22:38:06 -03:00
|
|
|
#include <AP_Vehicle/AP_Vehicle_Type.h>
|
2020-11-05 19:22:38 -04:00
|
|
|
|
2020-11-08 21:28:58 -04:00
|
|
|
/*
|
|
|
|
update position offsets to align to AHRS position
|
|
|
|
should only be called when this library is not being used as the position source
|
|
|
|
This function does not change EKF state, so does not need to be logged
|
|
|
|
*/
|
|
|
|
void AP_DAL_VisualOdom::align_position_to_ahrs(bool align_xy, bool align_z)
|
|
|
|
{
|
|
|
|
#if !APM_BUILD_TYPE(APM_BUILD_AP_DAL_Standalone)
|
|
|
|
auto *vo = AP::visualodom();
|
|
|
|
vo->align_position_to_ahrs(align_xy, align_z);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-11-05 19:22:38 -04:00
|
|
|
void AP_DAL_VisualOdom::start_frame()
|
|
|
|
{
|
|
|
|
const auto *vo = AP::visualodom();
|
|
|
|
|
|
|
|
const log_RVOH old = RVOH;
|
|
|
|
if (vo != nullptr) {
|
2020-11-10 22:04:51 -04:00
|
|
|
RVOH.pos_offset = vo->get_pos_offset();
|
|
|
|
RVOH.delay_ms = vo->get_delay_ms();
|
2020-11-05 19:22:38 -04:00
|
|
|
RVOH.healthy = vo->healthy();
|
2020-11-10 22:04:51 -04:00
|
|
|
RVOH.enabled = vo->enabled();
|
2020-11-05 19:22:38 -04:00
|
|
|
}
|
|
|
|
|
2020-11-07 17:29:45 -04:00
|
|
|
WRITE_REPLAY_BLOCK_IFCHANGED(RVOH, RVOH, old);
|
2020-11-05 19:22:38 -04:00
|
|
|
}
|
2020-11-06 06:21:46 -04:00
|
|
|
|
|
|
|
#endif // HAL_VISUALODOM_ENABLED
|