Added a defined TURN_FACTOR for easily testing variations of the SimpleDrive method
This commit is contained in:
parent
91831a1326
commit
46e5a428b1
@ -10,10 +10,15 @@
|
||||
#define RAMP_LOWER 4 // Button 4 to lower ramp.
|
||||
#define UNJAM 11
|
||||
|
||||
#define DEADZONE_RADIUS 0.01 // Deadzone Radius prevents tiny twitches in the joystick's value from
|
||||
#define DEADZONE_RADIUS 0.05 // Deadzone Radius prevents tiny twitches in the joystick's value from
|
||||
// affecting the robot. Use this for cleaning up drive train and shooter.
|
||||
// Also used for detecting changes in an axis' value.
|
||||
|
||||
#define TURN_FACTOR 1.5 // Left(x,y) = y*(1 + TF*x) : x < 0
|
||||
// = y : x >= 0
|
||||
// Right(x,y) = y : x < 0
|
||||
// = y*(1 - TF*x) : x >= 0
|
||||
|
||||
#endif // BUTTON_LAYOUT
|
||||
|
||||
class Robot: public IterativeRobot
|
||||
@ -246,6 +251,27 @@ private:
|
||||
lw->Run();
|
||||
}
|
||||
|
||||
void SimpleDrive()
|
||||
{
|
||||
float x = -driver_stick.GetX();
|
||||
float y = -driver_stick.GetY();
|
||||
float left = 0;
|
||||
float right = 0;
|
||||
|
||||
if (x > 0)
|
||||
{
|
||||
right = y;
|
||||
left = (1- x*TURN_FACTOR)*y ;
|
||||
}
|
||||
else
|
||||
{
|
||||
left = y;
|
||||
right = (1+x*TURN_FACTOR)*y;
|
||||
}
|
||||
|
||||
drive.TankDrive(left, right);
|
||||
}
|
||||
|
||||
void UpdateDrive()
|
||||
{
|
||||
float x = -driver_stick.GetX();
|
||||
|
Reference in New Issue
Block a user