Exemplo n.º 1
0
        private void tester(object state)
        {
            Debug.Print((_loopSettings.LoopUnit / (DateTime.Now.Ticks - _lastSensorTime)).ToString());
            _lastSensorTime = DateTime.Now.Ticks;
            Sensors sensors = (Sensors)state;

            sensors.ReadGyro();
            //Debug.Print(DateTime.Now.Ticks.ToString());
        }
        public ThreadingProgram()
        {
            Gyro gyro = new TestGyro();
            Sensors sensors = new Sensors(gyro);

            Motor testMotor = new TestMotor();
            MotorMixer mixer = new QuadMixer(testMotor, testMotor, testMotor, testMotor);
            ILogger logger = new PersistenceWriter(new MemoryStream(), new TelemetryFormatter());

            Radio radio = new TestRadio();
            PIDSettings[] pidSettings = GetPIDSettings();
            AxesController axesController = new AxesController(pidSettings[0], pidSettings[1], pidSettings[2], true);
            _loopSettings = GetLoopSettings();

            Timer sensorTimer = new Timer(tester, sensors,new TimeSpan(0),new TimeSpan((long)_loopSettings.SensorLoopFrequency) );
        }
Exemplo n.º 3
0
        public ThreadingProgram()
        {
            Gyro    gyro    = new TestGyro();
            Sensors sensors = new Sensors(gyro);

            Motor      testMotor = new TestMotor();
            MotorMixer mixer     = new QuadMixer(testMotor, testMotor, testMotor, testMotor);
            ILogger    logger    = new PersistenceWriter(new MemoryStream(), new TelemetryFormatter());

            Radio radio = new TestRadio();

            PIDSettings[]  pidSettings    = GetPIDSettings();
            AxesController axesController = new AxesController(pidSettings[0], pidSettings[1], pidSettings[2], true);

            _loopSettings = GetLoopSettings();


            Timer sensorTimer = new Timer(tester, sensors, new TimeSpan(0), new TimeSpan((long)_loopSettings.SensorLoopFrequency));
        }