private void button3_Click_1(object sender, EventArgs e) { RobotAgent r = RegistrationAgent.robotAgentRegisteredList.ElementAt(0).Value; String msg = DataTranformation.jsoncheckinDockingCoordinations(0); r.sendPackageStringType(r.paramsRosSocket.publication_serverRobotGotToCheckInDockingArea, msg); }
public void processFinishStates(int states) { // RegistrationAgent.mainWindowPointer.LogConsole("STATE " + states); switch (states) { case CommandSetsToRobotAgent.STATE_FINISH_PALLETUP: // hoan thanh docking { // go to check in putaway RegistrationAgent.mainWindowPointer.LogConsole("STATE_FINISH_PALLETUP" + states, "logRobot"); // go to check in docking or Front Ready Area String msg = DataTranformation.jsoncheckinPutAwayCoordinations(0); RegistrationAgent.mainWindowPointer.LogConsole(msg, "logRobot"); sendPackageStringType(paramsRosSocket.publication_serverRobotGotToCheckInPutAwayArea, msg); } break; case CommandSetsToRobotAgent.STATE_FINISH_PALLETDOWN: { if (statusFlag.flagCharge) { String msg = DataTranformation.jsonFrontReadyAreaCoordinations(0); RegistrationAgent.mainWindowPointer.LogConsole("ROBOT NEED CHARGE !!", "logRobot"); sendPackageStringType(paramsRosSocket.publication_serverRobotGotToChargeArea, msg); return; } // go to check in docking or Front Ready Area RegistrationAgent.mainWindowPointer.LogConsole("STATE_FINISH_PALLETDOWN" + states, "logRobot"); bool checkOrder = RegistrationAgent.areaList[this.AreaID.ToString()].CheckPalletInDockingArea(); RegistrationAgent.mainWindowPointer.LogConsole("Flag check order: " + checkOrder, "logRobot"); if (checkOrder) { String msg = DataTranformation.jsoncheckinDockingCoordinations(0); RegistrationAgent.mainWindowPointer.LogConsole(msg, "logRobot"); sendPackageStringType(paramsRosSocket.publication_serverRobotGotToCheckInDockingArea, msg); } else { String msg = DataTranformation.jsonFrontReadyAreaCoordinations(0); RegistrationAgent.mainWindowPointer.LogConsole(msg, "logRobot"); sendPackageStringType(paramsRosSocket.publication_serverRobotGotToFrontReadyArea, msg); } } break; case CommandSetsToRobotAgent.STATE_FINISH_GOTOLINE_READYAREA: { statusFlag.flagProcess = false; /* RegistrationAgent.mainWindowPointer.LogConsole("STATE_FINISH_GOTOLINE_CHARGINGSTATION " + states); * String msg = this.readyArea.requestRobotStandInSideReadyArea(); * RegistrationAgent.mainWindowPointer.LogConsole(msg); * sendPackageStringType(paramsRosSocket.publication_responsedStandPosInsideReadyArea, msg);*/ } break; case CommandSetsToRobotAgent.STATE_FINISH_GOTO_CHECKINDOCKING: { try { RegistrationAgent.mainWindowPointer.LogConsole("STATE_FINISH_GOTO_CHECKINDOCKING " + states, "logRobot"); String[] cmddk = this.orderTask.RequestDockingOrderLine(this.AreaID, NameID); if (cmddk == null) { timeOutRecallProcessing(CommandSetsToRobotAgent.STATE_FINISH_GOTO_CHECKINDOCKING, 3000); return; } // orderInfo.finishCheckInDockingStore = cmddk; orderInfo.stationNameID = cmddk[1]; orderInfo.lineIndex = cmddk[2]; //orderInfo.palletIndex = cmddk[3]; RegistrationAgent.mainWindowPointer.LogConsole(cmddk[0], "logRobot"); if (cmddk[0].Length > 0) { sendPackageStringType(paramsRosSocket.publication_serverRobotGotToLineDockingArea, cmddk[0]); } } catch { Console.WriteLine("Jump Again!"); } } break; case CommandSetsToRobotAgent.STATE_FINISH_GOTO_CHECKINPUTAWAY: { try { RegistrationAgent.mainWindowPointer.LogConsole("STATE_FINISH_GOTO_CHECKINPUTAWAY " + states, "logRobot"); String[] cmdpw = this.orderTask.RequestPutAwayOrderLine(this.AreaID, NameID); if (cmdpw == null) { timeOutRecallProcessing(CommandSetsToRobotAgent.STATE_FINISH_GOTO_CHECKINPUTAWAY, 3000); return; } // orderInfo.finishCheckinPutAwayStore = cmdpw; orderInfo.stationNameID = cmdpw[1]; orderInfo.lineIndex = cmdpw[2]; //orderInfo.palletIndex = cmdpw[3]; RegistrationAgent.mainWindowPointer.LogConsole(cmdpw[0], "logRobot"); if (cmdpw[0].Length > 0) { sendPackageStringType(paramsRosSocket.publication_serverRobotGotToLinePutAwayArea, cmdpw[0]); } } catch { Console.WriteLine("Jump Again!"); } } break; case CommandSetsToRobotAgent.STATE_FINISH_GOTO_LINEPUTAWAY: { try { RegistrationAgent.mainWindowPointer.LogConsole("STATE_FINISH_GOTO_LINEPUTAWAY " + states, "logRobot"); String[] cmdpw = this.orderTask.RequestPutAwayOrderPallet(this.AreaID, NameID, orderInfo.stationNameID, orderInfo.lineIndex); if (cmdpw == null) { timeOutRecallProcessing(CommandSetsToRobotAgent.STATE_FINISH_GOTO_LINEPUTAWAY, 3000); return; } // orderInfo.finishLinePutAwayStore = cmdpw; orderInfo.stationNameID = cmdpw[1]; orderInfo.lineIndex = cmdpw[2]; orderInfo.palletIndex = cmdpw[3]; RegistrationAgent.mainWindowPointer.LogConsole(cmdpw[0], "logRobot"); if (cmdpw[0].Length > 0) { sendPackageStringType(paramsRosSocket.publication_serverRobotGotToPalletPutAwayArea, cmdpw[0]); } } catch { Console.WriteLine("Jump Again!"); } } break; case CommandSetsToRobotAgent.STATE_FINISH_GOTO_LINEDOCKING: { try { RegistrationAgent.mainWindowPointer.LogConsole("STATE_FINISH_GOTO_LINEDOCKING " + states, "logRobot"); String[] cmddk = this.orderTask.RequestDockingOrderPallet(this.AreaID, NameID, orderInfo.stationNameID, orderInfo.lineIndex); if (cmddk == null) { timeOutRecallProcessing(CommandSetsToRobotAgent.STATE_FINISH_GOTO_LINEDOCKING, 3000); return; } // orderInfo.finishLineDockingStore = cmddk; orderInfo.stationNameID = cmddk[1]; orderInfo.lineIndex = cmddk[2]; orderInfo.palletIndex = cmddk[3]; RegistrationAgent.mainWindowPointer.LogConsole(cmddk[0], "logRobot"); if (cmddk[0].Length > 0) { sendPackageStringType(paramsRosSocket.publication_serverRobotGotToPalletDockingArea, cmddk[0]); } } catch { Console.WriteLine("Jump Again!"); } } break; case CommandSetsToRobotAgent.STATE_FINISH_DETECTLINE_TO_READYAREA: // reset flagGoback RegistrationAgent.mainWindowPointer.LogConsole("STATE_FINISH_DETECTLINE_TO_CHARGINGSTATION" + states, "logRobot"); break; case CommandSetsToRobotAgent.STATE_SELFDRIVING_WAIT_PALLETUP: // do pallet nhap nhay truoc vi tri pallet set { //bool stop = RegistrationAgent.areaList[this.AreaID.ToString()].robotStopDK(orderInfo.agentID, orderInfo.lineIndex, orderInfo.palletIndex); //if (stop) //{ // // RegistrationAgent.mainWindowPointer.LogConsole("Robot Stop"); //} } break; case CommandSetsToRobotAgent.STATE_SELFDRIVING_WAIT_PALLETDOWN: // do pallet nhap nhay truoc vi tri pallet set { //bool stop = RegistrationAgent.areaList[this.AreaID.ToString()].robotStopPW(orderInfo.agentID, orderInfo.lineIndex, orderInfo.palletIndex); //if (stop) //{ // // RegistrationAgent.mainWindowPointer.LogConsole("Robot Stop"); //} } break; case CommandSetsToRobotAgent.STATE_SELFDRIVING_REQUEST_CHARGEBATTERY: statusFlag.flagCharge = true; break; case CommandSetsToRobotAgent.STATE_SELFDRIVING_FINISH_BATTERYCHARGING: // finish charge /* { * bool checkOrder = RegistrationAgent.areaList[this.AreaID.ToString()].CheckPalletInDockingArea(); * if (checkOrder) * { * String msg = DataTranformation.jsoncheckinDockingCoordinations(0); * RegistrationAgent.mainWindowPointer.LogConsole(msg); * sendPackageStringType(paramsRosSocket.publication_serverRobotGotToCheckInDockingArea, msg); * * } * statusFlag.flagCharge = false; * }*/ statusFlag.flagCharge = false; statusFlag.flagProcess = false; // khi vị trí battery va ready cung vị trí break; } }