private void armsMan_StatusChanged(ArmControlStatus status) { if (this.InvokeRequired) { this.BeginInvoke(this.dlgStatusChanged, status); return; } if (status.IsSystemReady) { this.lblGeneralStatus.ForeColor = Color.Black; } else { this.lblGeneralStatus.ForeColor = Color.Red; } this.lblGeneralStatus.Text = status.SystemStatus; this.lblCnnStatus.Text = "| BB: " + status.CnnToBBStatus + " |"; this.lblLeftArmStatus.Text = "LA: " + status.LeftArmStatus + " |"; this.lblRightArmStatus.Text = "RA: " + status.RightArmStatus + " |"; this.lblLeftComPort.Text = "LA: " + status.LeftComPort + " |"; this.lblRightComPort.Text = "RA: " + status.RightComPort + " |"; }
private void OnFilesLoaded(ArmControlStatus status) { if (this.FilesLoaded != null) { this.FilesLoaded(status); } }
private void OnStatusChanged(ArmControlStatus status) { if (this.StatusChanged != null) { this.StatusChanged(status); } }
private void armsMan_FilesLoaded(ArmControlStatus status) { if (this.InvokeRequired) { this.BeginInvoke(this.dlgFilesLoaded, status); return; } UpdatePosAndMovs(); }
public ManipulatorManager(string leftPortName, string rightPortName) { this.status = new ArmControlStatus(); if (leftPortName == "disable") { this.status.LeftArmEnable = false; } if (rightPortName == "disable") { this.status.RightArmEnabled = false; } if (string.IsNullOrEmpty(leftPortName)) { leftPortName = "COM5"; } if (string.IsNullOrEmpty(rightPortName)) { rightPortName = "COM9"; } this.leftArmSerialPort = new SerialPort(leftPortName, 57600, Parity.None, 8, StopBits.One); this.rightArmSerialPort = new SerialPort(rightPortName, 57600, Parity.None, 8, StopBits.One); this.status.LeftComPort = leftPortName; this.status.RightComPort = rightPortName; this.leftArm = new Manipulator(this.leftArmSerialPort, ArmType.LeftArm); this.rightArm = new Manipulator(this.rightArmSerialPort, ArmType.RightArm); this.leftArm.ArmPositionChanged += new ArmPositionChangedEH(leftArm_ArmPositionChanged); this.rightArm.ArmPositionChanged += new ArmPositionChangedEH(rightArm_ArmPositionChanged); this.laEndEffectorType = TypeOfEndEffector.gripper; this.raEndEffectorType = TypeOfEndEffector.hand; this.mapObstacles = new SortedList <string, MapObstacle>(); this.mapNodes = new SortedList <string, MapNode>(); this.leftPredefPos = new SortedList <string, PredefPosition>(); this.leftPredefMovs = new SortedList <string, PredefMovement>(); this.rightPredefPos = new SortedList <string, PredefPosition>(); this.rightPredefMovs = new SortedList <string, PredefMovement>(); this.optLeftPath = new MapOptimalPath(); this.optRightPath = new MapOptimalPath(); this.leftGoal = new MapGoalPoint(); this.rightGoal = new MapGoalPoint(); this.lowBat = new SharedVariable <bool>("bat_alert"); this.sharedVarLeftArmPos = new DoubleArraySharedVariable("leftArmPos"); this.sharedVarRightArmPos = new DoubleArraySharedVariable("rightArmPos"); this.sharedVarEndEffectorType = new StringSharedVariable("endEffectorType"); this.cmdMan = new CommandManager(); this.cnnMan = new ConnectionManager("ARMS", 2080, this.cmdMan); this.cnnMan.ClientConnected += new System.Net.Sockets.TcpClientConnectedEventHandler(cnnMan_ClientConnected); this.cnnMan.ClientDisconnected += new System.Net.Sockets.TcpClientDisconnectedEventHandler(cnnMan_ClientDisconnected); this.status.Running = true; this.checkSystemThread = new Thread(new ThreadStart(this.CheckSystemThreadTask)); this.checkSystemThread.IsBackground = true; this.checkSystemThread.Start(); }