示例#1
0
        private void TryConnectToNxt(object sender, EventArgs e)
        {
            // connect and create robot obj
            var menuitem   = (ToolStripItem)sender;
            var comPortStr = menuitem.Text;
            // initialize application
            var robot = new AVINSoR_Library.NxtRobot(true, OnRobotConnectionStatusChanged, OnRobotConnectionStatusChanged, null, OnRobotNewBatteryLevel, null, comPortStr);

            Global.InitializeApp(ref robot, 100, 10);
            if (Global.Ready)
            {
                lstRobotVariables.List           = Global.TheRobot.Variables;
                lstPatternClassVariables.List    = Global.TheCognition.Variables;
                bayesClassifiersControl1.BcmList = Global.TheCognition.BayesClassifierModules;
                // start polling
                Global.TheRobot.StartReadingSensorValues();
                // cognition
                var bcm = new BayesClassifierModule("BCM1");
                bcm.ClassificationCategories.Add(new ClassCategory()
                {
                    Name = "Close By"
                });
                bcm.ClassificationCategories.Add(new ClassCategory()
                {
                    Name = "Far Away"
                });
                Global.TheCognition.BayesClassifierModules.Add(bcm);
            }
        }
 /// <summary>
 /// On user selecting/deselecting listviewitem in BCM listview
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void listOfBCMs_itemsSelectedOrDeselected(object sender, EventArgs e)
 {
     if (listBCMs.SelectedItems.Count > 0)
     {
         _selectedBCM = (BayesClassifierModule)listBCMs.SelectedItems[0].Tag;
         OnNewBCMSelected();
     }
     else
     {
         _selectedBCM = null;
         OnSelectedBCMCleared();
     }
 }
示例#3
0
        void AddBCMAsInputNode(object sender, EventArgs e)
        {
            var bt      = (Button)sender;
            var lstView = (ListView)bt.Tag;
            BayesClassifierModule bcm = null;

            // check if BCM selected and get selected BCM
            if (lstView.SelectedItems.Count > 0)
            {
                bcm = (BayesClassifierModule)lstView.SelectedItems[0].Tag;
            }
            // return error if null
            if (bcm != null)
            {
                _selectedBCM.InputNodes.Add(bcm);
                MessageBox.Show(_selectedBCM.InputNodes.Count.ToString());
            }
            else
            {
                throw new ApplicationException("No BCM selected.");
            }
        }
示例#4
0
 public ClassCategoryList(BayesClassifierModule parent)
 {
     Parent = parent;
 }
示例#5
0
 public PatternClassificationInputList(BayesClassifierModule parent)
 {
     Parent = parent;
 }