Ejemplo n.º 1
0
        /// <summary>
        /// Handle GPS GPVTG Notifications - Ground Speed and Course
        /// </summary>
        /// <param name="notification">GPVTG packet notification</param>
        private void GpVtgHandler(gps.GpVtgNotification notification)
        {
            /*
             *  VTG - Velocity made good. The gps receiver may use the LC prefix instead of GP if it is emulating Loran output.
             *
             *    $GPVTG,054.7,T,034.4,M,005.5,N,010.2,K*48
             *
             *  where:
             *          VTG          Track made good and ground speed
             *          054.7,T      True track made good (degrees)
             *          034.4,M      Magnetic track made good
             *          005.5,N      Ground speed, knots
             *          010.2,K      Ground speed, Kilometers per hour
             * 48          Checksum
             *  Note that, as of the 2.3 release of NMEA, there is a new field in the VTG sentence at the end just prior to the checksum. For more information on this field see here.
             *
             *  Receivers that don't have a magnetic deviation (variation) table built in will null out the Magnetic track made good.
             */

            if (!_mapperVicinity.robotState.ignoreGps)
            {
                if (!notification.Body.IsValid)
                {
                    Tracer.Error("the GPS reported GPVTG with IsValid=false");
                }
                else
                {
                    if (traceGps)
                    {
                        Tracer.Trace(string.Format("the GPS reported GPVTG: {0}  CourseDegrees: {1}  SpeedMetersPerSecond: {2}", notification.Body.LastUpdate, notification.Body.CourseDegrees, notification.Body.SpeedMetersPerSecond));
                    }

                    GpsState state = _state.gpsState;

                    // CourseDegrees:
                    state.GPVTG_CourseDegrees = notification.Body.CourseDegrees;

                    // SpeedMetersPerSecond:
                    state.GPVTG_SpeedMetersPerSecond = notification.Body.SpeedMetersPerSecond;

                    // Last Updated:
                    state.GPVTG_LastUpdate = notification.Body.LastUpdate;

                    if (!_testBumpMode && !_state.Dropping && !_doUnitTest)
                    {
                        Decide(SensorEventSource.Gps);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Handle GPS GPVTG Notifications - Ground Speed and Course
 /// </summary>
 /// <param name="notification">GPVTG packet notification</param>
 private void GpVtgHandler(gps.GpVtgNotification notification)
 {
     Tracer.Trace(string.Format("the GPS reported GPVTG: {0}  CourseDegrees: {1}  SpeedMetersPerSecond: {2}", notification.Body.LastUpdate, notification.Body.CourseDegrees, notification.Body.SpeedMetersPerSecond));
 }