-
Notifications
You must be signed in to change notification settings - Fork 1
/
robot.h
69 lines (65 loc) · 1.41 KB
/
robot.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
61
62
63
64
65
66
67
#ifndef ROBOT_H
#define ROBOT_H
#include<iostream>
#include "robot.h"
#include"serial_recv.h"
#include"serial_send.h"
#include <pthread.h>
#include<stdlib.h>
#include<math.h>
//#include"video_cap.h"
//#include"robot_trj.h"
using namespace std;
struct pose
{
double x; //mm
double y; //mm
double ang; //rad
pose()
{
x = y = ang = 0.0;
}
};
class ROBOT
{
public:
ROBOT();
~ROBOT();
void init(const char*dev, int baudrate);
void runAsync(bool a);
void setDeltaHeading(double theta); //左转90度,右转为负
void setVel(double v); //设置速度
void setVel2(double l_v,double r_v); //分别设置左右轮速度
double getVel(); //获取机器人速度
double getLeftVel();
double getRightVel();//获取两轮的速度
double getX(); //X;
double getY(); //Y;
double getTh(); //获得X Y Theta;
int isHeadingDone;
pose getPose();
void StartRun();
void stop();
void disconnect();
int mod_old;
float av_old;
float bv_old;
pose P;
SerialAdapter serial;
SE_RECV recv;
SE_SEND send;
bool isSend;
//video_capture
// VideoCap videocap;
//robot_trj
// RobotTrj robottrj;
protected:
pthread_mutex_t Mutex_robot;
pthread_mutex_t Mutex_recv;
pthread_mutex_t Mutex_video;
private:
void StartThread();
void StopThread();
int us;
};
#endif // ROBOT_H