AP_Mount_SoloGimbal.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. MAVLink enabled mount backend class
  3. */
  4. #pragma once
  5. #include <AP_HAL/AP_HAL.h>
  6. #include <AP_AHRS/AP_AHRS.h>
  7. #if AP_AHRS_NAVEKF_AVAILABLE
  8. #include <AP_Math/AP_Math.h>
  9. #include <AP_Common/AP_Common.h>
  10. #include <GCS_MAVLink/GCS_MAVLink.h>
  11. #include <RC_Channel/RC_Channel.h>
  12. #include "AP_Mount_Backend.h"
  13. #include "SoloGimbal.h"
  14. class AP_Mount_SoloGimbal : public AP_Mount_Backend
  15. {
  16. public:
  17. // Constructor
  18. AP_Mount_SoloGimbal(AP_Mount &frontend, AP_Mount::mount_state &state, uint8_t instance);
  19. // init - performs any required initialisation for this instance
  20. void init() override;
  21. // update mount position - should be called periodically
  22. void update() override;
  23. // has_pan_control - returns true if this mount can control it's pan (required for multicopters)
  24. bool has_pan_control() const override;
  25. // set_mode - sets mount's mode
  26. void set_mode(enum MAV_MOUNT_MODE mode) override;
  27. // send_mount_status - called to allow mounts to send their status to GCS using the MOUNT_STATUS message
  28. void send_mount_status(mavlink_channel_t chan) override;
  29. // handle a GIMBAL_REPORT message
  30. void handle_gimbal_report(mavlink_channel_t chan, const mavlink_message_t &msg) override;
  31. void handle_gimbal_torque_report(mavlink_channel_t chan, const mavlink_message_t &msg);
  32. void handle_param_value(const mavlink_message_t &msg) override;
  33. // send a GIMBAL_REPORT message to the GCS
  34. void send_gimbal_report(mavlink_channel_t chan) override;
  35. void update_fast() override;
  36. private:
  37. // internal variables
  38. bool _initialised; // true once the driver has been initialised
  39. // Write a gimbal measurament and estimation data packet
  40. void Log_Write_Gimbal(SoloGimbal &gimbal);
  41. bool _params_saved;
  42. SoloGimbal _gimbal;
  43. };
  44. #endif // AP_AHRS_NAVEKF_AVAILABLE