Skip to content

SpeedBadPointFilter

roosit edited this page Nov 15, 2026 · 1 revision

SpeedBadPointFilter

Up | Previous | Next | Русский

Full source with short explanations

Below is the full source of the class in documentation form. The comments inside the block explain the purpose of the parts of the class, but they are not stored in the working file SpeedBadPointFilter.java: the production code stays clean and the explanations live in the wiki.

package com.velitask.plugin.official.processing.filters;

import com.velitask.sdk.data.SpeedSensorAtom;

/* Bad speed points. */
public final class SpeedBadPointFilter extends BadPointFilter<SpeedSensorAtom> {

    /* Stable step name in plans and settings. */
    public static final String NAME = "speedBadPoint";

    /* The atom stores the speed in thousandths of km/h. */
    private static final double UNITS_PER_KMH = 1000d;

    public SpeedBadPointFilter() {
        /* Step version 1; the sensor atom is SpeedSensorAtom. */
        super(NAME, 1, SpeedSensorAtom.class);
    }

    @Override
    /* Speed in km/h. */
    protected double value(SpeedSensorAtom atom) {
        return atom.speed / UNITS_PER_KMH;
    }
}

Purpose

SpeedBadPointFilter is the "Bad speed points" filter for the SpeedSensorAtom sensor. It rejects values that cannot be trusted: right after a pause, outside the limits, with a too fast jump or a single spike. The whole algorithm and the ten parameters are in the base class BadPointFilter; the class only binds it to the atom.

How it works

  • Name and version: speedBadPoint, version 1.
  • value is the speed field of the atom divided by 1000: the atom stores the speed in thousandths of km/h, the filter works in km/h (the UNITS_PER_KMH constant). The parameters in sensor units (min, max, deviation, floor) are set in km/h; maxRate is in these units per hour.

Where it is used. The step is registered in BuiltinScenarios. The plans: FitImportPlan - useRange = true, min = 0, max = 120; DjiImportPlan and DjiSrtImportPlan - useRange = true, min = 0, max = FormulaParameters.NO_LIMIT (10^9, that is, only negative speeds are rejected); GoproImportPlan - settleSec = 8 (the speed sensor in the GoPro plan is marked disabled()).

Features and limitations

  • By default all parameters are off (0 or false) and the filter removes nothing; the values are set by the import plans, the user can change them in the step settings.
  • The "Check the limits" checkbox without set limits will reject all values except zero (min = max = 0 by default).
  • The other features (the order of the checks, the comparison with the last accepted point, the median window of spikes) are in BadPointFilter.

Clone this wiki locally