LCOV - code coverage report
Current view: top level - AP_Motors - AP_MotorsSingle.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 5 5 100.0 %
Date: 2026-09-09 11:02:08 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /// @file       AP_MotorsSingle.h
       2             : /// @brief      Motor and Servo control class for Singlecopters
       3             : #pragma once
       4             : 
       5             : #include <AP_Common/AP_Common.h>
       6             : #include <AP_Math/AP_Math.h>        // ArduPilot Mega Vector/Matrix math Library
       7             : #include "AP_MotorsMulticopter.h"
       8             : 
       9             : // feedback direction
      10             : #define AP_MOTORS_SING_POSITIVE      1
      11             : #define AP_MOTORS_SING_NEGATIVE     -1
      12             : 
      13             : #define NUM_ACTUATORS 4
      14             : 
      15             : #define AP_MOTORS_SINGLE_SPEED_DIGITAL_SERVOS 250 // update rate for digital servos
      16             : #define AP_MOTORS_SINGLE_SPEED_ANALOG_SERVOS 125  // update rate for analog servos
      17             : 
      18             : #define AP_MOTORS_SINGLE_SERVO_INPUT_RANGE      4500    // roll or pitch input of -4500 will cause servos to their minimum (i.e. radio_min), +4500 will move them to their maximum (i.e. radio_max)
      19             : 
      20             : /// @class      AP_MotorsSingle
      21             : class AP_MotorsSingle : public AP_MotorsMulticopter {
      22             : public:
      23             : 
      24             :     /// Constructor
      25           1 :     AP_MotorsSingle(uint16_t speed_hz = AP_MOTORS_SPEED_DEFAULT) :
      26           1 :         AP_MotorsMulticopter(speed_hz)
      27             :     {
      28           1 :     };
      29             : 
      30             :     // init
      31             :     void                init(motor_frame_class frame_class, motor_frame_type frame_type) override;
      32             : 
      33             :     // set frame class (i.e. quad, hexa, heli) and type (i.e. x, plus)
      34             :     void set_frame_class_and_type(motor_frame_class frame_class, motor_frame_type frame_type) override;
      35             : 
      36             :     // set update rate to motors - a value in hertz
      37             :     void                set_update_rate( uint16_t speed_hz ) override;
      38             : 
      39             :     // output_to_motors - sends minimum values out to the motors
      40             :     virtual void        output_to_motors() override;
      41             : 
      42             :     // get_motor_mask - returns a bitmask of which outputs are being used for motors or servos (1 means being used)
      43             :     //  this can be used to ensure other pwm outputs (i.e. for servos) do not conflict
      44             :     uint32_t            get_motor_mask() override;
      45             : 
      46             :     // Run arming checks
      47          42 :     bool arming_checks(size_t buflen, char *buffer) const override { return AP_Motors::arming_checks(buflen, buffer); }
      48             : 
      49             : protected:
      50             :     // output - sends commands to the motors
      51             :     void                output_armed_stabilizing() override;
      52             : 
      53           1 :     const char* _get_frame_string() const override { return "SINGLE"; }
      54             : 
      55             :     // output_test_seq - spin a motor at the pwm value specified
      56             :     //  motor_seq is the motor's sequence number from 1 to the number of motors on the frame
      57             :     //  pwm value is an actual pwm value that will be output, normally in the range of 1000 ~ 2000
      58             :     virtual void        _output_test_seq(uint8_t motor_seq, int16_t pwm) override;
      59             : 
      60             :     int16_t             _throttle_radio_output;   // total throttle pwm value, summed onto throttle channel minimum, typically ~1100-1900
      61             :     float               _actuator_out[NUM_ACTUATORS]; // combined roll, pitch, yaw and throttle outputs to motors in 0~1 range
      62             :     float               _thrust_out;
      63             : };

Generated by: LCOV version 1.14