2015-01-16 19:29:55 -05:00
|
|
|
#ifndef DRIVETRAIN_H
|
|
|
|
#define DRIVETRAIN_H
|
|
|
|
|
|
|
|
#include "WPILib.h"
|
2015-03-09 09:48:18 -04:00
|
|
|
/**
|
|
|
|
* @brief Drives the robot
|
|
|
|
*
|
|
|
|
* 4 wheel mecanum drive
|
|
|
|
*/
|
2015-01-31 12:16:02 -05:00
|
|
|
class Drivetrain: public Subsystem{
|
2015-01-16 20:12:48 -05:00
|
|
|
private:
|
2015-03-09 09:48:18 -04:00
|
|
|
CANTalon *rightFront, //<! Front right motor
|
|
|
|
*leftFront, //<! Front left motor
|
|
|
|
*rightRear, //<! Back right motor
|
|
|
|
*leftRear; //<! Back left motor
|
2015-03-10 20:14:38 -04:00
|
|
|
Gyro *gyro; //<! Gyro
|
2015-01-16 20:12:48 -05:00
|
|
|
public:
|
2015-03-09 09:48:18 -04:00
|
|
|
/**
|
|
|
|
* @brief Constructs Drivetrain
|
|
|
|
*/
|
2015-01-16 20:12:48 -05:00
|
|
|
Drivetrain();
|
2015-03-09 09:48:18 -04:00
|
|
|
/**
|
|
|
|
* @brief Current motor to test
|
|
|
|
*/
|
2015-02-07 09:17:20 -05:00
|
|
|
enum e_motors{
|
2015-03-09 09:48:18 -04:00
|
|
|
FRONTRIGHT, //<! Front right motor
|
|
|
|
FRONTLEFT, //<! Front left motor
|
|
|
|
BACKRIGHT, //<! Back right motor
|
|
|
|
BACKLEFT //<! Back left motor
|
2015-02-07 09:17:20 -05:00
|
|
|
};
|
2015-03-09 09:48:18 -04:00
|
|
|
/**
|
|
|
|
* @brief No action
|
|
|
|
*/
|
2015-01-16 20:12:48 -05:00
|
|
|
void InitDefaultCommand();
|
2015-03-09 09:48:18 -04:00
|
|
|
/**
|
|
|
|
* @brief Drives the robot with mecanum
|
|
|
|
*
|
2015-03-10 20:14:38 -04:00
|
|
|
* @param x Joystick x value (-1.0 to 1.0)
|
|
|
|
* @param y Joystick y value (-1.0 to 1.0)
|
|
|
|
* @param z Joystick z value (-1.0 to 1.0)
|
|
|
|
* @param sensitivity Sensitivity (0.0 to 1.0)
|
2015-03-23 10:52:02 -04:00
|
|
|
* @param driveStraight Overrides z value to correct for motor lag (default: false)
|
2015-03-09 09:48:18 -04:00
|
|
|
*/
|
2015-03-23 10:52:02 -04:00
|
|
|
void DriveMecanum(double x, double y, double z, double sensitivity, bool driveStraight = false);
|
2015-03-09 09:48:18 -04:00
|
|
|
/**
|
2015-03-10 20:14:38 -04:00
|
|
|
* @brief Tests one motor
|
2015-03-09 09:48:18 -04:00
|
|
|
*
|
2015-03-10 20:14:38 -04:00
|
|
|
* @param motor Motor to test
|
|
|
|
* @param power Power to set motor
|
2015-03-09 09:48:18 -04:00
|
|
|
*/
|
2015-03-10 20:14:38 -04:00
|
|
|
void TestMotor(e_motors motor, double power);
|
2015-03-09 09:48:18 -04:00
|
|
|
/**
|
2015-03-10 20:14:38 -04:00
|
|
|
* @brief Sets the gyro value to 0.0
|
2015-03-09 09:48:18 -04:00
|
|
|
*/
|
2015-03-10 20:14:38 -04:00
|
|
|
void ResetGyro();
|
2015-01-16 19:29:55 -05:00
|
|
|
};
|
|
|
|
#endif
|
2015-02-08 12:26:15 -05:00
|
|
|
// vim: ts=2:sw=2:et
|