新增:限速指令填负数可以取消限速

This commit is contained in:
joylink_zhangsai 2021-06-04 16:36:28 +08:00
parent 0b77fe4090
commit a93937c582

View File

@ -421,7 +421,7 @@ public class CommandBO {
/** /**
* 设置限速 * 设置限速
*/ */
Set_Speed_Limit(Arrays.asList(ParamName.speedLimit), SimulationMember.Type.DRIVER) { Set_Speed_Limit(List.of(ParamName.speedLimit), SimulationMember.Type.DRIVER) {
@Override @Override
public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) { public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
if (!SimulationMember.Type.DRIVER.equals(targetMember.getType())) { if (!SimulationMember.Type.DRIVER.equals(targetMember.getType())) {
@ -429,7 +429,10 @@ public class CommandBO {
} }
List<Step> stepList = new ArrayList<>(); List<Step> stepList = new ArrayList<>();
stepList.add(buildSetSpeedLimitStep(Float.parseFloat((String) params.get(ParamName.speedLimit.name())))); float speedLimit = Float.parseFloat((String) params.get(ParamName.speedLimit.name()));
if (speedLimit < 0)
speedLimit = Float.MAX_VALUE;
stepList.add(buildSetSpeedLimitStep(speedLimit));
return stepList; return stepList;
} }
@ -446,7 +449,7 @@ public class CommandBO {
/** /**
* 换端 * 换端
*/ */
Turn_Direction(Arrays.asList(), SimulationMember.Type.DRIVER) { Turn_Direction(List.of(), SimulationMember.Type.DRIVER) {
@Override @Override
public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) { public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertEquals(SimulationMember.Type.DRIVER, targetMember.getType()); BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertEquals(SimulationMember.Type.DRIVER, targetMember.getType());