Quote:
Originally Posted by touchdownjesus4
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.