From 5f77ad322690c1552fb4c695f1683741961dce28 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 4 Dec 2016 15:24:50 +0100 Subject: Messages --- protocol.go | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/protocol.go b/protocol.go index 0337590..813be12 100644 --- a/protocol.go +++ b/protocol.go @@ -116,3 +116,147 @@ const ( SupercodeNone = iota SupercodeBoostJump ) + +//////////////////////////////////////////////////////////////////////// + +type VehicleMsg struct { + Size uint8 + MsgID uint8 + Payload [VehicleMsgMaxSize]uint8 +} + +type VehicleMsgVersionResponse struct { + Size uint8 + MsgID uint8 + Version uint16 +} + +type VehicleBatteryLevelResponse struct { + Size uint8 + MsgID uint8 + BatteryLevel uint16 +} + +type VehcileMsgSDKMode 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 VehcileMsgChangeLane 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 +} -- cgit v1.2.3