AutonomyModel class

A view model for the autonomy page to render a grid map.

Shows a bird's-eye map of where the rover is, what's around it, where the goal is, and the path to get there. This class uses AutonomyData to keep track of the data as reported by the rover. The grid is a 2D map of width and height gridSize that keeps the roverPosition in the center (by keeping track of its offset) and filling the other cells with AutonomyCells.

Mixed-in types

Constructors

AutonomyModel()
Listens for incoming autonomy or position data.

Properties

badAppleAudioPlayer AudioPlayer
The audio player for the Bad Apple music
final
badAppleFrame ↔ int
Which frame in the Bad Apple video we are up to right now
getter/setter pair
badAppleTimer ↔ Timer?
A timer to update the map for every frame of Bad Apple
getter/setter pair
data AutonomyData
The autonomy data as received from the rover.
getter/setter pair
empty → List<List<(GpsCoordinates, AutonomyCell)>>
An empty grid of size gridSize.
no setter
grid → List<List<(GpsCoordinates, AutonomyCell)>>
The grid of size gridSize with the rover in the center, ready to draw on the UI.
no setter
gridSize ↔ int
The amount of blocks in the width and height of the grid.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isPlayingBadApple ↔ bool
Whether the UI is currently playing Bad Apple
getter/setter pair
markerBuilder GpsBuilder
The view model to edit the coordinate of the marker.
getter/setter pair
markers ↔ List<GpsCoordinates>
A list of markers manually placed by the user. Useful for the Extreme Retrieval Mission.
getter/setter pair
offset GridOffset
The offset to add to all other coordinates, based on roverPosition. See recenterRover.
getter/setter pair
roverHeading → double
The rover's heading
no setter
roverPosition GpsCoordinates
The rover's current position.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
clearMarkers() → void
Deletes all the markers in markers.
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
gpsToBlock(double value) → int
Converts a decimal GPS coordinate to an index representing the block in the grid.
init() → Future<void>
Initializes the view model.
markCell(List<List<(GpsCoordinates, AutonomyCell)>> list, GpsCoordinates gps, AutonomyCell value) → void
Calculates a new position for gps based on offset and adds it to the list.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
onNewData(AutonomyData value) → void
A handler to call when new data arrives. Updates data and the UI.
placeMarker() → void
Places the marker in markerBuilder.
placeMarkerOnRover() → void
Places a marker at the rover's current position.
recenterRover() → void
Determines the new offset based on the current roverPosition.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
startBadApple() → Future<void>
Starts playing Bad Apple.
stopBadApple() → void
Stops playing Bad Apple and resets the UI.
toString() → String
A string representation of this object.
inherited
updateMarker(GpsCoordinates gps) → void
Removes a marker in gps
zoom(int newSize) → void
Zooms in or out by modifying gridSize.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

badAppleFps → const int
How many frames in a second are being shown
badAppleLastFrame → const int
The last frame of Bad Apple