private void InitVariables() { // Add local variables that are linked to corresponding variables on the physical RC8 controller // Add a variable linked to the robot connected to the RC8 controller Robot = RC8Controller.AddRobot("Arm"); // Add robot variables RobotBusyStatus = Robot.AddVariable("@BUSY_STATUS"); // Add a variable linked to the robot's busy status RobotState = Robot.AddVariable("@State"); // Add a variable which contains the current state of the robot RobotExternalSpeed = Robot.AddVariable("@Extspeed"); // Add a variable linked to the external (teach pendant) speed RobotCurrentPosition = Robot.AddVariable("@CURRENT_POSITION"); // Add a variable which contains the current robot position RobotCurrentAngle = Robot.AddVariable("@CURRENT_ANGLE"); // Add a variable which contains the current robot angle // Add variables that are linked to the current error code and description CurrentErrorCode = RC8Controller.AddVariable("@ERROR_CODE"); CurrentErrorDescription = RC8Controller.AddVariable("@ERROR_DESCRIPTION"); // Register to handle new message events from the controller // Every time the controller has a new message, the ShowMessage function will be called RC8Controller.OnMessage += new _ICaoControllerEvents_OnMessageEventHandler(ShowMessage); // Add a variable linked to string variable S10 RC8variable_S10 = RC8Controller.AddVariable("S10"); timer_InterfaceUpdate.Start(); // Start the GUI timer }
public void Init() { if (IsInitialized) { return; } Kill(); // Create CaoEngine object caoEngine = new CaoEngine(); caoWorkspace = caoEngine.Workspaces.Item(0); //caoController = caoWorkspace.AddController("RC7", "CaoProv.DENSO.NetwoRC", "", "conn=eth:192.168.0.1"); caoController = caoWorkspace.AddController("RC8", "CaoProv.DENSO.RC8", null, "Server=192.168.0.1,@IfNotMember=True"); caoRobot = caoController.AddRobot("Arm", ""); Robot = new DensoRobot(caoRobot); Robot.LogEvent += OnLogEvent; Controller = new DensoController(caoController); Controller.LogEvent += OnLogEvent; Controller.ClearError(); if ((int)Controller.ControllerCaoVars["@MODE"].Value <= 2) { MessageBox.Show("Controller not in Auto Mode! Retry!"); Close(); Kill(); IsInitialized = false; return; } //Controller.PutAutoMode(); Controller.Initialize(); //RobslaveTask = new DensoTask(caoController.AddTask("robslave", null)); //RobslaveTask.LogEvent += OnLogEvent; //RobslaveTask.Stop(); //RobslaveTask.Start(); IsInitialized = true; }