Move Rover position into main class

This commit is contained in:
Marc Di Luzio 2020-06-26 18:22:37 +01:00
parent 8019ea4e25
commit 7ee340e976
9 changed files with 126 additions and 77 deletions

View file

@ -125,4 +125,5 @@ func TestServer_Rover(t *testing.T) {
assert.NotZero(t, len(resp.Name), "Rover should return valid name") assert.NotZero(t, len(resp.Name), "Rover should return valid name")
assert.NotZero(t, resp.Speed, "Rover should return valid speed") assert.NotZero(t, resp.Speed, "Rover should return valid speed")
assert.NotZero(t, resp.Position, "Rover should return valid position") assert.NotZero(t, resp.Position, "Rover should return valid position")
assert.NotZero(t, resp.Capacity, "Rover should return valid position")
} }

View file

@ -62,15 +62,19 @@ func (s *Server) Rover(ctx context.Context, req *rove.RoverRequest) (*rove.Rover
} else if attrib, err := s.world.RoverAttributes(id); err != nil { } else if attrib, err := s.world.RoverAttributes(id); err != nil {
return nil, fmt.Errorf("error getting rover attributes: %s", err) return nil, fmt.Errorf("error getting rover attributes: %s", err)
} else if pos, err := s.world.RoverPosition(id); err != nil {
return nil, fmt.Errorf("error getting rover attributes: %s", err)
} else { } else {
response = &rove.RoverResponse{ response = &rove.RoverResponse{
Name: attrib.Name, Name: attrib.Name,
Position: &rove.Vector{ Position: &rove.Vector{
X: int32(attrib.Pos.X), X: int32(pos.X),
Y: int32(attrib.Pos.Y), Y: int32(pos.Y),
}, },
Speed: int32(attrib.Speed), Speed: int32(attrib.Speed),
Range: int32(attrib.Range), Range: int32(attrib.Range),
Capacity: int32(attrib.Capacity),
} }
} }
return response, nil return response, nil

View file

@ -31,8 +31,8 @@ func TestCommand_Move(t *testing.T) {
world.EnqueueAllIncoming() world.EnqueueAllIncoming()
world.ExecuteCommandQueues() world.ExecuteCommandQueues()
newatributes, err := world.RoverAttributes(a) newPos, err := world.RoverPosition(a)
assert.NoError(t, err, "Failed to set position for rover") assert.NoError(t, err, "Failed to set position for rover")
pos.Add(vector.Vector{X: 0.0, Y: int(duration) * int(attribs.Speed)}) // We should have moved duration*speed north pos.Add(vector.Vector{X: 0.0, Y: int(duration) * int(attribs.Speed)}) // We should have moved duration*speed north
assert.Equal(t, pos, newatributes.Pos, "Failed to correctly set position for rover") assert.Equal(t, pos, newPos, "Failed to correctly set position for rover")
} }

View file

