-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClawMod.cpp
64 lines (52 loc) · 912 Bytes
/
ClawMod.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "ClawMod.hpp"
/*
ClawModule for use with Micro Gripper Kit A - v0.0.3
Written by: Piotr Kupczyk (dajmosster@gmail.com)
GitHub: https://github.com/piotrku91/ClawModule_SF
*/
bool ClawMod::isOpen()
{
if (ClawSrv.read() == PosAngle::Open)
{
m_isOpen = true;
return true;
};
m_isOpen = false;
return false;
};
bool ClawMod::isLocked()
{
return m_Lock;
};
void ClawMod::Open()
{
if ((!m_isOpen) && (!m_Lock))
{
ClawSrv.write(PosAngle::Open);
m_isOpen = true;
};
};
void ClawMod::Close()
{
if ((m_isOpen) && (!m_Lock))
{
ClawSrv.write(PosAngle::Close);
m_isOpen = false;
};
};
void ClawMod::Lock()
{
m_Lock = true;
};
void ClawMod::Unlock()
{
m_Lock = false;
};
void ClawMod::writeServo(const int &Value)
{
ClawSrv.write(Value);
};
int ClawMod::readServo()
{
return ClawSrv.read();
};