Throttle expo
Throttle expo
It is very hard to get stable altitude with my TX because it has no programming throttle curve. I think it is possible to add expo curve to the board to have more precise throttle near hover.
What we need: expo settings (already exists) and two #defines: ENABLE_THROTTLE_EXPO and THROTTLE_HOVER ( can be measured in gui). Also, throttle range may be shifted down because now 1/2 of the current range used to just start from earth.
I want to try to implement such things.
What we need: expo settings (already exists) and two #defines: ENABLE_THROTTLE_EXPO and THROTTLE_HOVER ( can be measured in gui). Also, throttle range may be shifted down because now 1/2 of the current range used to just start from earth.
I want to try to implement such things.
Re: Throttle expo
After a hours of debugging (this is my first lines of code for Arduino
) a compact working solution was born:
In MultiWii.pde:
replaced to:
Add to config.h:
Now throttle bar looks fine in GUI in middle range. But aware, I was not flying with it.

In MultiWii.pde:
Code: Select all
rcCommand[THROTTLE] = MINTHROTTLE + (int32_t)(MAXTHROTTLE-MINTHROTTLE)* (rcData[THROTTLE]-MINCHECK)/(2000-MINCHECK);
replaced to:
Code: Select all
#ifdef THROTTLE_EXPO
uint16_t tmp;
/* map x=[MINCHECK..SHIFT_HOVER..MAXCHECK] to [0..500] */
if(rcData[THROTTLE] < SHIFT_HOVER) {
tmp = 500 - (uint32_t)(max(rcData[THROTTLE], MINCHECK) - MINCHECK)*500/(SHIFT_HOVER - MINCHECK);
} else {
tmp = (uint32_t)(min(rcData[THROTTLE], MAXCHECK) - SHIFT_HOVER)*500/(MAXCHECK - SHIFT_HOVER);
}
uint16_t tmp2 = tmp/100;
uint16_t y = lookupRX[tmp2] + (tmp-tmp2*100) * (lookupRX[tmp2+1]-lookupRX[tmp2]) / 100;
/* map y=[0..500] to [1000..THROTTLE_HOVER..2000] */
if (rcData[THROTTLE] < SHIFT_HOVER) {
rcCommand[THROTTLE] = 1000 + (uint32_t)(500-y) * (THROTTLE_HOVER - 1000) / 500;
} else {
rcCommand[THROTTLE] = THROTTLE_HOVER + (uint32_t) y * (2000 - THROTTLE_HOVER) / 500;
}
#else
rcCommand[THROTTLE] = MINTHROTTLE + (int32_t)(MAXTHROTTLE-MINTHROTTLE)* (rcData[THROTTLE]-MINCHECK)/(2000-MINCHECK);
#endif
Add to config.h:
Code: Select all
/* You can enable throttle expo curve near hover point, affected by 'EXPO' AND 'RC RATE' setting in GUI */
/* It is recomended to test it in GUI with your receiver before fly */
#define THROTTLE_EXPO
/* Throttle value just before copter start flying (expo zero point will be here) */
/* Should be measured in GUI with full copter load. */
#define THROTTLE_HOVER 1500
/* You can shift hover point to the begining of the throttle range to use more of remaining range to fly */
/* 1500 - no shift */
#define SHIFT_HOVER 1500
Now throttle bar looks fine in GUI in middle range. But aware, I was not flying with it.
-
- Posts: 506
- Joined: Thu May 05, 2011 8:13 am
- Location: Slovenia
Re: Throttle expo
It is possible to use TX in Helli mode CCPM (one servo). That way you get normal helli like throttle curve which is probably easier to modify "on the fly"!
Andrej
Andrej
Re: Throttle expo
I have cheap TX (HK-T6A) - all configuration made trough PC. I tryed to get desired curve from it but no success, so I finally leave it in acro mode (all channels are linear).
Today I did field tests, result is very good - it is much more easier to hold altitude. So, this mod will be helpfull for those who own TX without throttle curve setting (or can't set it).
Today I did field tests, result is very good - it is much more easier to hold altitude. So, this mod will be helpfull for those who own TX without throttle curve setting (or can't set it).
-
- Posts: 2261
- Joined: Sat Feb 19, 2011 8:30 pm
Re: Throttle expo
Heli-90 would be best in my opinion. It function as Acro but you get the usage of the Throttle Curve without any mixing.
Re: Throttle expo
I've tested this patch and works grate. No problems so far. Grate job!
Regards,
Marcin.
Regards,
Marcin.
Re: Throttle expo
I have a final correction of my code: 1000 and 2000 values should be replaced to the MINTHROTTLE and MAXTHROTTLE to extend usefull range of throttle (we assumed that ESC should not accept values outside this range).
Also, expo curve from GUI contains the rcRate multiplier, wich decreases min and max values of controller. I think it is not needed in the throttle stick.
I have tested it and it works well.
Also, expo curve from GUI contains the rcRate multiplier, wich decreases min and max values of controller. I think it is not needed in the throttle stick.
Code: Select all
#ifdef THROTTLE_EXPO
uint16_t tmp;
/* map x=[MINCHECK..SHIFT_HOVER..MAXCHECK] to [0..500] (expo without rcRate) */
if(rcData[THROTTLE] < SHIFT_HOVER) {
tmp = 500 - (uint32_t)(max(rcData[THROTTLE], MINCHECK) - MINCHECK)*500/(SHIFT_HOVER - MINCHECK);
} else {
tmp = (uint32_t)(min(rcData[THROTTLE], MAXCHECK) - SHIFT_HOVER)*500/(MAXCHECK - SHIFT_HOVER);
}
uint16_t tmp2 = tmp/100;
uint16_t y = (lookupRX[tmp2]*50 + (tmp-tmp2*100) * (lookupRX[tmp2+1]-lookupRX[tmp2]) / 2 ) / rcRate8;
/* map y=[0..500] to [MINTHROTTLE..THROTTLE_HOVER..MAXTHROTTLE] */
if (rcData[THROTTLE] < SHIFT_HOVER) {
rcCommand[THROTTLE] = MINTHROTTLE + (uint32_t)(500-y) * (THROTTLE_HOVER - MINTHROTTLE) / 500;
} else {
rcCommand[THROTTLE] = THROTTLE_HOVER + (uint32_t) y * (MAXTHROTTLE - THROTTLE_HOVER) / 500;
}
#else
rcCommand[THROTTLE] = MINTHROTTLE + (int32_t)(MAXTHROTTLE-MINTHROTTLE)* (rcData[THROTTLE]-MINCHECK)/(2000-MINCHECK);
#endif
I have tested it and it works well.
Re: Throttle expo
Thanks a lot!!!
It's really helps to keep stable altitude now with my Hobby King 2.4Ghz 6Ch Tx!
It's really helps to keep stable altitude now with my Hobby King 2.4Ghz 6Ch Tx!
Re: Throttle expo
First, thanks a lot for this wonderful program multiwii to everybody developing it!
Throttle_expo helped me very much as a beginner and i wood like to use it again.
I have just a short question:
Is it still save to use throttle_expo with the latest versions of 2.0?
Thanks in advance
Throttle_expo helped me very much as a beginner and i wood like to use it again.
I have just a short question:
Is it still save to use throttle_expo with the latest versions of 2.0?
Thanks in advance
Re: Throttle expo
Sounds like a very usefull mod. I will try this soon too. (V2pre2)
While flying in level mode with Baro activated yesterday (taking gopro video footage) I found it difficult to maintain constant height because necessary Yaw stick movements invariably apply small but significant throttle changes.
I must say that the Baro function is working fine, -+ 0.3m
I applied the mod suggested by nhadrian to zero BaroAlt when motors are armed.(ground level)
viewtopic.php?f=8&t=1351
So, if Baro is activated on the ground, the throttle stick could then control actual altitude from ground-level (low trottle) to a Max altitude, say 50m (max throttle), defined in Config?
Thoughts?
While flying in level mode with Baro activated yesterday (taking gopro video footage) I found it difficult to maintain constant height because necessary Yaw stick movements invariably apply small but significant throttle changes.
I must say that the Baro function is working fine, -+ 0.3m
I applied the mod suggested by nhadrian to zero BaroAlt when motors are armed.(ground level)
viewtopic.php?f=8&t=1351
So, if Baro is activated on the ground, the throttle stick could then control actual altitude from ground-level (low trottle) to a Max altitude, say 50m (max throttle), defined in Config?
Thoughts?
Re: Throttle expo
Hi howadhb! You question is outside of this topic, because throttle expo does not control altitude, it just helps to get more precise throttle stick in the range of flight.
You question is more related to AltHold mode. In this mode, in my vision, throttle must switch to altitude control, as you wrote. I have implemented it for myself, but don't know how it is implemented in V2.
You question is more related to AltHold mode. In this mode, in my vision, throttle must switch to altitude control, as you wrote. I have implemented it for myself, but don't know how it is implemented in V2.
Re: Throttle expo
thornton wrote:First, thanks a lot for this wonderful program multiwii to everybody developing it!
Throttle_expo helped me very much as a beginner and i wood like to use it again.
I have just a short question:
Is it still save to use throttle_expo with the latest versions of 2.0?
Thanks in advance
I have not tested this mod with v2 (have a lack of time to merge all my code with v2) but I think it has 99% chance to be compatible. You can try it in GUI before flight to see it still working

Re: Throttle expo
Hi @alexmos.
Yes, I realise that expo (around the hover throttle point) will greatly improve altitude control (by the pilot) when Baro is not active.
(meaning, less sensitive to small changes to throttle stick, when applying yaw inputs)
Would you share your code for throttle stick altitude control when Baro is enabled?
I will merge it (if possible) with V2pre4 and post my experience.
Cheers
H.
Yes, I realise that expo (around the hover throttle point) will greatly improve altitude control (by the pilot) when Baro is not active.
(meaning, less sensitive to small changes to throttle stick, when applying yaw inputs)
Would you share your code for throttle stick altitude control when Baro is enabled?
I will merge it (if possible) with V2pre4 and post my experience.
Cheers
H.
Re: Throttle expo
I tried it today in acro and in stable mode (2.0 pre 3). Wonderfull!.
It makes life easier for beginners! Should be for everybody, not only coders!
Thanks a lot.
It makes life easier for beginners! Should be for everybody, not only coders!
Thanks a lot.
Re: Throttle expo
howardhb wrote:Hi @alexmos.
Would you share your code for throttle stick altitude control when Baro is enabled?
I will merge it (if possible) with V2pre4 and post my experience.
Cheers
H.
Yes, but there are few errors in my code. I will finish them soon and share revision r16 after some testing. After that, I will merge with 2.0.
Re: Throttle expo
thornton wrote:I tried it today in acro and in stable mode (2.0 pre 3). Wonderfull!.
It makes life easier for beginners! Should be for everybody, not only coders!
Thanks a lot.
I am beginner, too

Re: Throttle expo
I did not understand how this change
Re: Throttle expo
alexmos wrote:howardhb wrote:Hi @alexmos.
Would you share your code for throttle stick altitude control when Baro is enabled?
I will merge it (if possible) with V2pre4 and post my experience.
Cheers
H.
Yes, but there are few errors in my code. I will finish them soon and share revision r16 after some testing. After that, I will merge with 2.0.
hi alexmos,
i was looking for this option in multiwii, and i found your post, great work,
i want to use it on my setup, but i'm also using alt hold.
will it work ok with alt hold? and is it part of the new multiwii 2.0 update, or i have to install it and update my firmware ?
thx for this mod, i hope it gets imported to the full release

Re: Throttle expo
Hi,
This mod can be inserted into 2.0 and works well. Yes, it works with Alt Hold mode, too.
You should manually insert code into MultiWii.ino and config.h (see posts above).
This mod can be inserted into 2.0 and works well. Yes, it works with Alt Hold mode, too.
You should manually insert code into MultiWii.ino and config.h (see posts above).
Re: Throttle expo
with parameters that should make the expo to have a good throttle curve?
my default
rc rate : 0.90
expo: 0.65
MINTHROTTLE: 1200
MAXTHROTTLE:1850
my default
rc rate : 0.90
expo: 0.65
MINTHROTTLE: 1200
MAXTHROTTLE:1850
Re: Throttle expo
With your expo=0.65 throttle will be very smooth (I have used the same in the begining). Only remember to set THROTTLE_HOVER to value where you copter takes from the ground (for that, connect GUI and see throttle level in the hovering). SHIFT_HOVER may be the same as THROTTLE_HOVER or set it about 1500.
-
- Posts: 1630
- Joined: Wed Jan 19, 2011 9:07 pm
Re: Throttle expo
I'm currently implementing an equivalent feature with a GUI interaction.