Ejemplo n.º 1
0
        void LoadGrippingTests(LogicPart logic, DemoRules rules)
        {
            logic.Tests["Gripping_Rect_Grip"] = new RectangularGrippingTestBase(GrippingTest(
                true,
                rules.Move(50),
                rules.Stand(1),
                rules.Grip(),
                rules.Move(-10),
                rules.Stand(5)
                ));
            logic.Tests["Gripping_Round_Grip"] = new RoundGrippingTestBase(GrippingTest(
                true,
                rules.Move(50),
                rules.Stand(1),
                rules.Grip(),
                rules.Move(-10),
                rules.Stand(5)
                ));
            logic.Tests["Gripping_Round_GripAndMove"] = new RoundGrippingTestBase(LocationTest(
                0, 0, 0, 1,
                rules.Move(50),
                rules.Stand(1),
                rules.Grip(),
                rules.Move(-50),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(50),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(50),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(50),
                rules.Rotate(-Angle.HalfPi)
                ));
            logic.Tests["Gripping_Rect_GripAndMove"] = new RectangularGrippingTestBase(LocationTest(
                0, 0, 0, 1,
                rules.Move(50),
                rules.Stand(1),
                rules.Grip(),
                rules.Move(-50),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(50),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(50),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(50),
                rules.Rotate(-Angle.HalfPi)
                ));
            logic.Tests["Gripping_Rect_GripAndMove2"] = new RectangularGrippingTestBase(LocationTest(
                46.1, 0, 0, 1,
                rules.Move(50),
                rules.Stand(1),
                rules.Grip(),
                rules.Rotate(-Angle.HalfPi),
                rules.Rotate(-Angle.HalfPi),
                rules.Rotate(-Angle.HalfPi),
                rules.Rotate(-Angle.HalfPi)
                ));

            logic.Tests["Gripping_Rect_GripThroughWall"] = new RectangularGrippingTestBase(GrippingTest(
                false,
                rules.Rotate(Angle.HalfPi),
                rules.Move(50),
                rules.Grip(),
                rules.Move(-50)));
            logic.Tests["Gripping_Rect_Release"] = new RectangularGrippingTestBase(GrippingTest(
                false,
                rules.Move(50),
                rules.Stand(0.1d),
                rules.Grip(),
                rules.Move(-15),
                rules.Release()));
            logic.Tests["Gripping_Rect_GripUnGripable"] = new RectangularGrippingTestBase(GrippingTest(
                false,
                rules.Move(25),
                rules.Rotate(Angle.HalfPi),
                rules.Move(25),
                rules.Grip(),
                rules.Move(-25)));
            logic.Tests["Gripping_Rect_GripFromBack"] = new RectangularGrippingTestBase(
                GrippingTest(
                    false,
                    rules.Move(-40),
                    rules.Stand(1),
                    rules.Grip()));
        }
