-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprotocol.proto
68 lines (61 loc) · 2.23 KB
/
protocol.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
syntax = "proto3";
import "nanopb.proto";
enum RequestType {
GET_STATE = 0;
SET_TARGET = 1;
SET_CONFIG = 2;
GET_TARGET = 3;
GET_CONFIG = 4;
RESET = 5;
}
message Request {
RequestType type = 1;
oneof payload {
Config config = 2;
State state = 3;
Target target = 4;
}
}
enum ResponseStatus {
OK = 0; // +
ERROR = 1; // !
PROCESSING = 2; // ~
DEBUG = 3; // #
}
message Response {
ResponseStatus status = 1;
string message = 2 [(nanopb).max_size = 128];
oneof payload {
Config config = 3;
State state = 4;
Target target = 5;
}
}
message Config {
optional float max_x = 1; // [m] Absolute max cart position
optional float max_v = 2; // [m/s] Absolute max cart velocity
optional float max_a = 3; // [m/s^2] Absolute max cart acceleration
optional float hw_max_x = 4; // [m] Absolute max hardware-allowed position
optional float hw_max_v = 5; // [m/s] Absolute max hardware-allowed velocity
optional float hw_max_a = 6; // [m/s^2] Absolute max hardware-allowed acceleration
optional bool clamp_x = 7; // Clamp X to allowed range instead of raising error
optional bool clamp_v = 8; // Clamp V to allowed range instead of raising error
optional bool clamp_a = 9; // Clamp A to allowed range instead of raising error
optional bool debug_led = 10; // Debug LED pin to indicate start of session
}
message State {
optional float curr_x = 1; // [m] Current cart position
optional float curr_v = 2; // [m/s] Current cart velocity
optional float curr_a = 3; // [m/s^2] Current cart acceleration
optional float pole_x = 4; // [rad] Current pole angle
optional float pole_v = 5; // [rad/s] Current pole angular velocity
optional int32 errcode = 6; // Current error code
optional float imu_a = 7; // [m/s^2] Cart acceleration measured by IMU
optional float motor_x = 8; // [rad] Rotation of the motor shaft (secondary encoder)
optional float motor_v = 9; // [rad/s] Velocity of the motor shaft (secondary encoder)
}
message Target {
optional float trgt_x = 1; // [m] Target cart position
optional float trgt_v = 2; // [m/s] Target cart velocity
optional float trgt_a = 3; // [m/s^2] Target cart acceleration
}