public GyrometerSample(GyrometerReading gyrometerReading, DateTimeOffset _startDateTime) { this.MeasurementTime = gyrometerReading.Timestamp.Subtract(_startDateTime); this.VelocityX = Convert.ToSingle(gyrometerReading.AngularVelocityX); this.VelocityY = Convert.ToSingle(gyrometerReading.AngularVelocityY); this.VelocityZ = Convert.ToSingle(gyrometerReading.AngularVelocityZ); }
void gyrometer_ReadingChanged(Gyrometer sender, GyrometerReadingChangedEventArgs args) { Deployment.Current.Dispatcher.BeginInvoke(() => { gyrometerReading = args.Reading; ShowData(); }); }
static Vector ConvertToVector(GyrometerReading reading) { return new Vector { X = reading.AngularVelocityX, Y = reading.AngularVelocityY, Z = reading.AngularVelocityZ }; }
private void OnReadingChanged(GyrometerReading reading) { if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug)) { this.Log().DebugFormat($"Gyrometer reading received " + $"X:{reading.AngularVelocityX}, Y:{reading.AngularVelocityY}, Z:{reading.AngularVelocityZ}"); } _readingChanged?.Invoke(this, new GyrometerReadingChangedEventArgs(reading)); }
private void ReadingChanged(object sender, Sensors.GyrometerReadingChangedEventArgs e) { Sensors.GyrometerReading reading = e.Reading; this.SendEvent("Gyroscope", new RNSensorsJsonObject { X = reading.AngularVelocityX, Y = reading.AngularVelocityY, Z = reading.AngularVelocityZ, Timestamp = reading.Timestamp }.ToJObject()); }
private void ReadingChanged(object sender, Sensors.GyrometerReadingChangedEventArgs e) { Sensors.GyrometerReading reading = e.Reading; if (_lastReading.AddMilliseconds(interval) <= reading.Timestamp) { _lastReading = reading.Timestamp; this.SendEvent("Gyroscope", new RNSensorsJsonObject { X = reading.AngularVelocityX, Y = reading.AngularVelocityY, Z = reading.AngularVelocityZ, Timestamp = reading.Timestamp }.ToJObject()); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { try { gyrometer = Gyrometer.GetDefault(); if (gyrometer == null) { MessageBox.Show("不支持陀螺仪"); return; } gyrometer.ReportInterval = 1000; gyrometer.ReadingChanged += gyrometer_ReadingChanged; gyrometerReading = gyrometer.GetCurrentReading(); ShowData(); } catch (Exception err) { MessageBox.Show(err.Message); } }
private void GyrometerReadingUpdated(GyrometerReading reading) { _gyroReading = reading; if (_state == GenerationState.Gathering) { SpeedX.Value = reading.AngularVelocityX; SpeedY.Value = reading.AngularVelocityY; SpeedZ.Value = reading.AngularVelocityZ; } }
protected override void Update(GameTime gameTime) { if (started) { keyboardState = keyboardManager.GetState(); flushAddedAndRemovedGameObjects(); accelerometerReading = input.accelerometer.GetCurrentReading(); gyrometerReading = input.gyrometer.GetCurrentReading(); camera.Update(); for (int i = 0; i < gameObjects.Count; i++) { gameObjects[i].Update(gameTime); } mainPage.UpdateScore(score); if (keyboardState.IsKeyDown(Keys.Escape)) { this.Exit(); this.Dispose(); App.Current.Exit(); } // Handle base.Update } base.Update(gameTime); }
public void setGyrometerReading(GyrometerReading reading) { this.angularVelocity_x = reading.AngularVelocityX; this.angularVelocity_y = reading.AngularVelocityY; this.angularVelocity_z = reading.AngularVelocityZ; }
//################################################## Gyrometer ###################################################### /// <summary> /// Adds a new gyrometer reading into the active gyrometer reading list. /// </summary> /// <param name="gyrometerReading"></param> public void AddGyrometerReading(GyrometerReading gyrometerReading) { if (gyrometerReading != null) { if (_startDateTime.CompareTo(DateTimeOffset.MinValue) == 0) { _startDateTime = gyrometerReading.Timestamp; } this.AddGyrometerSample(new GyrometerSample(gyrometerReading, _startDateTime)); } }