Volt OpModes
OpModes in Volt are built on top of the VoltOpMode base class.
There are two main types of VoltOpMode: AutonomousModes and ManualModes.
The VoltOpMode class has the following properties:
hardwareMap: HardwareMap: Used to get hardware instancestelemetry: Telemetry: Used to log information to the driver stationgamepad1: Gamepad: Used to read input from the first gamepadgamepad2: Gamepad: Used to read input from the second gamepadblackboard: MutableMap<String, Any>: Used to store and share data across multiple OpModes
The purpose of a VoltOpMode is to determine when to trigger Actions.
This goal is accomplished using Events.
In both AutonomousModes and ManualModes
Events are defined using the then method:
Event then { /* Build an Action */ }then(Event, builder -> { /* Build an Action */ });The then method pairs Events with a VoltActionBuilder.
In this builder, you can build simple or complex sequences of Actions
from the ones defined in your Attachments and Robots.
Adding Metadata
Section titled “Adding Metadata”A VoltOpMode requires the VoltOpModeMeta annotation to determine how it appears on the Driver Station app.
The VoltOpModeMeta annotation has three parameters:
name: String: The only required parameter. Specifies the name that will appear on the Driver Station app.group: String: Specifies the group that will appear on the Driver Station app. Defaults toOpModeMeta.DefaultGroupwhich shows up as ”$$$$$$$”.autoTransition: String: Specifies the ManualMode that an AutonomousMode will automatically transition to on completion.
Next Steps
Section titled “Next Steps”- Create an AutonomousMode to control your Robot autonomously
- Create a ManualMode to control your Robot with gamepads
- Learn more about Events
- Learn more about the VoltActionBuilder