예제 #1
0
 public AsyncSensorData(Robot robot, ResponseCode code, Byte seqNum, Byte[] data, AsynchronousId asyncCode, Int32 length, UInt64 mask)
     : base(robot, code, seqNum, data, asyncCode, length)
 {
     if ((Int32)Data.Length == CountBits(mask) * 2)
     {
         Int32 num = 0;
         if (MaskHasFlag(mask, (DataStreaming)((Int64)458752)))
         {
             Attitude = new AttitudeReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4));
             num = num + 6;
         }
         if (MaskHasFlag(mask, (DataStreaming)((Int64)57344)))
         {
             Accelorometer = new AccelerometerReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4));
             num = num + 6;
         }
         if (MaskHasFlag(mask, (DataStreaming)((Int64)7168)))
         {
             Gyrometer = new GyrometerReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4));
             num = num + 6;
         }
         if (MaskHasFlag(mask, DataStreaming.Quaternion))
         {
             Quaternion = new QuaternionReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4), (Single)GetFloatFromBytes(num + 6));
             num = num + 8;
         }
         if (MaskHasFlag(mask, DataStreaming.Location))
         {
             Location = new LocationReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2));
             num = num + 4;
         }
         if (MaskHasFlag(mask, DataStreaming.Velocity))
         {
             Velocity = new VelocityReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2));
             num = num + 4;
         }
     }
 }
예제 #2
0
 public AsyncSensorData(Robot robot, ResponseCode code, Byte seqNum, Byte[] data, AsynchronousId asyncCode, Int32 length, UInt64 mask)
     : base(robot, code, seqNum, data, asyncCode, length)
 {
     if ((Int32)Data.Length == CountBits(mask) * 2)
     {
         Int32 num = 0;
         if (MaskHasFlag(mask, (DataStreaming)((Int64)458752)))
         {
             Attitude = new AttitudeReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4));
             num      = num + 6;
         }
         if (MaskHasFlag(mask, (DataStreaming)((Int64)57344)))
         {
             Accelorometer = new AccelerometerReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4));
             num           = num + 6;
         }
         if (MaskHasFlag(mask, (DataStreaming)((Int64)7168)))
         {
             Gyrometer = new GyrometerReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4));
             num       = num + 6;
         }
         if (MaskHasFlag(mask, DataStreaming.Quaternion))
         {
             Quaternion = new QuaternionReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2), (Single)GetFloatFromBytes(num + 4), (Single)GetFloatFromBytes(num + 6));
             num        = num + 8;
         }
         if (MaskHasFlag(mask, DataStreaming.Location))
         {
             Location = new LocationReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2));
             num      = num + 4;
         }
         if (MaskHasFlag(mask, DataStreaming.Velocity))
         {
             Velocity = new VelocityReading((Single)GetFloatFromBytes(num), (Single)GetFloatFromBytes(num + 2));
             num      = num + 4;
         }
     }
 }
 private void OnGyrometerUpdated(object sender, GyrometerReading reading) {
     GyroscopeX.Text = "" + reading.X;
     GyroscopeY.Text = "" + reading.Y;
     GyroscopeZ.Text = "" + reading.Z;
 }
예제 #4
0
 private void OnGyrometerUpdated(object sender, GyrometerReading reading)
 {
     _gyroscopeX = reading.X;
     _gyroscopeY = reading.Y;
     _gyroscopeZ = reading.Z;
 }