From c89c5f6e74a3c87776108ec4765b36b976d72d45 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Wed, 22 Jul 2020 23:36:13 +0100 Subject: [PATCH] Implement current wind direction and rover wind movement --- cmd/rove-server/internal/routes.go | 1 + pkg/maths/vector.go | 10 ++ pkg/rove/rover.go | 3 + pkg/rove/world.go | 82 ++++++++++++++-- pkg/rove/world_test.go | 46 +-------- proto/roveapi/roveapi.pb.go | 148 ++++++++++++++++------------- proto/roveapi/roveapi.proto | 3 + 7 files changed, 174 insertions(+), 119 deletions(-) diff --git a/cmd/rove-server/internal/routes.go b/cmd/rove-server/internal/routes.go index 02a7483..6cb5a99 100644 --- a/cmd/rove-server/internal/routes.go +++ b/cmd/rove-server/internal/routes.go @@ -102,6 +102,7 @@ func (s *Server) Status(ctx context.Context, req *roveapi.StatusRequest) (respon QueuedCommands: queued, SailPosition: rover.SailPosition, Logs: logs, + Wind: s.world.Wind, } } return response, nil diff --git a/pkg/maths/vector.go b/pkg/maths/vector.go index 9b9d755..a74ff16 100644 --- a/pkg/maths/vector.go +++ b/pkg/maths/vector.go @@ -107,3 +107,13 @@ func BearingToVector(b roveapi.Bearing) Vector { return Vector{} } + +// Dot returns the dot product of two vectors +func Dot(a Vector, b Vector) int { + return a.X*b.X + a.Y*b.Y +} + +// AngleCos returns the cosine of the angle between two vectors +func AngleCos(a Vector, b Vector) float64 { + return float64(Dot(a, b)) / a.Length() * b.Length() +} diff --git a/pkg/rove/rover.go b/pkg/rove/rover.go index 0bb9e4e..fb13ddc 100644 --- a/pkg/rove/rover.go +++ b/pkg/rove/rover.go @@ -57,6 +57,9 @@ type Rover struct { // SailPosition is the current position of the sails SailPosition roveapi.SailPosition + // Current number of ticks in this move, used for sailing speeds + MoveTicks int + // Logs Stores log of information Logs []RoverLogEntry } diff --git a/pkg/rove/world.go b/pkg/rove/world.go index fa7a0e2..0265951 100644 --- a/pkg/rove/world.go +++ b/pkg/rove/world.go @@ -10,11 +10,16 @@ import ( "github.com/mdiluz/rove/proto/roveapi" ) +const ( + TicksPerNormalMove = 4 +) + // CommandStream is a list of commands to execute in order type CommandStream []*roveapi.Command // World describes a self contained universe and everything in it type World struct { + // TicksPerDay is the amount of ticks in a single day TicksPerDay int @@ -27,6 +32,9 @@ type World struct { // Atlas represends the world map of chunks and tiles Atlas Atlas + // Wind is the current wind direction + Wind roveapi.Bearing + // Commands is the set of currently executing command streams per rover CommandQueue map[string]CommandStream // Incoming represents the set of commands to add to the queue at the end of the current tick @@ -230,8 +238,8 @@ func (w *World) WarpRover(rover string, pos maths.Vector) error { return nil } -// MoveRover attempts to move a rover in a specific direction -func (w *World) MoveRover(rover string, b roveapi.Bearing) (maths.Vector, error) { +// TryMoveRover attempts to move a rover in a specific direction +func (w *World) TryMoveRover(rover string, b roveapi.Bearing) (maths.Vector, error) { w.worldMutex.Lock() defer w.worldMutex.Unlock() @@ -240,12 +248,6 @@ func (w *World) MoveRover(rover string, b roveapi.Bearing) (maths.Vector, error) return maths.Vector{}, fmt.Errorf("no rover matching id") } - // Ensure the rover has energy - if i.Charge <= 0 { - return i.Pos, nil - } - i.Charge-- - // Try the new move position newPos := i.Pos.Added(maths.BearingToVector(b)) @@ -318,7 +320,9 @@ func (w *World) RoverToggle(rover string) (roveapi.SailPosition, error) { r.SailPosition = roveapi.SailPosition_CatchingWind } - w.Rovers[rover] = r + // Reset the movement ticks + r.MoveTicks = 0 + return r.SailPosition, nil } @@ -334,6 +338,8 @@ func (w *World) RoverTurn(rover string, bearing roveapi.Bearing) (roveapi.Bearin // Set the new bearing r.Bearing = bearing + // Reset the movement ticks + r.MoveTicks = 0 return r.Bearing, nil } @@ -502,6 +508,64 @@ func (w *World) Tick() { // Add any incoming commands from this tick and clear that queue w.EnqueueAllIncoming() + // Change the wind every day + if (w.CurrentTicks % w.TicksPerDay) == 0 { + w.Wind = roveapi.Bearing((rand.Int() % 8) + 1) // Random cardinal bearing + } + + // Move all the rovers based on current wind and sails + for n, r := range w.Rovers { + // Skip if we're not catching the wind + if r.SailPosition != roveapi.SailPosition_CatchingWind { + continue + } + + // Increment the current move ticks + r.MoveTicks++ + + // Get the difference between the two bearings + // Normalise, we don't care about clockwise/anticlockwise + diff := maths.Abs(int(w.Wind - r.Bearing)) + if diff > 4 { + diff = 8 - diff + } + + // Calculate the travel "ticks" + var ticksToMove int + switch diff { + case 0: + // Going with the wind, travel at base speed of once every 4 ticks + ticksToMove = TicksPerNormalMove + case 1: + // At a slight angle, we can go a little faster + ticksToMove = TicksPerNormalMove / 2 + case 2: + // Perpendicular to wind, max speed + ticksToMove = 1 + case 3: + // Heading at 45 degrees into the wind, back to min speed + ticksToMove = TicksPerNormalMove + case 4: + // Heading durectly into the wind, no movement at all + default: + log.Fatalf("bearing difference of %d should be impossible", diff) + } + + // If we've incremented over the current move ticks on the rover, we can try and make the move + if r.MoveTicks >= ticksToMove { + _, err := w.TryMoveRover(n, r.Bearing) + if err != nil { + log.Println(err) + // TODO: Report this error somehow + } + + // Reset the move ticks + r.MoveTicks = 0 + } + + log.Print(ticksToMove) + } + // Increment the current tick count w.CurrentTicks++ } diff --git a/pkg/rove/world_test.go b/pkg/rove/world_test.go index 785baa2..2dbcc86 100644 --- a/pkg/rove/world_test.go +++ b/pkg/rove/world_test.go @@ -78,25 +78,20 @@ func TestWorld_GetSetMovePosition(t *testing.T) { assert.Equal(t, pos, newPos, "Failed to correctly set position for rover") b := roveapi.Bearing_North - newPos, err = world.MoveRover(a, b) + newPos, err = world.TryMoveRover(a, b) assert.NoError(t, err, "Failed to set position for rover") pos.Add(maths.Vector{X: 0, Y: 1}) assert.Equal(t, pos, newPos, "Failed to correctly move position for rover") rover, err := world.GetRover(a) assert.NoError(t, err, "Failed to get rover information") - assert.Equal(t, rover.MaximumCharge-1, rover.Charge, "Rover should have lost charge for moving") assert.Contains(t, rover.Logs[len(rover.Logs)-1].Text, "moved", "Rover logs should contain the move") // Place a tile in front of the rover world.Atlas.SetObject(maths.Vector{X: 0, Y: 2}, Object{Type: roveapi.Object_RockLarge}) - newPos, err = world.MoveRover(a, b) + newPos, err = world.TryMoveRover(a, b) assert.NoError(t, err, "Failed to move rover") assert.Equal(t, pos, newPos, "Failed to correctly not move position for rover into wall") - - rover, err = world.GetRover(a) - assert.NoError(t, err, "Failed to get rover information") - assert.Equal(t, rover.MaximumCharge-2, rover.Charge, "Rover should have lost charge for move attempt") } func TestWorld_RadarFromRover(t *testing.T) { @@ -224,7 +219,7 @@ func TestWorld_RoverDamage(t *testing.T) { world.Atlas.SetObject(maths.Vector{X: 0.0, Y: 1.0}, Object{Type: roveapi.Object_RockLarge}) - vec, err := world.MoveRover(a, roveapi.Bearing_North) + vec, err := world.TryMoveRover(a, roveapi.Bearing_North) assert.NoError(t, err, "Failed to move rover") assert.Equal(t, pos, vec, "Rover managed to move into large rock") @@ -261,7 +256,7 @@ func TestWorld_RoverRepair(t *testing.T) { world.Atlas.SetObject(maths.Vector{X: 0.0, Y: 1.0}, Object{Type: roveapi.Object_RockLarge}) // Try and bump into the rock - vec, err := world.MoveRover(a, roveapi.Bearing_North) + vec, err := world.TryMoveRover(a, roveapi.Bearing_North) assert.NoError(t, err, "Failed to move rover") assert.Equal(t, pos, vec, "Rover managed to move into large rock") @@ -291,39 +286,6 @@ func TestWorld_RoverRepair(t *testing.T) { assert.Equal(t, originalInfo.Integrity, newinfo.Integrity, "rover should have kept the same integrity") } -func TestWorld_Charge(t *testing.T) { - world := NewWorld(4) - a, err := world.SpawnRover() - assert.NoError(t, err) - - // Get the rover information - rover, err := world.GetRover(a) - assert.NoError(t, err, "Failed to get rover information") - assert.Equal(t, rover.MaximumCharge, rover.Charge, "Rover should start with maximum charge") - - // Use up all the charge - for i := 0; i < rover.MaximumCharge; i++ { - // Get the initial position - initialPos, err := world.RoverPosition(a) - assert.NoError(t, err, "Failed to get position for rover") - - // Ensure the path ahead is empty - world.Atlas.SetTile(initialPos.Added(maths.BearingToVector(roveapi.Bearing_North)), roveapi.Tile_Rock) - world.Atlas.SetObject(initialPos.Added(maths.BearingToVector(roveapi.Bearing_North)), Object{Type: roveapi.Object_ObjectUnknown}) - - // Try and move north (along unblocked path) - newPos, err := world.MoveRover(a, roveapi.Bearing_North) - assert.NoError(t, err, "Failed to set position for rover") - assert.Equal(t, initialPos.Added(maths.BearingToVector(roveapi.Bearing_North)), newPos, "Failed to correctly move position for rover") - - // Ensure rover lost charge - rover, err := world.GetRover(a) - assert.NoError(t, err, "Failed to get rover information") - assert.Equal(t, rover.MaximumCharge-(i+1), rover.Charge, "Rover should have lost charge") - } - -} - func TestWorld_Daytime(t *testing.T) { world := NewWorld(1) diff --git a/proto/roveapi/roveapi.pb.go b/proto/roveapi/roveapi.pb.go index 51a886f..a9bf133 100644 --- a/proto/roveapi/roveapi.pb.go +++ b/proto/roveapi/roveapi.pb.go @@ -1095,6 +1095,8 @@ type StatusResponse struct { QueuedCommands []*Command `protobuf:"bytes,13,rep,name=queuedCommands,proto3" json:"queuedCommands,omitempty"` // The most recent logs Logs []*Log `protobuf:"bytes,14,rep,name=logs,proto3" json:"logs,omitempty"` + // The current wind direction + Wind Bearing `protobuf:"varint,15,opt,name=wind,proto3,enum=roveapi.Bearing" json:"wind,omitempty"` } func (x *StatusResponse) Reset() { @@ -1227,6 +1229,13 @@ func (x *StatusResponse) GetLogs() []*Log { return nil } +func (x *StatusResponse) GetWind() Bearing { + if x != nil { + return x.Wind + } + return Bearing_BearingUnknown +} + var File_roveapi_roveapi_proto protoreflect.FileDescriptor var file_roveapi_roveapi_proto_rawDesc = []byte{ @@ -1289,7 +1298,7 @@ var file_roveapi_roveapi_proto_rawDesc = []byte{ 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0x24, 0x0a, 0x06, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c, - 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x22, 0xaa, 0x04, 0x0a, + 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x22, 0xd0, 0x04, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, @@ -1324,59 +1333,61 @@ var file_roveapi_roveapi_proto_rawDesc = []byte{ 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x0e, 0x71, 0x75, 0x65, 0x75, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x12, 0x20, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, - 0x4c, 0x6f, 0x67, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x2a, 0x53, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, - 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x6e, 0x6f, 0x6e, 0x65, - 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x74, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x08, - 0x0a, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x73, - 0x68, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x61, 0x69, 0x72, 0x10, 0x04, 0x12, - 0x0d, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x10, 0x05, 0x2a, 0x83, - 0x01, 0x0a, 0x07, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x65, - 0x61, 0x72, 0x69, 0x6e, 0x67, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, - 0x74, 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x45, 0x61, 0x73, 0x74, - 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, - 0x04, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, - 0x53, 0x6f, 0x75, 0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10, 0x06, 0x12, 0x08, 0x0a, 0x04, 0x57, - 0x65, 0x73, 0x74, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x57, 0x65, - 0x73, 0x74, 0x10, 0x08, 0x2a, 0x5a, 0x0a, 0x06, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, - 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, - 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x4c, 0x69, 0x76, 0x65, 0x10, 0x01, - 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x44, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x74, - 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x10, - 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x10, 0x04, - 0x2a, 0x37, 0x0a, 0x04, 0x54, 0x69, 0x6c, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x69, 0x6c, 0x65, - 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x6f, 0x63, - 0x6b, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x72, 0x61, 0x76, 0x65, 0x6c, 0x10, 0x02, 0x12, - 0x08, 0x0a, 0x04, 0x53, 0x61, 0x6e, 0x64, 0x10, 0x03, 0x2a, 0x4c, 0x0a, 0x0c, 0x53, 0x61, 0x69, - 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x6e, 0x6b, - 0x6e, 0x6f, 0x77, 0x6e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x43, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x57, 0x69, - 0x6e, 0x64, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x6f, 0x6c, 0x61, 0x72, 0x43, 0x68, 0x61, - 0x72, 0x67, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x32, 0xcf, 0x02, 0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, - 0x12, 0x4d, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, - 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x41, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x72, 0x6f, + 0x4c, 0x6f, 0x67, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x24, 0x0a, 0x04, 0x77, 0x69, 0x6e, + 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, + 0x69, 0x2e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x04, 0x77, 0x69, 0x6e, 0x64, 0x2a, + 0x53, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, + 0x0a, 0x04, 0x6e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x74, 0x6f, 0x67, 0x67, + 0x6c, 0x65, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x74, 0x75, 0x72, 0x6e, 0x10, 0x02, 0x12, 0x09, + 0x0a, 0x05, 0x73, 0x74, 0x61, 0x73, 0x68, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x72, 0x65, 0x70, + 0x61, 0x69, 0x72, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, + 0x73, 0x74, 0x10, 0x05, 0x2a, 0x83, 0x01, 0x0a, 0x07, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, + 0x12, 0x12, 0x0a, 0x0e, 0x42, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, + 0x77, 0x6e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x10, 0x01, 0x12, + 0x0d, 0x0a, 0x09, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x02, 0x12, 0x08, + 0x0a, 0x04, 0x45, 0x61, 0x73, 0x74, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75, 0x74, + 0x68, 0x45, 0x61, 0x73, 0x74, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6f, 0x75, 0x74, 0x68, + 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10, + 0x06, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x65, 0x73, 0x74, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x4e, + 0x6f, 0x72, 0x74, 0x68, 0x57, 0x65, 0x73, 0x74, 0x10, 0x08, 0x2a, 0x5a, 0x0a, 0x06, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x12, 0x11, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x55, 0x6e, + 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x76, 0x65, 0x72, + 0x4c, 0x69, 0x76, 0x65, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x44, + 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, + 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x52, 0x6f, 0x63, 0x6b, 0x4c, + 0x61, 0x72, 0x67, 0x65, 0x10, 0x04, 0x2a, 0x37, 0x0a, 0x04, 0x54, 0x69, 0x6c, 0x65, 0x12, 0x0f, + 0x0a, 0x0b, 0x54, 0x69, 0x6c, 0x65, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, + 0x08, 0x0a, 0x04, 0x52, 0x6f, 0x63, 0x6b, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x72, 0x61, + 0x76, 0x65, 0x6c, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x61, 0x6e, 0x64, 0x10, 0x03, 0x2a, + 0x4c, 0x0a, 0x0c, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x17, 0x0a, 0x13, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x53, 0x61, 0x69, 0x6c, 0x50, 0x6f, + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x43, 0x61, 0x74, 0x63, + 0x68, 0x69, 0x6e, 0x67, 0x57, 0x69, 0x6e, 0x64, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x6f, + 0x6c, 0x61, 0x72, 0x43, 0x68, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x32, 0xcf, 0x02, + 0x0a, 0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, 0x4d, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, + 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x12, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, - 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x17, 0x2e, - 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, - 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x38, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61, 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, - 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, - 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, - 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, - 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, - 0x6f, 0x76, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, - 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, + 0x61, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, + 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, + 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x05, 0x52, 0x61, 0x64, 0x61, + 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, + 0x70, 0x69, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x72, + 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, + 0x26, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, + 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x72, 0x6f, 0x76, 0x65, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1430,21 +1441,22 @@ var file_roveapi_roveapi_proto_depIdxs = []int32{ 10, // 12: roveapi.StatusResponse.incomingCommands:type_name -> roveapi.Command 10, // 13: roveapi.StatusResponse.queuedCommands:type_name -> roveapi.Command 16, // 14: roveapi.StatusResponse.logs:type_name -> roveapi.Log - 5, // 15: roveapi.Rove.ServerStatus:input_type -> roveapi.ServerStatusRequest - 7, // 16: roveapi.Rove.Register:input_type -> roveapi.RegisterRequest - 11, // 17: roveapi.Rove.Command:input_type -> roveapi.CommandRequest - 13, // 18: roveapi.Rove.Radar:input_type -> roveapi.RadarRequest - 15, // 19: roveapi.Rove.Status:input_type -> roveapi.StatusRequest - 6, // 20: roveapi.Rove.ServerStatus:output_type -> roveapi.ServerStatusResponse - 9, // 21: roveapi.Rove.Register:output_type -> roveapi.RegisterResponse - 12, // 22: roveapi.Rove.Command:output_type -> roveapi.CommandResponse - 14, // 23: roveapi.Rove.Radar:output_type -> roveapi.RadarResponse - 18, // 24: roveapi.Rove.Status:output_type -> roveapi.StatusResponse - 20, // [20:25] is the sub-list for method output_type - 15, // [15:20] is the sub-list for method input_type - 15, // [15:15] is the sub-list for extension type_name - 15, // [15:15] is the sub-list for extension extendee - 0, // [0:15] is the sub-list for field type_name + 1, // 15: roveapi.StatusResponse.wind:type_name -> roveapi.Bearing + 5, // 16: roveapi.Rove.ServerStatus:input_type -> roveapi.ServerStatusRequest + 7, // 17: roveapi.Rove.Register:input_type -> roveapi.RegisterRequest + 11, // 18: roveapi.Rove.Command:input_type -> roveapi.CommandRequest + 13, // 19: roveapi.Rove.Radar:input_type -> roveapi.RadarRequest + 15, // 20: roveapi.Rove.Status:input_type -> roveapi.StatusRequest + 6, // 21: roveapi.Rove.ServerStatus:output_type -> roveapi.ServerStatusResponse + 9, // 22: roveapi.Rove.Register:output_type -> roveapi.RegisterResponse + 12, // 23: roveapi.Rove.Command:output_type -> roveapi.CommandResponse + 14, // 24: roveapi.Rove.Radar:output_type -> roveapi.RadarResponse + 18, // 25: roveapi.Rove.Status:output_type -> roveapi.StatusResponse + 21, // [21:26] is the sub-list for method output_type + 16, // [16:21] is the sub-list for method input_type + 16, // [16:16] is the sub-list for extension type_name + 16, // [16:16] is the sub-list for extension extendee + 0, // [0:16] is the sub-list for field type_name } func init() { file_roveapi_roveapi_proto_init() } diff --git a/proto/roveapi/roveapi.proto b/proto/roveapi/roveapi.proto index 9ca09d8..c45f29c 100644 --- a/proto/roveapi/roveapi.proto +++ b/proto/roveapi/roveapi.proto @@ -274,4 +274,7 @@ message StatusResponse { // The most recent logs repeated Log logs = 14; + + // The current wind direction + Bearing wind = 15; } \ No newline at end of file