Go to Post "FIRST, molding the future of America by inspiring children in the fields of science and technology....and eliminating playground dodgeball forever." - Andy Grady [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:52.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi