View Single Post
  #6   Spotlight this post!  
Unread 23-03-2011, 15:40
maleche maleche is offline
Senior Engineering Program Manager
no team
 
Join Date: Mar 2011
Rookie Year: 2004
Location: Washington State
Posts: 1
maleche is an unknown quantity at this point
Re: Single Joystick Tank Drive

This is a great subject. I am working on the same concept using Visual Basic. I have a scaled Picture box with -128,128, 128,128 set as the scaled box points. Center is 0 (zero) with adjustable deadbands in both X & Y centered.

Moving a joystick OR mouse sends the Xj, Yj or Xm, Ym directly to the motor controller, after calculations.

I am using pythagorean for vector speed (Vel) based on joystick/mouse angle and distance from center. This works great in direct Y and -Y vectors ( both treads move at same speed and direction). -X, X will rotate Left and Right tank treads in opposite directions at equal speed. When steering slightly left and forward (Xj=-20, Yj=50) the total vector is the Sin(Angle)* Vel. This does well when transitioning from full forward to left/right steering. I'm still working out some bugs. I have not considered Tan2 yet or using a Gyro to steer by. The motor controller is a Sabertooth 2x50 and using 0-127 as speed with direction tokens.
One thing to consider however, is when going from full forward to all-stop. This can tip the robot or cause problems with stability. I programmed a ramp-down speed Vel=Vel-ramp^2. this allow VERY smooth and quick stopping transitions.
Keep in touch!
Doyle
Reply With Quote