예제 #1
0
        public FormWorldControl()
        {
            InitializeComponent();

            RunMode runMode = RunMode.Real;
            if (!Constants.IsWinCE)
            {
                runMode = RunMode.Virtual;
            }

            Robot _robot = new Robot(runMode);
            Drive _drive = _robot.Drive;
            _drive.Power = true;
            _drive.Position = new PositionInfo(0, 0, 90);
            _robot.Color = Color.Red;

            World.Robot = _robot;

            driveView1.Drive = _drive;

            _robot.RobotConsole.SwitchChanged += new EventHandler(robotConsole1_SwitchChanged);
            consoleView1.RobotConsole = _robot.RobotConsole;

            createWorldView();
        }
예제 #2
0
        public Form1()
        {
            InitializeComponent();
            robot = new RobotCtrl.Robot(); // new Robot object

            // --------- Initialization ---------
            // Drive
            robot.Drive.Power = true; // Motor power ON
            driveView.Drive   = robot.Drive;
            runArcView.Drive  = robot.Drive;
            runTurnView.Drive = robot.Drive;
            runLineView.Drive = robot.Drive;
            // Initalization for the Start
            commonRunParameters_AccelerationChanged(null, EventArgs.Empty);
            commonRunParameters_SpeedChanged(null, EventArgs.Empty);

            // LED view
            consoleView.Console = robot.RobotConsole;
            robot.RobotConsole[Switches.Switch1].SwitchStateChanged += (s, e) => { robot.RobotConsole[Leds.Led1].LedEnabled = robot.RobotConsole[Switches.Switch1].SwitchEnabled; };
            robot.RobotConsole[Switches.Switch2].SwitchStateChanged += (s, e) => { robot.RobotConsole[Leds.Led2].LedEnabled = robot.RobotConsole[Switches.Switch2].SwitchEnabled; };
            robot.RobotConsole[Switches.Switch3].SwitchStateChanged += (s, e) => { robot.RobotConsole[Leds.Led3].LedEnabled = robot.RobotConsole[Switches.Switch3].SwitchEnabled; };
            robot.RobotConsole[Switches.Switch4].SwitchStateChanged += (s, e) => { robot.RobotConsole[Leds.Led4].LedEnabled = robot.RobotConsole[Switches.Switch4].SwitchEnabled; };
            robot.RobotConsole[Switches.Switch1].SwitchStateChanged += StartParkingManoveur;

            // Radar view
            radarView.Radar = robot.Radar;

            // FSM state
            fsmState = State.IDLE;

            // Parking status
            label_ParkingState.Text = "Bereit zum starten";

            // No barrier value
            noBarrier = 0.0f;

            // Thread Initalization

            ultrasonicSensorThread = new Thread(UltrasonicRead);
        }
예제 #3
0
        public void InterpretCommandTest()
        {
            RunMode actualMode = Constants.IsWinCE ? RunMode.Real : RunMode.Virtual;
            Drive drv = new Drive(actualMode);
            Robot r = new Robot(actualMode);
            World.Robot = r;

            Interpreter interpreter = new Interpreter();
            //Interpreter_Accessor target = new Interpreter_Accessor(); // TODO: Initialize to an appropriate value
            Command cmd = new Command(); // TODO: Initialize to an appropriate value
            cmd.Method = "RunLine";//RunLine(float length, float speed, float acceleration)
            //cmd.Parameters.Add(new CommandParam() { Type = typeof(float), Parameter = 1 });
            //cmd.Parameters.Add(new CommandParam() { Type = typeof(float), Parameter = 1 });
            //cmd.Parameters.Add(new CommandParam() { Type = typeof(float), Parameter = 1 });
            ////cmd.Parameters.Add(new CommandParam() { Type = typeof(float), Parameter = 1 });

            //interpreter.InterpretCommand(cmd);

            //target.InterpretCommand(cmd);

            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
예제 #4
0
        public FormWorldControl()
        {
            InitializeComponent();
            RunMode actualMode = Constants.IsWinCE ? RunMode.Real : RunMode.Virtual;
            Drive drv = new Drive(actualMode);
            Robot r = new Robot(actualMode);
            drv.DriveCtrl.Power = true;
            drv.DriveCtrl.PowerLeft = true;
            drv.DriveCtrl.PowerRight = true;

            this.runLineView1.drive = drv;
            this.driveView1.Drive = drv;
            this.trackArc1.drive = drv;
            this.trackTurnView1.drive = drv;

            r.ConfigurePathRecording(0.05f, 0.1f);

            drv.Position = new PositionInfo(5.0f, 5.0f, 0.0f);

            r.drv = drv;
            r.Color = Color.Red;
            World.Robot = r;

            r.SwitchStateChanged += new EventHandler<SwitchEventArgs>(r_SwitchStateChanged);
            RobotConsole rc = r.RobotConsole;

            consoleView1.RobotConsole = rc;

            if (r.RunMode == RunMode.Virtual)
            {
                World.ObstacleMap = new ObstacleMap(RobotView.Resource.ObstacleMap1c, xMin-0.25f, xMax+0.25f, yMin-0.25f, yMax-0.25f); //korrektur wg. doofen bildern
            }

            view = new FormWorldView(xMin, yMin, xMax, yMax);
            view.ViewPort = new RobotView.ViewPort(xMin, xMax, yMin, yMax);
            view.Show();

            this.StartServices();
        }