-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIControlModeImpl.cpp
79 lines (56 loc) · 1.95 KB
/
IControlModeImpl.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
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
#include "YarpOpenraveControlBoard.hpp"
#include <yarp/os/LogStream.h>
#include "LogComponent.hpp"
using namespace roboticslab;
// ------------------- IControlMode Related ------------------------------------
bool YarpOpenraveControlBoard::getControlMode(int j, int *mode)
{
*mode = controlModes[j];
return true;
}
// -----------------------------------------------------------------------------
bool YarpOpenraveControlBoard::getControlModes(int *modes)
{
bool ok = true;
for (unsigned int i = 0; i < axes; i++)
ok &= getControlMode(i, &(modes[i]));
return ok;
}
// ---------------------- IControlMode2 Related ---------------------------------
bool YarpOpenraveControlBoard::getControlModes(const int n_joint, const int *joints, int *modes)
{
yCTrace(YORCB) << n_joint;
bool ok = true;
for (unsigned int i = 0; i < n_joint; i++)
ok &= getControlMode(joints[i], &modes[i]);
return ok;
}
// -----------------------------------------------------------------------------
bool YarpOpenraveControlBoard::setControlMode(const int j, const int mode)
{
yCTrace(YORCB) << j << mode;
controlModes[j] = mode;
return true;
}
// -----------------------------------------------------------------------------
bool YarpOpenraveControlBoard::setControlModes(const int n_joint, const int *joints, int *modes)
{
yCTrace(YORCB) << n_joint;
bool ok = true;
for (int j = 0; j < n_joint; j++)
{
ok &= this->setControlMode(joints[j], modes[j]);
}
return ok;
}
// -----------------------------------------------------------------------------
bool YarpOpenraveControlBoard::setControlModes(int *modes)
{
yCTrace(YORCB);
bool ok = true;
for (unsigned int i = 0; i < axes; i++)
ok &= setControlMode(i, modes[i]);
return ok;
}
// -----------------------------------------------------------------------------