Pergunta

I'm writing a program that receives data in the form of GPRMC NMEA sentences and outputs it as specified by GTFS-realtime.

GTFS-realtime wants a "bearing" value, and describes it as such:

Bearing, in degrees, clockwise from True North, i.e., 0 is North and 90 is East. This can be the compass bearing, or the direction towards the next stop or intermediate location. This should not be deduced from the sequence of previous positions, which clients can compute from previous data.

GPRMC NMEA sentences contain three fields that I believe are relevant, but my research has turned up a bunch of different ideas on what they are:

  1. Track angle in degrees True, Course Made Good, True, Track made good in degrees True
  2. Magnetic Variation, Variation, Magnetic variation degrees (Easterly var. subtracts from true course)
  3. Magnetic Variation, East/West, E or W

For completeness, here's a complete GPRMC sentence, with the relevant fields bolded:

$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A

How would I go about deriving a bearing in GTFS-realtime's format from a GPRMC NMEA sentence?

Foi útil?

Solução

I recently bought a GPS Module to connect to my Arduino and had to learn about GPRMC sentence structure. Since GPS calculates direction by drawing a vector from the previous position to the current position, the correction for the magnetic North Pole doesn't come into consideration. The bearing in GTFS-realtime should be the same as the "Track angle in degrees True" of GPRMC. They are both in terms of True North. Imagine you are standing at the center of a circle, and you are facing true north. As you rotate clockwise 30 degrees, you will be on a bearing of 30 degrees (if you move forward). The data structure should be something like this, I think:

header {
  gtfs_realtime_version: "1.0"
}
entity {
    id: "myPosition"
    vehiclePosition{
        position{
            position_id: "myBearing"{
                bearing: 84.4
            }
        }
    }           
}

I figured this out from the descriptions and examples on these pages: https://developers.google.com/transit/gtfs-realtime/reference#VehiclePosition https://developers.google.com/transit/gtfs-realtime/examples/trip-updates-full

Does that help?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top