-
Notifications
You must be signed in to change notification settings - Fork 0
/
rbcx.proto
347 lines (299 loc) · 6.4 KB
/
rbcx.proto
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
syntax = "proto3";
import "nanopb.proto";
message None {
}
enum MotorMode {
POWER = 0;
BRAKE = 1;
VELOCITY = 2;
POSITION = 3;
POSITION_IDLE = 4;
COUPLE_POWER = 5;
}
message RegCoefs {
uint32 p = 1;
uint32 i = 2;
uint32 d = 3;
}
message MotorConfig {
uint32 velEpsilon = 1;
uint32 posEpsilon = 2;
uint32 maxAccel = 3;
}
message MpuCalibrationData {
bytes data = 1 [(nanopb).max_size = 12, (nanopb).fixed_length = true];
}
message CoprocReq {
oneof payload {
None keepalive = 1;
SetLeds setLeds = 4;
GetButtons getButtons = 5;
SetStupidServo setStupidServo = 6;
UltrasoundReq ultrasoundReq = 7;
MotorReq motorReq = 8;
BuzzerReq buzzerReq = 9;
CalibratePower calibratePower = 10;
None shutdownPower = 11;
None versionReq = 12;
RtcReq rtcReq = 13;
I2cReq i2cReq = 14;
EspWatchdogSettings espWatchdogSettings = 15;
CoprocStartupMessage coprocStartupMessage = 16;
SmartServoReq smartServoReq = 17;
}
message SetLeds {
LedsEnum ledsOn = 1;
}
enum LedsEnum {
NONE = 0;
L1 = 1;
L2 = 2;
L3 = 4;
L4 = 8;
}
message GetButtons {
}
message SetStupidServo {
uint32 servoIndex = 1;
oneof servoCmd {
None disable = 4;
float setPosition = 5;
}
}
message UltrasoundReq {
uint32 utsIndex = 1;
oneof utsCmd {
None singlePing = 4;
}
}
message SetMotorCoupling {
uint32 coupleAxis = 1;
}
message MotorReq {
uint32 motorIndex = 1;
oneof motorCmd {
None getState = 4;
sint32 setPower = 5;
sint32 setBrake = 6;
sint32 setVelocity = 7;
sint32 homePosition = 8;
SetPosition setPosition = 10;
SetPosition addPosition = 11;
RegCoefs setVelocityRegCoefs = 16;
RegCoefs setPositionRegCoefs = 17;
MotorConfig setConfig = 18;
SetMotorCoupling setCoupling = 19;
}
message SetPosition {
sint32 targetPosition = 1;
sint32 runningVelocity = 2;
}
}
message BuzzerReq {
bool on = 1;
}
message CalibratePower {
uint32 vccMv = 1;
uint32 battMidMv = 2;
uint32 vRef33Mv = 3;
uint32 temperatureC = 4;
}
message RtcReq {
oneof rtcCmd {
None get = 1;
uint32 setTime = 2;
uint32 setAlarm = 3;
}
}
message I2cReq {
oneof payload {
OledReq oledReq = 1;
MpuReq mpuReq = 2;
}
}
message OledReq {
oneof oledCmd {
OledInit init = 1;
OledColor fill = 2;
None update = 3;
OledDrawPixel drawPixel = 4;
OledWriteString writeString = 5;
OledSetCursor setCursor = 6;
OledDrawLine drawLine = 7;
OledDrawArc drawArc = 8;
OledDrawCircle drawCircle = 9;
OledDrawRectangle drawRectangle = 10;
}
}
enum OledColor {
OLED_BLACK = 0;
OLED_WHITE = 1;
}
enum OledFont {
OLED_FONT_6X8 = 0;
OLED_FONT_7X10 = 1;
OLED_FONT_11X18 = 2;
OLED_FONT_16X26 = 3;
}
message OledInit {
uint32 height = 1;
uint32 width = 2;
bool rotate = 3;
bool inverseColor = 4;
}
message OledDrawPixel {
uint32 x = 1;
uint32 y = 2;
OledColor color = 3;
}
message OledWriteString {
string text = 1 [(nanopb).max_length = 32];
OledFont font = 2;
OledColor color = 3;
}
message OledSetCursor {
uint32 x = 1;
uint32 y = 2;
}
message OledDrawLine {
uint32 x1 = 1;
uint32 y1 = 2;
uint32 x2 = 3;
uint32 y2 = 4;
OledColor color = 5;
}
message OledDrawArc {
uint32 x = 1;
uint32 y = 2;
uint32 radius = 3;
uint32 start_angle = 4;
uint32 sweep = 5;
OledColor color = 6;
}
message OledDrawCircle {
uint32 x = 1;
uint32 y = 2;
uint32 radius = 3;
OledColor color = 4;
}
message OledDrawRectangle {
uint32 x1 = 1;
uint32 y1 = 2;
uint32 x2 = 3;
uint32 y2 = 4;
OledColor color = 5;
}
message MpuReq {
oneof mpuCmd {
None init = 1;
None oneSend = 2;
None startSend = 3;
None stopSend = 4;
uint32 setCompressCoef = 5;
None getCompressCoef = 6;
None calibrateOffsets = 7;
MpuCalibrationData restoreCalibrationData = 8;
}
}
message EspWatchdogSettings {
bool disable = 1;
}
// This is intended to be the first message the ESP32 sends
// after startup, so it can request various stuff in a single pb message.
message CoprocStartupMessage {
bool getButtons = 1;
bool getVersion = 2;
bool getRtc = 3;
EspWatchdogSettings espWatchdogSettings = 4;
}
message SmartServoReq {
bool expect_response = 1;
bytes data = 2 [(nanopb).max_size = 24];
}
}
message CoprocStat {
oneof payload {
None ledsStat = 4;
ButtonsStat buttonsStat = 5;
None stupidServoStat = 6;
UltrasoundStat ultrasoundStat = 7;
PowerAdcStat powerAdcStat = 8;
VersionStat versionStat = 9;
MotorStat motorStat = 10;
RtcStat rtcStat = 11;
FaultStat faultStat = 12;
MpuStat mpuStat = 13;
SmartServoStat smartServoStat = 14;
MpuCalibrationData mpuCalibrationDone = 15;
}
message ButtonsStat {
ButtonsEnum buttonsPressed = 1;
}
enum ButtonsEnum {
BNONE = 0;
BOFF = 1;
B1 = 2;
B2 = 4;
B3 = 8;
B4 = 16;
BON = 32;
}
message UltrasoundStat {
uint32 utsIndex = 1;
uint32 roundtripMicrosecs = 2;
}
message MotorStat {
uint32 motorIndex = 1;
MotorMode mode = 2;
sint32 power = 3; // range <-32768; 32767>
sint32 velocity = 4;
sint32 position = 5;
}
message PowerAdcStat {
uint32 vccMv = 1;
uint32 battMidMv = 2;
int32 temperatureC = 3;
}
message VersionStat {
bytes revision = 1 [(nanopb).max_size = 8, (nanopb).fixed_length = true];
uint32 number = 2;
bool dirty = 3;
}
message RtcStat {
uint32 time = 1;
uint32 alarm = 2;
RtcFlags flags = 3;
}
enum RtcFlags {
RTC_NONE = 0;
RTC_NOT_READY = 1;
RTC_ALARM = 2;
}
message FaultStat {
oneof fault {
None oledFault = 1;
None mpuFault = 2;
}
}
message MpuStat {
uint32 compressCoef = 1;
MpuVector accel = 2;
MpuVector gyro = 3;
MpuQuaternion quat = 4;
MpuVector yawPitchRoll = 5;
}
message MpuVector {
int32 x = 1;
int32 y = 2;
int32 z = 3;
}
message MpuQuaternion {
int32 w = 1;
int32 x = 2;
int32 y = 3;
int32 z = 4;
}
message SmartServoStat {
bytes data = 1 [(nanopb).max_size = 24];
}
}