mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-18 06:38:29 -04:00
AP_HAL_SITL: add support for simulated RPLidarA2
This commit is contained in:
parent
f5320e8816
commit
be9fc57e8f
@ -336,6 +336,12 @@ int SITL_State::sim_fd(const char *name, const char *arg)
|
||||
// }
|
||||
// frsky_sport = new SITL::Frsky_SPortPassthrough();
|
||||
// return frsky_sportpassthrough->fd();
|
||||
} else if (streq(name, "rplidara2")) {
|
||||
if (rplidara2 != nullptr) {
|
||||
AP_HAL::panic("Only one rplidara2 at a time");
|
||||
}
|
||||
rplidara2 = new SITL::PS_RPLidarA2();
|
||||
return rplidara2->fd();
|
||||
}
|
||||
|
||||
AP_HAL::panic("unknown simulated device: %s", name);
|
||||
@ -417,6 +423,11 @@ int SITL_State::sim_fd_write(const char *name)
|
||||
AP_HAL::panic("No frsky-d created");
|
||||
}
|
||||
return frsky_d->write_fd();
|
||||
} else if (streq(name, "rplidara2")) {
|
||||
if (rplidara2 == nullptr) {
|
||||
AP_HAL::panic("No rplidara2 created");
|
||||
}
|
||||
return rplidara2->write_fd();
|
||||
}
|
||||
AP_HAL::panic("unknown simulated device: %s", name);
|
||||
}
|
||||
@ -603,6 +614,9 @@ void SITL_State::_fdm_input_local(void)
|
||||
// if (frsky_sportpassthrough != nullptr) {
|
||||
// frsky_sportpassthrough->update();
|
||||
// }
|
||||
if (rplidara2 != nullptr) {
|
||||
rplidara2->update(sitl_model->get_location());
|
||||
}
|
||||
|
||||
if (_sitl) {
|
||||
_sitl->efi_ms.update();
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <SITL/SIM_Frsky_D.h>
|
||||
// #include <SITL/SIM_Frsky_SPort.h>
|
||||
// #include <SITL/SIM_Frsky_SPortPassthrough.h>
|
||||
#include <SITL/SIM_PS_RPLidarA2.h>
|
||||
|
||||
#include <AP_HAL/utility/Socket.h>
|
||||
|
||||
@ -273,6 +274,8 @@ private:
|
||||
SITL::Frsky_D *frsky_d;
|
||||
// SITL::Frsky_SPort *frsky_sport;
|
||||
// SITL::Frsky_SPortPassthrough *frsky_sportpassthrough;
|
||||
// simulated NMEA rangefinder:
|
||||
SITL::PS_RPLidarA2 *rplidara2;
|
||||
|
||||
// output socket for flightgear viewing
|
||||
SocketAPM fg_socket{true};
|
||||
|
Loading…
Reference in New Issue
Block a user