AP_SpdHgtControl.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #pragma once
  2. /// @file AP_SpdHgtControl.h
  3. /// @brief generic speed & height controller interface
  4. /*
  5. This defines a generic interface for speed & height controllers. Each
  6. specific controller should be a subclass of this generic
  7. interface. All variables used by controllers should be in their
  8. own class.
  9. */
  10. #include <AP_Vehicle/AP_Vehicle.h>
  11. #include <stdint.h>
  12. class AP_SpdHgtControl {
  13. public:
  14. // Update the internal state of the height and height rate estimator
  15. // Update of the inertial speed rate estimate internal state
  16. // Should be called at 50Hz or faster
  17. virtual void update_50hz(void) = 0;
  18. // Update of the pitch and throttle demands
  19. // Should be called at 10Hz or faster
  20. virtual void update_pitch_throttle( int32_t hgt_dem_cm,
  21. int32_t EAS_dem_cm,
  22. enum AP_Vehicle::FixedWing::FlightStage flight_stage,
  23. float distance_beyond_land_wp,
  24. int32_t ptchMinCO_cd,
  25. int16_t throttle_nudge,
  26. float hgt_afe,
  27. float load_factor,
  28. bool soaring_active) = 0;
  29. // demanded throttle in percentage
  30. // should return 0 to 100
  31. virtual int32_t get_throttle_demand(void)=0;
  32. // demanded pitch angle in centi-degrees
  33. // should return -9000 to +9000
  34. virtual int32_t get_pitch_demand(void)=0;
  35. // Rate of change of velocity along X body axis in m/s^2
  36. virtual float get_VXdot(void)=0;
  37. // return current target airspeed
  38. virtual float get_target_airspeed(void) const = 0;
  39. // return maximum climb rate
  40. virtual float get_max_climbrate(void) const = 0;
  41. // added to let SoaringController reset pitch integrator to zero
  42. virtual void reset_pitch_I(void) = 0;
  43. // return landing sink rate
  44. virtual float get_land_sinkrate(void) const = 0;
  45. // return landing airspeed
  46. virtual float get_land_airspeed(void) const = 0;
  47. // set path_proportion accessor
  48. virtual void set_path_proportion(float path_proportion) = 0;
  49. // add new controllers to this enum. Users can then
  50. // select which controller to use by setting the
  51. // SPDHGT_CONTROLLER parameter
  52. enum ControllerType {
  53. CONTROLLER_TECS = 1
  54. };
  55. };