
30-03-2012, 17:23
|
|
Registered User
 FRC #1270
|
|
Join Date: Feb 2007
Location: Clevleand, Oh
Posts: 10
|
|
|
Re: Flipping the X - axis
Quote:
Originally Posted by Alan Anderson
Maybe you don't realize that the single-argument ArcadeDrive() method he's using doesn't provide anywhere to do this inversion. The sample code he's asking for is how to get around that lack. By the way, it's only the Y axis that needs to be inverted. The originally posted code is already getting the effect of inverting both axes by running all the motors in the other direction.
Try this: ( warning -- untested)
Code:
if(Driver->GetRawButton(6)) // reversed direction of robot
{
directionInverted = true;
}
if(Driver->GetRawButton(7)) // normal configuration
{
directionInverted = false;
}
if(directionInverted)
{
MyBase->ArcadeDrive(-Driver->GetY(),Driver->GetX(),false);
}
else
{
MyBase->ArcadeDrive(Driver);
}
You'll have to declare directionInverted as a static boolean variable, with an initial value of false.
|
This worked!!! Thanks!!! 
|