-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest2.cpp
More file actions
38 lines (28 loc) · 773 Bytes
/
test2.cpp
File metadata and controls
38 lines (28 loc) · 773 Bytes
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
//
// Created by think on 2021/2/25.
//
#include "inspirehand.hpp"
#include <thread>
#define HAND_ID 0x01
int main(int argc, char **argv)
{
InspireHand ih(HAND_ID, "/dev/ttyUSB0");
int16_t angles[3] = {20, 30, 40};
// ih.setAngle<1>(20);
ih.setAngle(100, 100, 100, 100, -1, -1);
std::this_thread::sleep_for(std::chrono::seconds(1));
ih.setAngle(1000, 0, 0, 1000, 1000, 1000);
std::this_thread::sleep_for(std::chrono::seconds(1));
std::vector<uint16_t> fingers;
if (ih.getAngle(fingers))
{
for (auto &v : fingers)
{
static int i = 0;
std::cout << "finger " << i++ << " is: " << static_cast<int>(v) << std::endl;
}
}
uint8_t id;
ih.getHandID(id);
return 0;
}