コード例 #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
ファイル: BMA180.cs プロジェクト: brandongrossutti/DotCopter
 public BMA180(I2CBus twiBus, AccelerometerSettings accelerometerSettings)
     : base(new AircraftPrincipalAxes())
 {
     _twiBus = twiBus;
     _accelerometerSettings = accelerometerSettings;
     Initialize();
 }
コード例 #3
0
ファイル: ITG3200.cs プロジェクト: brandongrossutti/DotCopter
 public ITG3200(I2CBus twiBus, GyroSettings gyroSettings)
     : base(new AircraftPrincipalAxes())
 {
     _twiBus = twiBus;
     _gyroSettings = gyroSettings;
     Initialize();
 }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
0
ファイル: BMA180.cs プロジェクト: brandongrossutti/DotCopter
        private Scale _scale = new Scale(0, 1/0.25F, 0); //Must be set to match range selection

        #endregion Fields

        #region Constructors

        public BMA180(I2CBus twiBus)
            : base(new Vector3D())
        {
            _twiBus = twiBus;
            Initialize();
        }
コード例 #7
0
 public DefaultRadio(I2CBus twiBus, RadioSettings settings)
     : base(0,new AircraftPrincipalAxes { Pitch = 0, Roll = 0, Yaw = 0 },false)
 {
     _twiBus = twiBus;
     _settings = settings;
 }
コード例 #8
0
 public DotCopterRadio(I2CBus twiBus, RadioSettings settings)
     : base(0,new Vector3D(),false)
 {
     _twiBus = twiBus;
     _settings = settings;
 }
コード例 #9
0
ファイル: ITG3200.cs プロジェクト: brandongrossutti/DotCopter
 public ITG3200(I2CBus twiBus)
     : base(new Vector3D())
 {
     _twiBus = twiBus;
     Initialize();
 }
コード例 #10
0
ファイル: ITG3200.cs プロジェクト: lukecummings/DotCopter
 public ITG3200(I2CBus twiBus, float factor) : base(new AircraftPrincipalAxes())
 {
     _twiBus = twiBus;
     _factor = factor;
     Initialize();
 }