View Single Post
  Spotlight this post!  
Unread 18-05-2011, 17:48
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
Re: How to go about making tankDrive and ArcadeDrive methods

Quote:
Originally Posted by kinganu123 View Post
I am driving via joystick but I dont have the robot or a driver station on my personal laptop to actually test it so thats kind of a problem, and ya my assignment is to pretty much make the drive class with those methods and when I know trig i gotta add mecanum to it, but thats next year.
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.
__________________
"Never let your schooling interfere with your education" -Mark Twain

Last edited by mwtidd : 18-05-2011 at 17:55.
Reply With Quote