AP_HAL_SITL: add simulated RPLidarA1

This commit is contained in:
Peter Barker 2021-02-05 12:46:44 +11:00 committed by Randy Mackay
parent 2257d4686f
commit ae7fb93e4c
4 changed files with 26 additions and 2 deletions

View File

@ -374,6 +374,14 @@ SITL::SerialDevice *SITL_State::create_serial_sim(const char *name, const char *
rplidara2 = new SITL::PS_RPLidarA2();
return rplidara2;
#endif
#if HAL_SIM_PS_RPLIDARA1_ENABLED
} else if (streq(name, "rplidara1")) {
if (rplidara1 != nullptr) {
AP_HAL::panic("Only one rplidara1 at a time");
}
rplidara1 = new SITL::PS_RPLidarA1();
return rplidara1;
#endif
#if HAL_SIM_PS_TERARANGERTOWER_ENABLED
} else if (streq(name, "terarangertower")) {
if (terarangertower != nullptr) {
@ -678,6 +686,11 @@ void SITL_State::_fdm_input_local(void)
}
#endif
#if HAL_SIM_PS_RPLIDARA1_ENABLED
if (rplidara1 != nullptr) {
rplidara1->update(sitl_model->get_location());
}
#endif
#if HAL_SIM_PS_TERARANGERTOWER_ENABLED
if (terarangertower != nullptr) {
terarangertower->update(sitl_model->get_location());

View File

@ -55,6 +55,7 @@
// #include <SITL/SIM_Frsky_SPort.h>
// #include <SITL/SIM_Frsky_SPortPassthrough.h>
#include <SITL/SIM_PS_RPLidarA2.h>
#include <SITL/SIM_PS_RPLidarA1.h>
#include <SITL/SIM_PS_TeraRangerTower.h>
#include <SITL/SIM_PS_LightWare_SF45B.h>
@ -257,6 +258,9 @@ private:
// simulated FETtec OneWire ESCs:
SITL::FETtecOneWireESC *fetteconewireesc;
// simulated RPLidarA1:
SITL::PS_RPLidarA1 *rplidara1;
#if HAL_SIM_PS_LIGHTWARE_SF45B_ENABLED
// simulated SF45B proximity sensor:
SITL::PS_LightWare_SF45B *sf45b;

View File

@ -51,7 +51,7 @@ rc 2 1450
#define HAL_SIM_PS_RPLIDARA2_ENABLED HAL_SIM_SERIALPROXIMITYSENSOR_ENABLED
#endif
#if HAL_SIM_PS_RPLIDARA2_ENABLED
#if HAL_SIM_PS_RPLIDARA2_ENABLED || HAL_SIM_PS_RPLIDARA1_ENABLED
#include <stdio.h>
@ -144,4 +144,4 @@ private:
};
#endif // HAL_SIM_PS_RPLIDARA2_ENABLED
#endif // HAL_SIM_PS_RPLIDARA2_ENABLED || HAL_SIM_PS_RPLIDARA1_ENABLED

View File

@ -45,6 +45,11 @@ rc 2 1450
#include "SIM_PS_RPLidar.h"
#ifndef HAL_SIM_PS_RPLIDARA1_ENABLED
#define HAL_SIM_PS_RPLIDARA1_ENABLED HAL_SIM_SERIALPROXIMITYSENSOR_ENABLED
#endif
#if HAL_SIM_PS_RPLIDARA1_ENABLED
namespace SITL {
class PS_RPLidarA1 : public PS_RPLidar {
@ -54,3 +59,5 @@ public:
};
}
#endif // HAL_SIM_PS_RPLIDARA1_ENABLED