Пример #1
0
        private void GetBallBouncing(Action action = null)
        {
            _strategies.Add(
                BallControlStrategyFactory.Bouncing(5, PIDTiltController.Instance, action: action));
            _strategies.Add(
                BallControlStrategyFactory.BouncingStrong(1, PIDTiltController.Instance));

            for (int i = 0; i < 4; i++)
            {
                _strategies.Add(BallControlStrategyFactory.Bouncing(5, PIDTiltController.Instance));
                _strategies.Add(BallControlStrategyFactory.BouncingStrong(1, PIDTiltController.Instance));
            }
        }
Пример #2
0
        private void Start()
        {
            _ballData = new BallData(
                _ballDataDebugView,
                _predictedPositionVisualizer,
                _gradientDescentX,
                _gradientDescentY,
                _gradientDescentZ);

            _strategies.Add(BallControlStrategyFactory.GoTo(0.01f));
            _strategies.Add(BallControlStrategyFactory.GoTo(0.05f));

            _strategies.Add(BallControlStrategyFactory.GoToWhenBallOnPlate(0.01f));
            _strategies.Add(BallControlStrategyFactory.GoToWhenBallOnPlate(0.05f));

            GetBallBouncing(() =>
            {
                _onCheckPointPassedSubject.OnNext(1);
                _machineStateView.Set("Get Ball Bouncing", MachineStateView.TiltControlType.PIDTiltController);
            });

            _strategies.Add(BallControlStrategyFactory.TwoStepBouncing(20, AnalyticalTiltController.Instance,
                                                                       action: () => _machineStateView.Set("Two Step Bouncing",
                                                                                                           MachineStateView.TiltControlType.AnalyticalTiltControl)));

            _strategies.Add(BallControlStrategyFactory.TwoStepBouncing(40, AnalyticalTiltController.Instance,
                                                                       action: () => _onCheckPointPassedSubject.OnNext(2)));

            _strategies.Add(BallControlStrategyFactory.TwoStepBouncing(20, AnalyticalTiltController.Instance,
                                                                       action: () => _onCheckPointPassedSubject.OnNext(3)));

            CircleBouncing(10, () => _machineStateView.Set("Circle Bouncing",
                                                           MachineStateView.TiltControlType.AnalyticalTiltControl));

            _strategies.Add(BallControlStrategyFactory.TwoStepBouncing(20, AnalyticalTiltController.Instance,
                                                                       new Vector2(40f, 0f), action: () => _machineStateView.Set("Two Step Bouncing",
                                                                                                                                 MachineStateView.TiltControlType.AnalyticalTiltControl)));
            _strategies.Add(BallControlStrategyFactory.TwoStepBouncing(20, AnalyticalTiltController.Instance,
                                                                       new Vector2(0f, 0f)));
            _strategies.Add(BallControlStrategyFactory.TwoStepBouncing(20, AnalyticalTiltController.Instance,
                                                                       new Vector2(-40f, 0f)));
            _strategies.Add(BallControlStrategyFactory.TwoStepBouncing(20, AnalyticalTiltController.Instance,
                                                                       new Vector2(0f, 0f)));
            _strategies.Add(BallControlStrategyFactory.TwoStepBouncing(20, AnalyticalTiltController.Instance,
                                                                       new Vector2(40f, 0f)));
            _strategies.Add(BallControlStrategyFactory.TwoStepBouncing(20, AnalyticalTiltController.Instance,
                                                                       new Vector2(0f, 0f)));
            _strategies.Add(BallControlStrategyFactory.TwoStepBouncing(20, AnalyticalTiltController.Instance,
                                                                       new Vector2(-40f, 0f)));

            for (int i = 0; i < 5; i++)
            {
                _strategies.Add(
                    BallControlStrategyFactory.Bouncing(5, AnalyticalTiltController.Instance));
                _strategies.Add(
                    BallControlStrategyFactory.BouncingStrong(1, AnalyticalTiltController.Instance));
                _strategies.Add(BallControlStrategyFactory.Balancing(0.05f, 8, Vector2.zero,
                                                                     AnalyticalTiltController.Instance));
            }

            _strategies.Add(BallControlStrategyFactory.GoTo(0.01f));
            _strategies.Add(BallControlStrategyFactory.GoTo(0.08f));
            _strategies.Add(BallControlStrategyFactory.GoTo(0.05f));

            GetBallBouncing();

            _strategies.Add(BallControlStrategyFactory.Bouncing(20, AnalyticalTiltController.Instance));

            for (int i = 0; i < 5; i++)
            {
                _strategies.Add(
                    BallControlStrategyFactory.Bouncing(5, AnalyticalTiltController.Instance));
                _strategies.Add(
                    BallControlStrategyFactory.BouncingStrong(1, AnalyticalTiltController.Instance));
                _strategies.Add(
                    BallControlStrategyFactory.Balancing(0.05f, 8, Vector2.zero, AnalyticalTiltController.Instance));
            }

            _strategies.Add(BallControlStrategyFactory.GoTo(0.01f));
        }