コード例 #1
0
ファイル: Program.cs プロジェクト: lukecummings/DotCopter
        public static void Main()
        {
            //Initialize motors first
            MotorSettings motorSettings = GetMotorSettings();
            Motor frontMotor = new PWMMotor(new PWM((Cpu.Pin) FezPin.PWM.Di8, 4000000), motorSettings);
            Motor rearMotor = new PWMMotor(new PWM((Cpu.Pin) FezPin.PWM.Di10, 4000000), motorSettings);
            Motor leftMotor = new PWMMotor(new PWM((Cpu.Pin) FezPin.PWM.Di9, 4000000), motorSettings);
            Motor rightMotor = new PWMMotor(new PWM((Cpu.Pin) FezPin.PWM.Di6, 4000000), motorSettings);
            MotorMixer mixer = new QuadMixer(frontMotor, rearMotor, leftMotor, rightMotor);

            //Telemetry
            ISDCard sdCard = (ISDCard) new SDCard();
            if (Configuration.DebugInterface.GetCurrent() == Configuration.DebugInterface.Port.USB1)
                sdCard.MountFileSystem();
            else
                new TelemetryPresenter(sdCard,(Cpu.Pin) FezPin.Digital.LED);
            ILogger logger = new PersistenceWriter(new FileStream(@"\SD\telemetry.bin",FileMode.OpenOrCreate), new TelemetryFormatter());

            //Sensors
            I2CBus twiBus = new I2CBus();
            Gyro gyro = new ITG3200(twiBus, GetGyroFactor());
            Radio radio = new DefaultRadio(twiBus, GetRadioSettings());

            //Control Algoriths
            PIDSettings[] pidSettings = GetPIDSettings();
            AxesController axesController = new AxesController(pidSettings[0], pidSettings[1], pidSettings[2], true);
            ControllerLoopSettings loopSettings = GetLoopSettings();
            Controller controller = new Controller(mixer, axesController, gyro, radio, loopSettings, GetMotorSettings(),logger);

            //controller.Start();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: brandongrossutti/DotCopter
        public static void Main()
        {
            MotorSettings motorSettings = GetMotorSettings();
            Motor frontMotor = new PWMMotor(new PWM((Cpu.Pin)FEZ_Pin.PWM.Di6, 4000000), motorSettings);
            Motor rearMotor = new PWMMotor(new PWM((Cpu.Pin)FEZ_Pin.PWM.Di9, 4000000), motorSettings);
            Motor rightMotor = new PWMMotor(new PWM((Cpu.Pin)FEZ_Pin.PWM.Di10, 4000000), motorSettings);
            Motor leftMotor = new PWMMotor(new PWM((Cpu.Pin)FEZ_Pin.PWM.Di8, 4000000), motorSettings);
            MotorMixer mixer = new QuadMixer(frontMotor, rearMotor, leftMotor, rightMotor);

            //Sensors
            I2CBus twiBus = new I2CBus();
            Gyro gyro = new ITG3200(twiBus);
            Thread.Sleep(2000);
            gyro.Zero();
            Radio radio = new DotCopterRadio(twiBus, GetRadioSettings());

            //Control Algoriths
            PID pid = new PIDWindup(GetPIDSettings());
            ControllerLoopSettings loopSettings = GetLoopSettings();
            new Controller(mixer, pid, gyro, radio, loopSettings);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: brandongrossutti/DotCopter
        public static void Main()
        {
            MotorSettings motorSettings = GetMotorSettings();
            Motor frontMotor = new PWMMotor(new PWM(Pins.GPIO_PIN_D10, 2 * 1000), motorSettings);
            Motor rearMotor = new PWMMotor(new PWM(Pins.GPIO_PIN_D5, 2 * 1000), motorSettings);
            Motor rightMotor = new PWMMotor(new PWM(Pins.GPIO_PIN_D9, 2 * 1000), motorSettings);
            Motor leftMotor = new PWMMotor(new PWM(Pins.GPIO_PIN_D6, 2 * 1000), motorSettings);
            MotorMixer mixer = new QuadMixer(frontMotor, rearMotor, leftMotor, rightMotor);

            //Sensors
            I2CBus twiBus = new I2CBus();
            Gyro gyro = new ITG3200(twiBus);
            gyro.Zero();
            Radio radio = new DotCopterRadio(twiBus, GetRadioSettings());

            //Control Algoriths
            PID pid = new PIDWindup(GetPIDSettings());
            ControllerLoopSettings loopSettings = GetLoopSettings();
            OutputPort led = new OutputPort(Pins.ONBOARD_LED,true);
            new Controller(mixer, pid, gyro, radio, loopSettings);
        }