Browse Source

AP_HAL_SITL: add simulated SF45B

c415-sdk
Peter Barker 4 years ago committed by Peter Barker
parent
commit
c1202e4878
  1. 15
      libraries/AP_HAL_SITL/SITL_State.cpp
  2. 4
      libraries/AP_HAL_SITL/SITL_State.h

15
libraries/AP_HAL_SITL/SITL_State.cpp

@ -358,6 +358,12 @@ int SITL_State::sim_fd(const char *name, const char *arg) @@ -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) @@ -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) @@ -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();
}

4
libraries/AP_HAL_SITL/SITL_State.h

@ -50,6 +50,7 @@ @@ -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: @@ -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

Loading…
Cancel
Save