Actually sane now. Really, I mean it. ...although the turning circle is somewhat ... elephantine ...
This commit is contained in:
parent
c32e95768c
commit
4044f448d7
@ -44,7 +44,6 @@ private:
|
|||||||
// instance variables
|
// instance variables
|
||||||
bool pickupRunning; // don't want to spam the Talon with set messages. Toggle the pickup when a button is pressed or released.
|
bool pickupRunning; // don't want to spam the Talon with set messages. Toggle the pickup when a button is pressed or released.
|
||||||
bool inverting;
|
bool inverting;
|
||||||
float oldXY;
|
|
||||||
bool ramping;
|
bool ramping;
|
||||||
bool shooting;
|
bool shooting;
|
||||||
bool unjamming;
|
bool unjamming;
|
||||||
@ -117,8 +116,10 @@ private:
|
|||||||
{
|
{
|
||||||
if (driver_stick.GetRawButton(THUMB))
|
if (driver_stick.GetRawButton(THUMB))
|
||||||
{
|
{
|
||||||
left_drive.Set(driver_stick.GetThrottle() * driver_stick.GetTwist());
|
float left = driver_stick.GetTwist();
|
||||||
right_drive.Set(-1 * driver_stick.GetThrottle() * driver_stick.GetTwist());
|
float right = -driver_stick.GetTwist();
|
||||||
|
|
||||||
|
drive.TankDrive(left, right);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -187,25 +188,25 @@ private:
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* The 'inverting' variable is used to make sure that the drive train isn't getting
|
* The 'inverting' variable is used to make sure that the drive train isn't getting
|
||||||
* inverted every itteration of the TeleopPeriodic method while the button is held down.
|
* inverted every iteration of the TeleopPeriodic method while the button is held down.
|
||||||
* This is important because the TeleopPeriodic method executes something like once every 10ms.
|
* This is important because the TeleopPeriodic method executes something like once every 10ms.
|
||||||
* Thus, this if-else if pair make the button a toggle.
|
* Thus, this if-else if pair make the button a toggle.
|
||||||
*/
|
*/
|
||||||
if(driver_stick.GetRawButton(THUMB) && !inverting)
|
if(driver_stick.GetRawButton(TRIGGER) && !inverting)
|
||||||
{
|
{
|
||||||
std::cout << "Inverting Drive Train.";
|
std::cout << "Inverting Drive Train.";
|
||||||
left_drive.SetInverted(!left_drive.GetInverted());
|
left_drive.SetInverted(!left_drive.GetInverted());
|
||||||
right_drive.SetInverted(!right_drive.GetInverted());
|
right_drive.SetInverted(!right_drive.GetInverted());
|
||||||
inverting = true;
|
inverting = true;
|
||||||
}
|
}
|
||||||
else if(!driver_stick.GetRawButton(THUMB))
|
else if(!driver_stick.GetRawButton(TRIGGER))
|
||||||
{
|
{
|
||||||
inverting = false;
|
inverting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unlike the previous actions, this method does need to be called every itteration of
|
* Unlike the previous actions, this method does need to be called every iteration of
|
||||||
* TeleopPeriodic. This is because the logic running this operation needs to be checked
|
* TeleopPeriodic. This is because the logic running this operation needs to be checked
|
||||||
* Every time the method is called. This cannot be a loop in the Shoot method because
|
* Every time the method is called. This cannot be a loop in the Shoot method because
|
||||||
* that would lock the robot every time the trigger is hit.
|
* that would lock the robot every time the trigger is hit.
|
||||||
@ -247,23 +248,19 @@ private:
|
|||||||
|
|
||||||
void UpdateDrive()
|
void UpdateDrive()
|
||||||
{
|
{
|
||||||
float x = driver_stick.GetX();
|
float x = -driver_stick.GetX();
|
||||||
float y = driver_stick.GetY();
|
float y = -driver_stick.GetY();
|
||||||
if ((x + y) != oldXY)
|
if (x > 0)
|
||||||
{
|
{
|
||||||
oldXY = x + y;
|
float right = y * SaneThrottle(driver_stick.GetThrottle());
|
||||||
if (x > 0)
|
float left = (1-x)*y * SaneThrottle(driver_stick.GetThrottle());
|
||||||
{
|
drive.TankDrive(left, right);
|
||||||
float left = y * driver_stick.GetThrottle();
|
}
|
||||||
float right = (1-x)*y * driver_stick.GetThrottle();
|
else
|
||||||
drive.TankDrive(left, right);
|
{
|
||||||
}
|
float left = y * SaneThrottle(driver_stick.GetThrottle());
|
||||||
else
|
float right = (1+x)*y * SaneThrottle(driver_stick.GetThrottle());
|
||||||
{
|
drive.TankDrive(left, right);
|
||||||
float left = y * driver_stick.GetThrottle();
|
|
||||||
float right = (1+x)*y * driver_stick.GetThrottle();
|
|
||||||
drive.TankDrive(left, right);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user