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.
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.
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.
Sweet! Thanks!
No Problem