How to Use the Slow Mode Manager
Introduction
The SlowModeManager
is a utility designed to manage slow mode configurations for an FTC robot, enabling dynamic speed adjustments using gamepad inputs. This allows for more precise control, particularly during delicate maneuvers.
Note: The slow mode factor is a DIVISION factor, meaning a factor of 2.0
will halve the speed.
Creating a SlowModeManager
There are multiple ways to initialize a SlowModeManager
:
Constructors
SlowModeManager(SlowModeMulti slowModeMulti)
Core Methods
double apply(double value)
- Adjusts a given value based on the currently active slow mode.DrivePowerCoefficients apply(DrivePowerCoefficients drivePowerCoefficients)
- Modifies drive power coefficients.void update(onFunc,offFunc)
- Updates the active slow mode based on gamepad input. OnFunc being the function to call when the slow mode should be activated, and offFunc being the function to deactivate it.void telemetry(Telemetry telemetry)
- Displays the current slow mode in telemetry.
2. SlowModeMulti
The SlowModeMulti
class defines an individual slow mode configuration, specifying activation and deactivation buttons.
Creating a SlowModeMulti
The Constructors
SlowModeMulti(SlowMode slowModeData)
Built-in Configurations
static SlowModeMulti basic()
- Returns a slow mode with a factor of2.0
.
3. SlowMode
The SlowMode
class defines a slow mode with a configurable factor.
Creating a SlowMode
Singular Constructor
SlowMode(double slowModeFactor)
Predefined Modes
static SlowMode basic()
- A factor of2.0
.static SlowMode one()
- A factor of1.0
(no change).static SlowMode of(double slowModeFactor)
- Creates a custom slow mode factor.
Usage Example
This example demonstrates how to integrate SlowModeManager
with a gamepad.
With this setup, your FTC robot can dynamically adjust its movement speed based on gamepad input, providing better control during gameplay.