Add SailPosition to the rover and implement toggle command

This also converts the commands to use the proto type for simplicity
This commit is contained in:
Marc Di Luzio 2020-07-21 23:12:50 +01:00
parent 6f30b665c7
commit f78efd1223
10 changed files with 490 additions and 267 deletions

View file

@ -89,12 +89,20 @@ func BearingToVector(b roveapi.Bearing) Vector {
switch b {
case roveapi.Bearing_North:
return Vector{Y: 1}
case roveapi.Bearing_NorthEast:
return Vector{X: 1, Y: 1}
case roveapi.Bearing_East:
return Vector{X: 1}
case roveapi.Bearing_SouthEast:
return Vector{X: 1, Y: -1}
case roveapi.Bearing_South:
return Vector{Y: -1}
case roveapi.Bearing_SouthWest:
return Vector{X: -1, Y: -1}
case roveapi.Bearing_West:
return Vector{X: -1}
case roveapi.Bearing_NorthWest:
return Vector{X: -1, Y: 1}
}
return Vector{}