diff --git a/libraries/AP_Mount/AP_Mount_Servo.cpp b/libraries/AP_Mount/AP_Mount_Servo.cpp index 2f926c7d84..fa9680307d 100644 --- a/libraries/AP_Mount/AP_Mount_Servo.cpp +++ b/libraries/AP_Mount/AP_Mount_Servo.cpp @@ -119,6 +119,18 @@ void AP_Mount_Servo::update() move_servo(_pan_idx, degrees(_angle_bf_output_rad.z)*10, _params.yaw_angle_min*10, _params.yaw_angle_max*10); } +// returns true if this mount can control its roll +bool AP_Mount_Servo::has_roll_control() const +{ + return SRV_Channels::function_assigned(_roll_idx) && roll_range_valid(); +} + +// returns true if this mount can control its tilt +bool AP_Mount_Servo::has_pitch_control() const +{ + return SRV_Channels::function_assigned(_tilt_idx) && pitch_range_valid(); +} + // returns true if this mount can control its pan (required for multicopters) bool AP_Mount_Servo::has_pan_control() const { diff --git a/libraries/AP_Mount/AP_Mount_Servo.h b/libraries/AP_Mount/AP_Mount_Servo.h index 529a97bd73..8ead11561f 100644 --- a/libraries/AP_Mount/AP_Mount_Servo.h +++ b/libraries/AP_Mount/AP_Mount_Servo.h @@ -31,6 +31,12 @@ public: // update mount position - should be called periodically void update() override; + // returns true if this mount can control its roll + bool has_roll_control() const override; + + // returns true if this mount can control its tilt + bool has_pitch_control() const override; + // returns true if this mount can control its pan (required for multicopters) bool has_pan_control() const override;