@ -16,9 +16,6 @@ type RoverAttributes struct {
// Name of this rover // Name of this rover
Name string `json:"name"` Name string `json:"name"`
// Pos represents where this rover is in the world
Pos vector.Vector `json:"pos"`
// Capacity represents the maximum number of items the rover can carry // Capacity represents the maximum number of items the rover can carry
Capacity int `json:"capacity"` Capacity int `json:"capacity"`
} }
@ -28,6 +25,9 @@ type Rover struct {
// Id is a unique ID for this rover // Id is a unique ID for this rover
Id uuid.UUID `json:"id"` Id uuid.UUID `json:"id"`
// Pos represents where this rover is in the world
Pos vector.Vector `json:"pos"`
// Attributes represents the physical attributes of the rover // Attributes represents the physical attributes of the rover
Attributes RoverAttributes `json:"attributes"` Attributes RoverAttributes `json:"attributes"`

View file

@ -101,26 +101,26 @@ func (w *World) SpawnRover() (uuid.UUID, error) {
} }
// Spawn in a random place near the origin // Spawn in a random place near the origin
rover.Attributes.Pos = vector.Vector{ rover.Pos = vector.Vector{
X: w.Atlas.ChunkSize/2 - rand.Intn(w.Atlas.ChunkSize), X: w.Atlas.ChunkSize/2 - rand.Intn(w.Atlas.ChunkSize),
Y: w.Atlas.ChunkSize/2 - rand.Intn(w.Atlas.ChunkSize), Y: w.Atlas.ChunkSize/2 - rand.Intn(w.Atlas.ChunkSize),
} }
// Seach until we error (run out of world) // Seach until we error (run out of world)
for { for {
if tile, err := w.Atlas.GetTile(rover.Attributes.Pos); err != nil { if tile, err := w.Atlas.GetTile(rover.Pos); err != nil {
return uuid.Nil, err return uuid.Nil, err
} else { } else {
if !atlas.IsBlocking(tile) { if !atlas.IsBlocking(tile) {
break break
} else { } else {
// Try and spawn to the east of the blockage // Try and spawn to the east of the blockage
rover.Attributes.Pos.Add(vector.Vector{X: 1, Y: 0}) rover.Pos.Add(vector.Vector{X: 1, Y: 0})
} }
} }
} }
log.Printf("Spawned rover at %+v\n", rover.Attributes.Pos) log.Printf("Spawned rover at %+v\n", rover.Pos)
// Append the rover to the list // Append the rover to the list
w.Rovers[rover.Id] = rover w.Rovers[rover.Id] = rover
@ -135,7 +135,7 @@ func (w *World) DestroyRover(id uuid.UUID) error {
if i, ok := w.Rovers[id]; ok { if i, ok := w.Rovers[id]; ok {
// Clear the tile // Clear the tile
if err := w.Atlas.SetTile(i.Attributes.Pos, atlas.TileEmpty); err != nil { if err := w.Atlas.SetTile(i.Pos, atlas.TileEmpty); err != nil {
return fmt.Errorf("coudln't clear old rover tile: %s", err) return fmt.Errorf("coudln't clear old rover tile: %s", err)
} }
delete(w.Rovers, id) delete(w.Rovers, id)
@ -145,6 +145,32 @@ func (w *World) DestroyRover(id uuid.UUID) error {
return nil return nil
} }
// RoverPosition returns the position of the rover
func (w *World) RoverPosition(id uuid.UUID) (vector.Vector, error) {
w.worldMutex.RLock()
defer w.worldMutex.RUnlock()
if i, ok := w.Rovers[id]; ok {
return i.Pos, nil
} else {
return vector.Vector{}, fmt.Errorf("no rover matching id")
}
}
// SetRoverPosition sets the position of the rover
func (w *World) SetRoverPosition(id uuid.UUID, pos vector.Vector) error {
w.worldMutex.Lock()
defer w.worldMutex.Unlock()
if i, ok := w.Rovers[id]; ok {
i.Pos = pos
w.Rovers[id] = i
return nil
} else {
return fmt.Errorf("no rover matching id")
}
}
// RoverAttributes returns the attributes of a requested rover // RoverAttributes returns the attributes of a requested rover
func (w *World) RoverAttributes(id uuid.UUID) (RoverAttributes, error) { func (w *World) RoverAttributes(id uuid.UUID) (RoverAttributes, error) {
w.worldMutex.RLock() w.worldMutex.RLock()
@ -178,7 +204,7 @@ func (w *World) WarpRover(id uuid.UUID, pos vector.Vector) error {
if i, ok := w.Rovers[id]; ok { if i, ok := w.Rovers[id]; ok {
// Nothing to do if these positions match // Nothing to do if these positions match
if i.Attributes.Pos == pos { if i.Pos == pos {
return nil return nil
} }
@ -189,7 +215,7 @@ func (w *World) WarpRover(id uuid.UUID, pos vector.Vector) error {
return fmt.Errorf("can't warp rover to occupied tile, check before warping") return fmt.Errorf("can't warp rover to occupied tile, check before warping")
} }
i.Attributes.Pos = pos i.Pos = pos
w.Rovers[id] = i w.Rovers[id] = i
return nil return nil
} else { } else {
@ -198,7 +224,7 @@ func (w *World) WarpRover(id uuid.UUID, pos vector.Vector) error {
} }
// SetPosition sets an rovers position // SetPosition sets an rovers position
func (w *World) MoveRover(id uuid.UUID, b bearing.Bearing) (RoverAttributes, error) { func (w *World) MoveRover(id uuid.UUID, b bearing.Bearing) (vector.Vector, error) {
w.worldMutex.Lock() w.worldMutex.Lock()
defer w.worldMutex.Unlock() defer w.worldMutex.Unlock()
@ -210,20 +236,20 @@ func (w *World) MoveRover(id uuid.UUID, b bearing.Bearing) (RoverAttributes, err
move := b.Vector().Multiplied(distance) move := b.Vector().Multiplied(distance)
// Try the new move position // Try the new move position
newPos := i.Attributes.Pos.Added(move) newPos := i.Pos.Added(move)
// Get the tile and verify it's empty // Get the tile and verify it's empty
if tile, err := w.Atlas.GetTile(newPos); err != nil { if tile, err := w.Atlas.GetTile(newPos); err != nil {
return i.Attributes, fmt.Errorf("couldn't get tile for new position: %s", err) return vector.Vector{}, fmt.Errorf("couldn't get tile for new position: %s", err)
} else if !atlas.IsBlocking(tile) { } else if !atlas.IsBlocking(tile) {
// Perform the move // Perform the move
i.Attributes.Pos = newPos i.Pos = newPos
w.Rovers[id] = i w.Rovers[id] = i
} }
return i.Attributes, nil return i.Pos, nil
} else { } else {
return RoverAttributes{}, fmt.Errorf("no rover matching id") return vector.Vector{}, fmt.Errorf("no rover matching id")
} }
} }
@ -235,7 +261,7 @@ func (w *World) RadarFromRover(id uuid.UUID) ([]byte, error) {
if r, ok := w.Rovers[id]; ok { if r, ok := w.Rovers[id]; ok {
// The radar should span in range direction on each axis, plus the row/column the rover is currently on // The radar should span in range direction on each axis, plus the row/column the rover is currently on
radarSpan := (r.Attributes.Range * 2) + 1 radarSpan := (r.Attributes.Range * 2) + 1
roverPos := r.Attributes.Pos roverPos := r.Pos
// Get the radar min and max values // Get the radar min and max values
radarMin := vector.Vector{ radarMin := vector.Vector{
@ -279,11 +305,11 @@ func (w *World) RadarFromRover(id uuid.UUID) ([]byte, error) {
// Add all rovers to the radar // Add all rovers to the radar
for _, r := range w.Rovers { for _, r := range w.Rovers {
// If the rover is in range // If the rover is in range
dist := r.Attributes.Pos.Added(roverPos.Negated()) dist := r.Pos.Added(roverPos.Negated())
dist = dist.Abs() dist = dist.Abs()
if dist.X <= r.Attributes.Range && dist.Y <= r.Attributes.Range { if dist.X <= r.Attributes.Range && dist.Y <= r.Attributes.Range {
relative := r.Attributes.Pos.Added(radarMin.Negated()) relative := r.Pos.Added(radarMin.Negated())
index := relative.X + relative.Y*radarSpan index := relative.X + relative.Y*radarSpan
radar[index] = atlas.TileRover radar[index] = atlas.TileRover
} }

View file

@ -76,21 +76,21 @@ func TestWorld_GetSetMovePosition(t *testing.T) {
err = world.WarpRover(a, pos) err = world.WarpRover(a, pos)
assert.NoError(t, err, "Failed to set position for rover") assert.NoError(t, err, "Failed to set position for rover")
newAttribs, err := world.RoverAttributes(a) newPos, err := world.RoverPosition(a)
assert.NoError(t, err, "Failed to set position for rover") assert.NoError(t, err, "Failed to set position for rover")
assert.Equal(t, pos, newAttribs.Pos, "Failed to correctly set position for rover") assert.Equal(t, pos, newPos, "Failed to correctly set position for rover")
b := bearing.North b := bearing.North
duration := 1 duration := 1
newAttribs, err = world.MoveRover(a, b) newPos, err = world.MoveRover(a, b)
assert.NoError(t, err, "Failed to set position for rover") assert.NoError(t, err, "Failed to set position for rover")
pos.Add(vector.Vector{X: 0, Y: attribs.Speed * duration}) // We should have move one unit of the speed north pos.Add(vector.Vector{X: 0, Y: attribs.Speed * duration}) // We should have move one unit of the speed north
assert.Equal(t, pos, newAttribs.Pos, "Failed to correctly move position for rover") assert.Equal(t, pos, newPos, "Failed to correctly move position for rover")
// Place a tile in front of the rover // Place a tile in front of the rover
assert.NoError(t, world.Atlas.SetTile(vector.Vector{X: 0, Y: 2}, atlas.TileLargeRock)) assert.NoError(t, world.Atlas.SetTile(vector.Vector{X: 0, Y: 2}, atlas.TileLargeRock))
newAttribs, err = world.MoveRover(a, b) newPos, err = world.MoveRover(a, b)
assert.Equal(t, pos, newAttribs.Pos, "Failed to correctly not move position for rover into wall") assert.Equal(t, pos, newPos, "Failed to correctly not move position for rover into wall")
} }
func TestWorld_RadarFromRover(t *testing.T) { func TestWorld_RadarFromRover(t *testing.T) {

View file

@ -497,6 +497,8 @@ type RoverResponse struct {
Range int32 `protobuf:"varint,3,opt,name=range,proto3" json:"range,omitempty"` Range int32 `protobuf:"varint,3,opt,name=range,proto3" json:"range,omitempty"`
// The speed the rover can move per tick // The speed the rover can move per tick
Speed int32 `protobuf:"varint,4,opt,name=speed,proto3" json:"speed,omitempty"` Speed int32 `protobuf:"varint,4,opt,name=speed,proto3" json:"speed,omitempty"`
// The inventory capacity of the rover
Capacity int32 `protobuf:"varint,5,opt,name=Capacity,proto3" json:"Capacity,omitempty"`
} }
func (x *RoverResponse) Reset() { func (x *RoverResponse) Reset() {
@ -559,6 +561,13 @@ func (x *RoverResponse) GetSpeed() int32 {
return 0 return 0
} }
func (x *RoverResponse) GetCapacity() int32 {
if x != nil {
return x.Capacity
}
return 0
}
// Empty placeholder // Empty placeholder
type StatusRequest struct { type StatusRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -761,52 +770,53 @@ var file_rove_rove_proto_rawDesc = []byte{
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x28, 0x0a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x28, 0x0a,
0x0c, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x0c, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a,
0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x79, 0x0a, 0x0d, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x95, 0x01, 0x0a, 0x0d, 0x52, 0x6f, 0x76, 0x65,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x08, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a,
0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x08, 0x70, 0x6f, 0x0c, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x08, 0x70,
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65,
0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a,
0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x70, 0x65, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x70,
0x65, 0x64, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18,
0x65, 0x73, 0x74, 0x22, 0x71, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x22,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x74, 0x69, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x54, 0x69, 0x22, 0x71, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x63, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x74, 0x69, 0x63, 0x6b, 0x18,
0x08, 0x52, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x63, 0x6b, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x54, 0x69, 0x63, 0x6b, 0x12,
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x69, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05,
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x72, 0x65, 0x61, 0x64, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x63, 0x6b, 0x18, 0x03, 0x20,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x24, 0x0a, 0x06, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x69, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72,
0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73,
0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x32, 0xf8, 0x02, 0x0a, 0x69, 0x6f, 0x6e, 0x22, 0x24, 0x0a, 0x06, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x0c, 0x0a,
0x04, 0x52, 0x6f, 0x76, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79,
0x13, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x32, 0xf8, 0x02, 0x0a, 0x04, 0x52, 0x6f,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x76, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x13, 0x2e, 0x72,
0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x0f, 0x82, 0xd3, 0xe4, 0x93, 0x6f, 0x76, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x02, 0x09, 0x12, 0x07, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4f, 0x0a, 0x08, 0x52, 0x74, 0x1a, 0x14, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52,
0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x0f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x09, 0x12,
0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x07, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4f, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69,
0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x74, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x22, 0x09, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x6f,
0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x3a, 0x01, 0x2a, 0x12, 0x4f, 0x0a, 0x08, 0x76, 0x65, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x22, 0x09, 0x2f, 0x72, 0x65,
0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x3a, 0x01, 0x2a, 0x12, 0x4f, 0x0a, 0x08, 0x43, 0x6f, 0x6d,
0x16, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x52, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x12, 0x15, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x43, 0x6f, 0x6d,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x22, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72,
0x09, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x3a, 0x01, 0x2a, 0x12, 0x43, 0x0a, 0x6f, 0x76, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70,
0x05, 0x52, 0x61, 0x64, 0x61, 0x72, 0x12, 0x12, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x61, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x22, 0x09, 0x2f, 0x63,
0x64, 0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x72, 0x6f, 0x76, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x3a, 0x01, 0x2a, 0x12, 0x43, 0x0a, 0x05, 0x52, 0x61,
0x65, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x64, 0x61, 0x72, 0x12, 0x12, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x61, 0x64, 0x61, 0x72,
0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x22, 0x06, 0x2f, 0x72, 0x61, 0x64, 0x61, 0x72, 0x3a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52,
0x01, 0x2a, 0x12, 0x43, 0x0a, 0x05, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x12, 0x12, 0x2e, 0x72, 0x6f, 0x61, 0x64, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x11, 0x82, 0xd3,
0x76, 0x65, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0xe4, 0x93, 0x02, 0x0b, 0x22, 0x06, 0x2f, 0x72, 0x61, 0x64, 0x61, 0x72, 0x3a, 0x01, 0x2a, 0x12,
0x13, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x43, 0x0a, 0x05, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x12, 0x12, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x22, 0x06, 0x2f, 0x72, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x72,
0x6f, 0x76, 0x65, 0x72, 0x3a, 0x01, 0x2a, 0x42, 0x21, 0x5a, 0x1f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x6f, 0x76, 0x65, 0x2e, 0x52, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x22, 0x06, 0x2f, 0x72, 0x6f, 0x76, 0x65,
0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x72, 0x3a, 0x01, 0x2a, 0x42, 0x21, 0x5a, 0x1f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x33, 0x6f, 0x6d, 0x2f, 0x6d, 0x64, 0x69, 0x6c, 0x75, 0x7a, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x2f, 0x70,
0x6b, 0x67, 0x2f, 0x72, 0x6f, 0x76, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View file

@ -311,6 +311,11 @@
"type": "integer", "type": "integer",
"format": "int32", "format": "int32",
"title": "The speed the rover can move per tick" "title": "The speed the rover can move per tick"
},
"Capacity": {
"type": "integer",
"format": "int32",
"title": "The inventory capacity of the rover"
} }
} }
}, },

View file

@ -125,6 +125,9 @@ message RoverResponse {
// The speed the rover can move per tick // The speed the rover can move per tick
int32 speed = 4; int32 speed = 4;
// The inventory capacity of the rover
int32 Capacity = 5;
} }
// Empty placeholder // Empty placeholder