-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIEncodersImpl.cpp
92 lines (69 loc) · 2.8 KB
/
IEncodersImpl.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
#include "YarpOpenraveControlboard.hpp"
// ------------------ IEncoders Related -----------------------------------------
bool roboticslab::YarpOpenraveControlboard::resetEncoder(int j) {
CD_INFO("\n");
if ((unsigned int)j>axes) return false;
return setEncoder(j,0.0);
}
// -----------------------------------------------------------------------------
bool roboticslab::YarpOpenraveControlboard::resetEncoders() {
CD_INFO("\n");
bool ok = true;
for(unsigned int i=0;i<axes;i++)
ok &= resetEncoder(i);
return ok;
}
// -----------------------------------------------------------------------------
bool roboticslab::YarpOpenraveControlboard::setEncoder(int j, double val) { // encExposed = val;
CD_INFO("\n");
return true;
}
// -----------------------------------------------------------------------------
bool roboticslab::YarpOpenraveControlboard::setEncoders(const double *vals) {
CD_INFO("\n");
bool ok = true;
for(unsigned int i=0;i<axes;i++)
ok &= setEncoder(i,vals[i]);
return ok;
}
// -----------------------------------------------------------------------------
bool roboticslab::YarpOpenraveControlboard::getEncoder(int j, double *v) {
//CD_INFO("\n"); //-- Way too verbose
*v = dEncRaw[ manipulatorIDs[j] ] * 180.0 / M_PI;
return true;
}
// -----------------------------------------------------------------------------
bool roboticslab::YarpOpenraveControlboard::getEncoders(double *encs) {
CD_INFO("\n");
bool ok = true;
for(unsigned int i=0;i<axes;i++)
ok &= getEncoder(i,&encs[i]);
return ok;
}
// -----------------------------------------------------------------------------
bool roboticslab::YarpOpenraveControlboard::getEncoderSpeed(int j, double *sp) {
//CD_INFO("\n"); //-- Way too verbose
// Make it easy, give the current reference speed.
*sp = 0; // begins to look like we should use semaphores.
return true;
}
// -----------------------------------------------------------------------------
bool roboticslab::YarpOpenraveControlboard::getEncoderSpeeds(double *spds) {
CD_INFO("\n");
bool ok = true;
for(unsigned int i=0;i<axes;i++)
ok &= getEncoderSpeed(i,&spds[i]);
return ok;
}
// -----------------------------------------------------------------------------
bool roboticslab::YarpOpenraveControlboard::getEncoderAcceleration(int j, double *spds) {
//CD_INFO("\n"); //-- Way too verbose
return false;
}
// -----------------------------------------------------------------------------
bool roboticslab::YarpOpenraveControlboard::getEncoderAccelerations(double *accs) {
CD_INFO("\n");
return false;
}
// -----------------------------------------------------------------------------