update
This commit is contained in:
parent
e6818275ab
commit
f2241efc68
@ -123,11 +123,11 @@ public class LoopbackCommunicationAdapter
|
||||
/**
|
||||
* 记录执行订单名称
|
||||
*/
|
||||
private static String ORDER_NAME;
|
||||
private String ORDER_NAME;
|
||||
/**
|
||||
* 记录当前车辆位置
|
||||
*/
|
||||
private static String CURRENT_POS;
|
||||
private String CURRENT_POS;
|
||||
/**
|
||||
* 订单任务key:记录当前订单执行的任务key
|
||||
*/
|
||||
@ -163,7 +163,10 @@ public class LoopbackCommunicationAdapter
|
||||
private final Router router;
|
||||
|
||||
//标记是否开启自动回休息点:true=开启,false=关闭
|
||||
private final Boolean IS_AUTOMATIC_BREAKS = false;
|
||||
private final Boolean IS_AUTOMATIC_BREAKS = true;
|
||||
|
||||
//连接状态
|
||||
private final Boolean CONNECT_STATUS = false;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
@ -343,7 +346,9 @@ public class LoopbackCommunicationAdapter
|
||||
sourcePoint = cmd.getStep().getSourcePoint().getName();
|
||||
|
||||
//下发AGV移动指令
|
||||
ExecuteMove.sendCmd(getProcessModel().getName(), cmd, getSerialNum());
|
||||
if (CONNECT_STATUS) {
|
||||
ExecuteMove.sendCmd(getProcessModel().getName(), cmd, getSerialNum());
|
||||
}
|
||||
}
|
||||
|
||||
// Start the simulation task if we're not in single step mode and not simulating already.
|
||||
@ -493,17 +498,26 @@ public class LoopbackCommunicationAdapter
|
||||
* @param command 命令
|
||||
*/
|
||||
private void startVehicleExec(MovementCommand command) {
|
||||
LOG.debug("VEHICLE: {} BEGINS TO EXECUTE THE COMMAND: {}", getProcessModel().getName(),command);
|
||||
LOG.info("车辆: {} 开始执行命令: {}", getProcessModel().getName(),command);
|
||||
getProcessModel().setState(Vehicle.State.EXECUTING);
|
||||
Step step = command.getStep();
|
||||
|
||||
if (step.getPath() == null) {
|
||||
actionExec(command);
|
||||
getExecutor().schedule(
|
||||
() -> actionExec(command),
|
||||
100,
|
||||
TimeUnit.MILLISECONDS
|
||||
);
|
||||
} else {
|
||||
// ExecuteOperation.setExecTaskKey(getProcessModel().getName(), TASK_KEY);
|
||||
// TASK_KEY++;
|
||||
LOG.info("车辆: {} 移动到: {}", getProcessModel().getName(),step.getDestinationPoint().getName());
|
||||
//todo 移动
|
||||
movementExec(command);
|
||||
getExecutor().schedule(
|
||||
() -> movementExec(command),
|
||||
100,
|
||||
TimeUnit.MILLISECONDS
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -529,7 +543,9 @@ public class LoopbackCommunicationAdapter
|
||||
ACTION_STATUS = true;
|
||||
|
||||
//下发动作
|
||||
ExecuteAction.sendCmd(command.getTransportOrder().getWrappingSequence().getName(), getProcessModel().getName(), getProcessModel().getPosition(), command.getOperation(), getSerialNum());
|
||||
if (CONNECT_STATUS) {
|
||||
ExecuteAction.sendCmd(command.getTransportOrder().getWrappingSequence().getName(), getProcessModel().getName(), getProcessModel().getPosition(), command.getOperation(), getSerialNum());
|
||||
}
|
||||
|
||||
//进入阻塞
|
||||
while (ACTION_STATUS) {
|
||||
@ -555,6 +571,7 @@ public class LoopbackCommunicationAdapter
|
||||
|
||||
String currentPosition = getProcessModel().getPosition();
|
||||
if (currentPosition != null && currentPosition.equals(CURRENT_POS)) {
|
||||
LOG.info("车辆: {} ,实际位置: {} ,记录位置: {}", vehicle.getName(), currentPosition, CURRENT_POS);
|
||||
getExecutor().schedule(
|
||||
() -> movementExec(command),
|
||||
500,
|
||||
@ -574,6 +591,7 @@ public class LoopbackCommunicationAdapter
|
||||
|
||||
private void finishCmd(MovementCommand command) {
|
||||
if (Objects.equals(getSentCommands().peek(), command)) {
|
||||
LOG.info("车辆: {} ,订单: {} ,命令: {} 结束", vehicle.getName(), command.getTransportOrder().getName(), command);
|
||||
//清理任务队列
|
||||
getProcessModel().commandExecuted(requireNonNull(getSentCommands().poll()));
|
||||
} else {
|
||||
@ -594,12 +612,12 @@ public class LoopbackCommunicationAdapter
|
||||
}
|
||||
|
||||
private void startVehicleSimulation(MovementCommand command) {
|
||||
LOG.debug("Starting vehicle simulation for command: {}", command);
|
||||
LOG.info("Starting vehicle simulation for command: {}", command);
|
||||
Step step = command.getStep();
|
||||
getProcessModel().setState(Vehicle.State.EXECUTING);
|
||||
|
||||
if (step.getPath() == null) {
|
||||
LOG.debug("Starting operation simulation...");
|
||||
LOG.info("Starting operation simulation...");
|
||||
getExecutor().schedule(
|
||||
() -> operationSimulation(command, 0),
|
||||
SIMULATION_PERIOD,
|
||||
@ -616,7 +634,7 @@ public class LoopbackCommunicationAdapter
|
||||
)
|
||||
);
|
||||
|
||||
LOG.debug("Starting movement simulation...");
|
||||
LOG.info("Starting movement simulation...");
|
||||
getExecutor().schedule(
|
||||
() -> movementSimulation(command),
|
||||
SIMULATION_PERIOD,
|
||||
|
Loading…
Reference in New Issue
Block a user