Skip to content

GoproImportPlan

roosit edited this page Nov 15, 2026 · 1 revision

GoproImportPlan

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 GoproImportPlan.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.compress.AccelToleranceCompress;
import com.velitask.plugin.official.processing.compress.GyroToleranceCompress;
import com.velitask.plugin.official.processing.compress.OrientToleranceCompress;
import com.velitask.plugin.official.processing.compress.SameValueCompress;
import com.velitask.plugin.official.processing.compress.ToleranceCompress;
import com.velitask.plugin.official.processing.filters.AccelAverageFilter;
import com.velitask.plugin.official.processing.filters.BadPointFilter;
import com.velitask.plugin.official.processing.filters.DriftFilter;
import com.velitask.plugin.official.processing.filters.ElevationBadPointFilter;
import com.velitask.plugin.official.processing.filters.ExponentialFilter;
import com.velitask.plugin.official.processing.filters.GeoBadPointFilter;
import com.velitask.plugin.official.processing.filters.GyroAverageFilter;
import com.velitask.plugin.official.processing.filters.OrientAverageFilter;
import com.velitask.plugin.official.processing.filters.SlopeBadPointFilter;
import com.velitask.plugin.official.processing.filters.SpeedBadPointFilter;
import com.velitask.plugin.official.processing.filters.SpeedDriftFilter;
import com.velitask.plugin.official.processing.filters.SpeedExponentialFilter;
import com.velitask.plugin.official.processing.filters.VectorAverageFilter;
import com.velitask.plugin.official.processing.gaps.ExplicitGaps;
import com.velitask.sdk.SensorType;
import com.velitask.sdk.scenario.ImportPlan;
import java.util.Map;

/* Import plan for GoPro telemetry. */
public final class GoproImportPlan extends ImportPlan {

    /* Import format identifier. */
    public static final String FORMAT_ID = "gopro";

    public GoproImportPlan() {
        super(FORMAT_ID);
    }

    @Override
    protected void define() {
        /* Coordinates: for 8 s after a pause the values are not trusted, a jump faster than 200 km/h is rejected, */
        /* reset after a 30 s break, the "no data" marker is rejected. */
        sensor(SensorType.GEO)
                .step(GeoBadPointFilter.NAME, Map.of(
                        BadPointFilter.SETTLE_SEC, 8, BadPointFilter.MAX_RATE, 200, BadPointFilter.RATE_RESET_SEC, 30,
                        BadPointFilter.USE_MARKER, true))
                .step(ExplicitGaps.NAME)
                .step(SameValueCompress.NAME);
        /* Speed (off): rejection in the first 8 s after a pause, */
        /* drift is zeroed below 4 km/h, gradual smoothing with factor 0.4. */
        sensor(SensorType.SPEED).disabled()
                .step(SpeedBadPointFilter.NAME, Map.of(BadPointFilter.SETTLE_SEC, 8))
                .step(ExplicitGaps.NAME, track(SensorType.GEO))
                .step(SpeedDriftFilter.NAME, Map.of(DriftFilter.SPEED_BELOW, 4))
                .step(SpeedExponentialFilter.NAME, Map.of(ExponentialFilter.ALPHA, 0.4))
                .step(SameValueCompress.NAME);
        /* Elevation (off): rejection in the first 8 s after a pause. */
        sensor(SensorType.ELEVATION).disabled()
                .step(ElevationBadPointFilter.NAME, Map.of(BadPointFilter.SETTLE_SEC, 8))
                .step(ExplicitGaps.NAME, track(SensorType.GEO))
                .step(SameValueCompress.NAME);
        /* Temperature (off): only pauses and compression. */
        sensor(SensorType.TEMPERATURE).disabled()
                .step(ExplicitGaps.NAME, track(SensorType.GEO))
                .step(SameValueCompress.NAME);
        /* Acceleration (off): average over a 0.04 s window, compression tolerance 981 mm/s² (about 0.1 g). */
        sensor(SensorType.ACCEL).disabled()
                .step(ExplicitGaps.NAME, track(SensorType.GEO))
                .step(AccelAverageFilter.NAME, Map.of(VectorAverageFilter.WINDOW_SEC, 0.04))
                .step(AccelToleranceCompress.NAME, Map.of(ToleranceCompress.TOLERANCE, 981));
        /* Rotation (off): average over a 0.04 s window, compression tolerance 4 °/s. */
        sensor(SensorType.GYRO).disabled()
                .step(ExplicitGaps.NAME, track(SensorType.GEO))
                .step(GyroAverageFilter.NAME, Map.of(VectorAverageFilter.WINDOW_SEC, 0.04))
                .step(GyroToleranceCompress.NAME, Map.of(ToleranceCompress.TOLERANCE, 4));
        /* Camera orientation (off): no smoothing, compression tolerance 0.01 (about 1°). */
        sensor(SensorType.ORIENT).disabled()
                .step(ExplicitGaps.NAME, track(SensorType.GEO))
                .step(OrientAverageFilter.NAME, Map.of(VectorAverageFilter.WINDOW_SEC, 0))
                .step(OrientToleranceCompress.NAME, Map.of(ToleranceCompress.TOLERANCE, 0.01));
        /* Computed distance and G-force (off): compression only. */
        computed(SensorType.DISTANCE).disabled()
                .step(SameValueCompress.NAME);
        computed(SensorType.GFORCE).disabled()
                .step(SameValueCompress.NAME);
        /* Computed slope (off): rejection outside -45..45 %, then compression. */
        computed(SensorType.SLOPE).disabled()
                .step(SlopeBadPointFilter.NAME,
                        Map.of(BadPointFilter.USE_RANGE, true, BadPointFilter.MIN, -45, BadPointFilter.MAX, 45))
                .step(SameValueCompress.NAME);
    }
}

