-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREVsupport.py
More file actions
67 lines (61 loc) · 1.52 KB
/
REVsupport.py
File metadata and controls
67 lines (61 loc) · 1.52 KB
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
REV_API_identifier = {
0x1: "Setpoint Set",
0x2: "DC Set",
0x12: "Speed Set",
0x13: "Smart Velocity Set",
0x32: "Position Set",
0x42: "Voltage Set",
0x43: "Current Set",
0x52: "Smart Motion Set",
0x60: "Status Frame 0",
0x61: "Status Frame 1",
0x62: "Status Frame 2",
0x63: "Status Frame 3",
0x6E: "Clear Faults",
0x6A: "DRV Stat",
0x72: "Burn Flash",
0x73: "Set Follower",
0x74: "Set Factory Defaults",
0x75: "Factory Reset",
0x80: "NACK",
0x81: "ACK",
0x90: "Broadcast",
0x92: "Heartbeat",
0x93: "Sync",
0x94: "ID Query",
0x95: "ID Assign",
0x98: "Firmware",
0x99: "Enum",
0x9B: "Lock",
0xB1: "Lock B",
0xB2: "Non-Rio Heartbeat",
0x1FF: "Software Download Bootloader",
0x9C: "Software Download Data",
0x9D: "Software Download Checksum",
0x9E: "Software Download Retransmit",
0xA0: "Mech Pos",
0xA2: "I Accumulator",
0x300: "Parameter Access"
}
REV_Fault_IDs = {
0: "Brownout",
1: "Over Current",
2: "Over Voltage",
3: "Motor Fault",
4: "Sensor Fault",
5: "Stall",
6: "EEPPROM CRC",
7: "CAN TX",
8: "CAN RX",
9: "Has Reset",
10: "DRV Fault",
11: "Other Fault",
12: "Soft Limit Forward",
13: "Soft Limit Reverse",
14: "Hard Limit Forward",
15: "Hard Limit Reverse"
}
def decode_rev_api(api: int) -> str:
return REV_API_identifier.get(api, "Unknown")
def decode_rev_fault(fault: int) -> str:
return REV_Fault_IDs.get(fault, "Unknown")