Class DriveWrapper
- All Implemented Interfaces:
Drive
public class DriveWrapper extends java.lang.Object implements Drive
- Since:
- 0.4.0
- Author:
- Colin Robertson
-
Field Summary
Fields Modifier and Type Field Description private DrivedriveThe wrapper's drivetrain.private booleandriveInvertXShould transformational X values be swapped?private booleandriveInvertYShould transformational Y values be swapped?private booleandriveSwapXYShould X and Y transformations be swapped? -
Constructor Summary
Constructors Constructor Description DriveWrapper(Drive drive, boolean driveSwapXY, boolean driveInvertX, boolean driveInvertY)Create a new drive wrapper. -
Method Summary
Modifier and Type Method Description voiddisableUserControl()Stop allowing the drivetrain to be controlled by a user.voiddrive(RTransform transform)Drive the robot according to a specified transformation.voidenableUserControl()Allow the drivetrain to be controlled by a user.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
drive
The wrapper's drivetrain. -
driveSwapXY
private final boolean driveSwapXYShould X and Y transformations be swapped? -
driveInvertX
private final boolean driveInvertXShould transformational X values be swapped? -
driveInvertY
private final boolean driveInvertYShould transformational Y values be swapped?
-
-
Constructor Details
-
DriveWrapper
Create a new drive wrapper.- Parameters:
drive- theDriveto use for the wrapper.driveSwapXY- should X and Y transforms be swapped?driveInvertX- should X transforms be inverted?driveInvertY- should Y transforms be inverted?
-
-
Method Details
-
drive
Drive the robot according to a specified transformation. Transformations are made up of several components, most notably X, Y, and angle. It's important to note that the angle component of these transformations represents the angle that the robot SHOULD be facing, not by how much the robot needs to turn. -
enableUserControl
public void enableUserControl()Allow the drivetrain to be controlled by a user.User control needs to be enabled in order for the user to actually control the robot manually, such as via a joystick. Although Pathfinder is pretty lovely, sometimes you need to control the robot.
If this isn't implemented properly, you may see very funky things going on with the motors - spasms, for example. In order to counter this, it's a good idea to... well, actually implement this method properly.
- Specified by:
enableUserControlin interfaceDrive
-
disableUserControl
public void disableUserControl()Stop allowing the drivetrain to be controlled by a user.In order for Pathfinder to actually function, and in order for the user to not miserably mess up absolutely everything, user control needs to be disabled prior to controlling a motor.
If this isn't implemented properly, you may see very funky things going on with the motors - spasms, for example. In order to counter this, it's a good idea to... well, actually implement this method properly.
- Specified by:
disableUserControlin interfaceDrive
-