View Single Post
  #8   Spotlight this post!  
Unread 02-02-2012, 22:37
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 431
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Drive Motor With Throttle on Logitech Attack 3

Quote:
Originally Posted by touchdownjesus4 View Post
I tried to use the getRawAxis(3) earlier and it didn't work.
getRawAxis(3) works for us. make sure your joystick object is initialized

Some sample code assuming you're using simpleRobot or equivalent.

place this is your class:
Code:
Joystick joy1; //define a variable accessible to all methods in your class
Add this to your init method
Code:
joy1 = new Joystick(1); // make a new joystick object on port 1
Add this to whereever you're trying to read the joystick (teleop?)
Code:
joy1.getRawAxis(3);
That returns a double, store it in a variable for use or manipulate it directly...


Quote:
Just for my knowledge, how would I go about inverting it? And also if we only need to drive the motor one direction (it's just a spinning wheel) is there a way to have it only go from 0 to 1 or 0 to -1?
Inverting would be multiply by -1
scaling in the case you asked would be (value + 1) / 2

Any data manipulation in FRC, you should be able to get a decent implementation using high school math courses( algebra, geometry, ...maybe some calc) - yea there is actually a practical use for that stuff you're required to learn
__________________
http://team2168.org
Reply With Quote