# Spike Filtering

The safety filter is a protective feature that monitors each motion axis independently and intervenes when acceleration exceeds a configurable threshold. Its goal is to prevent sudden, extreme simulator movements — for example during in-game crashes, respawns, or telemetry glitches — while keeping the rest of your motion experience intact.

## How It Works

The safety filter continuously watches acceleration on every axis (surge, sway, heave, pitch, roll, yaw). When the acceleration on any single axis exceeds its configured threshold, the filter activates **only on that axis** and applies a rapid deceleration to bring it back within safe limits.

Key details:

* **Per-axis isolation** — If the filter triggers on heave, only heave motion is affected. Surge, sway, pitch, roll, and yaw continue normally.
* **Cue-type isolation** — The filter targets motion cues (Primary, Ground, Simple) but does **not** affect vibration or bass shaker cues on the same axis. This means you still feel haptic feedback even while the motion spike is being filtered, helping maintain a sense of what's happening in the game.
* **Instant activation, smooth recovery** — The filter engages immediately when a spike is detected. When the spike subsides, the axis smoothly transitions back to normal operation over approximately 1 second to prevent jarring re-engagement.
* **Rolling average detection** — Acceleration is monitored using a rolling average of the last 3 samples, which prevents single-sample noise from causing false activations while still catching genuine spikes quickly.

### Detection Algorithm

The filter operates at the motion processing refresh rate (default 500 Hz / 2 ms):

1. Each tick, the filter computes the current acceleration on each axis from the position difference between frames.
2. The acceleration is added to a rolling history of the last 3 samples.
3. The mean acceleration across those 3 samples is compared against the configured threshold.
4. If the mean exceeds the threshold, the axis is "frozen" at its last safe position.
5. When the mean drops back below the threshold, a smooth 1-second transition blends the frozen position back to the live commanded position.

### Threshold Units

* **Translational axes** (surge, sway, heave) are measured in **G-force**. The default threshold is 3.00 G. The filter internally converts this to mm/s² for comparison with the acceleration data.
* **Rotational axes** (pitch, roll, yaw) are measured in **degrees per second squared (°/s²)**. The default threshold is 2000 °/s².

Thresholds are configured under **Settings > Safety**. See the [Settings](/dr-sim-manager/general/settings.md) page for default values and configuration options.

## Tuning the Safety Filter

When the safety filter activates too frequently, it can feel like motion is being "swallowed" or cut short. When it rarely activates, you get the full motion experience with protection only during genuine extremes. The goal is to find the right balance.

It is recommended to make adjustments in the following order:

1. **Adjust Source Data Limits** — Lower the input limits on individual axes (found on each cue's tuning panel) to clamp incoming telemetry before it reaches the motion processing. This is the most targeted fix because it caps only the specific contributor causing spikes. For typical cars, try acceleration values between 10 and 20 m/s². This allows realistic jumps and impacts without triggering the safety filter unnecessarily.
2. **Increase Activation Thresholds** — If the filter still activates more than you'd like, raise the translational or rotational threshold values in **Settings > Safety**. Be conservative here — setting thresholds too high reduces the protection the filter provides.
3. **Tuning Adjustments** — Modify axis tuning to reduce the intensity of motion reaching the filter. Options include:
   * Lowering the **Gain** on the offending axis in the Primary or Ground cue.
   * Increasing **Smoothing** to reduce sharp peaks.
   * Adjusting **Input Gain** in Settings to scale all incoming telemetry down.

### Per-Axis Threshold Tuning

While the translational and rotational thresholds apply to all axes in their respective group, you can effectively create per-axis tuning by adjusting the **gain** and **smoothing** on individual axes within each cue. For example:

* If heave triggers the filter frequently but surge and sway don't, lower the **heave gain** or increase **heave smoothing** in the Primary cue rather than raising the global threshold.
* This achieves a similar effect to per-axis thresholds without reducing protection on other axes.

For a broader tuning workflow that incorporates safety filter management, see the [Motion Tuning Guide](/dr-sim-manager/general/motion-tuning-guide.md).

## Monitoring Filter Activity

### Audio Notifications

Enable the **Safety Filter** audio notification in **Settings > Audio Notifications** to hear a sound each time the filter activates. This is especially useful while tuning — you can make adjustments in real time and immediately hear whether the filter is still triggering. The audio notification fires once when the filter engages and does not repeat until the filter disengages and re-engages.

### Log Entries

Set **Log Verbosity** to **DEBUG** in **Settings > General** to see detailed filter activations in the log. When the filter triggers, log entries will show which axis exceeded its threshold and by how much, for example:

```
Acceleration values (current/limit): sway: 7.06G/6.00G, pitch: 6689.56/5000 deg/s²
Safety limit exceeded on axis: pitch, sway
```

These entries help you identify exactly which axes and contributors need attention. If you see a particular axis appearing repeatedly, focus your tuning efforts there.

{% hint style="info" %}
The log only records a new entry when the set of over-limit axes **changes**. If heave is continuously over the limit, you'll see one entry when it starts and the axis will be absent from the next entry when it recovers. This prevents log spam during sustained spikes.
{% endhint %}

## Crash Detection vs. Spike Filtering

Crash detection and spike filtering are **separate features** that address different scenarios:

* **Spike filtering** reacts to individual axis acceleration exceeding a threshold. It filters the motion on that axis while everything else continues. This handles momentary telemetry spikes, aggressive curb strikes, or sudden elevation changes.
* **Crash detection** monitors game telemetry for major vehicle impacts (such as a car hitting a wall or an aircraft crashing). When a crash is detected, it can pause all motion output briefly to protect the user and equipment. Crash detection is configured separately under **Settings > Safety > Crash Detection**.

Both features can be active at the same time and complement each other — spike filtering handles sharp per-axis spikes during normal gameplay, while crash detection responds to catastrophic in-game events.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.departedreality.com/dr-sim-manager/advanced/spike-filtering.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
