APM:Libraries
AC_PrecLand_Backend.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <AP_Common/AP_Common.h>
4 #include <AP_Math/AP_Math.h>
5 #include <AC_PID/AC_PID.h>
6 #include "AC_PrecLand.h"
7 
9 {
10 public:
11  // Constructor
13  _frontend(frontend),
14  _state(state) {}
15 
16  // destructor
17  virtual ~AC_PrecLand_Backend() {}
18 
19  // perform any required initialisation of backend
20  virtual void init() = 0;
21 
22  // retrieve updates from sensor
23  virtual void update() = 0;
24 
25  // provides a unit vector towards the target in body frame
26  // returns same as have_los_meas()
27  virtual bool get_los_body(Vector3f& dir_body) = 0;
28 
29  // returns system time in milliseconds of last los measurement
30  virtual uint32_t los_meas_time_ms() = 0;
31 
32  // return true if there is a valid los measurement available
33  virtual bool have_los_meas() = 0;
34 
35  // returns distance to target in meters (0 means distance is not known)
36  virtual float distance_to_target() { return 0.0f; };
37 
38  // parses a mavlink message from the companion computer
39  virtual void handle_msg(mavlink_message_t* msg) {};
40 
41  // get bus parameter
42  int8_t get_bus(void) const { return _frontend._bus.get(); }
43 
44 protected:
45  const AC_PrecLand& _frontend; // reference to precision landing front end
46  AC_PrecLand::precland_state &_state; // reference to this instances state
47 };
AC_PrecLand_Backend(const AC_PrecLand &frontend, AC_PrecLand::precland_state &state)
AP_Int8 _bus
Definition: AC_PrecLand.h:111
Generic PID algorithm, with EEPROM-backed storage of constants.
virtual bool have_los_meas()=0
virtual void handle_msg(mavlink_message_t *msg)
virtual void init()=0
const AC_PrecLand & _frontend
virtual float distance_to_target()
virtual uint32_t los_meas_time_ms()=0
virtual void update()=0
virtual bool get_los_body(Vector3f &dir_body)=0
static int state
Definition: Util.cpp:20
int8_t get_bus(void) const
AC_PrecLand::precland_state & _state
Common definitions and utility routines for the ArduPilot libraries.