Repository navigation
DjiImportPlan
Up | Previous | Next | Русский
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 DjiImportPlan.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.sdk.SensorType;
import com.velitask.sdk.scenario.ImportPlan;
import java.util.Map;
/* Import plan for telemetry from DJI video. */
public final class DjiImportPlan extends ImportPlan {
/* Import format identifier. */
public static final String FORMAT_ID = "dji";
public DjiImportPlan() {
super(FORMAT_ID);
}
@Override
protected void define() {
/* Coordinates: bad point rejection (limit check), pauses from the file, compression. */
sensor(SensorType.GEO)
.step(GeoBadPointFilter.NAME, Map.of(BadPointFilter.USE_RANGE, true))
.step(ExplicitGaps.NAME)
.step(SameValueCompress.NAME);
/* Elevation: pauses from the file by the geo track. */
sensor(SensorType.ELEVATION)
.step(ExplicitGaps.NAME, track(SensorType.GEO))
.step(SameValueCompress.NAME);
/* Speed: rejection of negative values (no upper limit), 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: no smoothing, compression tolerance 1 degree. */
sensor(SensorType.ATTITUDE)
.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);
}
}Import plan for telemetry recorded inside DJI video files: coordinates, elevation, speed and orientation angles of the body or gimbal, plus computed distance, G-force and slope. All scenarios are on.
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.title ("DJI") and Plugin.ImportPlan.dji.description.
Data. The format identifier is "dji" (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.
Pauses are everywhere taken by ExplicitGaps ("Pauses from the file"). The upper limit of the speed is set by the constant FormulaParameters.NO_LIMIT (1.0e9): only negative values are rejected.
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 (the valid latitude and longitude are set by the step itself); "Pauses from the file"; "Data compression" |
Elevation (ELEVATION) |
"Pauses from the file" (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) |
"Pauses from the file" (track is GEO); "Smoothing by average: angles": window 0 (no smoothing); "Tolerance compression: angles": tolerance 1° |
Distance, computed (computed DISTANCE) |
"Data compression" |
G-force, computed (computed GFORCE) |
"Data compression" |
Slope, computed (computed SLOPE) |
"Data compression" |
There are no scenarios that are off in the plan.
Drawing. Not applicable: the plan only sets the order and the values of the processing.
- Unlike DJI SRT, the orientation angles are on here.
- Coordinate pauses are not searched by recording gap: only the pauses from the file are used.
- There is no rejection for the computed slope.
- 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.