Added comments to TankDrive
This commit is contained in:
parent
acbf4923ff
commit
5f36411af7
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user