修改:添加车辆停靠车站时,车门关闭后向前行驶一点的问题,因为车头偏移小于目标偏移(设定)

This commit is contained in:
tiger_zhou 2022-08-15 17:19:01 +08:00
parent 33203131b2
commit f3df206427

View File

@ -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);