Ejemplo n.º 2
0
        private void LoadCollisionTests(LogicPart logic, DemoRules rules)
        {
            logic.Tests["Collision_Rect_NoCollision"] = new RectangularCollisionTestBase(CollisionTest(0, 0, 0,
                rules.Grip(),
                rules.MoveWithVelocityForTime(-50, 0.2),
                rules.MoveWithVelocityForTime(50, 0.2)));
            logic.Tests["Collision_Rect_CollisionCount"] = new RectangularCollisionTestBase(CollisionTest(3, 3, 0,
                rules.MoveWithVelocityForTime(50, 1),
                rules.MoveWithVelocityForTime(50, 0.8),
                rules.MoveWithVelocityForTime(50, 0.3),
                rules.MoveWithVelocityForTime(-50, 0.2),
                rules.MoveWithVelocityForTime(50, 0.3),
                rules.MoveWithVelocityForTime(-50, 0.2),
                rules.MoveWithVelocityForTime(50, 0.3),
                rules.MoveWithVelocityForTime(-50, 0.2)));
            logic.Tests["Collision_Rect_CollisionBox"] = new RectangularCollisionTestBase(CollisionTest(1, 1, 0,
                rules.Grip(),
                rules.MoveWithVelocityForTime(50, 1.5),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1),
                rules.MoveWithVelocityForTime(50, 0.45)));
            logic.Tests["Collision_Rect_NoBox"] = new RectangularCollisionTestBase(CollisionTest(3, 3, 0,
                rules.MoveWithVelocityForTime(50, 1.05),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1),
                rules.MoveWithVelocityForTime(50, 0.8),
                rules.MoveWithVelocityForTime(50, 0.3),
                rules.MoveWithVelocityForTime(-50, 0.2),
                rules.MoveWithVelocityForTime(50, 0.3),
                rules.MoveWithVelocityForTime(-50, 0.2),
                rules.MoveWithVelocityForTime(50, 0.3),
                rules.MoveWithVelocityForTime(-50, 0.2)));
            logic.Tests["Collision_Rect_RotateNoBox"] = new RectangularCollisionTestBase(CollisionTest(1, 1, 0,
                rules.MoveWithVelocityForTime(50, 1.7),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1),
                rules.MoveWithVelocityForTime(50, 1.45),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1),
                rules.MoveWithVelocityForTime(50, 0.7),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1)));
            logic.Tests["Collision_Rect_RotateBox"] = new RectangularCollisionTestBase(CollisionTest(1, 1, 0,
                rules.Grip(),
                rules.MoveWithVelocityForTime(50, 1.7),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1),
                rules.MoveWithVelocityForTime(50, 1.6),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1),
                rules.MoveWithVelocityForTime(50, 0.7),
                rules.RotateWithVelocityForTime(Angle.HalfPi, 1)));
            logic.Tests["Collision_Rect_WallCollisionTime"] = new RectangularCollisionTestBase(ComplexCollisionTest(
                2,
                2.26,//вероятно после изменения размера робота эта велечина должна была измениться до 2,5-2,6
                false,
                false,
                rules.Rotate(Angle.HalfPi),
                rules.Move(50),
                rules.Move(50)
                ));
            logic.Tests["Collision_Rect_PushingWithBrick"] = new RectangularCollisionTestBase(ComplexCollisionTest(
                2,
                8.5,
                true,
                false,
                rules.Rotate(Angle.Pi),
                rules.Move(30),
                rules.Stand(0.00001),
                rules.Grip(),
                rules.Move(-30),
                rules.Rotate(Angle.HalfPi),
                rules.Move(25),
                rules.Rotate(Angle.HalfPi),
                rules.Move(40),
                rules.Rotate(Angle.HalfPi)
                ));
            logic.Tests["Collision_Rect_RotateWallCollision"] = new RectangularCollisionTestBase2(ComplexCollisionTest(
                2,
                8.5, //при удалении костыля время надо тоже уменьшать на 2 сек
                false,
                false,
                rules.Rotate(Angle.Pi),
                rules.Move(30),
                rules.Stand(0.00001),
                rules.Grip(),
                rules.Rotate(-Angle.HalfPi),
                //rules.Stand(2), //костыль, чтоб тест прошел
                rules.Move(70),
                rules.Rotate(-Angle.Pi)
                ));
            logic.Tests["Collision_Rect_BrickCollision"] = new RectangularCollisionTestBase2(
                CollisionTest(
                    4,
                    true,
                    false,
                    rules.Rotate(Angle.HalfPi),
                    rules.Move(50),
                    rules.Rotate(-Angle.HalfPi),
                    rules.Move(45),
                    rules.Rotate(-Angle.HalfPi),
                    rules.Move(70)
                ));
            logic.Tests["Collision_Rect_WallAndBrickCollision"] = new RectangularCollisionTestBase2(
                CollisionTest(
                    4,
                    false,
                    false,
                    rules.Rotate(Angle.HalfPi),
                    rules.Move(15),
                    rules.Rotate(-Angle.HalfPi),
                    rules.Move(45),
                    rules.Rotate(Angle.HalfPi),
                    rules.Move(70)
                ));

        }