Controller class
Uses the gamepad to control the rover.
Each gamepad can only control one subsystem at a time, so this class uses controls to keep track of what each button does in the current OperatingMode.
Once every gamepadDelay, the gamepadTimer will trigger, which _update
s the gamepad and
call RoverControls.parseInputs to see what actions can be done. Each command is then sent
with MessagesModel.sendMessage, which will either send them over the network or via serial.
- Inheritance
-
- Object
- Model
- Controller
Constructors
- Controller(int index, RoverControls controls)
-
Maps button presses on gamepad to
controls
.
Properties
- controls ↔ RoverControls
-
Defines what the current controls are for the current mode.
getter/setter pair
- gamepad → Gamepad
-
The gamepad to read from.
no setter
- gamepadTimer ↔ Timer
-
Reads the gamepad and controls the rover when triggered.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- index → int
-
The index of the gamepad to read from. Does not match Gamepad.controllerIndex.
final
- isConnected → bool
-
Whether this controller is ready to use.
no setter
- mode → OperatingMode
-
The current operating mode.
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
-
connect(
) → Future< void> - Connects the gamepad to the user's device.
-
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
-
init(
) → Future< void> -
Initializes any data needed by this model.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
otherControllerIs(
OperatingMode mode) → bool - Returns Whether another controller is set to the given mode.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
setMode(
OperatingMode? mode) → void - Changes the current mode this gamepad is controlling, and chooses a new RoverControls.
-
setModeIndex(
int index) → void -
Same as setMode, but uses
OperatingMode.index
instead. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited