View Single Post
  #7   Spotlight this post!  
Unread 06-02-2015, 15:56
cstelter cstelter is offline
Programming Mentor
AKA: Craig Stelter
FRC #3018 (Nordic Storm)
Team Role: Mentor
 
Join Date: Apr 2012
Rookie Year: 2012
Location: Mankato, MN
Posts: 77
cstelter will become famous soon enough
Re: Slowing down the drive motors

Quote:
Originally Posted by notmattlythgoe View Post
Change this line:
Code:
myRobot.tankDrive(stick1,stick2);
to this:
Code:
myRobot.tankDrive(stick1.getY() * 0.5, stick2.getY() * 0.5);
Then change the 0.5 to some scalar value depending on how much you want to scale it.
If your joystick has a throttle (any knob/lever that can be set and will stay at a value), you can read that value for the 0.5's above. A bit of math may be required-- the Extreme 3d our team uses goes -1 at the up position (what we think of as full throttle) and +1 at the bottom end so we use

double throttle=(-1*stick.getThrottle() + 1)/2;

This gives us a value between 0 and 1 depending on where the throttle is.

Depending on your stick, you may need to call getZ or some other mapping if you have a throttle. I can't say for sure-- we've only used the one joystick with this year's software.
Reply With Quote