View Single Post
  #7   Spotlight this post!  
Unread 30-03-2012, 17:23
cddp14 cddp14 is offline
Registered User
FRC #1270
 
Join Date: Feb 2007
Location: Clevleand, Oh
Posts: 10
cddp14 is an unknown quantity at this point
Re: Flipping the X - axis

Quote:
Originally Posted by Alan Anderson View Post
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!!!
Reply With Quote