HAL_SITL: support VectorNav simulation

This commit is contained in:
Andrew Tridgell 2020-12-29 21:30:34 +11:00 committed by Peter Barker
parent f57971eafe
commit 7cc71dc573
2 changed files with 18 additions and 0 deletions

View File

@ -376,6 +376,12 @@ int SITL_State::sim_fd(const char *name, const char *arg)
}
gyus42v2 = new SITL::RF_GYUS42v2();
return gyus42v2->fd();
} else if (streq(name, "VectorNav")) {
if (vectornav != nullptr) {
AP_HAL::panic("Only one VectorNav at a time");
}
vectornav = new SITL::VectorNav();
return vectornav->fd();
}
AP_HAL::panic("unknown simulated device: %s", name);
@ -491,6 +497,11 @@ int SITL_State::sim_fd_write(const char *name)
AP_HAL::panic("No gyus42v2 created");
}
return gyus42v2->write_fd();
} else if (streq(name, "VectorNav")) {
if (vectornav == nullptr) {
AP_HAL::panic("No VectorNav created");
}
return vectornav->write_fd();
}
AP_HAL::panic("unknown simulated device: %s", name);
}
@ -700,6 +711,9 @@ void SITL_State::_fdm_input_local(void)
if (sf45b != nullptr) {
sf45b->update(sitl_model->get_location());
}
if (vectornav != nullptr) {
vectornav->update();
}
if (_sitl) {
_sitl->efi_ms.update();

View File

@ -43,6 +43,7 @@
#include <SITL/SIM_RF_NMEA.h>
#include <SITL/SIM_RF_MAVLink.h>
#include <SITL/SIM_RF_GYUS42v2.h>
#include <SITL/SIM_VectorNav.h>
#include <SITL/SIM_Frsky_D.h>
#include <SITL/SIM_CRSF.h>
@ -300,6 +301,9 @@ private:
// simulated CRSF devices
SITL::CRSF *crsf;
// simulated VectorNav system:
SITL::VectorNav *vectornav;
// output socket for flightgear viewing
SocketAPM fg_socket{true};