Main Page
Namespaces
Classes
Files
File List
File Members
include
ric_interface
protocol.h
Go to the documentation of this file.
1
#ifndef PROTOCOL_H
2
#define PROTOCOL_H
3
4
#include <stdint.h>
5
6
namespace
ric_interface
7
{
8
namespace
protocol
9
{
10
enum class
Type
11
{
12
KEEP_ALIVE
= 100,
13
LOGGER
= 101,
14
ULTRASONIC
= 102,
15
LASER
= 103,
16
IMU
= 104,
17
GPS
= 105,
18
SERVO
= 106,
19
EMERGENCY_ALARM
= 107
20
};
21
22
const
uint16_t
MAX_PKG_SIZE
= 512;
23
const
uint8_t
HEADER_CODE
= 200;
24
const
uint8_t
HEADER_INDX
= 0;
25
const
uint8_t
PKG_SIZE_INDX
= 1;
26
27
struct
package
28
{
29
uint8_t type = 0;
30
};
31
32
struct
keepalive
:
package
33
{
34
keepalive
() { type = (uint8_t)
Type::KEEP_ALIVE
; }
35
};
36
37
struct
logger
:
package
38
{
39
logger
() { type = (uint8_t)
Type::LOGGER
; }
40
char
msg[30];
41
int32_t value = 0;
42
};
43
44
struct
sensor
:
package
45
{
46
47
};
48
49
struct
actuator
:
package
50
{
51
};
52
53
struct
emergency_alarm
:
sensor
54
{
55
emergency_alarm
() { type = (uint8_t)
Type::EMERGENCY_ALARM
; }
56
bool
is_on =
false
;
57
};
58
59
struct
ultrasonic
:
sensor
60
{
61
ultrasonic
() { type = (uint8_t)
Type::ULTRASONIC
; }
62
uint16_t distance_mm = 0;
63
};
64
65
struct
laser
:
sensor
66
{
67
laser
() { type = (uint8_t)
Type::LASER
; }
68
uint16_t distance_mm = 0;
69
};
70
71
struct
imu
:
sensor
72
{
73
imu
() { type = (uint8_t)
Type::IMU
; }
74
float
roll_rad = 0,
75
pitch_rad = 0,
76
yaw_rad = 0,
77
accl_x_rad = 0,
78
accl_y_rad = 0,
79
accl_z_rad = 0,
80
gyro_x_rad = 0,
81
gyro_y_rad = 0,
82
gyro_z_rad = 0,
83
mag_x_rad = 0,
84
mag_y_rad = 0,
85
mag_z_rad = 0;
86
};
87
88
struct
gps
:
sensor
89
{
90
gps
() { type = (uint8_t)
Type::GPS
; }
91
float
lat = 0,
92
lon = 0;
93
94
float
speed = 0,
95
angle = 0;
96
97
float
elevation = 0;
98
99
/* E, N, S, W */
100
char
lat_mark = 0,
101
lon_mark = 0;
102
103
uint8_t hour = 0,
104
minute = 0,
105
seconds = 0,
106
year = 0,
107
month = 0,
108
day = 0;
109
110
uint8_t fix_quality = 0,
111
satellites = 0;
112
113
bool
fix =
false
;
114
};
115
116
117
struct
servo
:
actuator
118
{
119
servo
() { type = (uint8_t)
Type::SERVO
; }
120
uint16_t cmd = 0;
//servo command 1000-2000
121
};
122
}
123
}
124
125
126
127
#endif //PROTOCOL_H
ric_interface::protocol::laser
Definition:
protocol.h:65
ric_interface::protocol::HEADER_INDX
const uint8_t HEADER_INDX
Definition:
protocol.h:24
ric_interface::protocol::ultrasonic
Definition:
protocol.h:59
ric_interface::protocol::Type::KEEP_ALIVE
ric_interface::protocol::Type::LASER
ric_interface::protocol::PKG_SIZE_INDX
const uint8_t PKG_SIZE_INDX
Definition:
protocol.h:25
ric_interface::protocol::servo
Definition:
protocol.h:117
ric_interface::protocol::servo::servo
servo()
Definition:
protocol.h:119
ric_interface::protocol::actuator
Definition:
protocol.h:49
ric_interface::protocol::MAX_PKG_SIZE
const uint16_t MAX_PKG_SIZE
Definition:
protocol.h:22
ric_interface::protocol::Type
Type
Definition:
protocol.h:10
ric_interface::protocol::imu::imu
imu()
Definition:
protocol.h:73
ric_interface::protocol::HEADER_CODE
const uint8_t HEADER_CODE
Definition:
protocol.h:23
ric_interface::protocol::Type::IMU
ric_interface::protocol::emergency_alarm::emergency_alarm
emergency_alarm()
Definition:
protocol.h:55
ric_interface::protocol::Type::ULTRASONIC
ric_interface::protocol::keepalive::keepalive
keepalive()
Definition:
protocol.h:34
ric_interface::protocol::logger::logger
logger()
Definition:
protocol.h:39
ric_interface::protocol::Type::LOGGER
ric_interface::protocol::imu
Definition:
protocol.h:71
ric_interface::protocol::gps::gps
gps()
Definition:
protocol.h:90
ric_interface::protocol::laser::laser
laser()
Definition:
protocol.h:67
ric_interface::protocol::gps
Definition:
protocol.h:88
ric_interface::protocol::emergency_alarm
Definition:
protocol.h:53
ric_interface::protocol::sensor
Definition:
protocol.h:44
ric_interface::protocol::logger
Definition:
protocol.h:37
ric_interface::protocol::package
Definition:
protocol.h:27
ric_interface::protocol::Type::EMERGENCY_ALARM
ric_interface::protocol::keepalive
Definition:
protocol.h:32
ric_interface::protocol::ultrasonic::ultrasonic
ultrasonic()
Definition:
protocol.h:61
ric_interface::protocol::Type::SERVO
ric_interface
Definition:
communicator.h:16
ric_interface::protocol::Type::GPS
ric_interface
Author(s):
autogenerated on Wed Jan 3 2018 03:48:20