|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Scaling Values in the Control Program
Posted by Dung Cao.
Engineer on team #397 from Flint Southwestern Academy and Delphi Automotive - E&C. Posted on 3/16/2000 9:46 AM MST In Reply to: Scaling Values in the Control Program posted by Nate Smith on 3/15/2000 10:06 AM MST: Here are some formulas that I've been using to scale down the speed of the pwm. These should help you. I also have an excel spreadsheet with graphics to show the speed control. It really helps out to figure these scaling. If you need this spreadsheet, just email me at Dung.Cao@delphiauto.com Speed limit algorithm 100% speed >>>>>> pwm = p_y 75% >>>>>> pwm = 31.75 + ((3/4) * p_y) 50% >>>>>> pwm = 63.50 + (p_y / 2) 33% >>>>>> pwm = 84.66 + (p_y / 3) 25% >>>>>> pwm = 95.25 + (p_y / 4) Also here is the one-joystick control for x-y control. '================== DRIVE for joytick 2 ==================================== ' ' This section modified the output of PWM1, and PWM 2 for control from one ' joystick (Port 2). ' Basic Stamp does not recognize negative numbers. Therefore, have to add 2000 ' to algorithm, then delete 2000 for the result ' p2_y = Y-axis controls speed. ' p2_x = X-axis turns. ' pwm1 - Left motor. ' pwm2 - Right motor. '----------------------------------------------------------------------------- If p2_sw_trig 1 then notturbo: pwm1 = (((2000 + p2_y - p2_x + 127) Min 2000 Max 2254) - 2000) pwm2 = (((2000 + p2_y + p2_x - 127) Min 2000 Max 2254) - 2000) Goto NoChange: notturbo: If p2_sw_top 1 then regularspeed: pwm1 = ((2000 + (p2_y/4) - (p2_x/4) + 127) Min 2095 Max 2159) - 2000 pwm2 = ((2000 + (p2_y/4) + (p2_x/4) + 63) Min 2095 Max 2159) - 2000 Goto NoChange: regularspeed: pwm1 = ((2000 + (p2_y/2) - (p2_x/2) + 127) Min 2064 Max 2190) - 2000 pwm2 = ((2000 + (p2_y/2) + (p2_x/2)) Min 2064 Max 2190) - 2000 : Does anybody out there have a foolproof way to scale down values in the control program? Whenever i try it, using different scaling constants for forward and reverse(scaling joystick inputs), I always seem to lose part of the range completely. Help! : Nate |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Battlebots I.Q.- A serious threat to FIRST or a half thought up cheep copy? | Joe Matt | General Forum | 75 | 17-10-2005 20:43 |
| Fried program slots? | Jeff Waegelin | Programming | 18 | 19-03-2003 18:08 |
| Anyone looking for more program space? | archiver | 2001 | 13 | 24-06-2002 02:20 |
| robot control emulator for default or other program | CharlieWilken | Programming | 26 | 24-02-2002 02:36 |
| control program looping??? | ctartist236 | Programming | 1 | 08-02-2002 10:09 |