Browse Source

AP_HAL_SITL: add TeraRange Neo Rangefinder

master
Henry Wurzburg 3 years ago committed by Andrew Tridgell
parent
commit
e682296b58
  1. 9
      libraries/AP_HAL_SITL/SITL_State.cpp
  2. 3
      libraries/AP_HAL_SITL/SITL_State.h

9
libraries/AP_HAL_SITL/SITL_State.cpp

@ -236,6 +236,12 @@ SITL::SerialDevice *SITL_State::create_serial_sim(const char *name, const char * @@ -236,6 +236,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, "teraranger_serial")) {
if (teraranger_serial != nullptr) {
AP_HAL::panic("Only one teraranger_serial at a time");
}
teraranger_serial = new SITL::RF_TeraRanger_Serial();
return teraranger_serial;
} else if (streq(name, "lightwareserial")) {
if (lightwareserial != nullptr) {
AP_HAL::panic("Only one lightwareserial at a time");
@ -567,6 +573,9 @@ void SITL_State::_fdm_input_local(void) @@ -567,6 +573,9 @@ void SITL_State::_fdm_input_local(void)
if (benewake_tfmini != nullptr) {
benewake_tfmini->update(sitl_model->rangefinder_range());
}
if (teraranger_serial != nullptr) {
teraranger_serial->update(sitl_model->rangefinder_range());
}
if (lightwareserial != nullptr) {
lightwareserial->update(sitl_model->rangefinder_range());
}

3
libraries/AP_HAL_SITL/SITL_State.h

@ -31,6 +31,7 @@ @@ -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_TeraRanger_Serial.h>
#include <SITL/SIM_RF_LightWareSerial.h>
#include <SITL/SIM_RF_LightWareSerialBinary.h>
#include <SITL/SIM_RF_Lanbao.h>
@ -212,6 +213,8 @@ private: @@ -212,6 +213,8 @@ private:
SITL::RF_Benewake_TF03 *benewake_tf03;
// simulated Benewake tfmini rangefinder:
SITL::RF_Benewake_TFmini *benewake_tfmini;
// simulated TeraRanger Serial:
SITL::RF_TeraRanger_Serial *teraranger_serial;
// simulated LightWareSerial rangefinder - legacy protocol::
SITL::RF_LightWareSerial *lightwareserial;

Loading…
Cancel
Save