Beispiel #1
0
 void ReadGyroscopeData()
 {
     if (Gyroscope.IsSupported)
     {
         GyroscopeReading reading  = gyroSensor.CurrentValue;
         Vector3          rotation = reading.RotationRate;
         gyroX.Text = "" + rotation.X;
         gyroY.Text = "" + rotation.Y;
         gyroZ.Text = "" + rotation.Z;
     }
 }
 void ReadGyroscopeData()
 {
     if (Gyroscope.IsSupported)
     {
         GyroscopeReading reading  = gyroSensor.CurrentValue;
         Vector3          rotation = reading.RotationRate;
         // height of control = 400; height of postive bar = 200; reasonable max value = 2pi = 6.25 (1.5 rotation per second)
         // set scale at 200/6.25 = 32
         gyroX.Value = rotation.X;
         gyroY.Value = rotation.Y;
         gyroZ.Value = rotation.Z;
     }
 }
Beispiel #3
0
        private async Task SendGyrMsg(GyroscopeReading gyroscopeReading)
        {
            Vector3 gyroscope = gyroscopeReading.RotationRate;

            if (post)
            {
                string strr = "{'rX':" + gyroscope.X.ToString("0.00") + ",'rY':" + gyroscope.Y.ToString("0.00") + ",'rZ':" + gyroscope.Z.ToString("0.00") + "}";
                string s    = await pb.sender(strr);

                gyrstateOutput.Dispatcher.BeginInvoke(() =>
                {
                    gyrstateOutput.Text = "陀螺仪: " + s + "  No." + (++indexgyr).ToString() + " message";
                });
            }
            // throw new NotImplementedException();
        }
        private void UpdateUI(GyroscopeReading gyroscopeReading)
        {
            statusTextBlock.Text = "getting data";

            Vector3 rotationRate = gyroscopeReading.RotationRate;

            // Show the numeric values.
            xTextBlock.Text = "X: " + rotationRate.X.ToString("0.00");
            yTextBlock.Text = "Y: " + rotationRate.Y.ToString("0.00");
            zTextBlock.Text = "Z: " + rotationRate.Z.ToString("0.00");

            // Show the values graphically.
            xLine.X2 = xLine.X1 + rotationRate.X * 200;
            yLine.Y2 = yLine.Y1 - rotationRate.Y * 200;
            zLine.X2 = zLine.X1 - rotationRate.Z * 100;
            zLine.Y2 = zLine.Y1 + rotationRate.Z * 100;
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GyroscopeValue"/> class.
 /// </summary>
 /// <param name="reading">The gyroscope reading.</param>
 public GyroscopeValue(GyroscopeReading reading)
     : this(reading.Timestamp, reading.RotationRate.X, reading.RotationRate.Y, reading.RotationRate.Z) { }
Beispiel #6
0
 public GyroscopeSensorReading(GyroscopeReading gyroscopeReading)
 {
     RotationRate = gyroscopeReading.RotationRate;
     Timestamp    = gyroscopeReading.Timestamp;
 }
 public GyroscopeSensorReading(GyroscopeReading gyroscopeReading)
 {
     RotationRate = gyroscopeReading.RotationRate;
     Timestamp = gyroscopeReading.Timestamp;
 }
        private void RefreshUIGyro(GyroscopeReading Gyroread)
        {
            Vector3 gyroDir = Gyroread.RotationRate;

            ValuesG.Text = "Gyroscopio \nx: " + gyroDir.X.ToString() + "\nY: " + gyroDir.Y.ToString() + "\nZ: " + gyroDir.Z.ToString();
        }
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GyroscopeValue"/> class.
 /// </summary>
 /// <param name="reading">The gyroscope reading.</param>
 public GyroscopeValue(GyroscopeReading reading)
     : this(reading.Timestamp, reading.RotationRate.X, reading.RotationRate.Y, reading.RotationRate.Z)
 {
 }