Skip to content

Implement Low-Pass Filter to Eliminate Telemetry Jitter #23

Description

@yufurkan

Description

Currently, the raw PWM signals (1000-2000) received from the STM32 microcontroller via TelemetryDecoder.cs contain minor hardware noise and communication jitter (e.g., fluctuating between 1498 and 1502 while the stick is stationary). Because these raw values are directly mapped to the control surface deflection angles (SetFlapAngle in radians) within the Gasgiant physics engine, the noise causes micro-fluttering on the ailerons, elevator, and rudder. This constant oscillation induces unrealistic aerodynamic anomalies and instability during the HIL simulation.

Expected Behavior

Control surfaces should remain perfectly stable when the transmitter sticks are stationary. The deflection should be smooth, ignoring high-frequency hardware noise without introducing significant input lag.

Implement a digital filtering algorithm—such as an Exponential Moving Average (EMA) or a Simple Low-Pass Filter—within TelemetryDecoder.cs. The filter must process the raw PWM inputs before they are converted to radians and dispatched to the AeroSurface instances.

  • Implement an EMA (Exponential Moving Average) algorithm in TelemetryDecoder.cs.

  • Expose a smoothingFactor (or alpha) variable in the Unity Inspector to allow real-time tuning of the filter's intensity.

  • Apply the filtering logic independently to aileronPWM, elevatorPWM, throttlePWM, and rudderPWM.

  • Conduct a latency test to find the optimal balance between signal smoothness and responsiveness.

  • Visual fluttering of 3D control surfaces in Unity is completely eliminated.

  • The physics engine receives perfectly stable radian values when inputs are idle.

  • The filter does not introduce an input lag exceeding 20ms (must remain imperceptible for flight control).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions