aboutsummaryrefslogtreecommitdiffstats
path: root/serial/serial.h
blob: 8061b248d72f92abf5ad5129636dbd17238c1d1d (plain) (blame)
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
已复制!
#ifndef SERIAL_H #define SERIAL_H #include "path_ctrl_t.h" #include "path_t.h" #include "pose_t.h" #include <errno.h> #include <fcntl.h> #include <pthread.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <termios.h> #include <unistd.h> #define MAX_BUFFER_SIZE 1024 #define DEFAULT_SPEED 0x15 // 默认速度,百分比 // TODO: 两个待测数据 #define RADIUS 0.3 // 两轮之间的距离的一半,米 #define FULLSPEED 1.5 // 轮子全速,m/s #define fabs(x) ((x) > 0 ? (x) : -(x)) typedef unsigned char byte; bool whellInit(); bool wheelSend(byte a, byte a_v, byte b, byte b_v); void parseCmd(const lcm_recv_buf_t *rbuf, const char *channel, const path_ctrl_t *msg, void *userdata); void parsePath(const lcm_recv_buf_t *rbuf, const char *channel, const path_t *msg, void *userdata); void setCurPose(const lcm_recv_buf_t *rbuf, const char *channel, const pose_t *msg, void *userdata); void renewCurPose(); void sendCurPose(); #endif