コード例 #1
0
 void Start()
 {
     working          = false;
     robot            = Robot.GetComponent <RobotCtrl>();
     robot.LeftPower  = 1;
     robot.RightPower = 1;
 }
コード例 #2
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;
        }