mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-26 01:33:56 -04:00
AP_HAL_SITL: add vicon-over-mavlink support
This commit is contained in:
parent
1151d76345
commit
85b41a8abb
@ -194,6 +194,13 @@ void SITL_State::wait_clock(uint64_t wait_time_usec)
|
|||||||
#define streq(a, b) (!strcmp(a, b))
|
#define streq(a, b) (!strcmp(a, b))
|
||||||
int SITL_State::sim_fd(const char *name, const char *arg)
|
int SITL_State::sim_fd(const char *name, const char *arg)
|
||||||
{
|
{
|
||||||
|
if (streq(name, "vicon")) {
|
||||||
|
if (vicon != nullptr) {
|
||||||
|
AP_HAL::panic("Only one vicon system at a time");
|
||||||
|
}
|
||||||
|
vicon = new SITL::Vicon();
|
||||||
|
return vicon->fd();
|
||||||
|
}
|
||||||
AP_HAL::panic("unknown simulated device: %s", name);
|
AP_HAL::panic("unknown simulated device: %s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,6 +305,13 @@ void SITL_State::_fdm_input_local(void)
|
|||||||
if (adsb != nullptr) {
|
if (adsb != nullptr) {
|
||||||
adsb->update();
|
adsb->update();
|
||||||
}
|
}
|
||||||
|
if (vicon != nullptr) {
|
||||||
|
Quaternion attitude;
|
||||||
|
sitl_model->get_attitude(attitude);
|
||||||
|
vicon->update(sitl_model->get_location(),
|
||||||
|
sitl_model->get_position(),
|
||||||
|
attitude);
|
||||||
|
}
|
||||||
|
|
||||||
if (_sitl && _use_fg_view) {
|
if (_sitl && _use_fg_view) {
|
||||||
_output_to_flightgear();
|
_output_to_flightgear();
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <SITL/SITL.h>
|
#include <SITL/SITL.h>
|
||||||
#include <SITL/SIM_Gimbal.h>
|
#include <SITL/SIM_Gimbal.h>
|
||||||
#include <SITL/SIM_ADSB.h>
|
#include <SITL/SIM_ADSB.h>
|
||||||
|
#include <SITL/SIM_Vicon.h>
|
||||||
#include <AP_HAL/utility/Socket.h>
|
#include <AP_HAL/utility/Socket.h>
|
||||||
|
|
||||||
class HAL_SITL;
|
class HAL_SITL;
|
||||||
@ -210,6 +211,9 @@ private:
|
|||||||
// simulated ADSb
|
// simulated ADSb
|
||||||
SITL::ADSB *adsb;
|
SITL::ADSB *adsb;
|
||||||
|
|
||||||
|
// simulated vicon system:
|
||||||
|
SITL::Vicon *vicon;
|
||||||
|
|
||||||
// output socket for flightgear viewing
|
// output socket for flightgear viewing
|
||||||
SocketAPM fg_socket{true};
|
SocketAPM fg_socket{true};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user