AC_PrecLand_SITL.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #if CONFIG_HAL_BOARD == HAL_BOARD_SITL
  3. #include <AP_Math/AP_Math.h>
  4. #include <AC_PrecLand/AC_PrecLand_Backend.h>
  5. #include <SITL/SITL.h>
  6. /*
  7. * AC_PrecLand_SITL - supplies vectors to a fake landing target
  8. */
  9. class AC_PrecLand_SITL : public AC_PrecLand_Backend
  10. {
  11. public:
  12. // Constructor
  13. using AC_PrecLand_Backend::AC_PrecLand_Backend;
  14. // perform any required initialisation of backend
  15. void init() override;
  16. // retrieve updates from sensor
  17. void update() override;
  18. // provides a unit vector towards the target in body frame
  19. // returns same as have_los_meas()
  20. bool get_los_body(Vector3f& ret) override;
  21. // returns system time in milliseconds of last los measurement
  22. uint32_t los_meas_time_ms() override { return _los_meas_time_ms; }
  23. // return true if there is a valid los measurement available
  24. bool have_los_meas() override;
  25. private:
  26. SITL::SITL *_sitl; // sitl instance pointer
  27. Vector3f _los_meas_body; // unit vector in body frame pointing towards target
  28. uint32_t _los_meas_time_ms; // system time in milliseconds when los was measured
  29. bool _have_los_meas; // true if there is a valid measurement from the camera
  30. };
  31. #endif