AP_HAL_STIL: add simulated nooploop tofsense rangefinder

This commit is contained in:
rishabsingh3003 2023-06-17 00:01:34 +05:30 committed by Randy Mackay
parent 89d4ba6a5d
commit 4957785fef
2 changed files with 12 additions and 0 deletions

View File

@ -259,6 +259,12 @@ SITL::SerialDevice *SITL_State::create_serial_sim(const char *name, const char *
}
benewake_tfmini = new SITL::RF_Benewake_TFmini();
return benewake_tfmini;
} else if (streq(name, "nooploop_tofsense")) {
if (nooploop != nullptr) {
AP_HAL::panic("Only one nooploop_tofsense at a time");
}
nooploop = new SITL::RF_Nooploop();
return nooploop;
} else if (streq(name, "teraranger_serial")) {
if (teraranger_serial != nullptr) {
AP_HAL::panic("Only one teraranger_serial at a time");
@ -618,6 +624,9 @@ void SITL_State::_fdm_input_local(void)
if (benewake_tfmini != nullptr) {
benewake_tfmini->update(sitl_model->rangefinder_range());
}
if (nooploop != nullptr) {
nooploop->update(sitl_model->rangefinder_range());
}
if (teraranger_serial != nullptr) {
teraranger_serial->update(sitl_model->rangefinder_range());
}

View File

@ -31,6 +31,7 @@
#include <SITL/SIM_RF_Benewake_TF02.h>
#include <SITL/SIM_RF_Benewake_TF03.h>
#include <SITL/SIM_RF_Benewake_TFmini.h>
#include <SITL/SIM_RF_NoopLoop.h>
#include <SITL/SIM_RF_TeraRanger_Serial.h>
#include <SITL/SIM_RF_LightWareSerial.h>
#include <SITL/SIM_RF_LightWareSerialBinary.h>
@ -215,6 +216,8 @@ private:
SITL::RF_Benewake_TF03 *benewake_tf03;
// simulated Benewake tfmini rangefinder:
SITL::RF_Benewake_TFmini *benewake_tfmini;
//simulated NoopLoop TOFSense rangefinder:
SITL::RF_Nooploop *nooploop;
// simulated TeraRanger Serial:
SITL::RF_TeraRanger_Serial *teraranger_serial;