forked from chenxiaoqino/udp-image-streaming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMachine.h
60 lines (51 loc) · 1.1 KB
/
Machine.h
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
//
// Created by chenyuan on 19-1-25.
//
#ifndef MACHINE_H
#define MACHINE_H
#include <iostream>
#include <vector>
#include <math.h>
//#include "WsHub.h"
using namespace std;
class Machine {
private:
class MachineState *current_;
std::vector<float> keypoints_;
float shoulder_width_;
public:
Machine();
~Machine();
void setCurrent(MachineState *s) {
current_ = s;
}
void run();
void setKeypoints(std::vector<float> &keypoints) {
keypoints_ = keypoints;
shoulder_width_ = keypoints_.at(0) < 0 ? 1 : fabsf(keypoints_.at(0) - keypoints_.at(2)) * 2;
}
const std::vector<float> &getKeypoints() const {
return keypoints_;
}
int count_ = 0;
//WsHub wsHub;
};
class MachineState {
public:
virtual void handle(Machine *m) = 0; //纯虚函数
};
class UpState : public MachineState {
private:
public:
UpState() {}
~UpState() = default;
void handle(Machine *m) override;
};
class DownState : public MachineState {
private:
public:
DownState() {}
~DownState() = default;
void handle(Machine *m) override;
};
#endif