View Single Post
  #4   Spotlight this post!  
Unread 26-02-2008, 19:25
BigJ BigJ is offline
Registered User
AKA: Josh P.
FRC #1675 (Ultimate Protection Squad)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Milwaukee, WI
Posts: 947
BigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond repute
Re: Mecanum Programming Help

1675's mecanum code this year may be able to perform what you describe...
(I admit i have not seen almost any of the driver practice, as I was sick for the last couple days of build ) but it may come out as more of an forward arc. I'm not sure.

What our algorithm does is get velocity and angle from one stick, and rotation from another, then calculates the PWM value of each individual motor taking those 3 variables into account. You can see our algorithm here:

http://team1675.org/forum/viewtopic.php?p=1352#1352

Most of the calculations are not shown (ex: getting the velocity and angle, scaling the rotation value), but the key lines are

Code:
MotorOutput = (((WORD)mySin( Heading ) * (WORD)Speed) >> 8) + ((256 - Speed) >> 1);
   
   MotorOutput += Rotation;
This is called for each motor. It first sets the value of each motor based on velocity and angle, then adds/subtracts the rotation value from each wheel.

This should create a spinning effect, but while moving forward, as I said, I am not sure, it may come out as an arc.

Last edited by BigJ : 26-02-2008 at 19:28.