2015-02-06 13:45:01 -05:00
|
|
|
#ifndef AUTODRIVE_H
|
|
|
|
#define AUTODRIVE_H
|
|
|
|
|
|
|
|
#include "Commands/Command.h"
|
2015-03-09 10:53:35 -04:00
|
|
|
#include "../../DentRobot.h"
|
2015-02-06 13:45:01 -05:00
|
|
|
#include "../../DentRobot.h"
|
|
|
|
#include "WPILib.h"
|
|
|
|
|
2015-03-01 17:19:00 -05:00
|
|
|
/**
|
|
|
|
* @brief Drives the robot without a joystick
|
|
|
|
*
|
|
|
|
* Drives the robot given a timeout and joystick values
|
|
|
|
*/
|
2015-07-31 12:52:15 -04:00
|
|
|
class AutoDrive: public Command {
|
|
|
|
private:
|
|
|
|
double x, //<! The x value of the simulated joystick value
|
|
|
|
y, //<! The y value of the simulated joystick value
|
|
|
|
z; //<! The z value of the simulated joystick value
|
|
|
|
bool gyro;
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @brief Constructs AutoDrive
|
|
|
|
*
|
|
|
|
* @param duration Timeout in seconds
|
|
|
|
* @param xtmp Joystick x value (default: 0.0)
|
|
|
|
* @param ytmp Joystick y value (default: -0.75)
|
|
|
|
* @param ztmp Joystick z value (default: 0.0)
|
|
|
|
* @param useGyro Use the gyro when driving (default: true)
|
|
|
|
*/
|
|
|
|
AutoDrive(double duration, double xtmp = 0.0, double ytmp = -0.75, double ztmp = 0.0, bool useGyro = true);
|
|
|
|
/**
|
|
|
|
* @brief Initializes the class
|
|
|
|
*/
|
|
|
|
void Initialize();
|
|
|
|
/**
|
|
|
|
* @brief Drives the robot
|
|
|
|
*/
|
|
|
|
void Execute();
|
|
|
|
/**
|
|
|
|
* @brief Checks if the command is finished
|
|
|
|
*
|
|
|
|
* @return True only if the timeout was reached
|
|
|
|
*/
|
|
|
|
bool IsFinished();
|
|
|
|
/**
|
|
|
|
* @brief Sets the drivetrain to stop
|
|
|
|
*/
|
|
|
|
void End();
|
|
|
|
/**
|
|
|
|
* @brief Calls End()
|
|
|
|
*/
|
|
|
|
void Interrupted();
|
2015-02-06 13:45:01 -05:00
|
|
|
};
|
|
|
|
#endif
|
2015-02-08 12:26:15 -05:00
|
|
|
// vim: ts=2:sw=2:et
|