mirror of https://github.com/ArduPilot/ardupilot
AP_HAL_SITL: add CRSF simulation driver
This commit is contained in:
parent
820d6654af
commit
a9ded9d870
|
@ -342,6 +342,12 @@ int SITL_State::sim_fd(const char *name, const char *arg)
|
|||
// }
|
||||
// frsky_sport = new SITL::Frsky_SPortPassthrough();
|
||||
// return frsky_sportpassthrough->fd();
|
||||
} else if (streq(name, "crsf")) {
|
||||
if (crsf != nullptr) {
|
||||
AP_HAL::panic("Only one crsf at a time");
|
||||
}
|
||||
crsf = new SITL::CRSF();
|
||||
return crsf->fd();
|
||||
} else if (streq(name, "rplidara2")) {
|
||||
if (rplidara2 != nullptr) {
|
||||
AP_HAL::panic("Only one rplidara2 at a time");
|
||||
|
@ -443,6 +449,11 @@ int SITL_State::sim_fd_write(const char *name)
|
|||
AP_HAL::panic("No frsky-d created");
|
||||
}
|
||||
return frsky_d->write_fd();
|
||||
} else if (streq(name, "crsf")) {
|
||||
if (crsf == nullptr) {
|
||||
AP_HAL::panic("No crsf created");
|
||||
}
|
||||
return crsf->write_fd();
|
||||
} else if (streq(name, "rplidara2")) {
|
||||
if (rplidara2 == nullptr) {
|
||||
AP_HAL::panic("No rplidara2 created");
|
||||
|
@ -648,6 +659,11 @@ void SITL_State::_fdm_input_local(void)
|
|||
// if (frsky_sportpassthrough != nullptr) {
|
||||
// frsky_sportpassthrough->update();
|
||||
// }
|
||||
|
||||
if (crsf != nullptr) {
|
||||
crsf->update();
|
||||
}
|
||||
|
||||
if (rplidara2 != nullptr) {
|
||||
rplidara2->update(sitl_model->get_location());
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <SITL/SIM_RF_GYUS42v2.h>
|
||||
|
||||
#include <SITL/SIM_Frsky_D.h>
|
||||
#include <SITL/SIM_CRSF.h>
|
||||
// #include <SITL/SIM_Frsky_SPort.h>
|
||||
// #include <SITL/SIM_Frsky_SPortPassthrough.h>
|
||||
#include <SITL/SIM_PS_RPLidarA2.h>
|
||||
|
@ -284,6 +285,9 @@ private:
|
|||
// simulated NMEA rangefinder:
|
||||
SITL::PS_RPLidarA2 *rplidara2;
|
||||
|
||||
// simulated CRSF devices
|
||||
SITL::CRSF *crsf;
|
||||
|
||||
// output socket for flightgear viewing
|
||||
SocketAPM fg_socket{true};
|
||||
|
||||
|
|
Loading…
Reference in New Issue