Line data Source code
1 : /* 2 : SToRM32 mount backend class 3 : */ 4 : #pragma once 5 : 6 : #include "AP_Mount_config.h" 7 : 8 : #if HAL_MOUNT_STORM32MAVLINK_ENABLED 9 : 10 : #include "AP_Mount_Backend.h" 11 : 12 : #include <AP_Math/AP_Math.h> 13 : #include <AP_Common/AP_Common.h> 14 : 15 : class AP_Mount_SToRM32 : public AP_Mount_Backend 16 : { 17 : 18 : public: 19 : // Constructor 20 : using AP_Mount_Backend::AP_Mount_Backend; 21 : 22 : // update mount position - should be called periodically 23 : void update() override; 24 : 25 : // has_pan_control - returns true if this mount can control its pan (required for multicopters) 26 0 : bool has_pan_control() const override { return yaw_range_valid(); } 27 : 28 : protected: 29 : 30 : // get attitude as a quaternion. returns true on success 31 : bool get_attitude_quaternion(Quaternion& att_quat) override; 32 : 33 : private: 34 : 35 : // search for gimbal in GCS_MAVLink routing table 36 : void find_gimbal(); 37 : 38 : // SToRM32 can only send angles: 39 0 : uint8_t natively_supported_mount_target_types() const override { 40 0 : return NATIVE_ANGLES_ONLY; 41 : }; 42 : 43 : // allow removing lean angles for pitch and roll locks 44 0 : bool apply_bf_roll_pitch_adjustments_in_rc_targeting() const override { 45 0 : return true; 46 : } 47 : 48 : // send_do_mount_control with latest angle targets 49 : void send_target_angles(const MountAngleTarget& angle_target_rad) override; 50 : 51 : // internal variables 52 : bool _initialised; // true once the driver has been initialised 53 : uint8_t _sysid; // sysid of gimbal 54 : uint8_t _compid; // component id of gimbal 55 : mavlink_channel_t _chan = MAVLINK_COMM_0; // mavlink channel used to communicate with gimbal 56 : }; 57 : #endif // HAL_MOUNT_STORM32MAVLINK_ENABLED