AC_PrecLand_Backend.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include <AP_Math/AP_Math.h>
  3. #include <AC_PID/AC_PID.h>
  4. #include "AC_PrecLand.h"
  5. class AC_PrecLand_Backend
  6. {
  7. public:
  8. // Constructor
  9. AC_PrecLand_Backend(const AC_PrecLand& frontend, AC_PrecLand::precland_state& state) :
  10. _frontend(frontend),
  11. _state(state) {}
  12. // destructor
  13. virtual ~AC_PrecLand_Backend() {}
  14. // perform any required initialisation of backend
  15. virtual void init() = 0;
  16. // retrieve updates from sensor
  17. virtual void update() = 0;
  18. // provides a unit vector towards the target in body frame
  19. // returns same as have_los_meas()
  20. virtual bool get_los_body(Vector3f& dir_body) = 0;
  21. // returns system time in milliseconds of last los measurement
  22. virtual uint32_t los_meas_time_ms() = 0;
  23. // return true if there is a valid los measurement available
  24. virtual bool have_los_meas() = 0;
  25. // returns distance to target in meters (0 means distance is not known)
  26. virtual float distance_to_target() { return 0.0f; };
  27. // parses a mavlink message from the companion computer
  28. virtual void handle_msg(const mavlink_message_t &msg) {};
  29. // get bus parameter
  30. int8_t get_bus(void) const { return _frontend._bus.get(); }
  31. protected:
  32. const AC_PrecLand& _frontend; // reference to precision landing front end
  33. AC_PrecLand::precland_state &_state; // reference to this instances state
  34. };