APM:Libraries
libraries
AP_Gripper
AP_Gripper.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
18
#include <
AP_Param/AP_Param.h
>
19
20
class
AP_Gripper_Backend
;
21
22
class
AP_Gripper
{
23
public
:
24
AP_Gripper
();
25
26
// indicate whether this module is enabled or not
27
bool
enabled
()
const
{
return
_enabled
; }
28
29
// initialise the gripper
30
void
init
();
31
32
// grab - move the servo to the grab position
33
void
grab
();
34
35
// release - move the servo output to the release position
36
void
release
();
37
38
// released - returns true if currently in released position
39
bool
released
()
const
;
40
41
// grabbed - returns true if currently in grabbed position
42
bool
grabbed
()
const
;
43
44
// update - should be called at at least 10hz
45
void
update
();
46
47
// valid - returns true if we have a gripper and it should work
48
bool
valid
()
const
;
49
50
static
const
struct
AP_Param::GroupInfo
var_info
[];
51
52
// parameters
53
AP_Int8
_enabled
;
// grabber enable/disable
54
55
typedef
enum
{
56
STATE_GRABBING
,
57
STATE_RELEASING
,
58
STATE_GRABBED
,
59
STATE_RELEASED
,
60
}
gripper_state
;
61
62
struct
Backend_Config
{
63
AP_Int8
type
;
// grabber type (e.g. EPM or servo)
64
AP_Int16
grab_pwm
;
// PWM value sent to Gripper to initiate grabbing the cargo
65
AP_Int16
release_pwm
;
// PWM value sent to Gripper to release the cargo
66
AP_Int16
neutral_pwm
;
// PWM value sent to gripper when not grabbing or releasing
67
AP_Int8
regrab_interval
;
// Time in seconds that gripper will regrab the cargo to ensure grip has not weakend
68
AP_Int16
uavcan_hardpoint_id
;
69
70
gripper_state
state
=
STATE_RELEASED
;
71
}
config
;
72
73
private
:
74
75
AP_Gripper_Backend
*
backend
;
76
};
AP_Gripper
Definition:
AP_Gripper.h:22
AP_Gripper::STATE_RELEASING
Definition:
AP_Gripper.h:57
AP_Gripper::enabled
bool enabled() const
Definition:
AP_Gripper.h:27
AP_Gripper::gripper_state
gripper_state
Definition:
AP_Gripper.h:55
AP_Gripper::Backend_Config::neutral_pwm
AP_Int16 neutral_pwm
Definition:
AP_Gripper.h:66
AP_Gripper::Backend_Config::state
gripper_state state
Definition:
AP_Gripper.h:70
AP_Gripper::valid
bool valid() const
AP_Gripper::Backend_Config::uavcan_hardpoint_id
AP_Int16 uavcan_hardpoint_id
Definition:
AP_Gripper.h:68
AP_Gripper::STATE_RELEASED
Definition:
AP_Gripper.h:59
AP_Gripper::grabbed
bool grabbed() const
AP_Gripper::Backend_Config::regrab_interval
AP_Int8 regrab_interval
Definition:
AP_Gripper.h:67
AP_Gripper::release
void release()
AP_Gripper::grab
void grab()
AP_Param.h
A system for managing and storing variables that are of general interest to the system.
AP_Gripper::Backend_Config::type
AP_Int8 type
Definition:
AP_Gripper.h:63
AP_Gripper::_enabled
AP_Int8 _enabled
Definition:
AP_Gripper.h:53
AP_Gripper::backend
AP_Gripper_Backend * backend
Definition:
AP_Gripper.h:75
AP_Gripper::STATE_GRABBING
Definition:
AP_Gripper.h:56
AP_Gripper::config
struct AP_Gripper::Backend_Config config
AP_Param::GroupInfo
Definition:
AP_Param.h:145
AP_Gripper_Backend
Definition:
AP_Gripper_Backend.h:20
AP_Gripper::Backend_Config::release_pwm
AP_Int16 release_pwm
Definition:
AP_Gripper.h:65
AP_Gripper::Backend_Config::grab_pwm
AP_Int16 grab_pwm
Definition:
AP_Gripper.h:64
AP_Gripper::init
void init()
Definition:
AP_Gripper.cpp:76
AP_Gripper::released
bool released() const
AP_Gripper::update
void update()
AP_Gripper::Backend_Config
Definition:
AP_Gripper.h:62
AP_Gripper::STATE_GRABBED
Definition:
AP_Gripper.h:58
AP_Gripper::var_info
static const struct AP_Param::GroupInfo var_info[]
Definition:
AP_Gripper.h:50
AP_Gripper::AP_Gripper
AP_Gripper()
Definition:
AP_Gripper.cpp:71
Generated on Sun Jun 17 2018 14:18:48 for APM:Libraries by
1.8.13