AP_HAL_SITL: add terarangertower simulator

This commit is contained in:
Peter Barker 2020-12-07 22:07:21 +11:00 committed by Peter Barker
parent bd5c34f626
commit 5e2bd6d9ec
2 changed files with 20 additions and 1 deletions

View File

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

View File

@ -49,6 +49,7 @@
// #include <SITL/SIM_Frsky_SPort.h>
// #include <SITL/SIM_Frsky_SPortPassthrough.h>
#include <SITL/SIM_PS_RPLidarA2.h>
#include <SITL/SIM_PS_TeraRangerTower.h>
#include <SITL/SIM_RichenPower.h>
#include <AP_HAL/utility/Socket.h>
@ -284,9 +285,12 @@ private:
SITL::Frsky_D *frsky_d;
// SITL::Frsky_SPort *frsky_sport;
// SITL::Frsky_SPortPassthrough *frsky_sportpassthrough;
// simulated NMEA rangefinder:
// simulated RPLidarA2:
SITL::PS_RPLidarA2 *rplidara2;
SITL::PS_TeraRangerTower *terarangertower;
// simulated CRSF devices
SITL::CRSF *crsf;