Line data Source code
1 : /* 2 : MAVLink enabled mount backend class 3 : */ 4 : #pragma once 5 : 6 : #include "AP_Mount_config.h" 7 : 8 : #if HAL_SOLO_GIMBAL_ENABLED 9 : 10 : #include "AP_Mount_Backend.h" 11 : #include <AP_Math/AP_Math.h> 12 : #include <AP_Common/AP_Common.h> 13 : #include <GCS_MAVLink/GCS_MAVLink.h> 14 : #include "SoloGimbal.h" 15 : 16 : class AP_Mount_SoloGimbal : public AP_Mount_Backend 17 : { 18 : 19 : public: 20 : // Constructor 21 : AP_Mount_SoloGimbal(AP_Mount &frontend, AP_Mount_Params ¶ms, uint8_t instance); 22 : 23 : // init - performs any required initialisation for this instance 24 : void init() override; 25 : 26 : // update mount position - should be called periodically 27 : void update() override; 28 : 29 : // has_pan_control - returns true if this mount can control its pan (required for multicopters) 30 6 : bool has_pan_control() const override { return false; } 31 : 32 : // handle a GIMBAL_REPORT message 33 : void handle_gimbal_report(mavlink_channel_t chan, const mavlink_message_t &msg) override; 34 : void handle_gimbal_torque_report(mavlink_channel_t chan, const mavlink_message_t &msg); 35 : void handle_param_value(const mavlink_message_t &msg) override; 36 : 37 : void update_fast() override; 38 : 39 : protected: 40 : 41 : // returns true if heart beat should be suppressed for this gimbal 42 1023 : bool suppress_heartbeat() const override { return true; } 43 : 44 : // get attitude as a quaternion. returns true on success 45 : bool get_attitude_quaternion(Quaternion& att_quat) override; 46 : 47 : private: 48 : // internal variables 49 : bool _initialised; // true once the driver has been initialised 50 : 51 : // Write a gimbal measurament and estimation data packet 52 : void Log_Write_Gimbal(SoloGimbal &gimbal); 53 : 54 : bool _params_saved; 55 : SoloGimbal _gimbal; 56 : }; 57 : 58 : #endif // HAL_SOLO_GIMBAL_ENABLED