Go to Post If it is good enough for Paul and JVN it's good enough for me. - Vikesrock [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-23-2010, 08:32 AM
windell747 windell747 is offline
Registered User
FRC #2477
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2001
Location: Hawaii
Posts: 158
windell747 will become famous soon enoughwindell747 will become famous soon enough
Inverting controls in Java

Hi,

Unfortunately, I'm not the programmer for my team, but I did pretty much all of our programming when we were using C. This means that I don't know the Java lingo either. So please bare with me.

What we're trying to do is invert our controls so that we can flip the forward and reverse directions on our robot. This is so that we dont need to turn the robot around to herd balls and stuff. Our programmer said that there is an "invert controls" option, but when she uses it, the axes of the joystick switch.

Has anyone found an easy way to invert the controls for their robot? We're using the out of the box tankdrive routine.

Thanks,
Windell
Reply With Quote
  #2   Spotlight this post!  
Unread 03-23-2010, 08:41 AM
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,069
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Inverting controls in Java

Code:
RobotDrive myDrive = new RobotDrive(1,2,3,4);

if( invertMyDrive == true )
{
 myDrive.setInvertedMotor(kFrontLeft, true);
 myDrive.setInvertedMotor(kFrontRight, true);
 myDrive.setInvertedMotor(kRearLeft, true);
 myDrive.setInvertedMotor(kRearRight, true);
}

myDrive.tankDrive(leftStick, rightStick);
The above snippet will reverse the forward/backward direction of your bot if the "invertMyDrive" variable (a boolean) is set.

It sounds like if your axes got switched, you only inverted half of the drive.
Reply With Quote
  #3   Spotlight this post!  
Unread 03-23-2010, 08:47 AM
windell747 windell747 is offline
Registered User
FRC #2477
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2001
Location: Hawaii
Posts: 158
windell747 will become famous soon enoughwindell747 will become famous soon enough
Re: Inverting controls in Java

really appreciate it Jared. I'll pass this on to our programmer!
Reply With Quote
  #4   Spotlight this post!  
Unread 03-24-2010, 01:27 AM
Geek 2.0 Geek 2.0 is offline
Registered User
FRC #0107
Team Role: Programmer
 
Join Date: Sep 2009
Rookie Year: 2008
Location: Holland, MI
Posts: 120
Geek 2.0 will become famous soon enough
Re: Inverting controls in Java

You might want an "else" portion in there too to set the back to normal. It's nice to be able to change, but it's nicer to be able to change back
Reply With Quote
  #5   Spotlight this post!  
Unread 03-24-2010, 07:35 AM
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,069
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Inverting controls in Java

Quote:
Originally Posted by Geek 2.0 View Post
You might want an "else" portion in there too to set the back to normal. It's nice to be able to change, but it's nicer to be able to change back
Details, details
Reply With Quote
Reply


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems Inverting Wheels? Must Be Drama NI LabVIEW 1 02-15-2010 05:41 PM
**FIRST EMAIL**/Java and Orbit Balls *****JAVA DISCUSSION*** Pjohn1959 Programming 37 08-31-2009 03:55 PM
Inverting x-axis jkjohnson Control System 8 02-22-2007 02:24 AM
Inverting Joysticks? The yellowdart Programming 5 02-20-2006 08:05 PM
Inverting Y axis on joystick FormatteD_C Programming 7 02-24-2004 04:56 PM


All times are GMT -5. The time now is 07:36 AM.

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