Esempio n. 1
0
        public Contingency(Encoder left, Encoder right, NavigationManager navigation)
        {
            alarm = false;
            monitor = new object();
            this.left = left;
            this.right = right;
            this.navigation = navigation;
            count = 0;
            end = false;

            th = new Thread(new ThreadStart(Run));
            th.Start();

            th2 = new Thread(new ThreadStart(Act));
            th2.Start();
            t = new Timer(new TimerCallback(decount), new object(), 0, 5000);
        }
Esempio n. 2
0
        public void InitializeSystem()
        {
            debug = new OutputPort((Cpu.Pin)PortMap.debug, false);
            debug.Write(true);

            coder = new Coder();
            Thread.Sleep(17000);
            coder.Start();

            Info("Initializing System...");

            navigation = new NavigationManager();
            Info("Initialized NavigationManager");
            sensors = new SensorManager();
            Info("Initialized SensorManager");
            battery = new BatteryManager();
            Info("Initialized BatteryManager");

            currentMode = Mode.SearchingForWall;

            sensorTimer = new Timer(new TimerCallback(sensorTimer_tick), new object(), 0, GlobalVal.transmissionPeriodSensor_ms);
            positionTimer = new Timer(new TimerCallback(posTimer_Tick), new object(), 0, GlobalVal.transmissionPeriodPosition_ms);
            batteryTimer = new Timer(new TimerCallback(batteryTimer_Tick), new object(), 0, GlobalVal.transmissionPeriodBattery_ms);
            magTimer = new Timer(new TimerCallback(magnetometer_Tick), new object(), 0, GlobalVal.trasmissionPeriodMagnetometer_ms);

            Info("Initialized Timers");

            cancel = false;
            debug.Write(false);

            navigation.manualSpeed = GlobalVal.speed;
            navigation.manualTurningSpeed = GlobalVal.turningSpeed;
            Info("Ready");
        }