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 VehicleMsgV2CLocalizationTransitionUpdate = 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 ( VehicleTurnTriggerImmediate = 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 ( VehicleMaxLightIntensity = 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 ) //////////////////////////////////////////////////////////////////////// type VehicleMsg struct { Size uint8 MsgID uint8 Payload [VehicleMsgMaxSize]byte } type VehicleMsgVersionResponse struct { Size uint8 MsgID uint8 Version uint16 } type VehicleBatteryLevelResponse struct { Size uint8 MsgID uint8 BatteryLevel uint16 } type VehicleMsgSDKMode struct { Size uint8 MsgID uint8 On uint8 Flags uint8 } type VehicleMsgSetSpeed struct { Size uint8 MsgID uint8 Speed uint16 // mm/sec Accel uint16 // mm/secĀ² SpeedLimit uint8 // respect road piece speed limit } type VehicleMsgTurn struct { Size uint8 MsgID uint8 Type uint8 Trigger uint8 } type VehicleMsgSetOffsetFromRoadCenter struct { Size uint8 MsgID uint8 Offset float32 // mm } type VehicleMsgChangeLane struct { Size uint8 MsgID uint8 HorizontalSpeed uint16 // mm/sec HorizontalAccel uint16 // mm/secĀ² Offset float32 // from road center mm HopIntent uint8 Tag uint8 } type VehicleLocalizationPositionUpdate struct { Size uint8 MsgID uint8 LocalizationID uint8 RoadPieceID uint8 Offset float32 // from road center mm Speed uint16 // mm/sec ParsingFlags uint8 // ACK commands received LastRecvLaneChangeCmdID uint8 LastExecLaneChangeCmdID uint8 LastDesiredHorizontalSpeed uint16 // mm/sec LastDesiredSpeed uint16 // mm/sec } type VehicleMsgLocalizationTransitionUpdate struct { Size uint8 MsgID uint8 RoadPieceIDX uint8 RoadPieceIDXPrev uint8 Offset float32 // from road center mm Direction uint8 // driving direction // ACK commands received LastRecvLaneChangeCmdID uint8 LastExecLaneChangeCmdID uint8 LastDesiredHorizontalSpeed uint16 // mm/sec LastDesiredSpeed uint16 // mm/sec // track grade detection UphillCounter uint8 DownhillCounter uint8 // wheel displacement (cm) since last transition bar LeftWheelDist uint8 // cm RightWheelDist uint8 // cm } type VehicleMsgLocalizationIntersectionUpdate struct { Size uint8 MsgID uint8 RoadPieceIDX uint8 Offset float32 // from road center mm Direction uint8 // driving direction IntersectionCode uint8 IntersectionTurn uint8 IsExiting uint8 } type VehicleMsgOffsetFromRoadCenterUpdate struct { Size uint8 MsgID uint8 Offset float32 // from road center mm LaneChangeID uint8 } type VehicleMsgSetLights struct { Size uint8 MsgID uint8 LightMask uint8 // valid and value bits for lights } type VehicleLightConfig struct { Channel uint8 Effect uint8 Start uint8 End uint8 Cycles uint8 // per 10 sec } type VehicleMsgLightsPattern struct { Size uint8 MsgID uint8 ChannelCount uint8 ChannelConfig [3]VehicleLightConfig } type VehicleMsgSetConfigParams struct { Size uint8 MsgID uint8 SuperCodeParseMask uint8 TrackMaterial uint8 } ////////////////////////////////////////////////////////////////////////