View Single Post
  #13   Spotlight this post!  
Unread 23-06-2002, 22:23
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
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


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.