DeepSpace  2019
DriveWithJoystick.h
Go to the documentation of this file.
1 #ifndef _DRIVEWITHJOYSTICK_HG_
3 #define _DRIVEWITHJOYSTICK_HG_
4 
5 #include <frc/commands/Command.h>
7 #include "RobotMap.h"
8 #include <frc/GenericHID.h>
9 
10 class DriveWithJoystick : public frc::Command {
11  public:
13  void Initialize() override;
14  void Execute() override;
15 
22  bool IsFinished() override;
23 
24  void End() override;
25  void Interrupted() override;
26 
27 private:
30 
31  double magnitude;
32  double radial;
33 
34  bool inline getTriggers();
35 
42  int driveMode;
43 
44  frc::XboxController* pJoyDrive;
45 };
46 
47 #endif // _DRIVEWITHJOYSTICK_HG_
int directionMultiplier
Can be 1 or -1. Determines the direction the the robot moves in.
frc::XboxController * pJoyDrive
A mnemonic for the driver&#39;s controller because we are lazy.
void Initialize() override
Runs once on initalization.
DriveWithJoystick()
Class constructor.
bool getTriggers()
Called only if the drivemode is set to 1.
void End() override
Runs once when IsFinished() returns true.
double radial
radial value that will be passed into DriveTrain::RadialDrive
void Interrupted() override
Runs once if the command is forced to stop.
int driveMode
Used to keep track of the drive mode.
An interface command for driving the robot with an xbox controller.
double magnitude
magnitude value that will be passed into DriveTrain::RadialDrive
double magnitudeMultiplier
The magnitude of the robot is multiplied by this number. Used for slowmode.
bool IsFinished() override
void Execute() override
Called in a loop during Teleop.