LCOV - code coverage report
Current view: top level - AP_Gripper - AP_Gripper_Backend.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 3 4 75.0 %
Date: 2026-09-09 11:02:08 Functions: 2 3 66.7 %

          Line data    Source code
       1             : /*
       2             :    This program is free software: you can redistribute it and/or modify
       3             :    it under the terms of the GNU General Public License as published by
       4             :    the Free Software Foundation, either version 3 of the License, or
       5             :    (at your option) any later version.
       6             : 
       7             :    This program is distributed in the hope that it will be useful,
       8             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
       9             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      10             :    GNU General Public License for more details.
      11             : 
      12             :    You should have received a copy of the GNU General Public License
      13             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      14             :  */
      15             : 
      16             : #pragma once
      17             : 
      18             : #include <AP_Gripper/AP_Gripper.h>
      19             : 
      20             : #if AP_GRIPPER_ENABLED
      21             : 
      22             : class AP_Gripper_Backend {
      23             : public:
      24           8 :     AP_Gripper_Backend(struct AP_Gripper::Backend_Config &_config) :
      25           8 :         config(_config) { }
      26             : 
      27             :     // initialise the gripper backend
      28             :     void init();
      29             : 
      30             :     // update - should be called at at least 10hz
      31             :     void update();
      32             : 
      33             :     // grab - move the servo to the grab position
      34             :     virtual void grab() = 0;
      35             : 
      36             :     // release - move the servo output to the release position
      37             :     virtual void release() = 0;
      38             : 
      39             :     // valid - returns true if the backend should be working
      40       24004 :     virtual bool valid() const { return true; };
      41             : 
      42             :     // released - returns true if currently in released position
      43             :     virtual bool released() const = 0;
      44             : 
      45             :     // grabbed - returns true if currently in grabbed position
      46             :     virtual bool grabbed() const = 0;
      47             : 
      48             :     // type-specific initialisations:
      49             :     virtual void init_gripper() = 0;
      50             : 
      51             :     // type-specific periodic updates:
      52           0 :     virtual void update_gripper() { };
      53             : 
      54             : protected:
      55             : 
      56             :     uint32_t _last_grab_or_release; // ms; time last grab or release happened
      57             : 
      58             :     struct AP_Gripper::Backend_Config &config;
      59             : };
      60             : 
      61             : #endif  // AP_GRIPPER_ENABLED

Generated by: LCOV version 1.14