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

          Line data    Source code
       1             : /*
       2             :  * AP_EPM.h
       3             :  *
       4             :  *  Created on: DEC 06, 2013
       5             :  *      Author: Andreas Jochum
       6             :  *              Pavel Kirienko <[email protected]> - UAVCAN support
       7             :  *
       8             :  *      Set-up Wiki: https://copter.ardupilot.club/wiki/common-electro-permanent-magnet-gripper/
       9             :  *      EPM docs:    https://docs.zubax.com/opengrab_epm_v3
      10             :  */
      11             : 
      12             : /// @file   AP_EPM.h
      13             : /// @brief  AP_EPM control class
      14             : #pragma once
      15             : 
      16             : #include "AP_Gripper.h"
      17             : 
      18             : #if AP_GRIPPER_EPM_ENABLED
      19             : 
      20             : #include "AP_Gripper_Backend.h"
      21             : 
      22             : #define EPM_RETURN_TO_NEUTRAL_MS    500         // EPM PWM returns to neutral position this many milliseconds after grab or release
      23             : 
      24             : /// @class  AP_Gripper_EPM
      25             : /// @brief  Class to manage the EPM_CargoGripper 
      26             : class AP_Gripper_EPM : public AP_Gripper_Backend {
      27             : public:
      28             :     AP_Gripper_EPM(struct AP_Gripper::Backend_Config &_config);
      29             : 
      30             :     // initialise the EPM
      31             :     void        init_gripper() override;
      32             : 
      33             :     // grab - move the EPM pwm output to the grab position
      34             :     void        grab() override;
      35             : 
      36             :     // release - move the EPM pwm output to the release position
      37             :     void        release() override;
      38             : 
      39             :     // grabbed - returns true if gripper in grabbed state
      40             :     bool grabbed() const override;
      41             : 
      42             :     // released - returns true if gripper in released state
      43             :     bool released() const override;
      44             : 
      45             :     // update - moves the pwm back to neutral after the timeout has passed
      46             :     // should be called at at least 10hz
      47             :     void        update_gripper() override;
      48             : 
      49             : private:
      50             : 
      51             :     // neutral - return the EPM pwm output to the neutral position
      52             :     void        neutral();
      53             : 
      54           2 :     bool should_use_uavcan() const { return _uavcan_fd >= 0; }
      55             : 
      56             :     struct UAVCANCommand make_uavcan_command(uint16_t command) const;
      57             : 
      58             :     // UAVCAN driver fd
      59             :     int _uavcan_fd = -1;
      60             : };
      61             : 
      62             : #endif  // AP_GRIPPER_EPM_ENABLED

Generated by: LCOV version 1.14