Skip to content

TmgImportPlan

roosit edited this page Nov 15, 2026 · 1 revision

TmgImportPlan

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 TmgImportPlan.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.SameValueCompress;
import com.velitask.plugin.official.processing.gaps.FollowGaps;
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 TMG recordings. */
public final class TmgImportPlan extends ImportPlan {

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

    public TmgImportPlan() {
        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);
        /* Wheel is the reference sensor for the others: pauses by gap, geo track taken from the coordinates. */
        sensor(SensorType.WHEEL)
                .step(StepGaps.NAME, stepValues, track(SensorType.GEO))
                .step(SameValueCompress.NAME);
        /* Distance, speed and tilt: the same pauses by gap. */
        sensor(SensorType.DISTANCE)
                .step(StepGaps.NAME, stepValues, track(SensorType.GEO))
                .step(SameValueCompress.NAME);
        sensor(SensorType.SPEED)
                .step(StepGaps.NAME, stepValues, track(SensorType.GEO))
                .step(SameValueCompress.NAME);
        sensor(SensorType.TILT)
                .step(StepGaps.NAME, stepValues, track(SensorType.GEO))
                .step(SameValueCompress.NAME);
        /* Coordinates: pauses by gap without bindings to other sensors. */
        sensor(SensorType.GEO)
                .step(StepGaps.NAME, stepValues)
                .step(SameValueCompress.NAME);
        /* Elevation, temperature, pressure, electrical readings and cadence repeat the wheel pauses. */
        sensor(SensorType.ELEVATION)
                .step(FollowGaps.NAME, track(SensorType.GEO), reference(SensorType.WHEEL))
                .step(SameValueCompress.NAME);
        sensor(SensorType.TEMPERATURE)
                .step(FollowGaps.NAME, track(SensorType.GEO), reference(SensorType.WHEEL))
                .step(SameValueCompress.NAME);
        sensor(SensorType.PRESSURE)
                .step(FollowGaps.NAME, track(SensorType.GEO), reference(SensorType.WHEEL))
                .step(SameValueCompress.NAME);
        sensor(SensorType.ELECTRIC)
                .step(FollowGaps.NAME, track(SensorType.GEO), reference(SensorType.WHEEL))
                .step(SameValueCompress.NAME);
        sensor(SensorType.CADENC)
                .step(FollowGaps.NAME, track(SensorType.GEO), reference(SensorType.WHEEL))
                .step(SameValueCompress.NAME);
        /* 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 telemetry recordings in the TMG format (sources of the TELEMIGER type): wheel, distance, speed, tilt, coordinates, elevation, temperature, pressure, electrical readings and cadence, 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.tmg.title ("TMG") and Plugin.ImportPlan.tmg.description.

How it works

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

The reference sensor is the wheel (SensorType.WHEEL). The pauses of the wheel, distance, speed, tilt and coordinates are searched by StepGaps ("Pauses by recording gap"); elevation, temperature, pressure, electrical readings and cadence repeat the wheel pauses through FollowGaps ("Pauses as in the reference sensor", the reference(SensorType.WHEEL) binding). If the recording has no reference sensor, FollowGaps adds no pauses.

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
Wheel (WHEEL) "Pauses by recording gap": minimal gap 10 s, usual step factor 5, track is GEO; "Data compression"
Distance (DISTANCE) the same "Pauses by recording gap" (10 s, 5, track is GEO); "Data compression"
Speed (SPEED) the same "Pauses by recording gap" (10 s, 5, track is GEO); "Data compression"
Tilt (TILT) the same "Pauses by recording gap" (10 s, 5, track is GEO); "Data compression"
Coordinates (GEO) "Pauses by recording gap" (10 s, 5, no bindings); "Data compression"
Elevation (ELEVATION) "Pauses as in the reference sensor": track is GEO, reference is WHEEL; "Data compression"
Temperature (TEMPERATURE) "Pauses as in the reference sensor" (track GEO, reference WHEEL); "Data compression"
Pressure (PRESSURE) "Pauses as in the reference sensor" (track GEO, reference WHEEL); "Data compression"
Electrical readings (ELECTRIC) "Pauses as in the reference sensor" (track GEO, reference WHEEL); "Data compression"
Cadence (CADENC) "Pauses as in the reference sensor" (track GEO, reference WHEEL); "Data compression"
Distance, computed (computed DISTANCE) "Data compression"
G-force, computed (computed GFORCE) "Data compression"
Slope, computed (computed SLOPE) "Data compression"

The speed during a gap (maxSpeed) is not set in the TMG plan: the step default applies. The plan has no bad point rejection, no smoothing and no scenarios that are off.

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

Features and limitations

  • Only the TMG plan uses FollowGaps and the reference(...) binding.
  • stepValues are shared by the wheel, distance, speed, tilt and coordinates; the other sensors have no thresholds of their own: they follow the wheel.
  • The computed slope is on by default, unlike FIT, TCX and GoPro.
  • 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