public CollisionData(Robot robot, ResponseCode code, Byte seqNum, Byte[] data, AsynchronousId asyncCode, Int32 length)
     : base(robot, code, seqNum, data, asyncCode, length)
 {
     if ((Int32)Data.Length == 16)
     {
         CollisionAccelerometerReading = new AccelerometerReading((Single)GetFloatFromBytes(0), (Single)GetFloatFromBytes(2), (Single)GetFloatFromBytes(4));
         XAxisCollision = (Data[6] & 1) > 0;
         YAxisCollision = (Data[6] >> 1 & 1) > 0;
         CollisionPower = new TwoAxisSensor((Single)GetFloatFromBytes(7), (Single)GetFloatFromBytes(9));
         SpheroSpeed = (Single)Data[11] / 255f;
         Timestamp = GetIntFromBytes((Int32)Data[12]);
     }
 }
 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;
         }
     }
 }
 internal AsynchronousResponse(Robot robot, ResponseCode code, Byte seqNum, Byte[] data, AsynchronousId asyncId, Int32 length)
     : base(robot, code, seqNum, data)
 {
     AsyncId      = asyncId;
     PacketLength = length;
 }
 internal AsynchronousResponse(Robot robot, ResponseCode code, Byte seqNum, Byte[] data, AsynchronousId asyncId, Int32 length)
     : base(robot, code, seqNum, data)
 {
     AsyncId = asyncId;
     PacketLength = length;
 }
Example #5
0
 public CollisionData(Robot robot, ResponseCode code, Byte seqNum, Byte[] data, AsynchronousId asyncCode, Int32 length)
     : base(robot, code, seqNum, data, asyncCode, length)
 {
     if ((Int32)Data.Length == 16)
     {
         CollisionAccelerometerReading = new AccelerometerReading((Single)GetFloatFromBytes(0), (Single)GetFloatFromBytes(2), (Single)GetFloatFromBytes(4));
         XAxisCollision = (Data[6] & 1) > 0;
         YAxisCollision = (Data[6] >> 1 & 1) > 0;
         CollisionPower = new TwoAxisSensor((Single)GetFloatFromBytes(7), (Single)GetFloatFromBytes(9));
         SpheroSpeed    = (Single)Data[11] / 255f;
         Timestamp      = GetIntFromBytes((Int32)Data[12]);
     }
 }
Example #6
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;
         }
     }
 }