Merge branch 'new_opentcs' of http://git.picaiba.com/agv/opentcs into new_opentcs

This commit is contained in:
魏红阳
2025-07-01 13:43:51 +08:00
12 changed files with 203 additions and 138 deletions

View File

@@ -162,6 +162,9 @@ public class LoopbackCommunicationAdapter
private final Router router;
//标记是否开启自动回休息点true=开启false=关闭
private final Boolean IS_AUTOMATIC_BREAKS = false;
/**
* Creates a new instance.
*
@@ -212,21 +215,23 @@ public class LoopbackCommunicationAdapter
}
super.initialize();
// 注册属性变化监听器
getProcessModel().addPropertyChangeListener(evt -> {
if (evt.getPropertyName().equals(VehicleProcessModel.Attribute.ENERGY_LEVEL.name())) {
LOG.info("Vehicle energy level changed to: {}", evt.getNewValue());
checkChargingNeed();
}
// 直接检查命令队列状态,不依赖特定属性名
if (getSentCommands().isEmpty() && getUnsentCommands().isEmpty()) {
LOG.debug("All commands executed, checking for parking position...");
LOG.info("Found parking positions: {}", findAllParkingPositions().stream()
.map(Point::getName)
.collect(Collectors.joining(", ")));
checkAndMoveToParkingPosition();
}
});
if (IS_AUTOMATIC_BREAKS) {
// 注册属性变化监听器
getProcessModel().addPropertyChangeListener(evt -> {
if (evt.getPropertyName().equals(VehicleProcessModel.Attribute.ENERGY_LEVEL.name())) {
LOG.info("Vehicle energy level changed to: {}", evt.getNewValue());
checkChargingNeed();
}
// 直接检查命令队列状态,不依赖特定属性名
if (getSentCommands().isEmpty() && getUnsentCommands().isEmpty()) {
LOG.debug("All commands executed, checking for parking position...");
LOG.info("Found parking positions: {}", findAllParkingPositions().stream()
.map(Point::getName)
.collect(Collectors.joining(", ")));
checkAndMoveToParkingPosition();
}
});
}
String initialPos
= vehicle.getProperties().get(LoopbackAdapterConstants.PROPKEY_INITIAL_POSITION);
@@ -524,7 +529,7 @@ public class LoopbackCommunicationAdapter
ACTION_STATUS = true;
//下发动作
ExecuteAction.sendCmd(command.getTransportOrder().getName(), getProcessModel().getName(), getProcessModel().getPosition(), command.getOperation(), getSerialNum());
ExecuteAction.sendCmd(command.getTransportOrder().getWrappingSequence().getName(), getProcessModel().getName(), getProcessModel().getPosition(), command.getOperation(), getSerialNum());
//进入阻塞
while (ACTION_STATUS) {