[启动自驾 拦截顺序整理]
This commit is contained in:
yangyakun
2024-04-29 15:54:35 +08:00
parent 44a2a284ed
commit 35c19eb812
7 changed files with 134 additions and 83 deletions

View File

@@ -21,7 +21,9 @@ import com.mogo.eagle.core.data.BaseData;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.utilcode.util.StringUtils;
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager;
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager;
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager;
import com.mogo.och.shuttle.bean.BusRoutesResponse;
import com.mogo.och.shuttle.util.ShuttleVoiceManager;
@@ -501,6 +503,7 @@ public class OrderModel {
removeTipRunnables();
// 取消自驾
CallerAutoPilotControlManager.INSTANCE.cancelAutoPilot();
setTrajectoryStation(null,null,-1L);
}
}
@@ -618,7 +621,7 @@ public class OrderModel {
* @param isRestart
*/
private void startAutopilot(boolean isRestart, int leaveIndex) {
//1、判断轨迹url是否可用
if(busRoutesResult!=null){
//根据开关和后台是否发布轨迹启动自驾
if (FunctionBuildConfig.isPassStartAutopilotCommand
@@ -634,7 +637,32 @@ public class OrderModel {
return;
}
}
//2、6个条件判断
if (!CallerAutoPilotControlManager.INSTANCE.isCanStartAutopilot(true)) {
return;
}
// 3、距离轨迹15m计算
//3、距离轨迹15m计算
String resion = TrajectoryAndDistanceManager.INSTANCE.canStartAutopilot((long)busRoutesResult.getLineId());
if(TrajectoryAndDistanceManager.errorTypeNoneLineId.equals(resion)){
MogoLocation nextStationPoint = new MogoLocation();
if (backgroundCurrentStationIndex < stationList.size() - 1) {
BusStationBean nextStation = stationList.get(backgroundCurrentStationIndex + 1);
nextStationPoint.setLongitude(nextStation.getGcjLon());
nextStationPoint.setLatitude(nextStation.getGcjLat());
}
BusStationBean busStationBean = stationList.get(backgroundCurrentStationIndex);
MogoLocation currentStationPoint = new MogoLocation();
currentStationPoint.setLongitude(busStationBean.getGcjLon());
currentStationPoint.setLatitude(busStationBean.getGcjLat());
setTrajectoryStation(currentStationPoint,nextStationPoint, (long) busRoutesResult.getLineId());
resion = TrajectoryAndDistanceManager.INSTANCE.canStartAutopilot((long)busRoutesResult.getLineId());
}
if(!StringUtils.isEmpty(resion)){
ToastUtils.showShort(resion);
return;
}
//4、ssm 给出数据
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()) {
ToastUtils.showLong(OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason() +
", 请稍候重试");
@@ -642,10 +670,6 @@ public class OrderModel {
return;
}
if (!CallerAutoPilotControlManager.INSTANCE.isCanStartAutopilot(true)) {
return;
}
firstStartAutopilot++;
triggerStartServiceEvent(isRestart, false);
@@ -792,9 +816,13 @@ public class OrderModel {
CallerLogger.d(M_BUS + TAG, "leaveStation-backgroundCurrentStationIndex = " + backgroundCurrentStationIndex);
String nextStationName = "";
String nextStationNameKr = "";
MogoLocation nextStationPoint = new MogoLocation();
if (backgroundCurrentStationIndex < stationList.size() - 1) {
nextStationName = stationList.get(backgroundCurrentStationIndex + 1).getName();
nextStationNameKr = stationList.get(backgroundCurrentStationIndex + 1).getNameKr();
BusStationBean nextStation = stationList.get(backgroundCurrentStationIndex + 1);
nextStationName = nextStation.getName();
nextStationNameKr = nextStation.getNameKr();
nextStationPoint.setLongitude(nextStation.getGcjLon());
nextStationPoint.setLatitude(nextStation.getGcjLat());
}
final String currentStationName = stationList.get(backgroundCurrentStationIndex).getName();
String finalNextStationName = nextStationName;
@@ -806,6 +834,13 @@ public class OrderModel {
long writeVersion = DateTimeUtil.getCurrentTimeStamp();
leaveStationSuccess(backgroundCurrentStationIndex, currentStationName,
finalNextStationName,finalNextStationNameKr,writeVersion);
BusStationBean busStationBean = stationList.get(backgroundCurrentStationIndex);
MogoLocation currentStationPoint = new MogoLocation();
currentStationPoint.setLongitude(busStationBean.getGcjLon());
currentStationPoint.setLatitude(busStationBean.getGcjLat());
setTrajectoryStation(currentStationPoint,nextStationPoint, (long) busRoutesResult.getLineId());
String changeInfo = "taskId:" + busRoutesResult.getTaskId() + "--lineId:" + busRoutesResult.getLineId() +
"--currentStationName:"+currentStationName+"--finalNextStationName:"+finalNextStationName;
OchChainLogManager.writeChainLog("滑动出发", changeInfo,
@@ -1053,7 +1088,7 @@ public class OrderModel {
}
CallerLogger.d(M_BUS + TAG, "单程结束====");
CallerAutoPilotControlManager.INSTANCE.cancelAutoPilot();
setTrajectoryStation(null,null,-1L);
endTask();
}
@@ -1244,4 +1279,8 @@ public class OrderModel {
return parameters;
}
public void setTrajectoryStation(MogoLocation startStation,MogoLocation endStation,Long lineId){
TrajectoryAndDistanceManager.INSTANCE.setStationPoint(startStation,endStation,lineId);
}
}