Exemplo n.º 1
0
        public MainWindow()
        {
            // Read information about the robot we are controlling here
            InitRobotConfig();

            // Initiate the components
            _client          = new CommunicationClient(ClientType.R, _robotConfig.ID, ReceiveTcpMsg, LogMessage, ConnectionErrorHandler);
            _iRobot          = new iRobot(LogMessage);
            _robotController = new RobotCtrl(_iRobot, () => { return(_botActive); }, () => { return(_appQuit); }, LogMessage, RobotStatusChanged, RobotPodChanged, UpdateRFIDTag, _client, "debugsnapshots", SetFilterSettings);

            // Init this component
            InitializeComponent();

            // Initialize imageboxes here (avoid markup problems in some VS versions)
            ImageBoxCamImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
            ImageBoxCVImage.SizeMode  = System.Windows.Forms.PictureBoxSizeMode.Zoom;

            // Initiate the GUI
            InitPidParameter();
            GetAllCOMPorts();
            GetAllCameraPorts();

            // Init meta-info
            TextBlockRobotInfo.Text = "Bot" + _robotConfig.ID + " (" + _robotConfig.Name + ")";

            // Init FPS logger
            ThreadPool.QueueUserWorkItem(new WaitCallback(LogPerformanceAndStateInfoAsync));

            // Init checkbox states
            CheckBoxActive_Checked(null, null);
            CheckBoxDummy_Checked(null, null);

            // Log all unhandled exceptions
            AppDomain.CurrentDomain.UnhandledException       += CurrentDomain_UnhandledException;
            Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
        }
Exemplo n.º 2
0
        private void InitializeRobots()
        {
            Position startPositionRobotA = new Position(1, 2, Direction.N);
            Position startPositionRobotB = new Position(3, 3, Direction.E);

            List <Move> stepsRobotA = new List <Move>();

            stepsRobotA.Add(global::WarRobots.Move.L);
            stepsRobotA.Add(global::WarRobots.Move.M);
            stepsRobotA.Add(global::WarRobots.Move.L);
            stepsRobotA.Add(global::WarRobots.Move.M);
            stepsRobotA.Add(global::WarRobots.Move.L);
            stepsRobotA.Add(global::WarRobots.Move.M);
            stepsRobotA.Add(global::WarRobots.Move.L);
            stepsRobotA.Add(global::WarRobots.Move.M);
            stepsRobotA.Add(global::WarRobots.Move.M);

            List <Move> stepsRobotB = new List <Move>();

            stepsRobotB.Add(global::WarRobots.Move.M);
            stepsRobotB.Add(global::WarRobots.Move.M);
            stepsRobotB.Add(global::WarRobots.Move.R);
            stepsRobotB.Add(global::WarRobots.Move.M);
            stepsRobotB.Add(global::WarRobots.Move.M);
            stepsRobotB.Add(global::WarRobots.Move.R);
            stepsRobotB.Add(global::WarRobots.Move.M);
            stepsRobotB.Add(global::WarRobots.Move.R);
            stepsRobotB.Add(global::WarRobots.Move.R);
            stepsRobotB.Add(global::WarRobots.Move.M);

            RobotA = new Robot(startPositionRobotA, stepsRobotA, BattleField);
            RobotB = new Robot(startPositionRobotB, stepsRobotB, BattleField);

            BattleField.AddRobot(RobotA);
            BattleField.AddRobot(RobotB);
        }
Exemplo n.º 3
0
 public void AddRobot(iRobot robot)
 {
     Robots.Add(robot);
 }