Go to Post if it's likely to break, it probably will - DonRotolo [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-02-2011, 15:31
DSST\neal.ian DSST\neal.ian is offline
AAHHH!! WHERE'D ALL THE TIME GO?!?!
AKA: Ian Neal
FRC #2240 (Brute Force)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Thornton, CO
Posts: 30
DSST\neal.ian has a spectacular aura aboutDSST\neal.ian has a spectacular aura aboutDSST\neal.ian has a spectacular aura about
Send a message via AIM to DSST\neal.ian Send a message via MSN to DSST\neal.ian Send a message via Yahoo to DSST\neal.ian
Question Manipulating throttle output (function)

This isn't a question on how to program or anything, but more of a mathematical question (I put it here because I figured this was more oten visited). My question is this: what is a function/equation I can use to change what the lower bound on the throttle is? I know that it gives outputs from -1 to 1 and to use it I need to negate the value that comes out, since "up" is -1. I figured out a function to manipulate the throttle inputs to get values from 0 to 1, which was (Z+1)/2, of course multiplied times -1 to give the right values. Any thoughts, or questions? Did this make sense at all? Thanks.
__________________

-2010 Finalists! CO Regional 2010

2240 BRUTE FORCE!!!!!!!

Our site: http://robotics.scienceandtech.org
  #2   Spotlight this post!  
Unread 10-02-2011, 16:01
DSST\neal.ian DSST\neal.ian is offline
AAHHH!! WHERE'D ALL THE TIME GO?!?!
AKA: Ian Neal
FRC #2240 (Brute Force)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Thornton, CO
Posts: 30
DSST\neal.ian has a spectacular aura aboutDSST\neal.ian has a spectacular aura aboutDSST\neal.ian has a spectacular aura about
Send a message via AIM to DSST\neal.ian Send a message via MSN to DSST\neal.ian Send a message via Yahoo to DSST\neal.ian
Re: Manipulating throttle output (function)

To clarify, I want a function in terms of X, Z, an W, where X is the new lower bound, Z is the throttle's raw output (or inverted, it doesn't matter), and W is the new output from X to 1.
__________________

-2010 Finalists! CO Regional 2010

2240 BRUTE FORCE!!!!!!!

Our site: http://robotics.scienceandtech.org
  #3   Spotlight this post!  
Unread 10-02-2011, 16:23
Aaron V Aaron V is offline
Registered User
FRC #1325 (Inverse Paradox)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Ontario, Canada
Posts: 13
Aaron V is an unknown quantity at this point
Re: Manipulating throttle output (function)

So as I understand what you're asking: you basically want to scale the range of -1 to 1 to, say, X to 1.

You're totally right in your (Z + 1) / 2 as a start. (The general equation for values not between -1 and 1 is: (Z - oldMinimum) / (oldMaximum - oldMinimum) assuming Z is you value. If you want to know more about why this is, let me know, but I don't think this is your main question). Now what this does is it gives you a value between 0 and 1 (always). Let's call this value P.

Now that you have this, you want to convert it to a new minimum. To get the new equation, you can just rearrange the old one to get: (newMax - newMin) * P + newMin.

So you can combine these things to get a general equation:
(newMax - newMin) * (Z - oldMin) / (oldMax - oldMin) + newMin

Or, you can do them separately if you want.
  #4   Spotlight this post!  
Unread 10-02-2011, 17:31
DSST\neal.ian DSST\neal.ian is offline
AAHHH!! WHERE'D ALL THE TIME GO?!?!
AKA: Ian Neal
FRC #2240 (Brute Force)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Thornton, CO
Posts: 30
DSST\neal.ian has a spectacular aura aboutDSST\neal.ian has a spectacular aura aboutDSST\neal.ian has a spectacular aura about
Send a message via AIM to DSST\neal.ian Send a message via MSN to DSST\neal.ian Send a message via Yahoo to DSST\neal.ian
Re: Manipulating throttle output (function)

Sweet! Thanks!
__________________

-2010 Finalists! CO Regional 2010

2240 BRUTE FORCE!!!!!!!

Our site: http://robotics.scienceandtech.org
  #5   Spotlight this post!  
Unread 10-02-2011, 19:45
Aaron V Aaron V is offline
Registered User
FRC #1325 (Inverse Paradox)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Ontario, Canada
Posts: 13
Aaron V is an unknown quantity at this point
Re: Manipulating throttle output (function)

Quote:
Originally Posted by DSST\neal.ian View Post
Sweet! Thanks!
No Problem
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


All times are GMT -5. The time now is 23:35.

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