AP_HAL_SITL: add simulated SF45B

This commit is contained in:
Peter Barker 2020-12-08 21:13:41 +11:00 committed by Peter Barker
parent dc3ded234b
commit c1202e4878
2 changed files with 19 additions and 0 deletions

View File

@ -358,6 +358,12 @@ int SITL_State::sim_fd(const char *name, const char *arg)
}
terarangertower = new SITL::PS_TeraRangerTower();
return terarangertower->fd();
} else if (streq(name, "sf45b")) {
if (sf45b != nullptr) {
AP_HAL::panic("Only one sf45b at a time");
}
sf45b = new SITL::PS_LightWare_SF45B();
return sf45b->fd();
} else if (streq(name, "richenpower")) {
sitl_model->set_richenpower(&_sitl->richenpower_sim);
return _sitl->richenpower_sim.fd();
@ -471,6 +477,11 @@ int SITL_State::sim_fd_write(const char *name)
AP_HAL::panic("No terarangertower created");
}
return terarangertower->write_fd();
} else if (streq(name, "sf45b")) {
if (sf45b == nullptr) {
AP_HAL::panic("No sf45b created");
}
return sf45b->write_fd();
} else if (streq(name, "richenpower")) {
return _sitl->richenpower_sim.write_fd();
} else if (streq(name, "ie24")) {
@ -686,6 +697,10 @@ void SITL_State::_fdm_input_local(void)
terarangertower->update(sitl_model->get_location());
}
if (sf45b != nullptr) {
sf45b->update(sitl_model->get_location());
}
if (_sitl) {
_sitl->efi_ms.update();
}

View File

@ -50,6 +50,7 @@
// #include <SITL/SIM_Frsky_SPortPassthrough.h>
#include <SITL/SIM_PS_RPLidarA2.h>
#include <SITL/SIM_PS_TeraRangerTower.h>
#include <SITL/SIM_PS_LightWare_SF45B.h>
#include <SITL/SIM_RichenPower.h>
#include <AP_HAL/utility/Socket.h>
@ -289,6 +290,9 @@ private:
// simulated RPLidarA2:
SITL::PS_RPLidarA2 *rplidara2;
// simulated SF45B proximity sensor:
SITL::PS_LightWare_SF45B *sf45b;
SITL::PS_TeraRangerTower *terarangertower;
// simulated CRSF devices