View Single Post
  #29   Spotlight this post!  
Unread 16-03-2015, 11:18
Ozuru's Avatar
Ozuru Ozuru is offline
It's always the programmer's fault.
no team
 
Join Date: May 2013
Rookie Year: 2010
Location: Earth
Posts: 268
Ozuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to behold
Re: Limit speed of 4 chassis CIM motors

Quote:
Originally Posted by microman1934 View Post
Thank you so much for the help guys, I just ended up doing this:

Code:
double rot = -stick.getX();
double speed = -stick.getY();
myRobot.arcadeDrive(rot*0.5, speed*0.5);
Why not just square the magnitude? Pseudo code for example.

Code:
double rot = -stick.getX();
double speed = -stick.getRawAxis(drive axis);
myRobot.arcadeDrive(rot, speed * Math.abs(speed));
This allows finer control at lower speeds (when joystick is reading 0.5 you will send 0.25 to the motors) but still allows full speed when the joysticks are at full throttle.