Go to Post No robot left behind! - M. Mellott [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 19-03-2007, 12:59
Adam Schuman's Avatar
Adam Schuman Adam Schuman is offline
Schubox
AKA: Schubox
FRC #0357 (Royal Assault)
Team Role: Engineer
 
Join Date: Feb 2007
Rookie Year: 2000
Location: Swarthmore, PA
Posts: 1
Adam Schuman is an unknown quantity at this point
Code For Mecanum Wheels

I thought it was about time that Team 357 posted some of their control mixing code for Jester Drive. So here goes...

void JesterDrive(signed int JOYX, signed int JOYY, signed int JOYZ)
{
char reduction_factor = 3;
if (JOYX == 0)
{
reduction_factor--;
}
if (JOYY == 0)
{
reduction_factor--;
}
if (JOYZ == 0)
{
reduction_factor--;
}
else
{
reduction_factor = 3;
}
if(reduction_factor == 0)
{
LF = 0;
LR = 0;
RF = 0;
RR = 0;
return;
}
else
{
LF_X = JOYX /reduction_factor;
LF_Y = JOYY /reduction_factor;
LF_Z = JOYZ /reduction_factor;
}

RR_X = LF_X;
RF_X = -LF_X;
LR_X = -LF_X;

LR_Y = RF_Y = RR_Y = LF_Y;

RR_Z = -LF_Z;
RF_Z = -LF_Z;
LR_Z = LF_Z;

LF = (LF_X + LF_Y + LF_Z);
LR = (LR_X + LR_Y + LR_Z);
RF = (RF_X + RF_Y + RF_Z);
RR = (RR_X + RR_Y + RR_Z);
}


And thats about it! In order for this code to work there are several things that still need to be done...

1) Check and verify that there is no under or over flow. This means that the values for LF, LR, RF, RR must be in the range of -127 to +127.

2) Be very careful with the signed vs. unsigned numbers. Data from the OI
is unsigned data with a 127 center value and must be converted with a simple algorithm to signed data with a 0 center value.
ie. JOYX = p2_x - 127;

3) Same as number two but backwards. Data from this JesterDrive function needs to be converted back into appropriate values for output to the victors.
ie. pwm01 = LF + 127;

4) Don't forget joystick deadbands.... They help.

Also, there are some nifty simple filters to protect the motors and gearboxes but this post is too long already. I'll post it if someone asks. Team 357 Royal Assault uses the chicklet and a 3 axis joystick FYI. And if you haven't figured it out already the JesterDrive function yields complete holonomic drive capabilities.

GOOD LUCK to all... Feel free to use the code just make sure whenever borrowing any body's code to give credit where credit is due.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mecanum wheels akash155 General Forum 12 20-02-2007 22:15
Friction coefficients for Omni wheels and Mecanum wheels from AndyMark Andy Baker Technical Discussion 11 16-12-2006 19:40
Looking for Mecanum Wheels Armando Gonzalez General Forum 30 24-05-2006 12:54
Mecanum Wheels chaolin2007 Control System 1 25-02-2006 19:16
Mixing Joystick Values for mecanum wheels Leav Programming 10 15-01-2006 14:51


All times are GMT -5. The time now is 23:48.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi