AP_HAL_SITL: add simulated LightWare serial lidar talking new binary protocol

This commit is contained in:
Peter Barker 2020-06-30 21:10:28 +10:00 committed by Peter Barker
parent db0a0beb1b
commit c3246d61f4
2 changed files with 18 additions and 1 deletions

View File

@ -261,6 +261,12 @@ int SITL_State::sim_fd(const char *name, const char *arg)
}
lightwareserial = new SITL::RF_LightWareSerial();
return lightwareserial->fd();
} else if (streq(name, "lightwareserial-binary")) {
if (lightwareserial_binary != nullptr) {
AP_HAL::panic("Only one lightwareserial-binary at a time");
}
lightwareserial_binary = new SITL::RF_LightWareSerialBinary();
return lightwareserial_binary->fd();
} else if (streq(name, "lanbao")) {
if (lanbao != nullptr) {
AP_HAL::panic("Only one lanbao at a time");
@ -373,6 +379,11 @@ int SITL_State::sim_fd_write(const char *name)
AP_HAL::panic("No lightwareserial created");
}
return lightwareserial->write_fd();
} else if (streq(name, "lightwareserial-binary")) {
if (lightwareserial_binary == nullptr) {
AP_HAL::panic("No lightwareserial_binary created");
}
return lightwareserial_binary->write_fd();
} else if (streq(name, "lanbao")) {
if (lanbao == nullptr) {
AP_HAL::panic("No lanbao created");
@ -578,6 +589,9 @@ void SITL_State::_fdm_input_local(void)
if (lightwareserial != nullptr) {
lightwareserial->update(sitl_model->get_range());
}
if (lightwareserial_binary != nullptr) {
lightwareserial_binary->update(sitl_model->get_range());
}
if (lanbao != nullptr) {
lanbao->update(sitl_model->get_range());
}

View File

@ -28,6 +28,7 @@
#include <SITL/SIM_RF_Benewake_TF03.h>
#include <SITL/SIM_RF_Benewake_TFmini.h>
#include <SITL/SIM_RF_LightWareSerial.h>
#include <SITL/SIM_RF_LightWareSerialBinary.h>
#include <SITL/SIM_RF_Lanbao.h>
#include <SITL/SIM_RF_BLping.h>
#include <SITL/SIM_RF_LeddarOne.h>
@ -249,8 +250,10 @@ private:
// simulated Benewake tfmini rangefinder:
SITL::RF_Benewake_TFmini *benewake_tfmini;
// simulated LightWareSerial rangefinder:
// simulated LightWareSerial rangefinder - legacy protocol::
SITL::RF_LightWareSerial *lightwareserial;
// simulated LightWareSerial rangefinder - binary protocol:
SITL::RF_LightWareSerialBinary *lightwareserial_binary;
// simulated Lanbao rangefinder:
SITL::RF_Lanbao *lanbao;
// simulated BLping rangefinder: