Added comments to TankDrive

This commit is contained in:
Jason 2016-02-02 09:46:08 -05:00
parent acbf4923ff
commit 5f36411af7
9 changed files with 1934 additions and 1923 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,11 @@
#include "WPILib.h"
/**
* Encapsulates two RobotDrive objects and keeps them synced by sending
* identical ArcadeDrive calls to each. Also handles massaging of Joystick
* data to smooth out drive operations.
*/
class TankDrive {
public:
@ -26,6 +31,11 @@ public:
delete dt2;
}
/**
* Calls ArcadeDrive on the two RobotDrive objects for the TankDrive.
* Uses #defined DEADZONE_RADIUS to keep the robot from freaking out.
* Some math on the "rot" variable could make the driving smoother, I think.
*/
void Drive(Joystick *js) {
float x = js->GetX(), y = js->GetY(), th = ((1.0 - (js.GetThrottle()))
/ 2.0);
@ -39,7 +49,8 @@ public:
}
float speed = y * th;
float rot = y;
float rot = x; // do some math here to smooth out turning?
dt1.ArcadeDrive(speed, rot, false);
dt2.ArcadeDrive(speed, rot, false);
}