Go to Post So remember, we may be envious of teams who can do water jet cutting and has every possible monetary and engineering advantage, but there are many more people who are envious of every team who has a chance to compete. - Rombus [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 24-11-2008, 14:34
Burmeister #279's Avatar
Burmeister #279 Burmeister #279 is offline
What Time Is It?
AKA: Nick Burmeister
FRC #0279 (TechFusion)
Team Role: Programmer
 
Join Date: Nov 2008
Rookie Year: 2007
Location: Toledo
Posts: 207
Burmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of lightBurmeister #279 is a glorious beacon of light
Send a message via AIM to Burmeister #279
Question about Mecanum code

I was looking at a few sets of mecanum code and was wondering about a few things.
Whats the best way to make sure there is no under/overflow in the code?
Is it necessary to have the wheels perfectly square?
i found some code that uses the distance to the XY center point of the axels to the center of the bot in the code, and that tells me that its only to tell where the axis of rotation is for Z.

Thanks for the help.

~Burmeister
__________________
WHAT TIME IS IT? TWO SEVEN NINE!!! [Team B =) ] Awards: 4 Safety, 2 Ind. Design, 2 Xerox, 1 Nat. Champs
2009 Buckeye Semi-Finalists (1014 & 695) || 2008 GLR Safety Award || 2006 GLR Safety Award
2005 Buckeye Regional Champs (67 & 274) & GM Industrial Design Award & Safety Award GLR Quarter Finalist & Xerox Creativity Award & Safety Award National Xerox Creativity Award & Curie Quarter Finalist (1126 & 180)
2004 Buckeye Delphi Driving Tomorrows Technology Award & Quarter Finalist GLR Champs Nationals Curie Division Finalist
2003 GLR GM Industrial Design Award || 2001 National Newton Division Winner & National Champions
2000 MI DaimlerChrysler Team Spirit Award
  #2   Spotlight this post!  
Unread 24-11-2008, 16:10
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: Question about Mecanum code

Most of the time the precise positioning of the wheels isn't needed, but they should be reasonably close. In general if normal wheels would work then so will Mecanums.

To prevent overflow issues you can use a larger data type to store the intermediate calculation. For example if your inputs and outputs are in the range of -100 to 100, then if your variable can handle values from -300 to 300 you shouldn't experience any overflows, and since the next step up from a char is a 16 bit integer, which holds -32768 to 32767, then you won't experience any overflows unless you input data is incorrect.

You should also confirm that the output values are in an acceptable range.

As for exact code most of the time something like this is all you need to get a reasonable output. You can add additional logic, like a PID loop for encoders, but its not needed for a simple robot.

This code is from memory, but it should be correct.

Code:
//This is just some generic C-like syntax, but you should be able to
// use it for the old robot or the new controller assuming you use C/C++.
// If you use Labview you'll need to port the logic into that language.
/*
Wheel names:
Front of robot
NW     NE
/-------\
|       |
|       |
|       |
|       |
\-------/
SW     SE
*/

int NW, NE, SW, SE; //Variables which will hold the calculated values
int X, Y, Z; //X sideways movement, Y forward movement, Z rotation
NW = Y + X + Z;
NE = Y - X - Z;
SW = Y - X + Z;
SE = Y + X - Z;

//Check output are in a valid range here

//You can check the outputs are in range with somthing like this
//Assuming your output range is -100 to 100
if (NW < -100)
{
     NW = -100;
}
else if(NW > 100)
{
     NW = 100;
}
//Assign outputs to motors or motor control loop here
__________________
Eric Haskins KC9JVH

Last edited by EHaskins : 24-11-2008 at 16:13.
Closed Thread


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
Question about Solenoid and default code waialua359 Control System 4 21-01-2006 18:21
question about the code naor52 Programming 1 10-01-2006 16:42
Question about kevin's code ImmortalAres Programming 3 23-06-2005 11:13
One last question about our code dddriveman Programming 5 22-03-2004 09:49
Rookie Programmer has question about the default code DanL Programming 3 26-01-2002 19:59


All times are GMT -5. The time now is 19:31.

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