Beispiel #1
0
 void OnTelemetryMessage(DieMessage message)
 {
     // Don't bother doing anything with the message if we don't have
     // anybody interested in telemetry data.
     if (_OnTelemetry != null)
     {
         // Notify anyone who cares
         var telem = (DieMessageAcc)message;
         _OnTelemetry.Invoke(this, telem.data);
     }
 }
Beispiel #2
0
    void OnTelemetryMessage(DieMessage message)
    {
        // Don't bother doing anything with the message if we don't have
        // anybody interested in telemetry data.
        if (_OnTelemetry != null)
        {
            var telem = (DieMessageAcc)message;

            for (int i = 0; i < 2; ++i)
            {
                // Compute actual accelerometer readings (in Gs)
                float   cx  = (float)telem.data[i].X / (float)(1 << 11) * (float)(scale);
                float   cy  = (float)telem.data[i].Y / (float)(1 << 11) * (float)(scale);
                float   cz  = (float)telem.data[i].Z / (float)(1 << 11) * (float)(scale);
                Vector3 acc = new Vector3(cx, cy, cz);
                lastSampleTime += telem.data[i].DeltaTime;

                // Notify anyone who cares
                _OnTelemetry.Invoke(this, acc, lastSampleTime);
            }
        }
    }