Ejemplo n.º 1
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]);
     }
 }
Ejemplo n.º 2
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]);
     }
 }