Go to Post Pessimism and optimism are both contagious. - Taylor [more]
Home
Go Back   Chief Delphi > Old Forum Archives > 2000
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
  #12   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 Mike Gray.

Engineer on team HOT from Huron Valley Schools sponsored by GM Milford Proving Ground.

Posted on 3/15/2000 11:08 AM MST


In Reply to: Scaling Values in the Control Program posted by Nate Smith on 3/15/2000 10:06 AM MST:



Nate:

Not sure exactly what you're after, so I'll discuss three methods:

1. If you want to scale the joystick variable linearly, use slope and intercept.

Example:

p1_y=p1_y / 2 + 64

This example assumes that you want to scale the variable to half-scale. You must add
64 counts so that 127 counts still represents center-stick. If you want 1/4 speed, simply
divide by 4 and add 96.

2. If you want to reduce the authority in one direction only, use the branch statement, and write a routine that scales the joystick variable (as above) only when the raw variable is in a particular range.

3. If you just want to limit the reverse speed, simply clamp the joystick variable at some minimum or maximum value.

Example:

p1_y=p1_y min 50

This example assumes that zero counts is full reverse (depends upon motor polarity). Experiment with the minimum value. Use the MAX function if 255 counts is full reverse.

Example:

p1_y=p1_y max 200

You can combine these two techniques, scaling and clamping in the same line of code:

Example:

p1_y=p1_y / 2 + 64 min 32 max 160

If you are using a single joystick to control both traction motors, you will find it VERY beneficial to leave the y-axis alone, but scale the x-axis. You then have full authority fore-and-aft, but reduced authority when turning. Much more controllable.

When scaling, remember: power=I squared R. Its always best to optimize the mechanical features so that you make use of all the motor's potential (times a safety factor) before making software tweaks.

Non-linear scaling is much more complex, and not recommended unless you have a rotating member working against gravity. If that is the case, take a look at SIN and COS functions. Hope some of this helps!

Mike Gray

: 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.
 


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 Off
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 18:59.

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