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(); }
public BMA180(I2CBus twiBus, AccelerometerSettings accelerometerSettings) : base(new AircraftPrincipalAxes()) { _twiBus = twiBus; _accelerometerSettings = accelerometerSettings; Initialize(); }
public ITG3200(I2CBus twiBus, GyroSettings gyroSettings) : base(new AircraftPrincipalAxes()) { _twiBus = twiBus; _gyroSettings = gyroSettings; Initialize(); }
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); }
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); }
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(); }
public DefaultRadio(I2CBus twiBus, RadioSettings settings) : base(0,new AircraftPrincipalAxes { Pitch = 0, Roll = 0, Yaw = 0 },false) { _twiBus = twiBus; _settings = settings; }
public DotCopterRadio(I2CBus twiBus, RadioSettings settings) : base(0,new Vector3D(),false) { _twiBus = twiBus; _settings = settings; }
public ITG3200(I2CBus twiBus) : base(new Vector3D()) { _twiBus = twiBus; Initialize(); }
public ITG3200(I2CBus twiBus, float factor) : base(new AircraftPrincipalAxes()) { _twiBus = twiBus; _factor = factor; Initialize(); }