APM:Libraries
AP_Gripper_Servo.h
Go to the documentation of this file.
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 
20 
22 public:
23 
25  AP_Gripper_Backend(_config) { }
26 
27  // grab - move the servo to the grab position
28  void grab() override;
29 
30  // release - move the servo output to the release position
31  void release() override;
32 
33  // grabbed - returns true if gripper in grabbed state
34  bool grabbed() const override;
35 
36  // released - returns true if gripper in released state
37  bool released() const override;
38 
39  // valid - returns true if the backend should be working
40  bool valid() const;
41 
42 protected:
43 
44  // type-specific intiailisations:
45  void init_gripper() override;
46 
47  // type-specific periodic updates:
48  void update_gripper() override;
49 
50 private:
51 
52  uint32_t action_timestamp; // ms; time grab or release happened
53  const uint16_t action_time = 3000; // ms; time to grab or release
54 
55  bool has_state_pwm(const uint16_t pwm) const;
56 };
const uint16_t action_time
uint32_t action_timestamp
bool released() const override
void release() override
static uint16_t pwm
Definition: RCOutput.cpp:20
void grab() override
bool has_state_pwm(const uint16_t pwm) const
AP_Gripper_Servo(struct AP_Gripper::Backend_Config &_config)
void init_gripper() override
void update_gripper() override
bool grabbed() const override