View Single Post
  #5   Spotlight this post!  
Unread 02-02-2012, 21:00
neal's Avatar
neal neal is offline
Neal
FRC #1777 (Viking Robotics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2009
Location: United States
Posts: 56
neal is an unknown quantity at this point
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. I actually just took a look at the WPI library and it has a getThrottle() function under the library class. I didn't know this existed so I'm gonna try it later. I didn't have internet access when I was coding earlier so I couldn't access the library.

I'll post back how it work when I get a chance to change my code.

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?
getThrottle() uses raw axis 4. To scale the throttle value from 0 - 1, you could do something like this: (simple math)

Code:
	public double scaleThrottle(double x) {
		return (x + 1) / 2;
	}
*** The code has not been tested. I just wrote that and to me, it looks like it should work.

You shouldn't need an internet connection to look at the library. You should be able to access it from your IDE, Eclipse or Netbeans. You could also just go to the sunspotfrcsdk folder and find it.

Last edited by neal : 02-02-2012 at 21:11. Reason: code not tested
Reply With Quote