Quote:
Originally Posted by Ether
sample code? not to be flippant, but this is what I meant:
|
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.