3

I am streaming position data (lat, lon) of an airplane into Google Earth via NMEA 0183 ($GPRMC, $GPGGA sentences) and it works OK (I generate and stream these from my own software). Now I would also like to stream attitude (roll, pitch, yaw) but I can't find any NMEA sentence for this, except proprietary vendor sentences which Google Earth seem to ignore.

In Google Earth, I selected Tools -> GPS -> Real Time -> NMEA, but I haven't tried "Garmin PVT" yet as I can't find any reference to the protocol in connection with roll, pitch and yaw (found this document though).

Is there any way? I know .kml files can include this information, but I can't stream a .kml file into GE (only one-time import).


This is what I see now. Notice no pitch, roll or yaw data:

enter image description here

Roll, pitch and yaw:

enter image description here

5
  • Could you give a code example of what pitch-roll-yaw data look like in a KML file? Also, how are you expecting Google Earth to use the data?
    – Simbamangu
    Jun 9, 2016 at 6:04
  • I'm not really familiar with KML (yet) so I can't provide you any code, but I've read that you can create a 3D model with lon,lat AND roll,pitch,yaw data in it. Thinking of it, maybe I could programmatically generate KML file for each change and then programatically open it with Google Earth, giving an illusion of real-time tracking.
    – c0dehunter
    Jun 9, 2016 at 6:14
  • How are you expecting Google Earth to use this additional data? To give us a better chance of helping: click 'edit' on your post and explain the exact types of output or behaviour you are looking for.
    – Simbamangu
    Jun 9, 2016 at 6:17
  • See main post update (picture). The model is missing roll, pitch and yaw.
    – c0dehunter
    Jun 9, 2016 at 6:18
  • So, to clarify: you are generating NMEA sentences that include roll/pitch/yaw and sending those to GE, and you would like GE to display those values onscreen?
    – Simbamangu
    Jun 9, 2016 at 9:32

1 Answer 1

2

I have given up on my original idea to stream NMEA into Google Earth.. and found a better solution!

I was able to solve this by programmatically generating KML file for each position and attitude change and then opening up an instance of Google Earth with the generated KML file as parameter. This is happening in 250ms loop which makes the transitions smooth. Also, Google Earth detects that another instance is already running and therefore it only loads the KML file.

Here is a capture:

enter image description here

I was able to accomplish generating of KML using C# and SharpKml software library. Here is a code example:

private void GenerateKML()
{
    SharpKml.Dom.Location loc = new SharpKml.Dom.Location();
    loc.Latitude = currentLat;
    loc.Longitude = currentLon;
    loc.Altitude = currentAlt;

    SharpKml.Dom.Model model = new SharpKml.Dom.Model();
    model.Location = loc;
    model.AltitudeMode = SharpKml.Dom.AltitudeMode.Absolute;

    SharpKml.Dom.Orientation ori = new SharpKml.Dom.Orientation();
    ori.Roll = currentRoll;
    ori.Tilt = currentPitch;
    ori.Heading = (currentTrack + 180) % 360;
    model.Orientation = ori;

    SharpKml.Dom.Link link = new SharpKml.Dom.Link();
    link.Href = new Uri("model.dae", UriKind.Relative);
    model.Link = link;

    SharpKml.Dom.Placemark pmplane = new SharpKml.Dom.Placemark();
    pmplane.Geometry = model;

    File.Delete(AppDomain.CurrentDomain.BaseDirectory + kmlFileName);

    SharpKml.Engine.KmlFile kml = SharpKml.Engine.KmlFile.Create(pmplane, false);
    using (var stream = System.IO.File.OpenWrite(kmlFileName))
        kml.Save(stream);
}

If you also want custom viewpoint of the model in Google Earth, instantiate LookAt object and assign it to model.Viewpoint.

2
  • 1
    Interesting - could you edit your post with examples of how roll / etc are coded in KML? More information and context always helpful so others can use this information in the future! Also, are you coding telemetry from an actual aircraft?
    – Simbamangu
    Jun 13, 2016 at 5:36
  • I've added code example. Also, yes, telemetry is from an actual aircraft.
    – c0dehunter
    Jun 13, 2016 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.