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