public RoverRobot(ExpansionPlate expansionPlate, IFrameSource <Image <Rgb24> > camera, RoverRobotConfiguration configuration) { using var operation = Log.OnEnterAndExit(); operation.Info("configuring platform ", configuration.LeftMotorPort, configuration.RightMotorPort, configuration.PanMotorPort, configuration.TiltMotorPort); ExpansionPlate = expansionPlate ?? throw new ArgumentNullException(nameof(expansionPlate)); Camera = camera; DashBoard = new RoverDashboard(expansionPlate.PiTop4Board.Display); TiltController = new PanTiltController( ExpansionPlate.GetOrCreateServoMotor(configuration.PanMotorPort), ExpansionPlate.GetOrCreateServoMotor(configuration.TiltMotorPort) ); MotionComponent = new SteeringMotorController( ExpansionPlate.GetOrCreateEncoderMotor(configuration.LeftMotorPort), ExpansionPlate.GetOrCreateEncoderMotor(configuration.RightMotorPort) ); FrontRightLed = ExpansionPlate.GetOrCreateLed(DigitalPort.D3, Color.Green); FrontLeftLed = ExpansionPlate.GetOrCreateLed(DigitalPort.D4, Color.Green); BackRightLed = ExpansionPlate.GetOrCreateLed(DigitalPort.D0, Color.Red); BackLeftLed = ExpansionPlate.GetOrCreateLed(DigitalPort.D5, Color.Red); UltrasoundFront = ExpansionPlate.GetOrCreateUltrasonicSensor(DigitalPort.D7); UltrasoundBack = ExpansionPlate.GetOrCreateUltrasonicSensor(DigitalPort.D6); Sound = ExpansionPlate.GetOrCreateSoundSensor(AnaloguePort.A3); FrontRightLed.Off(); FrontLeftLed.Off(); BackRightLed.Off(); BackLeftLed.Off(); }
public void AllLightsOff() { FrontRightLed.Off(); FrontLeftLed.Off(); BackRightLed.Off(); BackLeftLed.Off(); }