mutability / dump1090

Dump1090 is a simple Mode S decoder for RTLSDR devices
528 stars 137 forks source link

Support for Stratux v0.8 #122

Closed ghost closed 5 years ago

ghost commented 8 years ago

The Stratux output format includes full support for airborne DF18 TIS-B / ADS-R messages. Fields are intended to decode using the following type definitions. Fields denoted as *pointers will be sent as 'null' if the reported parameter is not part of the message being decoded.

type dump1090Data struct {
    Icao_addr           uint32
    DF                  int     // Mode S downlink format.
    CA                  int     // Lowest 3 bits of first byte of Mode S message (DF11 and DF17 capability; DF18 control field, zero for all other DF types)
    TypeCode            int     // Mode S type code
    SubtypeCode         int     // Mode S subtype code
    SBS_MsgType         int     // type of SBS message (9 indicates target state /operational status)
    SignalLevel         float64 // Decimal RSSI (0-1 nominal)
    Tail                *string
    Squawk              *int // Mode A squawk code. Decimal representation of octal format
    Emitter_category    *int
    OnGround            *bool
    Lat                 *float32
    Lng                 *float32
    Position_valid      bool
    NACp                *int
    Alt                 *int
    AltIsGNSS           bool
    GnssDiffFromBaroAlt *int16 // GNSS height above baro altitude in feet
    Vvel                *int16
    Speed_valid         bool
    Speed               *uint16
    Track               *uint16
    Timestamp           time.Time // timestamp of last message, UTC
}

Sample Mode S surveillance replies (DF4 / DF 5):

{"Icao_addr":10525328,"DF":4,"CA":0,"TypeCode":0,"SubtypeCode":0,"SBS_MsgType":5,"SignalLevel":0.012829,"Tail":null,"Squawk":null,"Emitter_category":null,"OnGround":false,"Lat":null,"Lng":null,"Position_valid":false,"NACp":null,"Alt":14400,"AltIsGNSS":false,"GnssDiffFromBaroAlt":null,"Vvel":null,"Speed_valid":false,"Speed":null,"Track":null,"Timestamp":"2016-02-24T00:44:34.309Z"}
{"Icao_addr":10525328,"DF":5,"CA":0,"TypeCode":0,"SubtypeCode":0,"SBS_MsgType":6,"SignalLevel":0.014155,"Tail":null,"Squawk":3651,"Emitter_category":null,"OnGround":false,"Lat":null,"Lng":null,"Position_valid":false,"NACp":null,"Alt":null,"AltIsGNSS":false,"GnssDiffFromBaroAlt":null,"Vvel":null,"Speed_valid":false,"Speed":null,"Track":null,"Timestamp":"2016-02-24T00:39:30.492Z"}

Sample airborne position message (DF17 BDS 0,5):

{"Icao_addr":10525328,"DF":17,"CA":5,"TypeCode":11,"SubtypeCode":0,"SBS_MsgType":3,"SignalLevel":0.011162,,"Tail":null,"Squawk":null,"Emitter_category":null,"OnGround":false,"Lat":44.933384,"Lng":-93.762147,"Position_valid":true,"NACp":null,"Alt":13850,"AltIsGNSS":false,"GnssDiffFromBaroAlt":null,"Vvel":null,"Speed_valid":false,"Speed":null,"Track":null,"Timestamp":"2016-02-24T00:44:19.783Z"}

Sample airborne velocity message (DF17 BDS 0,8):

{"Icao_addr":10525328,"DF":17,"CA":5,"TypeCode":19,"SubtypeCode":1,"SBS_MsgType":4,"SignalLevel":0.007394,"Tail":null,"Squawk":null,"Emitter_category":null,"OnGround":false,"Lat":null,"Lng":null,"Position_valid":false,"NACp":null,"Alt":null,"AltIsGNSS":false,"GnssDiffFromBaroAlt":-400,"Vvel":2304,"Speed_valid":true,"Speed":306,"Track":271,"Timestamp":"2016-02-24T00:44:21.908Z"}

Sample identification message (DF17 BDS 0,8):

{"Icao_addr":10525328,"DF":17,"CA":5,"TypeCode":4,"SubtypeCode":3,"SBS_MsgType":1,"SignalLevel":0.007926,"Tail":"SKW5956 ","Squawk":null,"Emitter_category":3,"OnGround":false,"Lat":null,"Lng":null,"Position_valid":false,"NACp":null,"Alt":null,"AltIsGNSS":false,"GnssDiffFromBaroAlt":null,"Vvel":null,"Speed_valid":false,"Speed":null,"Track":null,"Timestamp":"2016-02-24T00:44:34.105Z"}
mutability commented 8 years ago

Can you give me some more context here? Does Stratux rely on this output? I thought it had its own decoder in some form..

ghost commented 8 years ago

Sure.

Stratux has always used dump978 raw hex string output. The UAT traffic messages are easy to decode, and there's always been a need to pass undecoded uplink (FIS-B) messages in the GDL90 output stream. Currently, traffic messages and text weather messages are decoded.

When 1090 MHz traffic support was added, we initially used dump1090 port 30003 (SBS1) -- no sense in reinventing the wheel and trying to decode something as convoluted as Mode S ourselves. For several months, we ran used the latest commit from the antirez branch, until the lack of Q-bit handling caused certain light aircraft to show altitudes of 0'. At that point we switched to MalcolmRobb's branch.

The lack of certain information (GNSS height delta, NACp, DF / CA fields, signal strength) in the SBS1 messages had been something of a dissatisfier for me. Rather than extend the SBS1 format and possibly break compatibility with other applications, I forked MalcolmRobb, added support for TIS-B, NACp, and GNSS delta height, and created a new interface on port 30006 earlier this year.

Subsequent to that, I learned about your branch, and ported the interface improvements.

Romeo-Golf commented 7 years ago

This looks interesting, would it need updating to make a clean merge with the latest code?