Groundwork to track "reliable" messages & aircraft.
A "reliable" message is a DF17 or DF11 with good CRC. A "reliable" aircraft is one that's probably real - we decide it's reliable when we've seen enough reliable messages, or just enough messages in total, that it's unlikely to be noise.
This commit is contained in:
parent
dda442c121
commit
ce89cd08d9
|
|
@ -410,6 +410,7 @@ struct modesMessage {
|
||||||
int remote; // If set this message is from a remote station
|
int remote; // If set this message is from a remote station
|
||||||
double signalLevel; // RSSI, in the range [0..1], as a fraction of full-scale power
|
double signalLevel; // RSSI, in the range [0..1], as a fraction of full-scale power
|
||||||
int score; // Scoring from scoreModesMessage, if used
|
int score; // Scoring from scoreModesMessage, if used
|
||||||
|
int reliable; // is this a "reliable" message (uncorrected DF11/DF17/DF18)?
|
||||||
|
|
||||||
datasource_t source; // Characterizes the overall message source
|
datasource_t source; // Characterizes the overall message source
|
||||||
|
|
||||||
|
|
|
||||||
7
mode_s.c
7
mode_s.c
|
|
@ -465,6 +465,7 @@ int decodeModesMessage(struct modesMessage *mm, unsigned char *msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mm->source = SOURCE_MODE_S_CHECKED;
|
mm->source = SOURCE_MODE_S_CHECKED;
|
||||||
|
mm->reliable = (mm->IID == 0 && mm->correctedbits == 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 17: // Extended squitter
|
case 17: // Extended squitter
|
||||||
|
|
@ -493,6 +494,7 @@ int decodeModesMessage(struct modesMessage *mm, unsigned char *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
mm->source = SOURCE_ADSB; // TIS-B decoding will override this if needed
|
mm->source = SOURCE_ADSB; // TIS-B decoding will override this if needed
|
||||||
|
mm->reliable = (mm->correctedbits == 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1442,6 +1444,8 @@ static void decodeExtendedSquitter(struct modesMessage *mm)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
// Dubious.
|
||||||
|
mm->reliable = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1878,6 +1882,9 @@ void displayModesMessage(struct modesMessage *mm) {
|
||||||
mm->metype);
|
mm->metype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mm->reliable) {
|
||||||
|
printf(" (reliable)");
|
||||||
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if (mm->msgtype == 20 || mm->msgtype == 21) {
|
if (mm->msgtype == 20 || mm->msgtype == 21) {
|
||||||
|
|
|
||||||
23
track.c
23
track.c
|
|
@ -927,6 +927,26 @@ struct aircraft *trackUpdateFromMessage(struct modesMessage *mm)
|
||||||
a->seen = messageNow();
|
a->seen = messageNow();
|
||||||
a->messages++;
|
a->messages++;
|
||||||
|
|
||||||
|
// count reliable messages we receive; use them as a metric to
|
||||||
|
// decide when this is a real aircraft, not noise
|
||||||
|
if (mm->msgtype == 11 && mm->reliable) {
|
||||||
|
++a->reliableDF11;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mm->msgtype == 17 && mm->reliable) {
|
||||||
|
++a->reliableDF17;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a->reliableDF11 >= TRACK_RELIABLE_DF11_MESSAGES || a->reliableDF17 >= TRACK_RELIABLE_DF17_MESSAGES || a->messages >= TRACK_RELIABLE_ANY_MESSAGES) {
|
||||||
|
a->reliable = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mm->reliable && !a->reliable) {
|
||||||
|
// no further update from this message as we don't trust it
|
||||||
|
++a->discarded;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
// update addrtype, we only ever go towards "more direct" types
|
// update addrtype, we only ever go towards "more direct" types
|
||||||
if (mm->addrtype < a->addrtype)
|
if (mm->addrtype < a->addrtype)
|
||||||
a->addrtype = mm->addrtype;
|
a->addrtype = mm->addrtype;
|
||||||
|
|
@ -1282,8 +1302,7 @@ static void trackRemoveStaleAircraft(uint64_t now)
|
||||||
struct aircraft *prev = NULL;
|
struct aircraft *prev = NULL;
|
||||||
|
|
||||||
while(a) {
|
while(a) {
|
||||||
if ((now - a->seen) > TRACK_AIRCRAFT_TTL ||
|
if ((now - a->seen) > TRACK_AIRCRAFT_TTL || (!a->reliable && (now - a->seen) > TRACK_AIRCRAFT_UNRELIABLE_TTL)) {
|
||||||
(a->messages == 1 && (now - a->seen) > TRACK_AIRCRAFT_ONEHIT_TTL)) {
|
|
||||||
// Count aircraft where we saw only one message before reaping them.
|
// Count aircraft where we saw only one message before reaping them.
|
||||||
// These are likely to be due to messages with bad addresses.
|
// These are likely to be due to messages with bad addresses.
|
||||||
if (a->messages == 1)
|
if (a->messages == 1)
|
||||||
|
|
|
||||||
20
track.h
20
track.h
|
|
@ -50,11 +50,11 @@
|
||||||
#ifndef DUMP1090_TRACK_H
|
#ifndef DUMP1090_TRACK_H
|
||||||
#define DUMP1090_TRACK_H
|
#define DUMP1090_TRACK_H
|
||||||
|
|
||||||
/* Maximum age of tracked aircraft in milliseconds */
|
/* Maximum age of a reliable tracked aircraft in milliseconds */
|
||||||
#define TRACK_AIRCRAFT_TTL 300000
|
#define TRACK_AIRCRAFT_TTL 300000
|
||||||
|
|
||||||
/* Maximum age of a tracked aircraft with only 1 message received, in milliseconds */
|
/* Maximum age of an unreliable tracked aircraft, in milliseconds */
|
||||||
#define TRACK_AIRCRAFT_ONEHIT_TTL 60000
|
#define TRACK_AIRCRAFT_UNRELIABLE_TTL 60000
|
||||||
|
|
||||||
/* Maximum validity of an aircraft position */
|
/* Maximum validity of an aircraft position */
|
||||||
#define TRACK_AIRCRAFT_POSITION_TTL 60000
|
#define TRACK_AIRCRAFT_POSITION_TTL 60000
|
||||||
|
|
@ -64,6 +64,15 @@
|
||||||
*/
|
*/
|
||||||
#define TRACK_MODEAC_MIN_MESSAGES 4
|
#define TRACK_MODEAC_MIN_MESSAGES 4
|
||||||
|
|
||||||
|
/* Minimum number of DF17 messages required to mark a track as reliable */
|
||||||
|
#define TRACK_RELIABLE_DF17_MESSAGES 2
|
||||||
|
|
||||||
|
/* Minimum number of DF11 messages required to mark a track as reliable */
|
||||||
|
#define TRACK_RELIABLE_DF11_MESSAGES 3
|
||||||
|
|
||||||
|
/* Minimum number of any sort of messages required to mark a track as reliable */
|
||||||
|
#define TRACK_RELIABLE_ANY_MESSAGES 5
|
||||||
|
|
||||||
/* Special value for Rc unknown */
|
/* Special value for Rc unknown */
|
||||||
#define RC_UNKNOWN 0
|
#define RC_UNKNOWN 0
|
||||||
|
|
||||||
|
|
@ -89,6 +98,11 @@ struct aircraft {
|
||||||
uint64_t seen; // Time (millis) at which the last packet was received
|
uint64_t seen; // Time (millis) at which the last packet was received
|
||||||
long messages; // Number of Mode S messages received
|
long messages; // Number of Mode S messages received
|
||||||
|
|
||||||
|
int reliable; // Do we think this is a real aircraft, not noise?
|
||||||
|
long reliableDF11; // Number of "reliable" DF11s (no CRC errors corrected, IID = 0) received
|
||||||
|
long reliableDF17; // Number of "reliable" DF17s (no CRC errors corrected) received
|
||||||
|
long discarded; // Number of messages discarded as possibly-noise
|
||||||
|
|
||||||
double signalLevel[8]; // Last 8 Signal Amplitudes
|
double signalLevel[8]; // Last 8 Signal Amplitudes
|
||||||
int signalNext; // next index of signalLevel to use
|
int signalNext; // next index of signalLevel to use
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue