|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
||||
|
||||
|
Re: Thanks for all your help...and a question
Quote:
although reducing speed with a button is a nice idea. i might try that out. |
|
#17
|
||||
|
||||
|
Re: Thanks for all your help...and a question
just make sure to test the code with the robot up on blocks or something. just to make sure it wont do any damage
...forest |
|
#18
|
|||
|
|||
|
Re: Thanks for all your help...and a question
Another way to do it would be to make a few lookup tables. We set up custom curves, so we had a large area that was slow for fine adjustments, and an area of full speed. This also makes so no calculations are needed on the fly, you just load them into the ram.
You would toss something like this (what we used) under the #include's in user_routines.c Code:
rom unsigned short int Joystick_Array[] = {0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,61,62,63,63,64,65,66,67,68,69,69,70,71,72,73,74,75,75,
76,77,78,79,80,81,81,82,83,84,85,86,87,87,88,89,90,90,91,91,92,92,93,93,94,94,94,95,95,96,96,97,97,98,98,99,99,99,100,100,101,101,102,102,103,
103,103,104,104,105,105,106,106,107,107,107,108,108,109,109,110,110,111,111,111,112,112,113,113,114,114,115,115,116,116,116,117,117,118,
118,119,119,120,120,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,135,135,136,136,136,136,137,137,137,138,
138,138,139,139,139,139,140,140,140,141,141,141,141,142,142,142,143,143,143,144,144,144,144,145,145,145,146,146,146,146,147,147,147,148,
148,148,149,149,149,149,150,150,150,151,151,151,151,152,152,152,153,153,153,154,154,154,154,155,155,156,157,158,158,159,160,161,162,163,
164,164,165,166,167,168,169,170,170,171,172,173,174,175,176,176,177,178,179,180,181,182,182,183,184,185,190,194,199,204,208,213,218,222,
227,232,236,241,246,250,255,};
Code:
Left_Drive = Joystick_Array[p1_y]; Right_Drive = Joystick_Array[p3_y]; That makes so the variable "Left_Drive" and "Right_Drive" are modified pwm values, but not assigned to the pwm yet. To go with one joystick: Code:
if (p1_sw_trig == 0)
{
pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);
pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);
}
else
{
pwm13 = pwm14 = Limit_Mix(2000 + Joystick_Array[p1_y] + Joystick_Array[p1_x] - 127);
pwm15 = pwm16 = Limit_Mix(2000 + Joystick_Array[p1_y] - Joystick_Array[p1_x + 127);
}
|
|
#19
|
||||
|
||||
|
Re: Thanks for all your help...and a question
(This is in regard to the post above mine, which I will not quote, for space considerations)
We do essentially the same thing, the only differences are, we use a slightly different equation, and our lookup table uses unsigned chars instead of short ints (although, in theory both should work, unsigned chars just take up less space). However, instead of just using ours for only our drive system, ours is used for every single joystick controlled movement on our robot. We have found that this greatly increases usability and driveability of our robot and its mechaisms by allowing fine control when necessary (like positioning the wrist for a ringer) and fast control when you need the speed (like driving across the field to a ringer). I would highly recommend at least trying exponential lookup tables, you may be amazed by the improvement such a small change can make. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Thanks J&J :O (And of course, all sponsors) | JC-75 | Thanks and/or Congrats | 0 | 05-04-2006 12:32 |
| Thanks for the help and parts, 340! | Joe Ross | Thanks and/or Congrats | 1 | 22-02-2004 00:09 |
| 'So Long, and Thanks for All the Fish' | Ashley Weed | Math and Science | 4 | 07-06-2003 13:43 |
| Thanks for the fun all... | archiver | 2001 | 0 | 24-06-2002 03:23 |
| Thanks for all your help! | archiver | 2000 | 0 | 23-06-2002 22:01 |