Purpose

Import plan for telemetry from GoPro clips: GPS, speed, elevation, temperature, accelerometer, gyroscope and camera orientation. Only the coordinates are on; the other scenarios are off by default, and the user turns them on in the import settings.

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.gopro.title ("GoPro") and Plugin.ImportPlan.gopro.description.

How it works

Data. The format identifier is "gopro" (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.

GoPro uses ExplicitGaps ("Pauses from the file") almost everywhere, and the geo track of the other sensors is taken from track(SensorType.GEO). The BadPointFilter.SETTLE_SEC parameter (8 s) rejects values in the first seconds after a pause, while the GPS receiver has not settled yet.

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), on "Bad GPS points": settling time 8 s, rate of change limit 200 km/h, reset after a break 30 s, the "no data" marker is rejected; "Pauses from the file"; "Data compression"
Speed (SPEED), off "Bad speed points": settling time 8 s; "Pauses from the file" (track is GEO); "Speed drift at a stop": zero below 4 km/h; "Gradual smoothing: speed": factor 0.4; "Data compression"
Elevation (ELEVATION), off "Bad elevation points": settling time 8 s; "Pauses from the file"; "Data compression"
Temperature (TEMPERATURE), off "Pauses from the file"; "Data compression"
Acceleration (ACCEL), off "Pauses from the file"; "Smoothing by average: acceleration": window 0.04 s; "Tolerance compression: acceleration": tolerance 981 mm/s²
Rotation (GYRO), off "Pauses from the file"; "Smoothing by average: rotation": window 0.04 s; "Tolerance compression: rotation": tolerance 4 °/s
Camera orientation (ORIENT), off "Pauses from the file"; "Smoothing by average: camera orientation": window 0 (no smoothing); "Tolerance compression: camera orientation": tolerance 0.01
Distance, computed (computed DISTANCE), off "Data compression"
G-force, computed (computed GFORCE), off "Data compression"
Slope, computed (computed SLOPE), off "Bad slope points": limit check on, -45..45; "Data compression"

A window of 0 in an averaging step means "do not smooth"; the step itself stays in the scenario.

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

Features and limitations

  • Only the coordinates are on: speed, elevation, temperature, the sensors and all computed sensors are off by default.
  • It is the only plan with speed smoothing, speed drift and smoothing of the acceleration, rotation and camera orientation sensors.
  • The compression tolerances are set in the units of their sensors, so the numbers are not comparable with each other (981 mm/s², 4 °/s, 0.01).
  • 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