-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1e1d94
commit 8178323
Showing
8 changed files
with
271 additions
and
109 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/main/java/aero/t2s/modes/constants/NavigationUncertaintyCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package aero.t2s.modes.constants; | ||
|
||
public enum NavigationUncertaintyCategory { | ||
UNKNOWN("Unknown"), | ||
NUC1("Horizontal: < 10 m/s | Vertical: < 15.2 m/s (50fps)"), | ||
NUC2("Horizontal: < 3 m/s | Vertical: < 4.6 m/s (15fps)"), | ||
NUC3("Horizontal: < 1 m/s | Vertical: < 1.5 m/s (5fps)"), | ||
NUC4("Horizontal: < 0.3 m/s | Vertical: < 13786 m/s (1.5fps)"), | ||
; | ||
|
||
private String probability; | ||
|
||
NavigationUncertaintyCategory(String probability) { | ||
this.probability = probability; | ||
} | ||
|
||
public static NavigationUncertaintyCategory from(int code) { | ||
switch (code) { | ||
case 0: return UNKNOWN; | ||
case 1: return NUC1; | ||
case 2: return NUC2; | ||
case 3: return NUC3; | ||
case 4: return NUC4; | ||
default: throw new IllegalArgumentException("NUC " + code + " is not valid"); | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return probability; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package aero.t2s.modes.constants; | ||
|
||
public enum RocdSource { | ||
BARO, | ||
GNSS, | ||
; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package aero.t2s.modes.constants; | ||
|
||
public enum Speed { | ||
KTS, | ||
KMH, | ||
|
||
IAS, | ||
TAS, | ||
GS, | ||
; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/main/java/aero/t2s/modes/decoder/df/df17/AirborneVelocityAirspeedHeading.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package aero.t2s.modes.decoder.df.df17; | ||
|
||
import aero.t2s.modes.Track; | ||
import aero.t2s.modes.constants.RocdSource; | ||
import aero.t2s.modes.constants.Speed; | ||
|
||
public class AirborneVelocityAirspeedHeading extends AirborneVelocity { | ||
private static final double HEADING_RESOLUTION = 360.0 / 1024.0; | ||
|
||
private boolean headingAvailable; | ||
private double heading; | ||
|
||
private boolean airspeedAvailable; | ||
private Speed airspeedType; | ||
private int airspeed; | ||
|
||
public AirborneVelocityAirspeedHeading(short[] data) { | ||
super(data); | ||
} | ||
|
||
@Override | ||
public AirborneVelocityAirspeedHeading decode() { | ||
decodeCommonInformation(); | ||
|
||
headingAvailable = (data[5] & 0b00000100) != 0; | ||
heading = (((data[5] & 0b00000011) << 8) | data[6]) * HEADING_RESOLUTION; | ||
|
||
airspeed = ((data[7] & 0b01111111) << 3) | (data[8] & 0b11100000) >>> 5; | ||
airspeedAvailable = airspeed != 0; | ||
airspeed = (airspeed - 1) * (isSupersonic() ? 4 : 1); | ||
airspeedType = ((data[7] & 0b10000000) != 0) ? Speed.TAS : Speed.IAS; | ||
|
||
return this; | ||
} | ||
|
||
@Override | ||
public void apply(Track track) { | ||
track.setNACv(NACv.ordinal()); | ||
|
||
if (isGnssAltitudeDifferenceFromBaroAvailable()) { | ||
track.setGeometricHeightOffset(getGnssAltitudeDifferenceFromBaro()); | ||
} | ||
|
||
if (isRocdAvailable()) { | ||
track.setRocdAvailable(true); | ||
track.setRocdSourceBaro(getRocdSource() == RocdSource.BARO); | ||
if (getRocdSource() == RocdSource.BARO) { | ||
track.setBaroRocd(getRocd()); | ||
} else { | ||
track.setRocd(getRocd()); | ||
} | ||
} | ||
} | ||
|
||
public boolean isHeadingAvailable() { | ||
return headingAvailable; | ||
} | ||
|
||
public double getHeading() { | ||
return heading; | ||
} | ||
|
||
public boolean isAirspeedAvailable() { | ||
return airspeedAvailable; | ||
} | ||
|
||
public Speed getAirspeedType() { | ||
return airspeedType; | ||
} | ||
|
||
public int getAirspeed() { | ||
return airspeed; | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
src/main/java/aero/t2s/modes/decoder/df/df17/AirborneVelocityGroundspeed.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package aero.t2s.modes.decoder.df.df17; | ||
|
||
import aero.t2s.modes.Track; | ||
import aero.t2s.modes.constants.RocdSource; | ||
|
||
public class AirborneVelocityGroundspeed extends AirborneVelocity { | ||
private boolean xVelocityAvailable; | ||
private int xVelocity; | ||
|
||
private boolean yVelocityAvailable; | ||
private int yVelocity; | ||
|
||
public AirborneVelocityGroundspeed(short[] data) { | ||
super(data); | ||
} | ||
|
||
@Override | ||
public AirborneVelocityGroundspeed decode() { | ||
decodeCommonInformation(); | ||
|
||
xVelocity = ((data[5] & 0b00000011) << 8) | data[6]; | ||
xVelocityAvailable = xVelocity != 0; | ||
xVelocity = (xVelocity - 1) * (isSupersonic() ? 4 : 1); | ||
if ((data[5] & 0b00000100) != 0) { | ||
xVelocity *= -1; | ||
} | ||
|
||
yVelocity = ((data[7] & 0b01111111) << 3) | (data[8] & 0b11100000) >>> 5; | ||
yVelocityAvailable = yVelocity != 0; | ||
yVelocity = (yVelocity - 1) * (isSupersonic() ? 4 : 1); | ||
if ((data[7] & 0b10000000) != 0) { | ||
yVelocity *= -1; | ||
} | ||
|
||
|
||
return this; | ||
} | ||
|
||
@Override | ||
public void apply(Track track) { | ||
track.setNACv(NACv.ordinal()); | ||
|
||
if (isGnssAltitudeDifferenceFromBaroAvailable()) { | ||
track.setGeometricHeightOffset(getGnssAltitudeDifferenceFromBaro()); | ||
} | ||
|
||
if (isRocdAvailable()) { | ||
track.setRocdAvailable(true); | ||
track.setRocdSourceBaro(getRocdSource() == RocdSource.BARO); | ||
if (getRocdSource() == RocdSource.BARO) { | ||
track.setBaroRocd(getRocd()); | ||
} else { | ||
track.setRocd(getRocd()); | ||
} | ||
} | ||
|
||
if (xVelocityAvailable) { | ||
track.setVx(xVelocity); | ||
} | ||
|
||
if (yVelocityAvailable) { | ||
track.setVy(yVelocity); | ||
} | ||
|
||
if (xVelocityAvailable && yVelocityAvailable) { | ||
track.setGs(Math.sqrt(xVelocity * xVelocity + yVelocity * yVelocity)); | ||
} | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
src/main/java/aero/t2s/modes/decoder/df/df17/AirborneVelocityVersion0.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.