Line data Source code
1 : /* 2 : CADDX mount using serial protocol backend class 3 : */ 4 : #pragma once 5 : 6 : #include "AP_Mount_config.h" 7 : 8 : #if HAL_MOUNT_CADDX_ENABLED 9 : 10 : #include "AP_Mount_Backend_Serial.h" 11 : #include <AP_Math/quaternion.h> 12 : 13 : class AP_Mount_CADDX : public AP_Mount_Backend_Serial 14 : { 15 : 16 : public: 17 : // Constructor 18 : using AP_Mount_Backend_Serial::AP_Mount_Backend_Serial; 19 : 20 : // update mount position - should be called periodically 21 : void update() override; 22 : 23 : // has_pan_control - returns true if this mount can control its pan (required for multicopters) 24 0 : bool has_pan_control() const override { return yaw_range_valid(); }; 25 : 26 : // has_roll_control - returns true if this mount can control its roll 27 0 : bool has_roll_control() const override { return roll_range_valid(); }; 28 : 29 : // has_pitch_control - returns true if this mount can control its tilt 30 0 : bool has_pitch_control() const override { return pitch_range_valid(); }; 31 : 32 : protected: 33 : 34 : // get attitude as a quaternion. returns true on success 35 : bool get_attitude_quaternion(Quaternion& att_quat) override; 36 : 37 : private: 38 : 39 : // lock mode enum 40 : enum class LockMode { 41 : PITCH_LOCK = (1<<0), 42 : ROLL_LOCK = (1<<1), 43 : YAW_LOCK = (1<<2), 44 : }; 45 : 46 : // CADDX can only send angles 47 0 : uint8_t natively_supported_mount_target_types() const override { 48 0 : return NATIVE_ANGLES_ONLY; 49 : }; 50 : 51 : // send_target_angles 52 : void send_target_angles(const MountAngleTarget& angle_target_rad) override; 53 : }; 54 : #endif // HAL_MOUNT_CADDX_ENABLED