View Single Post
  #30   Spotlight this post!  
Unread 20-05-2011, 20:13
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: How to go about making tankDrive and ArcadeDrive methods

Quote:
Originally Posted by lineskier View Post
The way you solve the grid seems to be a case statement
No, its not a case statement. It's simply this:

L = Y+X
R = Y-X

I can't imagine anything simpler. It works for all 4 quadrants. No case statement is necessary.


Quote:
Personally I would rather have one equation that gets the value based on heading and magnitude.
If that's your personal choice I cannot argue. But what "one equation" are you referring to? To get heading and magnitude, you need two equations right there. Then you have to calculate the wheel speeds from those.


Quote:
But i guess we approach the joystick from 2 different views: a square vs a circle. I believe both approaches to be correct.
I also believe both approaches are correct.


Quote:
approaching it as a square requires normalization where as approaching it as a circle does not
If your X,Y values are (1,1) then your magnitude calculation will give 1.4 and you will need to clip or normalize... unless you aren't using the magnitude but converting it back to X and Y values... in which case I'm puzzled why you converted them to polar in the first place.

Would you be willing to post your code ? I'd like to understand better what you are saying.



Reply With Quote