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

Projects
None yet
3 participants
@shellixyz
Copy link
Collaborator

commented May 25, 2018

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 shellixyz:manual_throttle_increase_in_auto_throttle_modes_clean branch from ea05a7a to aa08bd0 May 26, 2018

@FinalFrag

This comment has been minimized.

Copy link

commented May 26, 2018

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

This comment has been minimized.

Copy link
Collaborator Author

commented May 26, 2018

@FinalFrag I built 1.9.1 with this patch:

iNav_1.9.1_auto_thr_manu_increase.zip

@shellixyz shellixyz force-pushed the shellixyz:manual_throttle_increase_in_auto_throttle_modes_clean branch 2 times, most recently from 4435ec2 to 7b2ac46 May 27, 2018

@FinalFrag

This comment has been minimized.

Copy link

commented May 28, 2018

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

@shellixyz

This comment has been minimized.

Copy link
Collaborator Author

commented May 28, 2018

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Collaborator Author

commented May 28, 2018

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

@FinalFrag

This comment has been minimized.

Copy link

commented May 28, 2018

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

This comment has been minimized.

Copy link
Collaborator Author

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

This comment has been minimized.

Copy link
Collaborator Author

commented May 28, 2018

Sorry I misread your code

@FinalFrag

This comment has been minimized.

Copy link

commented May 28, 2018

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

This comment has been minimized.

Copy link
Collaborator Author

commented May 28, 2018

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

This comment has been minimized.

Copy link

commented May 28, 2018

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

This comment has been minimized.

Copy link
Collaborator Author

commented May 28, 2018

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

This comment has been minimized.

Copy link

commented May 28, 2018

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 shellixyz:manual_throttle_increase_in_auto_throttle_modes_clean branch from 7b2ac46 to 792a32f Jun 18, 2018

@fiam fiam added this to the 2.0 milestone Jun 18, 2018

@fiam fiam merged commit b665c48 into iNavFlight:development Jun 18, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.