public async Task Initialize(AutomaticSpeakController automaticSpeakController, byte i2cAddress = 0x60, int frequency = 100) { _automaticSpeakController = automaticSpeakController; _i2caddress = i2cAddress; _frequency = frequency; Motors = new List <Motor> { new Motor(this, 0), new Motor(this, 1), new Motor(this, 2), new Motor(this, 3) }; PwmController = new PwmController(i2cAddress); await PwmController.Initialize(); PwmController.SetDesiredFrequency(_frequency); MoveCar(null, new CarMoveCommand { ForwardBackward = true, Speed = 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(); }
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; }