diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/robot/SimulationRobotService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/robot/SimulationRobotService.java index a5525d218..36c22c703 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/robot/SimulationRobotService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/robot/SimulationRobotService.java @@ -11,6 +11,7 @@ import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.command.CommandBO; import club.joylink.rtss.simulation.cbtc.constant.SignalAspect; +import club.joylink.rtss.simulation.cbtc.constant.SignalModel; import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants; import club.joylink.rtss.simulation.cbtc.constant.SimulationModule; import club.joylink.rtss.simulation.cbtc.data.CalculateService; @@ -436,13 +437,31 @@ public class SimulationRobotService { */ private void robotDrive(Simulation simulation, VirtualRealityTrain train, SectionPosition targetPosition) { SimulationDataRepository repository = simulation.getRepository(); - if (!train.getDoor1().isCloseAndLock() || !train.getDoor2().isCloseAndLock()) { //如果车门没关 - return; - } SectionPosition headPosition = train.getHeadPosition(); boolean right = train.isRight(); float speed = train.getSpeed(); - + if (!train.getDoor1().isCloseAndLock() || !train.getDoor2().isCloseAndLock()) { //如果车门没关 + return; + } + /** + * 添加车辆停靠车站时,车门关闭后向前行驶一点的问题,因为车头偏移与目标偏移大于 @seeSimulationConstants.PARK_POINT_MAX_OFFSET位置,故修正逻辑如下 + * 判断车辆是否停靠车站,没有开发的信号,没有新车命令,如果有其中一项的条件那么车辆可以启动 + * begin 2022-08-15 + */ + boolean trainPackingForStand = train.isParkingAt(); +// headPosition.getSection().getStandList().stream().anyMatch(d->d.isTrainParking()); + Signal targetSignal = headPosition.getSection().getSignalOf(right); + boolean closeSignal = false; + if(Objects.nonNull(targetSignal)){ + closeSignal = targetSignal.getAspect() == targetSignal.getSignalModel().getDefaultAspect(); + } + boolean noCommond = Objects.isNull(train.getRobotDriveParam().getThroughSignal()); + if(trainPackingForStand && closeSignal && noCommond){ + return; + } + /** + * end 2022-08-15 + */ Float distance = CalculateService.calculateDistance(headPosition, targetPosition, right, true); if (distance == null || distance <= SimulationConstants.PARK_POINT_MAX_OFFSET) { //如果列车已经抵达或越过目标位置 atoService.doBreakMax(train);