Go to Post FIRST has given me too much for me to leave without leaving a mark... - Joe G. [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

 
View Poll Results: How are you changing the default drive equations?
Not changing them, just using the regular 2-joystick tank drive 7 14.58%
Just switching to the single-joystick default drive equations 7 14.58%
Making joysticks be more sensitive around 127 and less so farther out 4 8.33%
Making joysticks be less sensitive around 127 and more so farther out 10 20.83%
Having a switch that when flipped makes joysticks more/less sensitive 2 4.17%
Using a tank drive, but none of the above 7 14.58%
Using some sort of parabolic drive equation 5 10.42%
Using some sort of exponential drive equation 4 8.33%
Totally changing drive equations: using an omni/ball/holonomic drive 9 18.75%
My team doesn't plan to have a moving robot this year. 1 2.08%
My robot's a hovercraft! 10 20.83%
Multiple Choice Poll. Voters: 48. You may not vote on this poll

Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-02-2006, 14:37
CronosPrime1 CronosPrime1 is offline
Registered User
FRC #0321
 
Join Date: Jan 2006
Location: Hyperspace
Posts: 53
CronosPrime1 is an unknown quantity at this point
Drive Equations

How many of you are remapping your drive equations from what they are in the default code? If so, how?
An example of a remapping would be to make the joystick less sensitive around 127 and more sensitive farther out. This can enhance control.
__________________
  #2   Spotlight this post!  
Unread 11-02-2006, 15:53
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,082
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Drive Equations

We simply broke the joystick transfer function into two piecewise functions - one for the first 50% of joystick movement, and one for the other half. The first half is less sensistive, allowing finer control, while the second is more sensitive, letting you throw the robot into full speed quickly.
  #3   Spotlight this post!  
Unread 11-02-2006, 16:44
X-Istence X-Istence is offline
Melt the RC controller!
AKA: Bert JW Regeer
no team
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Montville
Posts: 151
X-Istence will become famous soon enoughX-Istence will become famous soon enough
Send a message via AIM to X-Istence Send a message via MSN to X-Istence
Re: Drive Equations

Parobolic, with the two parts cut out, using a lookuptable created with a small C program, so that we don't have to do any sin calculating on the CPU.
__________________
My Blog!
  #4   Spotlight this post!  
Unread 11-02-2006, 17:02
Idaman323 Idaman323 is offline
In Theory, Our Robot Would Own.
FRC #1706
Team Role: Driver
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Wentzville, MO
Posts: 116
Idaman323 is an unknown quantity at this point
Re: Drive Equations

How would you go about making that table? Becase I would like to do something like this with our robot.
__________________
TEAM 1706
2007 Judges Award, St. Louis (For our amazing ability to have bad luck)
2005 Rookie Inspiration Award, St. Louis
  #5   Spotlight this post!  
Unread 11-02-2006, 22:03
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,082
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Drive Equations

rom unsigned char joystick_transfer[254] = {0, 1, 2...254};

...

pwm01 = joystick_transfer[p1_y];
  #6   Spotlight this post!  
Unread 11-02-2006, 22:28
CronosPrime1 CronosPrime1 is offline
Registered User
FRC #0321
 
Join Date: Jan 2006
Location: Hyperspace
Posts: 53
CronosPrime1 is an unknown quantity at this point
Re: Drive Equations

For example, my smoothed out motor curve looks as shown in the image at the bottom of this post.

If you're wondering what equation I used: it is as follows, in Java syntax (in the C code, I just have a lookup table):

(i is the joystick input)

pwm_output [i] = 127-42.5*(Math.pow (1.010889286,-i+127)-1)+Heaviside (i-127)*42.5*(Math.pow (1.010889286,-i+127)-1)+Heaviside (i-127)*42.5*(Math.pow (1.010889286,i-127)-1);

Heaviside (i) is just a fancy term. By definition,

Heaviside (i) = 0 if i < 0
Heaviside (i) = 1 if i >= 0.

Thus, Heaviside (i-127) is 1 if i >= 127 and 0 otherwise.

It allows me to write the whole function in one equation. So really, this is two exponential functions stuck together.

If you want the syntax for the table,

Code:
rom const int drive_lookup[]= {0, 0, 0, 0, 0, 5, 10, 13, 15, 16,
18, 20, 21, 23, 24, 26, 28, 29, 31, 32, 34, 35, 36, 38, 39, 41,
42, 43, 45, 46, 47, 49, 50, 51, 53, 54, 55, 56, 58, 59, 60, 61,
62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 93,
94, 94, 95, 96, 97, 98, 98, 99, 100, 101, 101, 102, 103, 103, 104,
105, 106, 106, 107, 108, 108, 109, 110, 110, 111, 111, 112, 113,
113, 114, 114, 115, 116, 116, 117, 117, 118, 118, 119, 120, 120,
121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127,
127, 127, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133,
133, 134, 135, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140,
141, 142, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 149,
150, 150, 151, 152, 152, 153, 154, 155, 155, 156, 157, 158, 159,
159, 160, 161, 162, 163, 164, 165, 165, 166, 167, 168, 169, 170,
171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
184, 185, 186, 187, 188, 190, 191, 192, 193, 194, 195, 197, 198,
199, 200, 202, 203, 204, 206, 207, 208, 210, 211, 212, 214, 215,
217, 218, 219, 221, 222, 224, 225, 227, 229, 230, 232, 233, 235,
237, 238, 240, 245, 250, 254, 254, 254, 254, 254, 254};
You can plug this right into your program and just say:
Code:
pwm01 = drive_lookup [p1_y];
to map your pwm01 to your p1_y using my curve.

At the endpoints, I chose to replace several of the last terms with an endvalue. Notice how there are several 254 terms at the end and several zeros in the beginning.
Attached Thumbnails
Click image for larger version

Name:	image002.gif
Views:	55
Size:	4.4 KB
ID:	3970  
__________________

Last edited by CronosPrime1 : 11-02-2006 at 22:34.
  #7   Spotlight this post!  
Unread 14-02-2006, 16:27
iamthetallpaul iamthetallpaul is offline
Registered User
FRC #1189
 
Join Date: Jan 2006
Location: Grosse Pointe
Posts: 13
iamthetallpaul is on a distinguished road
Re: Drive Equations

Quote:
Originally Posted by CronosPrime1

If you want the syntax for the table,

Code:
rom const int drive_lookup[]= {0, 0, 0, 0, 0, 5, 10, 13, 15, 16,
18, 20, 21, 23, 24, 26, 28, 29, 31, 32, 34, 35, 36, 38, 39, 41,
42, 43, 45, 46, 47, 49, 50, 51, 53, 54, 55, 56, 58, 59, 60, 61,
62, 63, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 88, 89, 90, 91, 92, 93,
94, 94, 95, 96, 97, 98, 98, 99, 100, 101, 101, 102, 103, 103, 104,
105, 106, 106, 107, 108, 108, 109, 110, 110, 111, 111, 112, 113,
113, 114, 114, 115, 116, 116, 117, 117, 118, 118, 119, 120, 120,
121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127,
127, 127, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133,
133, 134, 135, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140,
141, 142, 142, 143, 143, 144, 145, 145, 146, 147, 147, 148, 149,
150, 150, 151, 152, 152, 153, 154, 155, 155, 156, 157, 158, 159,
159, 160, 161, 162, 163, 164, 165, 165, 166, 167, 168, 169, 170,
171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
184, 185, 186, 187, 188, 190, 191, 192, 193, 194, 195, 197, 198,
199, 200, 202, 203, 204, 206, 207, 208, 210, 211, 212, 214, 215,
217, 218, 219, 221, 222, 224, 225, 227, 229, 230, 232, 233, 235,
237, 238, 240, 245, 250, 254, 254, 254, 254, 254, 254};
You can plug this right into your program and just say:
Code:
pwm01 = drive_lookup [p1_y];
to map your pwm01 to your p1_y using my curve.

At the endpoints, I chose to replace several of the last terms with an endvalue. Notice how there are several 254 terms at the end and several zeros in the beginning.

Thanks for the table version, but where exactly do you put this in the program? I've tried copying your code into DefaultRoutine() as well as Process_Data_From_Master_uP(), both result in errors. I searched the forums and found a lot of threads about making lookup tables but none about where to acutally put the code.
  #8   Spotlight this post!  
Unread 14-02-2006, 16:30
aaeamdar's Avatar
aaeamdar aaeamdar is offline
Post-A-Holic
AKA: Paul Dennis
FRC #1719 (The Umbrella Corp)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Baltimore, MD
Posts: 231
aaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant future
Re: Drive Equations

Quote:
Originally Posted by Abwehr
rom unsigned char joystick_transfer[254] = {0, 1, 2...254};

...

pwm01 = joystick_transfer[p1_y];

We have something a lot like this. However, we have only one side of it, and just do 254 - lookTable[value].

Interesting question.

Hovercraft FTW! =)

