public SerialCarHardwareInterface(String portPath)
        {
            // For now, we're hardcoding our sensors.
            RearUltrasonicSensor = new UltrasonicSensor();
            FrontUltrasonicSensors = new UltrasonicSensor[] {
                new UltrasonicSensor(),
                new UltrasonicSensor(),
                new UltrasonicSensor()
            };
            Accelerometor = new AccelerometorSensor();
            ThrottleServo = new Servo(this);
            SteeringServo = new Servo(this);

            StartSerialPortConnection();
        }
        public bool ApplyValueToServo(double value, Servo servo)
        {

            double throttleValue = ThrottleServo.Value;
            double steeringValue = SteeringServo.Value;

            if (servo == ThrottleServo) throttleValue = value;
            if (servo == SteeringServo) steeringValue = value;

            return WriteServoValuesToDevice(steeringValue, throttleValue);
        }
예제 #3
0
 public ServoInfoScreen(Servo servo, string name)
 {
     ScreenServo = servo;
     Name = name;
 }