驾驶和停车操作
This commit is contained in:
parent
266463eb4c
commit
280f4edd78
@ -23,6 +23,7 @@ import club.joylink.rtss.vo.client.fault.FaultRuleVO;
|
||||
import club.joylink.rtss.vo.client.iscs.systemRes.IscsSystemResourcesQueryVO;
|
||||
import club.joylink.rtss.vo.client.iscs.systemRes.IscsSystemResourcesVO;
|
||||
import club.joylink.rtss.vo.client.map.DestinationCodeVO;
|
||||
import club.joylink.rtss.vo.client.operation.DriveParamVO;
|
||||
import club.joylink.rtss.vo.client.psl.PslStatus;
|
||||
import club.joylink.rtss.vo.client.runplan.PlanTripNumberVO;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanEChartsDataVO;
|
||||
@ -402,6 +403,14 @@ public class SimulationV1Controller {
|
||||
return groupSimulationService.getLog(group, queryVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机器人驾驶参数
|
||||
*/
|
||||
@GetMapping("/{simulationId}/driveParam/{groupNumber}")
|
||||
public DriveParamVO getDriveParam(@PathVariable String simulationId, @PathVariable String groupNumber) {
|
||||
return groupSimulationService.getDriveParam(simulationId, groupNumber);
|
||||
}
|
||||
|
||||
/* ----------------------- 泰雷兹操作辅助接口 ----------------------- */
|
||||
/**
|
||||
*查询进路路径
|
||||
|
@ -833,6 +833,10 @@ public class Operation {
|
||||
* 确认
|
||||
*/
|
||||
Driver_Confirm,
|
||||
/**
|
||||
* 停车
|
||||
*/
|
||||
Driver_Stop,
|
||||
|
||||
//--------------------------- 方向杆 ---------------------------
|
||||
/**
|
||||
|
@ -10,6 +10,7 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.ATOService;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATP.ATPService;
|
||||
import club.joylink.rtss.simulation.cbtc.robot.SimulationRobotService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@ -28,6 +29,9 @@ public class DriverOperateHandler {
|
||||
@Autowired
|
||||
private ATPService ATPService;
|
||||
|
||||
@Autowired
|
||||
private SimulationRobotService simulationRobotService;
|
||||
|
||||
@OperateHandlerMapping(type = Operation.Type.Driver_Force_Change)
|
||||
public void changeTrainForce(Simulation simulation, String groupNumber, Float percent) {
|
||||
Objects.requireNonNull(percent);
|
||||
@ -62,6 +66,9 @@ public class DriverOperateHandler {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 紧急制动
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Driver_EB)
|
||||
public void trainEB(Simulation simulation, String groupNumber) {
|
||||
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
|
||||
@ -195,4 +202,11 @@ public class DriverOperateHandler {
|
||||
ATPService.confirmMessage(train);
|
||||
}
|
||||
|
||||
/**
|
||||
* 停车
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Driver_Stop)
|
||||
public void stopTrain(Simulation simulation, String groupNumber, Boolean eb) {
|
||||
simulationRobotService.stopTrain(simulation, groupNumber, eb);
|
||||
}
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ public class TrainOperateHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* 列车托管
|
||||
* 列车托管。使用司机的驾驶指令
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Train_Trust)
|
||||
public void trust(Simulation simulation, String groupNumber, DriveParamVO param) {
|
||||
|
@ -419,20 +419,12 @@ public class AtsTrainService {
|
||||
public void trust(Simulation simulation, String groupNumber, DriveParamVO param) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
VirtualRealityTrain train = repository.getOnlineTrainBy(groupNumber);
|
||||
//设置限速
|
||||
Float speedLimit = param.getSpeedLimit();
|
||||
if (speedLimit != null) {
|
||||
if (speedLimit < 0)
|
||||
speedLimit = Float.MAX_VALUE;
|
||||
train.setSpeedLimit(speedLimit / 3.6f);
|
||||
}
|
||||
//向前行驶
|
||||
train.setRobotDriveForward(param.isDriveForward());
|
||||
//设置目标位置
|
||||
//计算目标位置
|
||||
SectionPosition targetPosition = null;
|
||||
String targetDeviceCode = param.getTargetDeviceCode();
|
||||
if (StringUtils.hasText(targetDeviceCode)) {
|
||||
boolean right = train.isRight();
|
||||
SectionPosition targetPosition;
|
||||
SectionPosition tempTargetPosition;
|
||||
MapElement element = repository.findByCode(targetDeviceCode);
|
||||
if (element != null) {
|
||||
if (!(element instanceof Section)) {
|
||||
@ -448,24 +440,25 @@ public class AtsTrainService {
|
||||
if (distance == null) {
|
||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "无法到达的位置");
|
||||
}
|
||||
targetPosition = CalculateService.calculateNextPositionByStartAndLen(train.getHeadPosition(), right, distance, false);
|
||||
tempTargetPosition = CalculateService.calculateNextPositionByStartAndLen(train.getHeadPosition(), right, distance, false);
|
||||
} else {
|
||||
targetPosition = new SectionPosition(section, section.getStopPointByDirection(right));
|
||||
tempTargetPosition = new SectionPosition(section, section.getStopPointByDirection(right));
|
||||
}
|
||||
} else {
|
||||
targetPosition = new SectionPosition(section, section.getStopPointByDirection(right));
|
||||
tempTargetPosition = new SectionPosition(section, section.getStopPointByDirection(right));
|
||||
}
|
||||
} else {
|
||||
VirtualRealityTrain targetTrain = repository.getVRByCode(targetDeviceCode, VirtualRealityTrain.class);
|
||||
SectionPosition targetTrainTailPosition = targetTrain.calculateTailPosition();
|
||||
boolean targetIsRight = targetTrain.isRight();
|
||||
targetPosition = CalculateService.calculateNextPositionByStartAndLen(targetTrainTailPosition, !targetIsRight, 2, false);
|
||||
tempTargetPosition = CalculateService.calculateNextPositionByStartAndLen(targetTrainTailPosition, !targetIsRight, 2, false);
|
||||
}
|
||||
SectionPosition physicalPosition = targetPosition.convert2PhysicalSectionPosition();
|
||||
train.setRobotTargetPosition(physicalPosition);
|
||||
} else {
|
||||
train.setRobotTargetPosition(null);
|
||||
targetPosition = tempTargetPosition.convert2PhysicalSectionPosition();
|
||||
BusinessExceptionAssertEnum.OPERATION_FAIL.assertNotNull(targetPosition, "无法抵达所选位置");
|
||||
}
|
||||
|
||||
param.setTargetPosition(targetPosition);
|
||||
train.setRobotDriveParam(param);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,6 +17,7 @@ import club.joylink.rtss.vo.client.fault.FaultRuleVO;
|
||||
import club.joylink.rtss.vo.client.iscs.systemRes.IscsSystemResourcesQueryVO;
|
||||
import club.joylink.rtss.vo.client.iscs.systemRes.IscsSystemResourcesVO;
|
||||
import club.joylink.rtss.vo.client.map.DestinationCodeVO;
|
||||
import club.joylink.rtss.vo.client.operation.DriveParamVO;
|
||||
import club.joylink.rtss.vo.client.runplan.PlanTripNumberVO;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanEChartsDataVO;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
|
||||
@ -293,4 +294,6 @@ public interface GroupSimulationService {
|
||||
List<IscsSystemResourcesVO> getAllIscsSystemResources(String group, IscsSystemResourcesQueryVO queryVO);
|
||||
|
||||
void modifySystemTime(String group, LocalTime time);
|
||||
|
||||
DriveParamVO getDriveParam(String simulationId, String groupNumber);
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
|
||||
import club.joylink.rtss.simulation.cbtc.data.storage.StorageSimulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.RealDeviceVO;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.SimulationRealDeviceConnectManager;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.event.*;
|
||||
@ -54,6 +55,7 @@ import club.joylink.rtss.vo.client.fault.FaultRuleVO;
|
||||
import club.joylink.rtss.vo.client.iscs.systemRes.IscsSystemResourcesQueryVO;
|
||||
import club.joylink.rtss.vo.client.iscs.systemRes.IscsSystemResourcesVO;
|
||||
import club.joylink.rtss.vo.client.map.DestinationCodeVO;
|
||||
import club.joylink.rtss.vo.client.operation.DriveParamVO;
|
||||
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
|
||||
import club.joylink.rtss.vo.client.runplan.*;
|
||||
import club.joylink.rtss.vo.client.runplan.user.RunPlanParkingTimeVO;
|
||||
@ -1102,6 +1104,14 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
simulation.setSystemTime(simulationTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DriveParamVO getDriveParam(String simulationId, String groupNumber) {
|
||||
Simulation simulation = getSimulationByGroup(simulationId);
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
VirtualRealityTrain train = repository.getOnlineTrainBy(groupNumber);
|
||||
return train.getRobotDriveParam();
|
||||
}
|
||||
|
||||
private boolean isThirdAccountHasPermission(AccountVO accountVO, List<UserPermissionVO> ups, Long mapId, String prdType) {
|
||||
if (accountVO.isThirdChildAccount()) {
|
||||
List<LoginUserInfoVO> loginInfos = this.loginSessionManager.getAllLoginUserInfos();
|
||||
|
@ -408,9 +408,11 @@ public class CommandBO {
|
||||
public Step execute(Simulation simulation, CommandBO command) {
|
||||
VirtualRealityTrain train = (VirtualRealityTrain) command.getTargetMember().getDevice();
|
||||
float speedLimit = Float.parseFloat((String) command.getParams().get(ParamName.speedLimit.name()));
|
||||
if (speedLimit < 0)
|
||||
speedLimit = Float.MAX_VALUE;
|
||||
train.setSpeedLimit(speedLimit / 3.6f);
|
||||
if (speedLimit < 0) {
|
||||
train.setSpeedLimit(Float.MAX_VALUE);
|
||||
} else {
|
||||
train.setSpeedLimit(speedLimit / 3.6f);
|
||||
}
|
||||
command.getTargetMember().setCommand(null);
|
||||
return null;
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.storage.support;
|
||||
|
||||
import club.joylink.rtss.vo.client.operation.DriveParamVO;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class StorageDriveParam {
|
||||
/**
|
||||
* 限速值
|
||||
*/
|
||||
private Float speedLimit;
|
||||
|
||||
/**
|
||||
* 向前行驶(持续看信号行驶)
|
||||
*/
|
||||
private boolean driveForward = true;
|
||||
|
||||
/**
|
||||
* 目标设备code(用于确定目标位置)
|
||||
*/
|
||||
private String targetDeviceCode;
|
||||
|
||||
/**
|
||||
* 根据目标设备code计算出的目标位置
|
||||
*/
|
||||
private StorageSectionPosition targetPosition;
|
||||
|
||||
/**
|
||||
* 越过信号机
|
||||
*/
|
||||
private int through;
|
||||
|
||||
public StorageDriveParam(DriveParamVO param) {
|
||||
this.speedLimit = param.getSpeedLimit();
|
||||
this.driveForward = param.isDriveForward();
|
||||
this.targetDeviceCode = param.getTargetDeviceCode();
|
||||
if (param.getTargetPosition() != null) {
|
||||
this.targetPosition = new StorageSectionPosition(param.getTargetPosition());
|
||||
}
|
||||
this.through = param.getThrough();
|
||||
}
|
||||
}
|
@ -7,11 +7,13 @@ import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Responder;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Station;
|
||||
import club.joylink.rtss.simulation.cbtc.data.storage.support.StorageDriveParam;
|
||||
import club.joylink.rtss.simulation.cbtc.data.storage.support.StorageMA;
|
||||
import club.joylink.rtss.simulation.cbtc.data.storage.support.StorageSectionPosition;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.StandParkedTrainActivity;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityDevice;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import club.joylink.rtss.vo.client.operation.DriveParamVO;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@ -267,6 +269,8 @@ public class StorageVirtualRealityTrain extends StorageVirtualRealityDeviceStatu
|
||||
|
||||
private List<String> lastTwoPassedResponders;
|
||||
|
||||
private StorageDriveParam driveParam;
|
||||
|
||||
public StorageVirtualRealityTrain(VirtualRealityTrain train) {
|
||||
super(train);
|
||||
this.groupNumber = train.getGroupNumber();
|
||||
@ -299,9 +303,9 @@ public class StorageVirtualRealityTrain extends StorageVirtualRealityDeviceStatu
|
||||
this.headPosition = new StorageSectionPosition(train.getHeadPosition());
|
||||
}
|
||||
this.right = train.isRight();
|
||||
if (train.getRobotTargetPosition() != null) {
|
||||
this.robotTargetPosition = new StorageSectionPosition(train.getRobotTargetPosition());
|
||||
}
|
||||
// if (train.getRobotTargetPosition() != null) {
|
||||
// this.robotTargetPosition = new StorageSectionPosition(train.getRobotTargetPosition());
|
||||
// }
|
||||
if (train.getMa() != null) {
|
||||
this.ma = new StorageMA(train.getMa());
|
||||
}
|
||||
@ -312,7 +316,7 @@ public class StorageVirtualRealityTrain extends StorageVirtualRealityDeviceStatu
|
||||
this.atoSpeedMax = train.getAtoSpeedMax();
|
||||
this.atoSpeed = train.getAtoSpeed();
|
||||
this.atpSpeed = train.getAtpSpeed();
|
||||
this.speedLimit = train.getSpeedLimit();
|
||||
// this.speedLimit = train.getNonNullSpeedLimit();
|
||||
this.signalEB = train.isSignalEB();
|
||||
this.circuitEB = train.isCircuitEB();
|
||||
this.dtro = train.isDtro();
|
||||
@ -338,6 +342,7 @@ public class StorageVirtualRealityTrain extends StorageVirtualRealityDeviceStatu
|
||||
}
|
||||
// 20220721修改为保存应答器Code
|
||||
this.lastTwoPassedResponders = train.getLastTwoPassedResponders().stream().map(Responder::getCode).collect(Collectors.toList());
|
||||
this.driveParam = new StorageDriveParam(train.getRobotDriveParam());
|
||||
}
|
||||
|
||||
public static StorageVirtualRealityTrain convert2Storage(VirtualRealityTrain vrTrain) {
|
||||
@ -425,5 +430,20 @@ public class StorageVirtualRealityTrain extends StorageVirtualRealityDeviceStatu
|
||||
if (!CollectionUtils.isEmpty(lastTwoPassedResponders)) {
|
||||
// train.setLastTwoPassedResponders(lastTwoPassedResponders);
|
||||
}
|
||||
if (driveParam != null) {
|
||||
train.setRobotDriveParam(convert2DriveParam(driveParam, repository));
|
||||
}
|
||||
}
|
||||
|
||||
private DriveParamVO convert2DriveParam(StorageDriveParam storageDriveParam, SimulationDataRepository repository) {
|
||||
DriveParamVO param = new DriveParamVO();
|
||||
param.setSpeedLimit(storageDriveParam.getSpeedLimit());
|
||||
param.setDriveForward(storageDriveParam.isDriveForward());
|
||||
param.setTargetDeviceCode(storageDriveParam.getTargetDeviceCode());
|
||||
if (storageDriveParam.getTargetPosition() != null) {
|
||||
param.setTargetPosition(storageDriveParam.getTargetPosition().convert2SimulationObj(repository));
|
||||
}
|
||||
param.setThrough(storageDriveParam.getThrough());
|
||||
return param;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import club.joylink.rtss.simulation.cbtc.data.support.MovementAuthority;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import club.joylink.rtss.vo.client.operation.DriveParamVO;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -213,11 +214,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
*/
|
||||
private boolean right;
|
||||
|
||||
/**
|
||||
* 目标位置(托管或机器人根据语音指令模仿人工驾车)
|
||||
*/
|
||||
private SectionPosition robotTargetPosition;
|
||||
|
||||
/**
|
||||
* 移动授权
|
||||
*/
|
||||
@ -262,11 +258,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
*/
|
||||
private float atpSpeed;
|
||||
|
||||
/**
|
||||
* 限速(m/s)(默认float最大值是为了取速度最小值方便)
|
||||
*/
|
||||
private float speedLimit = Float.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* 是否紧急停车(信号)
|
||||
*/
|
||||
@ -459,10 +450,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
|
||||
private VirtualRealityAudio vrAudio;
|
||||
|
||||
/**
|
||||
* 机器人向前驾驶
|
||||
*/
|
||||
private boolean robotDriveForward;
|
||||
private DriveParamVO robotDriveParam = new DriveParamVO();
|
||||
|
||||
public SectionPosition getTailPosition() {
|
||||
return this.tailPosition == null ? calculateTailPosition() : this.tailPosition;
|
||||
@ -559,7 +547,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
this.trainHold = false;
|
||||
this.terminalStation = null;
|
||||
this.headPosition = null;
|
||||
this.robotTargetPosition = null;
|
||||
this.ma2 = null;
|
||||
this.ma = null;
|
||||
this.cbtcMaMissDuration = 0;
|
||||
@ -569,7 +556,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
resetAtoSpeedMax();
|
||||
this.atoSpeed = 0;
|
||||
this.atpSpeed = 0;
|
||||
this.speedLimit = Float.MAX_VALUE;
|
||||
this.signalEB = false;
|
||||
this.circuitEB = false;
|
||||
this.dtro = false;
|
||||
@ -599,7 +585,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
this.doorSelection = DoorSelection.Z;
|
||||
this.confirmationMessages.clear();
|
||||
this.atoCanOpen = false;
|
||||
this.robotDriveForward = false;
|
||||
this.robotDriveParam = new DriveParamVO();
|
||||
}
|
||||
|
||||
public boolean isEB() {
|
||||
@ -1108,15 +1094,15 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
* 是否自动开门
|
||||
*/
|
||||
public boolean isAutoOpenDoor() {
|
||||
return isCBTC() && (VirtualRealityTrain.DoorMode.AM.equals(doorMode)
|
||||
|| VirtualRealityTrain.DoorMode.AA.equals(doorMode));
|
||||
return isCBTC() && (DoorMode.AM.equals(doorMode)
|
||||
|| DoorMode.AA.equals(doorMode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否自动关门
|
||||
*/
|
||||
public boolean isAutoCloseDoor() {
|
||||
return isCBTC() && VirtualRealityTrain.DoorMode.AA.equals(doorMode);
|
||||
return isCBTC() && DoorMode.AA.equals(doorMode);
|
||||
}
|
||||
|
||||
public void initAsAM_I() {
|
||||
@ -1136,6 +1122,33 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
this.setAtoOn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一个非null的限速值。(计算限速时更方便)
|
||||
*/
|
||||
public float getNonNullSpeedLimit() {
|
||||
return robotDriveParam.getNonNullSpeedLimit();
|
||||
}
|
||||
|
||||
public void setSpeedLimit(float v) {
|
||||
this.robotDriveParam.setSpeedLimit(v);
|
||||
}
|
||||
|
||||
public SectionPosition getRobotTargetPosition() {
|
||||
return robotDriveParam.getTargetPosition();
|
||||
}
|
||||
|
||||
public void setRobotTargetPosition(SectionPosition targetPosition) {
|
||||
robotDriveParam.setTargetPosition(targetPosition);
|
||||
}
|
||||
|
||||
public boolean isRobotDriveForward() {
|
||||
return robotDriveParam.isDriveForward();
|
||||
}
|
||||
|
||||
public void invalidateRobotDrive() {
|
||||
this.robotDriveParam.invalidate();
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Door extends ControllableVrDevice<Door.Operation> {
|
||||
|
@ -197,9 +197,9 @@ public class SrTrainServiceImpl implements UDPRealDeviceService {
|
||||
} else {
|
||||
float recommendedSpeedMax;
|
||||
if (train.isRMMode()) {
|
||||
recommendedSpeedMax = Math.min(repository.getConfig().getRmAtpSpeed(), train.getSpeedLimit()) * 0.9f;
|
||||
recommendedSpeedMax = Math.min(repository.getConfig().getRmAtpSpeed(), train.getNonNullSpeedLimit()) * 0.9f;
|
||||
} else if (train.isNRMMode()) {
|
||||
recommendedSpeedMax = Math.min(repository.getConfig().getUrmAtpSpeed(), train.getSpeedLimit()) * 0.9f;
|
||||
recommendedSpeedMax = Math.min(repository.getConfig().getUrmAtpSpeed(), train.getNonNullSpeedLimit()) * 0.9f;
|
||||
} else {
|
||||
recommendedSpeedMax = 0;
|
||||
}
|
||||
|
@ -80,32 +80,6 @@ public class SpeedCurve {
|
||||
}
|
||||
}
|
||||
return calculateAtoStopCurveAndUpdate(train, ma, stopPosition);
|
||||
|
||||
|
||||
// SectionPosition headPosition = train.getHeadPosition();
|
||||
// SectionPosition tailPosition = train.calculateTailPosition();
|
||||
// boolean right = train.isRight();
|
||||
// float stopDistance = ma.calculateDistanceOfAtoEnd();
|
||||
// float speedMax = Math.min(train.getAtoSpeedMax(), train.getSpeedLimit() * 0.9f);
|
||||
// SpeedCurve atoStopCurve;
|
||||
// if (!train.isJump() && (train.isNextParking() || train.isHold())) { // 列车下一站停车
|
||||
// Section target = train.getTarget();
|
||||
// if (target != null) {
|
||||
// float stopPoint = target.getStopPointByDirection(right);
|
||||
// SectionPosition stopPosition = new SectionPosition(target, stopPoint);
|
||||
// Float stopPointDistance = CalculateService.calculateDistance(headPosition, stopPosition, right);
|
||||
// float ebTriggerDistance = ma.calculateDistanceOfEbTriggerEnd();
|
||||
// if (stopPointDistance != null && stopPointDistance.floatValue() <= ebTriggerDistance) {
|
||||
// // 列车停车位置距离小于eb触发距离
|
||||
// stopDistance = stopPointDistance;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// atoStopCurve = SpeedCurve
|
||||
// .buildTargetSpeedCurve(headPosition, tailPosition, right,
|
||||
// stopDistance, train.getSpeed(), speedMax);
|
||||
//// ma.setAtoStopCurve(atoStopCurve);
|
||||
// return atoStopCurve;
|
||||
}
|
||||
|
||||
public static SpeedCurve calculateAtoStopCurveAndUpdate(VirtualRealityTrain train, MaService.Ma ma, SectionPosition stopPosition) {
|
||||
@ -113,7 +87,8 @@ public class SpeedCurve {
|
||||
SectionPosition tailPosition = train.calculateTailPosition();
|
||||
boolean right = train.isRight();
|
||||
float stopDistance = ma.calculateDistanceOfAtoEnd();
|
||||
float speedMax = Math.min(train.getAtoSpeedMax(), train.getSpeedLimit() * 0.9f);
|
||||
float speedMax = train.getAtoSpeedMax();
|
||||
// float speedMax = Math.min(train.getAtoSpeedMax(), train.getNonNullSpeedLimit() * 0.9f); 不知道为什么这个限速会影响到ATO驾驶的速度,先注掉
|
||||
SpeedCurve atoStopCurve;
|
||||
if (stopPosition != null) {
|
||||
Float stopPointDistance = CalculateService.calculateDistance(headPosition, stopPosition, right, false);
|
||||
|
@ -158,7 +158,7 @@ public class SimulationRobotService {
|
||||
//机器人驾驶
|
||||
if (driver.getCommand() != null || train.getRobotTargetPosition() != null) { //如果有和驾驶行为不冲突的指令,这里需要做修改
|
||||
robotDriveByCommand(simulation, driver, train);
|
||||
} else if (repository.getConfig().isRailway() || train.isRobotDriveForward()) {
|
||||
} else if (train.isRobotDriveForward()) {
|
||||
//地铁的自动驾驶暂时也用大铁的逻辑。因为地铁线路没有行车日志,所以效果等同于只看信号
|
||||
railRobotDrive(simulation, train);
|
||||
}
|
||||
@ -308,11 +308,11 @@ public class SimulationRobotService {
|
||||
break;
|
||||
case RM:
|
||||
speedCurve = SpeedCurve.buildTargetSpeedCurve(headPosition, tailPosition, right,
|
||||
distance, speed, Math.min(repository.getConfig().getRmAtpSpeed(), train.getSpeedLimit()) * 0.9f);
|
||||
distance, speed, Math.min(repository.getConfig().getRmAtpSpeed(), train.getNonNullSpeedLimit()) * 0.9f);
|
||||
break;
|
||||
case NRM:
|
||||
speedCurve = SpeedCurve.buildTargetSpeedCurve(headPosition, tailPosition, right,
|
||||
distance, speed, Math.min(repository.getConfig().getUrmAtpSpeed(), train.getSpeedLimit()) * 0.9f);
|
||||
distance, speed, Math.min(repository.getConfig().getUrmAtpSpeed(), train.getNonNullSpeedLimit()) * 0.9f);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
@ -487,4 +487,15 @@ public class SimulationRobotService {
|
||||
public void addJobs(Simulation simulation) {
|
||||
simulation.addJob(SimulationModule.ROBOT.name(), () -> this.run(simulation), SimulationConstants.ROBOT_LOGIC_LOOP_RATE);
|
||||
}
|
||||
|
||||
public void stopTrain(Simulation simulation, String groupNumber, Boolean eb) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
VirtualRealityTrain train = repository.getOnlineTrainBy(groupNumber);
|
||||
train.invalidateRobotDrive(); //使机器人驾驶功能失效
|
||||
if (Objects.equals(true, eb)) {
|
||||
atpService.triggerCircuitEB(train);
|
||||
} else {
|
||||
doBreakMax(simulation, train);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package club.joylink.rtss.vo.client.operation;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@ -17,12 +19,53 @@ public class DriveParamVO {
|
||||
private Float speedLimit;
|
||||
|
||||
/**
|
||||
* 向前行驶
|
||||
* 向前行驶(持续看信号行驶)
|
||||
*/
|
||||
private boolean driveForward;
|
||||
@JsonIgnore
|
||||
private boolean driveForward = true;
|
||||
|
||||
/**
|
||||
* 目标设备code(用于确定目标位置)
|
||||
*/
|
||||
private String targetDeviceCode;
|
||||
|
||||
/**
|
||||
* 根据目标设备code计算出的目标位置
|
||||
*/
|
||||
@JsonIgnore
|
||||
private SectionPosition targetPosition;
|
||||
|
||||
/**
|
||||
* 越过信号机
|
||||
*/
|
||||
private int through;
|
||||
public static final int NO = 0;
|
||||
public static final int RED_SIGNAL = 1;
|
||||
public static final int GUIDE_SIGNAL = 2;
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isThroughRedSignal() {
|
||||
return RED_SIGNAL == through;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isThroughGuideSignal() {
|
||||
return GUIDE_SIGNAL == through;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public void setTargetPosition(SectionPosition targetPosition) {
|
||||
this.targetPosition = targetPosition;
|
||||
driveForward = targetPosition == null;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public float getNonNullSpeedLimit() {
|
||||
return speedLimit == null ? Float.MAX_VALUE : speedLimit;
|
||||
}
|
||||
|
||||
public void invalidate() {
|
||||
this.driveForward = false;
|
||||
this.targetPosition = null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user