Skip to content

DjiSrtImportPlan

roosit edited this page Nov 15, 2026 · 1 revision

DjiSrtImportPlan

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 DjiSrtImportPlan.java: the production code stays clean and the explanations live in the wiki.

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

import com.velitask.plugin.official.processing.FormulaParameters;
import com.velitask.plugin.official.processing.compress.AttitudeToleranceCompress;
import com.velitask.plugin.official.processing.compress.SameValueCompress;
import com.velitask.plugin.official.processing.compress.ToleranceCompress;
import com.velitask.plugin.official.processing.filters.AttitudeAverageFilter;
import com.velitask.plugin.official.processing.filters.BadPointFilter;
import com.velitask.plugin.official.processing.filters.GeoBadPointFilter;
import com.velitask.plugin.official.processing.filters.SpeedBadPointFilter;
import com.velitask.plugin.official.processing.filters.VectorAverageFilter;
import com.velitask.plugin.official.processing.gaps.ExplicitGaps;
import com.velitask.plugin.official.processing.gaps.StepGaps;
import com.velitask.sdk.SensorType;
import com.velitask.sdk.scenario.ImportPlan;
import java.util.Map;

/* Import plan for DJI telemetry from an SRT file. */
public final class DjiSrtImportPlan extends ImportPlan {

    /* Import format identifier. */
    public static final String FORMAT_ID = "dji-srt";

    public DjiSrtImportPlan() {
        super(FORMAT_ID);
    }

    @Override
    protected void define() {
        /* Pauses by gap: minimal gap 10 s, step factor 5. */
        Map<String, Object> stepValues = Map.of(StepGaps.MIN_STEP_SEC, 10, StepGaps.STEP_FACTOR, 5);
        /* Coordinates: bad point rejection (limit check), pauses by gap, compression. */
        sensor(SensorType.GEO)
                .step(GeoBadPointFilter.NAME, Map.of(BadPointFilter.USE_RANGE, true))
                .step(StepGaps.NAME, stepValues)
                .step(SameValueCompress.NAME);
        /* Elevation: the same pauses by gap, geo track taken from the coordinates. */
        sensor(SensorType.ELEVATION)
                .step(StepGaps.NAME, stepValues, track(SensorType.GEO))
                .step(SameValueCompress.NAME);
        /* Speed: rejection of negative values, pauses from the file. */
        sensor(SensorType.SPEED)
                .step(SpeedBadPointFilter.NAME, Map.of(
                        BadPointFilter.USE_RANGE, true, BadPointFilter.MIN, 0, BadPointFilter.MAX, FormulaParameters.NO_LIMIT))
                .step(ExplicitGaps.NAME, track(SensorType.GEO))
                .step(SameValueCompress.NAME);
        /* Orientation angles are off by default; no smoothing, compression tolerance 1 degree. */
        sensor(SensorType.ATTITUDE).disabled()
                .step(ExplicitGaps.NAME, track(SensorType.GEO))
                .step(AttitudeAverageFilter.NAME, Map.of(VectorAverageFilter.WINDOW_SEC, 0))
                .step(AttitudeToleranceCompress.NAME, Map.of(ToleranceCompress.TOLERANCE, 1));
        /* Computed distance, G-force and slope: compression only. */
        computed(SensorType.DISTANCE)
                .step(SameValueCompress.NAME);
        computed(SensorType.GFORCE)
                .step(SameValueCompress.NAME);
        computed(SensorType.SLOPE)
                .step(SameValueCompress.NAME);
    }
}

Purpose

Import plan for DJI telemetry from the SRT subtitle file next to the clip: coordinates, elevation, speed and orientation angles (off by default), plus computed distance, G-force and slope.

The plan processes no data itself. It tells the application which steps (formulas) to apply to each sensor of the source, in what order and with which parameter values. The steps themselves are in the packages processing/gaps, processing/filters and processing/compress, and the list of plans is collected by BuiltinScenarios. The title and description of the format in the import settings are the strings Plugin.ImportPlan.dji-srt.title ("DJI SRT") and Plugin.ImportPlan.dji-srt.description.

How it works

Data. The format identifier is "dji-srt" (the FORMAT_ID constant), it is passed to the constructor of the base ImportPlan. The define() method declares the sensor scenarios in two ways: sensor(type) is a sensor that the source reads from the file, and computed(type) is a sensor that the application computes from others (the SensorType.GEO channel). .disabled() means the scenario is off by default, and the user can turn it on in the import settings. .step(name, values, bindings) adds a step: the name is the NAME of the step, Map.of(...) holds the parameter values, track(...) is the sensor that provides the geo track to a pause step, reference(...) is the reference sensor. A step without a Map takes the default values.

Coordinates and elevation use StepGaps ("Pauses by recording gap"): minimal gap 10 s and factor 5, the moving speed during a gap is not set (the step default applies). Speed and angles use ExplicitGaps with the track(SensorType.GEO) binding. The upper limit of the speed is set by FormulaParameters.NO_LIMIT.

Settings. The step values below are taken from the plan code; the units are as in the step parameter description (speed in km/h, distances in metres, time in seconds, balance and slope in percent, acceleration in mm/s², rotation in °/s).

Sensor Steps and values
Coordinates (GEO) "Bad GPS points": limit check on; "Pauses by recording gap": minimal gap 10 s, usual step factor 5; "Data compression"
Elevation (ELEVATION) "Pauses by recording gap": 10 s, factor 5, track is GEO; "Data compression"
Speed (SPEED) "Bad speed points": limit check on, from 0 to NO_LIMIT (1.0e9); "Pauses from the file" (track is GEO); "Data compression"
Orientation angles (ATTITUDE), off "Pauses from the file" (track is GEO); "Smoothing by average: angles": window 0; "Tolerance compression: angles": tolerance 1°
Distance, computed (computed DISTANCE) "Data compression"
G-force, computed (computed GFORCE) "Data compression"
Slope, computed (computed SLOPE) "Data compression"

Drawing. Not applicable: the plan only sets the order and the values of the processing.

Features and limitations

  • Differences from the DJI video plan: the pauses of the coordinates and elevation are searched by recording gap, and the orientation angles are off.
  • The coordinates and elevation have different pause steps (StepGaps) than the speed and angles (ExplicitGaps); the plan does not explain why.
  • The user can change the values and turn scenarios on or off; the plan sets only the default values.
  • A public no-argument constructor is required: without it the user could not change the plan values in the settings. The class is final.

Clone this wiki locally