Пример #1
0
        private async Task Initialze()
        {
            if (LightningProvider.IsLightningEnabled)
            {
                LowLevelDevicesController.DefaultProvider = LightningProvider.GetAggregateProvider();
            }
            else
            {
                throw new Exception("Lightning drivers not enabled. Please enable Lightning drivers.");
            }

            _camera = new Camera();
            await _camera.Initialize();
            
            SpeedSensor.Initialize();
            SpeedSensor.Start();

            SpeechSynthesis.Initialze();

            await AudioPlayerController.Initialize();

            _accelerometerSensor = new AccelerometerGyroscopeSensor();
            await _accelerometerSensor.Initialize();
            _accelerometerSensor.Start();

            _automaticSpeakController = new AutomaticSpeakController(_accelerometerSensor);

            _motorController = new MotorController();
            await _motorController.Initialize(_automaticSpeakController);

            _servoController = new ServoController();
            await _servoController.Initialize();

            _distanceMeasurementSensor = new DistanceMeasurementSensor();
            await _distanceMeasurementSensor.Initialize(I2C_ADDRESS_SERVO);

            _automaticDrive = new AutomaticDrive(_motorController, _servoController, _distanceMeasurementSensor);

            _speechRecognation = new SpeechRecognition();
            await _speechRecognation.Initialze(_motorController, _servoController, _automaticDrive);
            _speechRecognation.Start();

            _gamepadController = new GamepadController(_motorController, _servoController, _automaticDrive, _accelerometerSensor);

            _camera.Start();

            _httpServerController = new HttpServerController(_motorController, _servoController, _automaticDrive, _camera);

            SystemController.Initialize(_accelerometerSensor, _automaticSpeakController, _motorController, _servoController, _automaticDrive, _camera, _httpServerController, _speechRecognation, _gamepadController);

            await SystemController.SetAudioRenderVolume(AUDIO_RENDER_VOLUME, true);
            await SystemController.SetAudioCaptureVolume(AUDIO_CAPTURE_VOLUME, true);
            
            await AudioPlayerController.PlayAndWaitAsync(AudioName.Welcome);

            _automaticSpeakController.Start();
        }
Пример #2
0
        public GamepadController(MotorController motorController,
                                 ServoController servoController,
                                 AutomaticDrive automaticDrive,
                                 AccelerometerGyroscopeSensor acceleratorSensor)
        {
            if (_shutdown)
            {
                return;
            }

            _motorController   = motorController;
            _servoController   = servoController;
            _automaticDrive    = automaticDrive;
            _acceleratorSensor = acceleratorSensor;

            Gamepad.GamepadAdded   += GamepadAdded;
            Gamepad.GamepadRemoved += GamepadRemoved;
        }
Пример #3
0
        public static void Initialize(AccelerometerGyroscopeSensor accelerometerSensor,
                                      AutomaticSpeakController automaticSpeakController,
                                      MotorController motorController,
                                      ServoController servoController,
                                      AutomaticDrive automaticDrive,
                                      Camera camera,
                                      HttpServerController httpServerController,
                                      SpeechRecognition speechRecognation,
                                      GamepadController gamepadController)
        {
            _accelerometerSensor      = accelerometerSensor;
            _automaticSpeakController = automaticSpeakController;
            _motorController          = motorController;
            _servoController          = servoController;
            _automaticDrive           = automaticDrive;
            _camera = camera;
            _httpServerController = httpServerController;
            _speechRecognation    = speechRecognation;
            _gamepadController    = gamepadController;

            _initialized = true;
        }
Пример #4
0
 public AutomaticSpeakController(AccelerometerGyroscopeSensor accelerometer)
 {
     _accelerometer = accelerometer;
 }