void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { Quaternion q = e.Reading.Orientation; const float eps = 0.137472f; const float deg90 = 0.707f; if (q.X > 0 && Math.Abs(q.Y - q.Z) <= eps) { Orientation = ImageOrientation.Portrait; } else if (q.X < 0 && (Math.Abs(q.Y - q.Z) <= eps || Math.Abs(q.Y + q.Z) <= eps)) { Orientation = ImageOrientation.PortraitBottom; } else if (Math.Abs(q.Z - q.X) <= eps && q.Y < 0) { Orientation = ImageOrientation.LandscapeLeft; } else if (Math.Abs(q.Z + q.X) <= eps && q.Y > 0) { Orientation = ImageOrientation.LandscapeRight; } else if (Math.Abs(q.X) <= eps && Math.Abs(q.Y) <= eps) { Orientation = ImageOrientation.Portrait; } else if (q.X < 0 && Math.Abs(q.Z) <= eps && Math.Abs(q.W) <= eps) { Orientation = ImageOrientation.Portrait; } SetOrientationToContext(); }
private void Update(object sender, OrientationSensorChangedEventArgs e) { var ea = (e.Reading.Orientation).ToEulerAngles(); ea.X = 0f; //(float)Math.Round(ea.X, 2); ea.Y = (float)Math.Round(ea.Y, 2) * (float)(180 / Math.PI); ea.Z = 0f; //(float)Math.Round(ea.Z, 2); var current = getString(ea.Y); label.Text = list.getCurrent().ToString(); if (OLD != current) { if (current == "True") { label.Text = list.GetNext().ToString(); } if (current == "Fasle") { label.Text = list.GetNext().ToString(); } } OLD = getString(ea.Y); }
void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { var data = e.Reading; // Process Orientation quaternion (X, Y, Z, and W) Console.WriteLine($"Reading: X: {data.Orientation.X}, Y: {data.Orientation.Y}, Z: {data.Orientation.Z}, W: {data.Orientation.W}"); label.Text = String.Format("X: {0,0:F4} \nY: {1,0:F4} \nZ: {2,0:F4} \nW: {3,0:F4}", data.Orientation.X, data.Orientation.Y, data.Orientation.Z, data.Orientation.W); }
void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { MainThread.BeginInvokeOnMainThread(() => { xLabel.Text = e.Reading.Orientation.X.ToString(); yLabel.Text = e.Reading.Orientation.Y.ToString(); zLabel.Text = e.Reading.Orientation.Z.ToString(); }); }
private void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { var data = e.Reading; XOrientationValue = data.Orientation.X; YOrientationValue = data.Orientation.Y; ZOrientationValue = data.Orientation.Z; WOrientationValue = data.Orientation.W; }
private void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { OrientationSensorData reading = e.Reading; QuaternionData data = Orientation; data.Value = reading.Orientation; data.TimeStamp = DateTime.UtcNow; data.SendNotification(); }
void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { //c++; //c'è questa cosa perchè i sensori fanno una misurazione circa ogni 10ms, //if (c % 10 == 0) //quindi spamma troppo e il garbage collector esplode //return; //facendo così 9 misurazioni su 10 le skippa e quindi è più leggero //if (c == 1000000) //c = 0; num++; ToEulerAngles(e.Reading.Orientation); }
private void OrientationChanged(object sender, OrientationSensorChangedEventArgs args) { Euler euler = args.Reading.Orientation.ToEuler(); double headingInMils = euler.Yaw / 360 * 6400; double elevationInMils = euler.Pitch * -1 / 360 * 6400; HorizontalGauge.Value = ((headingInMils % 6400) + 6400) % 6400; VerticalGauge.Value = elevationInMils; }
void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { var data = e.Reading; this.OrrX = data.Orientation.X; this.OrrY = data.Orientation.Y; this.OrrZ = data.Orientation.Z; this.OrrW = data.Orientation.W; Console.WriteLine($"Orientation: X: {data.Orientation.X}, Y: {data.Orientation.Y}, Z: {data.Orientation.Z}, W: {data.Orientation.W}"); }
private void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { if (udpClient != null) { var o = e.Reading.Orientation; var msg = Encoding.ASCII.GetBytes($"{o.X.ToString(enUS)},{o.Y.ToString(enUS)},{o.Z.ToString(enUS)},{o.W.ToString(enUS)}"); udpClient.Send(msg, msg.Length); } }
void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { var data = e.Reading; //Console.WriteLine($"Reading: X: {data.Orientation.X}, Y: {data.Orientation.Y}, Z: { data.Orientation.Z}, W: { data.Orientation.W}"); // Process Orientation quaternion (X, Y, Z, and W) oriX = data.Orientation.X; oriY = data.Orientation.Y; oriZ = data.Orientation.Z; oriW = data.Orientation.W; }
internal void RaiseReadingChanged(OrientationSensorData reading) { var args = new OrientationSensorChangedEventArgs(reading); if (UseSyncContext) { MainThread.BeginInvokeOnMainThread(() => ReadingChanged?.Invoke(null, args)); } else { ReadingChanged?.Invoke(null, args); } }
void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { var data = e.Reading; ToEulerAngles(data.Orientation.W, data.Orientation.X, data.Orientation.Y, data.Orientation.Z); EulerAngles0.Text = eulerAngles[0].ToString("#.##"); EulerAngles1.Text = eulerAngles[1].ToString("#.##"); EulerAngles2.Text = eulerAngles[1].ToString("#.##"); if (bAngledWalk == true && CheckOrientation() == false) { EulerAngles2.Text = "Whoops..."; bAngledWalk = false; StartMeasuringAngledWalk(bAngledWalk); } }
void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { var data = e.Reading; // 調整するパラメータ float paramX = 3; float paramY = 5.5F; int paramLR = 140; // 直角に傾けるくらいで左右モードにする // Xに係数をかけて左右のSpeedとする int ox = (int)(data.Orientation.X * 100 * paramX); // Yに係数をかけて前後のSpeedとする int oy = (int)(data.Orientation.Y * 100 * paramY); int ow = (int)(data.Orientation.W * 100); int oz = (int)(data.Orientation.Z * 100); Device.BeginInvokeOnMainThread(() => { LableOrientation.Text = $"Orientation X={ox}, Y={oy}, Z={oz}, W={ow}"; }); if (_OrientationMode) { if (Math.Abs(ox) > paramLR) { if (ox < 0) { _ev3.Wheels.TurnLeft(ox, 360); } else { _ev3.Wheels.TurnRight(ox, 360); } } else { if (oy >= 0) { _ev3.Wheels.GoForward(oy, 720); } else { _ev3.Wheels.GoBackward(oy, 720); } } } }
private void OnOrientationReadingChanged(object sender, OrientationSensorChangedEventArgs e) { if (Orientation == e.Reading.Orientation) { return; } if (_origin == Quaternion.Identity) { _origin = Quaternion.Inverse(e.Reading.Orientation); } Orientation = Quaternion.Multiply(_origin, e.Reading.Orientation); CalculateEulerAngles(Orientation, out var roll, out var yaw, out var pitch); TranslationX = (yaw / Math.PI) * PanoramaWidth; TranslationY = (roll / Math.PI) * PanoramaHeight; }
void Orientation_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { var o = e.Reading.Orientation; var v = new Vector4(o.X, o.Y, o.Z, o.W); var min = (OrientationMin = GetMin(v, OrientationMin)).Value; var max = (OrientationMax = GetMax(v, OrientationMax)).Value; var d = max - min; if (d.X > sensitivity || d.Y > sensitivity || d.Z > sensitivity || d.W > sensitivity) { PlayAlarm(true); } var ev = OrientationChanged; if (ev != null) { ev(this, new MoveMonitorEventArgs <Vector4>(v, d)); } }
void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { var data = e.Reading; var item = new ItemC { DateInfo = DateTime.Now.ToString(), LabelX = "X: " + data.Orientation.X, LabelY = "Y: " + data.Orientation.Y, LabelZ = "Z: " + data.Orientation.Z, LabelW = "W: " + data.Orientation.W }; Calculos.Insert(0, item); ListViewCheck.ItemsSource = Calculos; if (OrientationSensor.IsMonitoring) { OrientationSensor.Stop(); } }
void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { double seuil = 0.4; oldOrtX = e.Reading.Orientation.X; oldOrtY = e.Reading.Orientation.Y; if ((Math.Abs(Math.Round(oldOrtX, 2)) == seuil || Math.Abs(Math.Round(oldOrtY, 2)) == seuil) && nbDeplacement >= 1) { nbTangRoul++; nbDeplacement++; switch (nbTangRoul) { case 1: PlayerVoice(voix, 2); break; case 5: PlayerVoice(voix, 4); break; } } }
void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { var data = e.Reading; _data = $"Reading: X: {data.Orientation.X}, Y: {data.Orientation.Y}, Z: {data.Orientation.Z}"; }
private void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { this.OrientationValue.Text = DeviceDisplay.MainDisplayInfo.Orientation.ToString(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { _ = e.Reading; // Process Orientation quaternion (X, Y, Z, and W) }
void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { var data = e.Reading; FindViewById <TextView>(Resource.Id.orientation).Text = $"Reading: X: {data.Orientation.X}, Y: {data.Orientation.Y}, Z: {data.Orientation.Z}, W: {data.Orientation.W}"; }
private void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { OrientationDataReading.Add(OrientationWatch.ElapsedTicks, e.Reading); }
private void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { orientation = e.Reading.Orientation; Debug.WriteLine($"Reading: X: {orientation.X}, Y: {orientation.Y}, Z: {orientation.Z}, W: {orientation.W}"); }
private void SecondSequence(object sender, OrientationSensorChangedEventArgs e) { Console.WriteLine(e.Reading.Orientation + "fffffff"); }
void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { var data = e.Reading; OrientationSensorString = ($"Mesure: X: {data.Orientation.X}, Y: {data.Orientation.Y}, Z: {data.Orientation.Z}, W: {data.Orientation.W}"); }
private void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { LatestOrientation = e.Reading.Orientation; }
private void orientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { showOrientation(e.Reading.Orientation); }
void OrientationSensor_ReadingChanged(object sender, OrientationSensorChangedEventArgs e) { var data = e.Reading; //Debug.WriteLine($"Reading: X: {data.Orientation.X}, Y: {data.Orientation.Y}, Z: {data.Orientation.Z}, W: {data.Orientation.W}"); // Process Orientation quaternion (X, Y, Z, and W) }