Try   HackMD

nerdCopter's EmuFlight Tuning Guide for FreeStyle

  • This will get you 80+++% there (Filters & PIDs)
  • Squeezing the best performance will be up to you to fine-tune
  • Tune the setup that you intend to fly, use the camera, lipo, props you expect to normally fly. Changing any of these may require re-tuning.

Setup ESC's first (BLHeli, BlueJay, etc.)

  • Setup your ESC's however you like, but some good tips are:
  • Demag-Compensation High (or Medium-to-High if applicable). This will avoid in-flight de-syncs.
  • Ramp-up power 30% for most mini-quads. (Ryan Harrell said 25%, but i like headroom.) Toothpick and ultralights may need alternative tuning. (*This is totally debatable, keep at default 50% if any question.)
  • Variable PWM (latest versions) is good. Set Max-PWM to variable. For 5-inch, set Min-PWM to 32 or 48khz. If variable PWM is not available, 48Khz is generally good. For 7" set Min-PWM to 24 or 32khz. Other sizes may need alternative tuning.
  • Timing as you like, Auto is good enough and will fly the longest but least "performant". 23°-25° is good for 32-bit ESC. Higher values may be more "performant" at cost of flight time.
  • No AMP limiting (Current) or very high AMP limiting (105+).
  • No, Sine-Modulation; it apparently has no significant help.

Pre-Tuning

  • EmuFlight Defaults are generic and safe for 5 inch quads. It may be over-filtered or under-performant.
  • EmuFlight Presets are generally good, but also may not be "locked-in" for your quad.
  • Turn off ADC Filter in EdgeTX, OpenTX, etc.
  • Radio-link has a direct effect on setpoint and thus affects PIDs. Defaults may work for some RX/TX links, but not all. Consider setting Interpolation, Manual, 21, RPYT if you do not wish to tune RC-Smoothing.

Step 1 : Motor Protocol

  • Select a DShot of choice (recommended); This is a digital protocol and does not need calibration.
  • If selecting MultiShot, this analog protocol requires ESC-calibration and is dangerous to the hardware until performed.
  • Most motors have 14 magnets. If your motors have another count, be sure to set motor_poles in the CLI.

Step 2 : BlackBox Logging

  • Setup blackbox to log at 1.5Khz or better.
  • set debug_mode = gyro_scaled.
  • Test-hover checking motor temperatures. If motors are not hot, then continue. If motors are hot, then check your hardware for faults and reduce Roll/Pitch D.
  • Record blackbox without hitting obstacles, or LOS fly in your back yard. An appropriate amount of Roll and Pitch movement are needed, flips and rolls are better, but a backyard LOS can get the basic data to start tuning.

