Go to Post Magic doesn't count as a support, sorry. Neither does simply constraining in CAD... - EricH [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 20-03-2007, 19:52
Mr. Freeman Mr. Freeman is offline
Put better title here.
AKA: Kellan
no team (CSM Robotics)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Colorado
Posts: 198
Mr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to behold
Mecanum drivetrain programming problems

My team recently purchased a set of andymark mecanum wheels for off season testing use. We haven't managed to build a chassis for them yet, but I want to get started on the programming so we have something to work with when we have the chassis built. I've been searching these forums for a few weeks now and I'm pretty sure I've read everything ever posted about mecanum wheels....twice. I've found a lot of code snippets but no explanation of the algorithms behind them.

Anyway, I've come up with this so far: http://img83.imageshack.us/img83/4896/mecanumqx7.jpg

I'm working under the assumption that each wheel will move at a 45 degree angle when powered. Thus, each wheel will attempt to move in the directions indicated by the green arrows. The green arrows show the movement of the wheels when the back two are turned backwards and the front two are turned forwards. They are then combined into the vectors shown by the blue arrows. Because the blue arrows are at 90 degrees from each other, you can orient them on the grid shown by the red lines.

I came up with the following equations, where x is the movement of the left front and back right wheels, and y is the movement of the right front and back left wheels:
y = sin(theta-45)*(magnitude of R)
x = cos(theta-45)*(magnitude of R)

R and theta being the vector indicated by the joystick you're using to control the drivetrain.

This should return a value between -1 and +1 that should correspond to a PWM value between 0 and 255. If this function returns 0, the PWM value should be 127, if it returns 1 the PWM value should be 255, etc.

I ran a couple of values through this function and found the following problem. If I want the robot to go straight, theta is 90 and magnitude of R is 1.
Thus,
y = sin(90-45)*(1) = .707
x = cos(90-45)*(1) = .707
The PWM value for this should be:
.707 * 127 = 90
90 + 127 = 217

The problem with this is that all four wheels will move at the same speed (and therefore in the correct direction) but not at full power. I'm assuming that when the magnitude of R is 1, it indicates full speed, I think my problem lies here but I can't be sure. Any help would be much appreciated.
__________________
"Time is an illusion, lunchtime doubly so."
-Douglas Adams
“Why is it that I can walk into Wal-Mart and buy boxes of bullets and black powder, but I can’t buy potassium perchlorate to do science because it can also be used to make explosives?”
-Theodore Gray
 


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 problems Ian_Xodus General Forum 8 01-02-2007 08:31
mecanum programming mrmummert Programming 27 28-01-2007 13:45
Problems with Programming DHarris Programming 4 16-02-2006 13:08
Problems programming a switch caderader Programming 2 18-02-2005 22:06
Programming Sub-Team Problems Phil Paspalas Programming 9 19-01-2005 21:42


All times are GMT -5. The time now is 11:03.

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