修改机器人驾驶识别信号机bug

This commit is contained in:
joylink_zhangsai 2021-12-13 11:21:59 +08:00
parent 690acdba5f
commit b8687f8d40

View File

@ -6,6 +6,7 @@ import club.joylink.rtss.simulation.cbtc.ATS.operation.handler.DriverOperateHand
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsStationService;
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.SimulationConstants;
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
@ -182,10 +183,14 @@ public class RobotLogicLoop {
Signal signal = nextSection.getSignalOf(right);
if (signal != null && !Signal.SignalType.SHUNTING.equals(signal.getType())) {
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
if (vrSignal != null && (signal.isGuideAspect() || signal.isDefaultAspect())) { //真实信号机不为null且信号机显示是引导或默认
if (vrSignal != null &&
(Objects.equals(signal.getGuideAspect(), vrSignal.getAspect())
|| Objects.equals(signal.getDefaultAspect(), vrSignal.getAspect())
|| SignalAspect.No.equals(vrSignal.getAspect()))) { //真实信号机不为null且信号机显示是引导/默认/灭灯
//目标位置修改为信号机前5米
SectionPosition signalPosition = signal.getPosition();
targetPosition = CalculateService.calculateNextPositionByStartAndLen(signalPosition, !right, 5, true);
break;
}
}
nextSection = nextSection.getNextRunningSectionBaseRealSwitch(right);
@ -199,6 +204,7 @@ public class RobotLogicLoop {
/**
* 机器人驾驶
*
* @param simulation
* @param train
* @param targetPosition