-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Automatically pitch down in angle mode when throttle is bellow cruise throttle #3290
Automatically pitch down in angle mode when throttle is bellow cruise throttle #3290
Conversation
542c81e
to
ba3839a
Compare
ba3839a
to
f97c97e
Compare
src/main/flight/pid.c
Outdated
|
||
// Automatically pitch down if the throttle is reduced bellow cruise throttle | ||
if ((axis == FD_PITCH) && STATE(FIXED_WING) && FLIGHT_MODE(ANGLE_MODE)) | ||
angleTarget += scaleRange(MAX(0, navConfig()->fw.cruise_throttle - rcCommand[THROTTLE]), 0, navConfig()->fw.cruise_throttle - PWM_RANGE_MIN, 0, mixerConfig()->fwMinThrottleDownPitchAngle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should move cruise_throttle
from navConfig
to something more generic since we're now using it outside navigation system?
|
||
// Automatically pitch down if the throttle is manually controlled and reduced bellow cruise throttle | ||
if ((axis == FD_PITCH) && STATE(FIXED_WING) && FLIGHT_MODE(ANGLE_MODE) && !navigationIsControllingThrottle()) | ||
angleTarget += scaleRange(MAX(0, navConfig()->fw.cruise_throttle - rcCommand[THROTTLE]), 0, navConfig()->fw.cruise_throttle - PWM_RANGE_MIN, 0, mixerConfig()->fwMinThrottleDownPitchAngle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should start thinking about unifying configuration for navigation and other things into "platform configuration". We can have separate airplaneConfig
and rotorcraftConfig
plus unified platformConfig
to keep common values. These structures will hold platform capabilities like max inclination, cruise throttle, hover throttle, reference airspeed etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's definitely out of scope of current PR, but we should really look into it.
@shellixyz please document it somehow! |
I added an explanation in the PR description for the moment. I will document it in the wiki when released. |
Inspired by Arduplane STAB_PITCH_DOWN setting.
The
fw_min_throttle_down_pitch
(decidegrees) controls the amount of down pitch to add inANGLE
mode mode when at low throttle. No down trim is added when throttle is abovenav_fw_cruise_thr
. Belownav_fw_cruise_thr
downtrim is added in proportion to the amount the throttle is belownav_fw_cruise_thr
. At zero throttle the full down pitch specified in this parameter is added. This parameter is meant to help keep airspeed up when flying inANGLE
mode with low throttle, such as when on a landing approach, without relying on an airspeed sensor.Tested, ready to merge.