Step 3 : Filters First

  • Open logs in EmuFlight Blackbox explorer (https://github.com/emuflight/EmuFlight-Blackbox-Explorer/releases).
  • View the frequency analyzer for gyro_scaled per each axis.
  • Set Gyro LPF #1 lower than the primary noise-profile (default is usually good).
  • Helio®-Specific: If Helio-based FC's, then use IMUF-LPF's not Gyro-LPF. ptn_order 2 (PT2) is a good choice.
  • Set the dynamic_filter's Min and Max to cover the primary noise-profile. Typically 150Hz to 400Hz+ on 5-inch. Lower for larger quads. Higher for smaller quads.
  • Decide if you prefer to use dynamic_filter enabled or disabled.
  • If enabled, then in most circumstances, set the first d-Term LPF type to PT2 and disable the second d-Term LPF altogether.
  • Tune the first D-Term LPF cutoff to below the primary noise profile. Lower values are more filtering at cost of delay (over-filtering), higher values are less filtering at cost of motor-heat (under-filtering).
  • Note that d-term LPF tuning is really important. Do see the wiki for alternative tuning options: https://github.com/emuflight/EmuFlight/wiki/LowPassFilters#filter-tuning-tips. Choices include 100% static filtering, dynamic_filter with single dLPF (described here) or dynamic_filter (Gyro) AND Dynamic-D-Notch.
  • "IMU-F" Kalman-based filter: Lower Q is more gyro-filtering, Higher Q is less Filtering. Recommended 9000+. Larger craft, smaller Q. W is how much gyro data is used to calculate the kalman filtering. Smaller feels sharper, larger feels smoother. Smaller W for combatting wind. Smaller craft, smaller W. Larger craft, larger W.
  • Repeat step 3 as needed.

Filter considerations

  • over-filtering will cause poor prop-wash handling.
  • over-filtering can cause feedback-loop, oscillations, and fly-offs.
  • under-filtering can cause hot motors.
  • Larger quads generally need lower LPF cutoffs.
  • Smaller quads gernarlly need higher LPF cutoffs.
  • Gyro filter order: kalman, static notch, lpf1, lpf2, dynamic notch, ABG
  • D-Term filter order: lpf1, lpf2, dynamic notch, ABG

Step 4 : PIDs

  • Open logs in PID Tool box (https://github.com/bw1129/PIDtoolbox/releases).
  • Run Step-Response tool.
  • Use the step-response graphing to find a good PID balance (P/D ratio).
  • Typically more Roll/Pitch D is needed than defaults.
  • Possibly less Roll/Pitch I-term is needed than default. Too high I-terms will always overshoot initial step-response.
  • Raise Roll/Pitch P/D in balance as needed to combat high winds.
  • Almost always more Yaw P-term (80+) and more yaw I-Term (90+) is needed than defaults. Typically do not increase yaw D over 5.
  • Repeat step 4 as needed until relatively "flat-line" step responses or acceptably balanced Roll/Pitch.

PID considerations

  • D dampens overshoot/oscillation caused by high P.
  • Too low D allows P to overshoot, oscillate, and wobble.
  • Too high D can cause motor heat, oscillation, and possibly fly-aways.
  • Find a good P/D ratio and they can be increased or decreased while keeping them in balance.
  • High I-Term can keep a quad from being affected by outside forces. Making it "stick" into position better.
  • Too high I-Term will be too robotic.
  • Too high I-Term will pull the P-Term too much and cause an initial hump in the step-response graphs.
  • 7-inch and larger craft, do not need as much I-Term because a larger craft has stronger inherit authority.
  • 7-inch and larger craft may not need very high yaw P.
  • Pitch generally need higher PIDs due to how HD cameras and LiPo batteries are mounted
  • Whoops Roll/Pitch are usually 1:1
  • To tune PIDs from scratch, see MadChiller's baseline PIDs: https://hackmd.io/XwPQyN7OS9CspZZndNz-tg (Basically find the PIDs that move closest to 1.0 in PTB's step-response, then tune D for better P/D ratio, then lastly tune I.)

Step 5 : Optional

  • Better performance be achieved be repeating steps 3 and 4 round-robin; However, at some point it becomes unwarranted chasing because changes to either will affect the other.
  • Fine tuning can encompass some of the following:
  • i-Decay default of 4 may be too much for 5-inch. Consider dropping to 2 or 3. Larger quads may want a bit higher values.
  • Larger quads may need smaller than default i-Relax values.
  • Feathered can be adjusted 0 to 100. Where 0 is calculated "on error" like KISS and 100 is calculated "on measurement" like Betaflight. Closer to 0 may be more responsive but less tolerant to high D's. I prefer 50 for a balance of the two.
  • EmuBoost boosts P & I error during PID calculations. Higher Boost will increase feel-response, increase as much as desired. Limit should not be overly high. Typically not over 80% of your roll's P value, but tune as desired.
  • D-Boost is typically not needed. D-Boost limit should remain very small (2% to 5%); otherwise it may induce oscillation same as too much D would.
  • EmuGravity increases "error" on throttle-change and can help reduce dolphin-effect on throttle-bumping. Increase as needed in increments of 5 or 10. Too much may induce flutter during flight.

Step 6 : Advanced

  • TPA changes P, I, & D values base on throttle. TPA tuning can repair oscillation on high throttle; However, the need for TPA can be bypassed with Thrust Linearization as well.
  • Motor output mixer can be set to alternate smoothing types. Legacy was present since day 0, and some people prefer the old feel. Default is 2pass which can be elevated to an even smoother Thrust Linearization by enabling Laziness and tuning both the high and low rpm compensation. See: https://github.com/emuflight/EmuFlight/wiki/Motor-Mixers-and-Thrust-Linearization
  • Axis-Lock can make your quad feel more locked in.
  • Enable expert-mode in the configurator to access per-axis LPF's.
  • Enable expert-mode in the configurator to access ABG filters. I really like ABG filters in conjunction with Static LPF's (but not necessarily with dynamic_filter).

Prop-Wash handling

  • Poor prop-wash handling can be caused by too much filtering.
  • Poor prop-wash handling can be caused by poor P/D balance.
  • Prop-wash handling can be affected by too low motor idle speed.

Final Thoughts

  • As with all tuning, every quad is different and some settings may or may not be best suited for the application.
  • Further stick-feel and flight-feel can be achieved with rateDynamics and Dual-Axis-Steering.
  • DShot1200 and above can result in smoother cooler motors if the ESC's supports it. CPU utilization is NOT significantly increased by EmuFlights implementation of dShot.
  • Enable expert-mode in the configurator to access GPS OSD elements.
  • Enable expert-mode in the configurator to access Angle/Horizon PIDs
  • Everything is in the wiki: https://github.com/emuflight/EmuFlight/wiki

Notable resources