Home
Help
Calendar
Login
Register
New to this forum or RC hobby ? Start here : The RC India Gems !
Welcome Guest, please
login
or
register
.
Reputation
Add to Reputation:
What do you think of this post?
I agree
I disagree
Comment:
RC India
General Topics
RC General Topics
Topic:
Math behind Expos
Pages: [
1
]
Go Down
0 Members and 1 Guest are viewing this topic.
Topic Tools
Topic Tools
Print
«
on:
June 10, 2013, 06:29:31 PM »
girishsarwal
Plane Lover
Forum Hero
Reputation Power: 17
Offline
City: Gurgaon
State: Haryana
RC Skills: Beginner
Posts: 1420
Join Date: May, 2012
DIYer
Math behind Expos
Tweet
Gentlemen,
I am currently wiring up some code to redo Expos for this ->
http://www.rcindia.org/self-designed-diy-and-college-projects/flying-on-a-3d-joystick
The code I have right now is very kludgy and broken and fidgety. I have tried various expression till now. Also checked out the code for er9x, pretty convoluted.
I understand the basic idea of expos pretty well, just need to get my head around the formula.
I am little stumped at the moment by the maths that is involved for applying the exponential transformation/incorporating it while calculating the channel width. I'm hopeful with the kind of talent we have at RCI, from control theory and robotics and mathematics, I will get some advise from the seniors...
I know we have cent percent scorers amongst us
Any help is appreciated, discussions trigger further thoughts...
GS
Logged
gs
«
Reply #1 on:
June 10, 2013, 06:43:27 PM »
sanjayrai55
Plane Lover
Forum Hero
Reputation Power: 85
Offline
City: Gurgaon
State: Haryana
RC Skills: Intermediate
Posts: 8337
Join Date: Dec, 2011
Don't wake a Tiger until you've factored the teeth
Re: Math behind Expos
Draw an abcissa & an ordinate (X&Y axes) on a sheet of paper
draw a line at 45 deg from (0,0) This is y=x
Now, try y= ln x (logarithm to the base 'e')
See what you get. Try in Excel for say x = 1 to 10 in increment of 1
Plot in a graph. Instead of linear proportional, you will get a graph that will show less y for the same x value initially.
Sorry if it is not too clear an explanation, it's been about 35 years
Logged
Sanjay - Gravity is my enemy
http://www.rcindia.org/rc-people/builds-i-have-posted-on-rci/
«
Reply #2 on:
June 10, 2013, 07:04:11 PM »
rcpilotacro
Global Moderator
Forum Hero
Reputation Power: 58
Offline
City: Delhi
State: Delhi
RC Skills: Advanced
Posts: 5041
Join Date: Nov, 2010
Practice, and only Practice will make you perfect
Re: Math behind Expos
Since technically it is stepped output, discrete maths incl Combinatorics is easier approach in coding, incl for adding logic 'Choose' fn
Logged
Gusty's Hangar and Introduction
.
A Good pilot will practice until he gets it right,
A Great pilot will practice until he can’t get it wrong.
«
Reply #3 on:
June 10, 2013, 07:07:47 PM »
santhosh-r
Plane Lover
Forum Hero
Reputation Power: 7
Offline
City: coimbatore
State: Tamil Nadu
RC Skills: Intermediate
Posts: 596
Join Date: Dec, 2012
Re: Math behind Expos
I think you would have seen this...
http://www.helifreak.com/showthread.php?t=496729
I think I can help you out...
Logged
Spektrum DX6i | Phoenix V4 | CoroTrainer | Tamiya Baja king 2WD | RCTimer F450 Quadcopter
«
Reply #4 on:
June 10, 2013, 07:59:43 PM »
saikat
Plane Lover
Forum Hero
Reputation Power: 14
Offline
City: Tezpur
State: Tripura
RC Skills: Expert
Posts: 1130
Join Date: Jul, 2009
Re: Math behind Expos
Aha ! - something to separate the men from the boys -
Logged
https://t.me/pump_upp
«
Reply #5 on:
June 10, 2013, 09:08:03 PM »
girishsarwal
Plane Lover
Forum Hero
Reputation Power: 17
Offline
City: Gurgaon
State: Haryana
RC Skills: Beginner
Posts: 1420
Join Date: May, 2012
DIYer
Re: Math behind Expos
Many thanks everyone.
Sanjay sir, spot on. I started with y= ln(x) as the starting function. I must get deeper into the details. The natural log function was the easy part; putting in the coefficient (which will range from let us say 0-100, adjustable by the pilot, and will determine the tightness of the graph) is where the problem comes in. I cant multiply it directly as that will only cause the upper range to shift and the range parameters will have to be recalculated which I wish to avoid
. I am looking for having that coefficient as a part of the equation (preferably adjusting for negative values automagically in the equation). I will call you in a little while.
Gusty sir, I agree having a finite set of values and choosing will help easy out the programming, I was thinking if an equation works well, even if takes longer to identify, it is a long term knowledge investment
. Have a question for you in the last but one paragraph!
Santhosh sir, that link looks great as a starting point. I think i will closely read it up tonite. However, at the onset I do feel it is still linear as k * expo/100 will yield a linear multiplier. Using fooplot to do all the visualization and both ln(x) multiplied by a constant and the specified equation give close results but they don't look ideal
If we look at it graphically, I am looking at the expo graph being a straight line at 0 expo (y=x) and when increased in the positive side by the pilot, the curve should ideally be moved as if pinched from the exact center of the line and pulled to the southeast corner, thereby tighetning the graph. Gusty sir, do you think my understanding is correct in achieving an ideal expo graph.
Woah! I'm so tripped on this thing, I haven't done any useful work at office today...lol. I will now have to read up beizers maybe...And i still have another problem. I dont know if the ATmega will natural logs for me
Logged
gs
«
Reply #6 on:
June 10, 2013, 09:52:12 PM »
santhosh-r
Plane Lover
Forum Hero
Reputation Power: 7
Offline
City: coimbatore
State: Tamil Nadu
RC Skills: Intermediate
Posts: 596
Join Date: Dec, 2012
Re: Math behind Expos
You can use Microsoft mathematics to easily plot equations and visualize them..also easily adjust constant /coefficients..
Logged
Spektrum DX6i | Phoenix V4 | CoroTrainer | Tamiya Baja king 2WD | RCTimer F450 Quadcopter
«
Reply #7 on:
June 10, 2013, 10:00:46 PM »
girishsarwal
Plane Lover
Forum Hero
Reputation Power: 17
Offline
City: Gurgaon
State: Haryana
RC Skills: Beginner
Posts: 1420
Join Date: May, 2012
DIYer
Re: Math behind Expos
Hey thanks for the tip Santhosh sir. Didn't know about MS maths...gotta get hold of it now
Logged
gs
«
Reply #8 on:
June 10, 2013, 10:32:30 PM »
santhosh-r
Plane Lover
Forum Hero
Reputation Power: 7
Offline
City: coimbatore
State: Tamil Nadu
RC Skills: Intermediate
Posts: 596
Join Date: Dec, 2012
Re: Math behind Expos
Don't call me "santhosh sir"- just "santhosh"
Logged
Spektrum DX6i | Phoenix V4 | CoroTrainer | Tamiya Baja king 2WD | RCTimer F450 Quadcopter
«
Reply #9 on:
June 10, 2013, 11:36:20 PM »
rcpilotacro
Global Moderator
Forum Hero
Reputation Power: 58
Offline
City: Delhi
State: Delhi
RC Skills: Advanced
Posts: 5041
Join Date: Nov, 2010
Practice, and only Practice will make you perfect
Re: Math behind Expos
First question is why is expo needed ? well! in real aeroplane we have something called
Gain
, since control effectiveness increases as a function of the air speed, as the speed increases aeroplane becomes more sensitive and difficult to control. therefore the throw was adjusted continuously as a function of speed and altitude (Altitude because as you climbed density reduced and aeroplane became sluggish, therefore as you climbed more throw was needed ). In a model aeroplane DR is manually done, because there is no speed, altitude info adjusting throw automatically (Telemetry radio could technically do that though) expo makes, centre soft.
Having understood this what we need to see is
throw
, throw is finite, servo output is finite too, so it is essentially a DISCRETE math problem rather than CONTINUOUS math problem. essentially Factorials, Choose etc
Why DISCRETE ? faster, clean, predictable, finite, possibility of error is least, scalable ? definitely.
CONTINUOUS is preferred for, i think easy to comprehend and cool, though it really is for something changing against something, not for something choosing something where order does/doesn't matter.
Many codes i have come across are, sorry to say really belongs to quantum physics rather than aeromodelling.
Fact is it is
Easy to complicate
and difficult to simplify, Paradox ! but true.
As a challenge, just for fun, try DISCRETE approach, you will know what i mean.
Logged
Gusty's Hangar and Introduction
.
A Good pilot will practice until he gets it right,
A Great pilot will practice until he can’t get it wrong.
«
Reply #10 on:
June 11, 2013, 01:40:12 AM »
kakka_rao
Plane Lover
Senior Member
Reputation Power: 2
Offline
City: Nashik
State: Maharashtra
RC Skills: Beginner
Posts: 106
Join Date: Jul, 2011
Re: Math behind Expos
sir jee , I like your easy lang.
Logged
«
Reply #11 on:
June 11, 2013, 07:40:02 AM »
girishsarwal
Plane Lover
Forum Hero
Reputation Power: 17
Offline
City: Gurgaon
State: Haryana
RC Skills: Beginner
Posts: 1420
Join Date: May, 2012
DIYer
Re: Math behind Expos
Gusty sir,
I am convinced with what you say. It is indeed a discrete function, and the limits are so well established. And I so agree with "Fact is it is Easy to complicate and difficult to simplify, Paradox ! but true."
The closest I've been able to come with a continuous function for expo is a parabola. A modified version (x^2n) comes up well but also suffers from almost linear variance as it reaches its higher limits.
I now think a discrete 5/7/9 point curve with linear interpolation between the points should be enough for providing an expo. DR can be linearly factored in. In fact many radios do the same I believe. And once good curves are established, with your help, I can program them as presets based on an expo setting, so an expo of 20 would mean choose some curve from the presets. In theory it will take quite some memory on the chip, but that I have plenty
Out of curiosity, do you mean that in real airplanes, gain is auto adjusted (with perhaps a manual override) based on the conditions?
Quote
because there is no speed, altitude info adjusting throw automatically (Telemetry radio could technically do that though) expo makes
. This will be fun to do in a model airplane. although altitude changes might not be significant.
GS
Logged
gs
«
Reply #12 on:
June 11, 2013, 08:50:58 AM »
rcpilotacro
Global Moderator
Forum Hero
Reputation Power: 58
Offline
City: Delhi
State: Delhi
RC Skills: Advanced
Posts: 5041
Join Date: Nov, 2010
Practice, and only Practice will make you perfect
Re: Math behind Expos
Quote from: girishsarwal on June 11, 2013, 07:40:02 AM
Out of curiosity, do you mean that in real airplanes, gain is auto adjusted (with perhaps a manual override) based on the conditions?...
This will be fun to do in a model airplane. although altitude changes might not be significant.
GS
Yes Auto adjusted with a facility of manual override in older versions of aeroplanes and quadruplex redundancy in newer version of aeroplanes (With no manual override), so in a quad channel failure situation (possibility of which is 1 in 10
15
) quitting the sick aeroplane is the only choice
Altitude is Altitude
Above Mean Sea Level
, so models flying at Shillong are already at 7000 feet, therefore needs to be factored in, Air Speed however is IAS and not GPS Speed (Which is ground speed), so an IAS probe for making auto gain in a model aeroplane is an inescapable requirement
Logged
Gusty's Hangar and Introduction
.
A Good pilot will practice until he gets it right,
A Great pilot will practice until he can’t get it wrong.
«
Reply #13 on:
June 11, 2013, 08:56:40 AM »
santhosh-r
Plane Lover
Forum Hero
Reputation Power: 7
Offline
City: coimbatore
State: Tamil Nadu
RC Skills: Intermediate
Posts: 596
Join Date: Dec, 2012
Re: Math behind Expos
Quote from: rcpilotacro on June 11, 2013, 08:50:58 AM
Quote from: girishsarwal on June 11, 2013, 07:40:02 AM
Out of curiosity, do you mean that in real airplanes, gain is auto adjusted (with perhaps a manual override) based on the conditions?...
This will be fun to do in a model airplane. although altitude changes might not be significant.
GS
Yes Auto adjusted with a facility of manual override in older versions of aeroplanes and quadruplex redundancy in newer version of aeroplanes (With no manual override), so in a quad channel failure situation (possibility of which is 1 in 10
15
) quitting the sick aeroplane is the only choice
Altitude is Altitude
Above Mean Sea Level
, so models flying at Shillong are already at 7000 feet, therefore needs to be factored in, Air Speed however is IAS and not GPS Speed (Which is ground speed), so an IAS probe for making auto gain in a model aeroplane is an inescapable requirement
WoW
Logged
Spektrum DX6i | Phoenix V4 | CoroTrainer | Tamiya Baja king 2WD | RCTimer F450 Quadcopter
«
Reply #14 on:
June 11, 2013, 10:51:24 AM »
girishsarwal
Plane Lover
Forum Hero
Reputation Power: 17
Offline
City: Gurgaon
State: Haryana
RC Skills: Beginner
Posts: 1420
Join Date: May, 2012
DIYer
Re: Math behind Expos
Quote
so an IAS probe for making auto gain in a model aeroplane is an inescapable requirement
Gusty sir, so you have an IAS probe in most of your model planes already or is it still a requirement?
Something on the lines of this, linked back to the Tx:
http://www.hobbyking.com/hobbyking/store/__7838__Airspeed_Expander_V3.html
Logged
gs
«
Reply #15 on:
August 28, 2014, 04:33:01 PM »
girishsarwal
Plane Lover
Forum Hero
Reputation Power: 17
Offline
City: Gurgaon
State: Haryana
RC Skills: Beginner
Posts: 1420
Join Date: May, 2012
DIYer
Re: Math behind Expos
So, I've finally been able to crack this after numerous hours of reading the exponential function
http://en.wikipedia.org/wiki/Exponential_function
and banging my head.
I tried with discrete maths but that didnt really work out because large look up tables had to be created in the small Atmega memory, so had to fall back to continous function analysis.
The objective
Given
1. An input range (stick position), I
LOW
-> I
HIGH
2. An output range (servo timing in ms) O
LOW
-> O
HIGH
3. An expo value E
4. A value (current stick position)
the function should be able calculate the output O such that O
HIGH
>=O>=O
LOW
and follows the expo curves. The output curve gets tighter with increasing expo values
Here's the basic idea:
- Whenever the expo changes, calculate the min and max expo adjustment factors. the lower range will always be 0, and the upper range will approach e (natural antilog). E
LOW
and E
HIGH
- The exponential function (1+x/n)
n
allows us to create the expo adjustment. Yes the same function for compound interest. x is the ratio of movement and n is the expo setting, as that is compounded over travel.
- Get the stick position for a channel
- Interpolate using LERP to find the stick movement ratio over the complete travel
- adjust this values with the expo setting - this will range between the interval [0, e] where e is the natural antilog
- get a ratio of movement between E
HIGH
and E
LOW
- interpolate this to the output range O
LOW
to O
HIGH
Attached is a PDF that highlights this code done in a sample in C#. For source code, visit:
http://gt-jtx.googlecode.com
Will do this code in atmega to see effects but as of now it's fast enough for a microcontroller.
ExpoCalc.pdf
(26.68 KB - downloaded 217 times.)
«
Last Edit: August 28, 2014, 04:56:15 PM by girishsarwal
»
Logged
gs
«
Reply #16 on:
August 28, 2014, 05:18:27 PM »
sanjayrai55
Plane Lover
Forum Hero
Reputation Power: 85
Offline
City: Gurgaon
State: Haryana
RC Skills: Intermediate
Posts: 8337
Join Date: Dec, 2011
Don't wake a Tiger until you've factored the teeth
Re: Math behind Expos
Kludgy
Logged
Sanjay - Gravity is my enemy
http://www.rcindia.org/rc-people/builds-i-have-posted-on-rci/
«
Reply #17 on:
August 28, 2014, 05:20:34 PM »
sanjayrai55
Plane Lover
Forum Hero
Reputation Power: 85
Offline
City: Gurgaon
State: Haryana
RC Skills: Intermediate
Posts: 8337
Join Date: Dec, 2011
Don't wake a Tiger until you've factored the teeth
Re: Math behind Expos
Lerp
COGTEST
Where's the graph, you kludgy lerp? Or is in the Cogtest?
Logged
Sanjay - Gravity is my enemy
http://www.rcindia.org/rc-people/builds-i-have-posted-on-rci/
«
Reply #18 on:
August 28, 2014, 06:11:51 PM »
girishsarwal
Plane Lover
Forum Hero
Reputation Power: 17
Offline
City: Gurgaon
State: Haryana
RC Skills: Beginner
Posts: 1420
Join Date: May, 2012
DIYer
Re: Math behind Expos
Graphs coming up soon. You know my way. Solutions come out in a split second but then I end up waiting for a year for the split second to arrive
PS Cogtest is the cognitive testing product I take care of where I work so yea the solution was in there somewhere..
technically and figuratively. Wait till the boss gets to know of it..
Logged
gs
«
Reply #19 on:
August 28, 2014, 06:14:34 PM »
sanjayrai55
Plane Lover
Forum Hero
Reputation Power: 85
Offline
City: Gurgaon
State: Haryana
RC Skills: Intermediate
Posts: 8337
Join Date: Dec, 2011
Don't wake a Tiger until you've factored the teeth
Re: Math behind Expos
Boss? Don't worry about that kludge. He's such a lerp he won't cogtest
Logged
Sanjay - Gravity is my enemy
http://www.rcindia.org/rc-people/builds-i-have-posted-on-rci/
Pages: [
1
]
Go Up
RC India
General Topics
RC General Topics
Topic:
Math behind Expos
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Topics
-----------------------------
=> Chatter Zone
=> Beginners Zone
=> RC Events
=> RC People
=> RC India Forum
-----------------------------
RC Models
-----------------------------
=> Electric Planes
=> Helis
=> Cars
=> Kites, Trains, Free Flight and All Others
-----------------------------
RC Equipments
-----------------------------
=> Tools, Materials and Building Techniques
=> Radios and Receivers
=> Electric Power
=> Fuel and Engines
=> Batteries and Chargers
=> Servos, Gyros and All Electronics
-----------------------------
RC Models
-----------------------------
=> Gas/Glow/Nitro Planes
-----------------------------
RC Baazar
-----------------------------
=> For Sale
=> Wanted
-----------------------------
General Topics
-----------------------------
=> RC Outlets and Resellers
-----------------------------
RC Baazar
-----------------------------
=> Free, Donations and Sweepstakes
=> Deals and Special Offers
-----------------------------
General Topics
-----------------------------
=> RC Locations and Clubs
=> RC Maneuvers and Skills
-----------------------------
RC Models
-----------------------------
=> Self-designed, DIY and College Projects
-----------------------------
General Topics
-----------------------------
=> RC General Topics
-----------------------------
RC Baazar
-----------------------------
===> For Sale - Completed
===> Wanted - Completed
-----------------------------
RC Models
-----------------------------
=> Boats
=> Multirotors
Loading...