Paul Dennis
  #9   Spotlight this post!  
Unread 15-02-2006, 16:31
slade24 slade24 is offline
AKA: Slick Daddy Ellis
AKA: Aaron Schultz
FRC #1370 (Blue Charge)
 
Join Date: Feb 2006
Rookie Year: 2004
Location: Middletown, DE
Posts: 6
slade24 is on a distinguished road
Re: Drive Equations

Though we haven't decided yet which one we want to use on our robot, we have three possible equations for throttling/sensitivity. (This is on a tank-drive system)

First I include this code:
if (Joystick >= 255)
Joystick = 254;
if (Throttle >= 255)
Throttle = 254;

Then I use one of these three equations (these are the pseudocode versions):
1) pwm = ((Joystick - 127) * (Throttle) / 254) + 127

2) pwm = ((Joystick-127)^3 / 16129) + 127

3) pwm = (cuberoot{Joystick-127} * 16129) + 127


In the first one, a joystick with a throttle on it (like the CH Flightstick Pro I have) can be used to adjust the maximum speed in both directions. When the throttle is at zero, the robot can't move, and when it is at full, the joysticks act normally. At a throttle of 127 (halfway), the joystick can go from 63.5 to 190.5. Besides simply reducing the maximum speeds, this approach also decreases sensitivity when the speed it lower (in other words, you can move more precisely). NOTE: the one throttle controls speed for both tank-drive joysticks.

In the second formula, the equation forms an exponential graph that gets sharper as it moves away from 127. This equation means that the robot will move slowly at first, but gain speed faster and faster.

In the third formula, for which I still have to figure out the coding, the graph is the inverse of that in #2. Speed gains very quickly at first, then more and more slowly.

NOTE: each of these formulas, when in the code, will be included inside a Limit_Mix call in order to prevent exceeding the 0-254 range.
__________________
-- Time is my only enemy --

Middletown Robotics: Home
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
Drive() Not a Standard Toolset in EasyC? Chris_Elston Programming 3 08-02-2006 09:01
If you could change one thing.... Koko Ed General Forum 48 31-03-2005 19:23
Drive Straight C Code using Encoders without PID? Chris_Elston Programming 17 15-02-2005 23:41
What is wrong with this code???? It won't Compile and I don't know why? Please Help CrashZero Programming 23 26-03-2004 09:44
"Motors and Drive train edition" of Fresh From the Forum Ken Leung CD Forum Support 6 29-01-2002 12:32


All times are GMT -5. The time now is 02:13.

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