mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
AP_HAL_SITL: add simulated mavlink-attached rangefinder
This commit is contained in:
parent
6be519fb0d
commit
185bc68476
@ -310,6 +310,13 @@ int SITL_State::sim_fd(const char *name, const char *arg)
|
|||||||
nmea = new SITL::RF_NMEA();
|
nmea = new SITL::RF_NMEA();
|
||||||
return nmea->fd();
|
return nmea->fd();
|
||||||
|
|
||||||
|
} else if (streq(name, "rf_mavlink")) {
|
||||||
|
if (wasp != nullptr) {
|
||||||
|
AP_HAL::panic("Only one rf_mavlink at a time");
|
||||||
|
}
|
||||||
|
rf_mavlink = new SITL::RF_MAVLink();
|
||||||
|
return rf_mavlink->fd();
|
||||||
|
|
||||||
} else if (streq(name, "frsky-d")) {
|
} else if (streq(name, "frsky-d")) {
|
||||||
if (frsky_d != nullptr) {
|
if (frsky_d != nullptr) {
|
||||||
AP_HAL::panic("Only one frsky_d at a time");
|
AP_HAL::panic("Only one frsky_d at a time");
|
||||||
@ -400,6 +407,11 @@ int SITL_State::sim_fd_write(const char *name)
|
|||||||
AP_HAL::panic("No nmea created");
|
AP_HAL::panic("No nmea created");
|
||||||
}
|
}
|
||||||
return nmea->write_fd();
|
return nmea->write_fd();
|
||||||
|
} else if (streq(name, "rf_mavlink")) {
|
||||||
|
if (rf_mavlink == nullptr) {
|
||||||
|
AP_HAL::panic("No rf_mavlink created");
|
||||||
|
}
|
||||||
|
return rf_mavlink->write_fd();
|
||||||
} else if (streq(name, "frsky-d")) {
|
} else if (streq(name, "frsky-d")) {
|
||||||
if (frsky_d == nullptr) {
|
if (frsky_d == nullptr) {
|
||||||
AP_HAL::panic("No frsky-d created");
|
AP_HAL::panic("No frsky-d created");
|
||||||
@ -578,6 +590,9 @@ void SITL_State::_fdm_input_local(void)
|
|||||||
if (nmea != nullptr) {
|
if (nmea != nullptr) {
|
||||||
nmea->update(sitl_model->get_range());
|
nmea->update(sitl_model->get_range());
|
||||||
}
|
}
|
||||||
|
if (rf_mavlink != nullptr) {
|
||||||
|
rf_mavlink->update(sitl_model->get_range());
|
||||||
|
}
|
||||||
|
|
||||||
if (frsky_d != nullptr) {
|
if (frsky_d != nullptr) {
|
||||||
frsky_d->update();
|
frsky_d->update();
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <SITL/SIM_RF_MaxsonarSerialLV.h>
|
#include <SITL/SIM_RF_MaxsonarSerialLV.h>
|
||||||
#include <SITL/SIM_RF_Wasp.h>
|
#include <SITL/SIM_RF_Wasp.h>
|
||||||
#include <SITL/SIM_RF_NMEA.h>
|
#include <SITL/SIM_RF_NMEA.h>
|
||||||
|
#include <SITL/SIM_RF_MAVLink.h>
|
||||||
|
|
||||||
#include <SITL/SIM_Frsky_D.h>
|
#include <SITL/SIM_Frsky_D.h>
|
||||||
// #include <SITL/SIM_Frsky_SPort.h>
|
// #include <SITL/SIM_Frsky_SPort.h>
|
||||||
@ -265,6 +266,8 @@ private:
|
|||||||
SITL::RF_Wasp *wasp;
|
SITL::RF_Wasp *wasp;
|
||||||
// simulated NMEA rangefinder:
|
// simulated NMEA rangefinder:
|
||||||
SITL::RF_NMEA *nmea;
|
SITL::RF_NMEA *nmea;
|
||||||
|
// simulated MAVLink rangefinder:
|
||||||
|
SITL::RF_MAVLink *rf_mavlink;
|
||||||
|
|
||||||
// simulated Frsky devices
|
// simulated Frsky devices
|
||||||
SITL::Frsky_D *frsky_d;
|
SITL::Frsky_D *frsky_d;
|
||||||
|
Loading…
Reference in New Issue
Block a user