View Single Post
  #13   Spotlight this post!  
Unread 05-18-2011, 06:09 PM
kinganu123 kinganu123 is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Piscataway, NJ
Posts: 243
kinganu123 is on a distinguished road
Re: How to go about making tankDrive and ArcadeDrive methods

Quote:
Originally Posted by lineskier View Post
Actually you can do mecanum without trig. Just like the arcade drive is figuring out how to sum up the motor in the right way based on the joystick input. It certainly isn't an overly efficient mecanum drive as scaling is an issue, but you can get the idea of it. I think its actually a good problem solving task to do the mecanum without trig .

Actually doing an encoder based mecanum drive could be done without trig too. Its only when you start going field centric that you really need trig.

Also the trig isn't too bad either, you could find it online. Just treat the left joystick as a circle and find the angle and distance from center based on the 2 values.

x^2 + y^2 = magnitude^2

angle = arctan(y/x)

soh cah toa
sin = opposite over hypotenuse
cos = adjacent over hypotenuse
tan = opposite over adjacent

cos(angle)*mag = y mag
sin(angle)*mag = x mag

give all 4 motor the y mag

top right back left y mag + x mag
top left back right y mag - x mag
i may have the side flipped not sure

programming a mec via trig is a lot easier than doing it without it, that why i suggest you try doing it by taking all joystick values / 2 and setting the motors via that. its def possible. for scaling reasons i'd leave out rotation at first.

if your feeling really ambitious let a gyro set the rotation value and you just set the x and y.
Lol Ill save mecanum for later on though, so ya i kinda got the logic behind tank, what about arcade?
__________________
Reply With Quote