Thread: 2014 Game
View Single Post
  #459   Spotlight this post!  
Unread 11-12-2013, 13:30
Christopher149 Christopher149 is offline
Registered User
FRC #0857 (Superior Roboworks) FTC 10723 (SnowBots)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2007
Location: Houghton, MI
Posts: 1,100
Christopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond repute
Re: 2014 Game

With mecanum, if you have a 3-axis joy stick, there's like a whole ~16 lines of code to write.

Something like (in pseudocode):

Spoiler for Spoliered the code in case you want to learn it, and not be told the answers:

Code:
motor arrangement:
A------D
|      |
|      |
|      |
B------C

Joystick axes
  Y
  |
  +--X
 /
T
Code:
double y = joy.y;
double x = joy.x;
double t = joy.t;

double a = x + y + t;
double b = -x + y + t;
double c = -x + -y + t;
double d = x + -y + t;

double factor = max(a,b,c,d);

if (factor > 1){
  a /= factor;
  b /= factor;
  c /= factor;
  d /= factor;
}

motorA.set(a);
motorB.set(c);
motorC.set(b);
motorD.set(d);
Note: I make no warranty that this is entirely correct, or that the signs are actually correct. It's more the pattern of the signs that matters. This is what 857 has used last two times we've done mecanum.
Reply With Quote