Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FW: Allow manual throttle increase in auto controlled modes #3278

Conversation

shellixyz
Copy link
Collaborator

Should satisfy #3251 and #1985 at least partially until better air speed functionality.

The idea is to increase the throttle in auto modes by raising the throttle stick above nav_fw_cruise_thr. If no increase in throttle is wanted the throttle stick can be left at cruise power for easy transition out of the auto controlled throttle mode. If the throttle is above 95% the motor will be commanded to run at max_throttle. The OSD throttle indicator will blink in auto modes when the throttle is manually increased.

@shellixyz shellixyz force-pushed the manual_throttle_increase_in_auto_throttle_modes_clean branch from ea05a7a to aa08bd0 Compare May 26, 2018 01:51
@FinalFrag
Copy link
Contributor

Awesome, is there an "easy" way to get this flashed. Are there nightly build available somewhere? Or instructions how to build it myself? Not much of a C-wiz myself.

@shellixyz
Copy link
Collaborator Author

@FinalFrag I built 1.9.1 with this patch:

iNav_1.9.1_auto_thr_manu_increase.zip

@shellixyz shellixyz force-pushed the manual_throttle_increase_in_auto_throttle_modes_clean branch 2 times, most recently from 4435ec2 to 7b2ac46 Compare May 27, 2018 14:30
@FinalFrag
Copy link
Contributor

Is there a specific reason you went with 'anything over 95% should be 100%'? Seems a bit redundant to me.

@shellixyz
Copy link
Collaborator Author

I went with 'anything over 95% should be 100%' because 100% throttle should correspond to max thrust and, if you are asking to descent, the "base throttle" will be lowered bellow cruise throttle and otherwise you couldn't get full throttle when asking for it.

@FinalFrag
Copy link
Contributor

FinalFrag commented May 28, 2018

Can't the whole throttle block be simplified to this? You'd get whatever throttle your stick is at as long as it's above the previously corrected value (which includes the lowered throttle on descend).

I'm assuming both rcCommand and correctedThrottleValue is 1000-2000 here though, which I may be wrong on.

isAutoThrottleManuallyIncreased = false;

if (!FLIGHT_MODE(FAILSAFE_MODE) && rcCommand[THROTTLE] > correctedThrottleValue) {
    correctedThrottleValue = rcCommand[THROTTLE];
    isAutoThrottleManuallyIncreased = true;
}

@shellixyz
Copy link
Collaborator Author

You are right rcCommand and correctedThrottleValue are between 1000-2000. Your code would disable the automatic throttle entirely when not in failsafe.

@FinalFrag
Copy link
Contributor

Whoops, was just editing my comment to make it even briefer.

My code would only "disable" auto-thr (more like overrule) when rcCommand[THROTTLE] > correctedThrottleValue, which is the goal of this issue to my understanding?

@shellixyz
Copy link
Collaborator Author

shellixyz commented May 28, 2018

The issue is that if you ask for say 10µs above cruise throttle and to ascend 4m/s you will trigger a stall because the throttle won't be enough. With my code the throttle is always automatically adjusted depending on the requested vertical speed. Well not always, only if thr < 95% but if it is >95% the max thrust will be requested from the motor so you can't do more. If it stalls at this point it is because the max climb rate is misconfigured.

@shellixyz
Copy link
Collaborator Author

Sorry I misread your code

@FinalFrag
Copy link
Contributor

If the throttle is not enough, that also implies rcCommand[THROTTLE] is no longer above correctedThrottleValue and the auto-thr would get priority and my code would not be executed.

E.g. flying level at 1500 auto and requesting 1510 by throttle would give you 1510.
Pitching up to 4m/s would put auto-thr at 1600 let's say, so the throttle stick at 1510 would be ignored.

@shellixyz
Copy link
Collaborator Author

Right. I read your code a bit too fast. I did like I did because I wanted the throttle to always be automatically adjusted when requested throttle is < 95%. Your code would work but it overrides the automatic throttle when it is above the calculated auto throttle.

@FinalFrag
Copy link
Contributor

Ah I see where our thought process was different.

Not sure which of the 2 is better to follow people around, which was my original reason for the request. I should figure out how to build the code so I can test both approaches.

@shellixyz
Copy link
Collaborator Author

The idea of the auto throttle is to keep the air speed constant so to me when it is enabled it should always vary the throttle depending on pitch. In my opinion it is adequate for your use case since it should help you keep a constant speed when pitching up/down but also allow you to vary your speed with the throttle stick.

@FinalFrag
Copy link
Contributor

Yes, certainly adequate and I appreciate taking the time to make this change and build it for us to use before 1.9.2. Just wondering if you'd be able to "feel" the difference in the air, but yours is in theory the better solution.

This is also a better approach than to split alt-hold into 2 features alt-hold and auto-thr as I originally requested.

@shellixyz shellixyz force-pushed the manual_throttle_increase_in_auto_throttle_modes_clean branch from 7b2ac46 to 792a32f Compare June 18, 2018 16:03
@fiam fiam added this to the 2.0 milestone Jun 18, 2018
@fiam fiam merged commit b665c48 into iNavFlight:development Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants