aboutsummaryrefslogtreecommitdiff
path: root/protocol.go
blob: 033759025e46724a05ca50113e1eba9b186f7ffa (plain)
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
package anki

const (
	VehicleMsgMaxSize        = 20
	VehicleMsgPayloadMaxSize = 18
	VehicleMsgBaseSize       = 1
)

// Identifier for a vehicle message
const (
	// BLE Connection
	VehicleMsgC2VDisconnect = 0x0d

	// Ping request / response
	VehicleMsgC2VPingRequest  = 0x16
	VehicleMsgV2CPingResponse = 0x17

	// Messages for checking vehicle version info
	VehicleMsgC2VVersionRequest  = 0x18
	VehicleMsgV2CVersionResponse = 0x19

	// Baterry level
	VehicleMsgC2VBatteryLevelRequest  = 0x1a
	VehicleMsgV2CBatteryLevelResponse = 0x1b

	// Lights
	VehicleMsgC2VSetLights = 0x1d

	// Driving Commands
	VehicleMsgC2VSetSpeed         = 0x24
	VehicleMsgC2VChangeLane       = 0x25
	VehicleMsgC2VCancelLaneChange = 0x26
	VehicleMsgC2VTurn             = 0x32

	// Vehicle position updates
	VehicleMsgV2CLocalizationPositionUpdate     = 0x27
	VehcileMsgV2CLocalizationTransitionUpdate   = 0x29
	VehicleMsgV2CLocalizationIntersectionUpdate = 0x2a
	VehicleMsgV2cVehicleDelocalized             = 0x2b
	VehicleMsgC2VSetOffsetFromRoadCenter        = 0x2c
	VehicleMsgV2COffsetFromRoadCenterUpdate     = 0x2d

	// Light Patterns
	VehicleMsgC2VLightsPattern = 0x33

	// Vehicle Configuration Prameters
	VehicleMsgC2VSetConfigParams = 0x45

	// SDK Mode
	VehicleMsgC2VSDKMode = 0x90
)

const (
	VehicleTurnNone = iota
	VehicleTurnLeft
	VehicleTurnRight
	VehicleTurnUTurn
	VehicleTurnUTurnJump
)

const (
	VehcileTurnTriggerImmediate    = iota // Run immediately
	VehicleTurnTriggerIntersection        // Run at the next intersection
)

const (
	Forward = iota
	Reverse
)

const (
	IntersectionCodeEntryFirst = iota
	IntersectionCodeExitFirst
	IntersectionCodeEntrySecond
	IntersectionCodeExitSecond
)

// Lights
// The bits in the simple light message corresponding to each type of light
const (
	LightHeadlights = 1 << iota
	LightBrakelights
	LightFrontlights
	LightEngine
)

const (
	VehcileMaxLightIntensity = 14
	VehicleMaxLightTime      = 11
)

// LED channel definitions - for RGB engine, front, and tail lights
const (
	LightRed = iota
	LightTail
	LightBlue
	LightGreen
	LightFrontL
	LightFrontR
)

const (
	EffectSteady = iota // Simply set the light intensity to 'start' value
	EffectFade          // Fade intensity from 'start' to 'end'
	EffectThrob         // Fade intensity from 'start' to 'end' and back to 'start'
	EffectFlash         // Tun on LED between time 'start' and time 'end' inclusive
	EffectRandom        // Flash the LED erratically - ignoring start/end
)

const (
	TrackMaterialPlastic = iota
	TrackMaterialVinyl
)

const (
	SupercodeNone = iota
	SupercodeBoostJump
)