mirror of https://github.com/ArduPilot/ardupilot
AP_HAL_SITL: add simulated GY-US42-v2 rangefinder
This commit is contained in:
parent
6ec497229b
commit
0b431f3ecd
|
@ -351,6 +351,12 @@ int SITL_State::sim_fd(const char *name, const char *arg)
|
|||
} else if (streq(name, "richenpower")) {
|
||||
sitl_model->set_richenpower(&_sitl->richenpower_sim);
|
||||
return _sitl->richenpower_sim.fd();
|
||||
} else if (streq(name, "gyus42v2")) {
|
||||
if (gyus42v2 != nullptr) {
|
||||
AP_HAL::panic("Only one gyus42v2 at a time");
|
||||
}
|
||||
gyus42v2 = new SITL::RF_GYUS42v2();
|
||||
return gyus42v2->fd();
|
||||
}
|
||||
|
||||
AP_HAL::panic("unknown simulated device: %s", name);
|
||||
|
@ -444,6 +450,11 @@ int SITL_State::sim_fd_write(const char *name)
|
|||
return rplidara2->write_fd();
|
||||
} else if (streq(name, "richenpower")) {
|
||||
return _sitl->richenpower_sim.write_fd();
|
||||
} else if (streq(name, "gyus42v2")) {
|
||||
if (gyus42v2 == nullptr) {
|
||||
AP_HAL::panic("No gyus42v2 created");
|
||||
}
|
||||
return gyus42v2->write_fd();
|
||||
}
|
||||
AP_HAL::panic("unknown simulated device: %s", name);
|
||||
}
|
||||
|
@ -624,6 +635,9 @@ void SITL_State::_fdm_input_local(void)
|
|||
if (rf_mavlink != nullptr) {
|
||||
rf_mavlink->update(sitl_model->get_range());
|
||||
}
|
||||
if (gyus42v2 != nullptr) {
|
||||
gyus42v2->update(sitl_model->get_range());
|
||||
}
|
||||
|
||||
if (frsky_d != nullptr) {
|
||||
frsky_d->update();
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <SITL/SIM_RF_Wasp.h>
|
||||
#include <SITL/SIM_RF_NMEA.h>
|
||||
#include <SITL/SIM_RF_MAVLink.h>
|
||||
#include <SITL/SIM_RF_GYUS42v2.h>
|
||||
|
||||
#include <SITL/SIM_Frsky_D.h>
|
||||
// #include <SITL/SIM_Frsky_SPort.h>
|
||||
|
@ -273,6 +274,8 @@ private:
|
|||
SITL::RF_NMEA *nmea;
|
||||
// simulated MAVLink rangefinder:
|
||||
SITL::RF_MAVLink *rf_mavlink;
|
||||
// simulated GYUS42v2 rangefinder:
|
||||
SITL::RF_GYUS42v2 *gyus42v2;
|
||||
|
||||
// simulated Frsky devices
|
||||
SITL::Frsky_D *frsky_d;
|
||||
|
|
Loading…
Reference in New Issue