[6.8.0]
[fea] [taxi 正常单添加wayLatLons、blackLatLons]
This commit is contained in:
@@ -342,64 +342,7 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
)
|
||||
}
|
||||
|
||||
val wayLatLons = mutableListOf<AutoPilotLonLat>()
|
||||
// 途经点
|
||||
if (!contrai.passPoints.isNullOrEmpty()) {
|
||||
for (mogoLatLng in contrai.passPoints!!) {
|
||||
wayLatLons.add(
|
||||
AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lon,
|
||||
when (mogoLatLng.pointType) {
|
||||
1 -> {//途径点
|
||||
false
|
||||
}
|
||||
|
||||
2 -> {//禁行点
|
||||
false
|
||||
}
|
||||
|
||||
3 -> {//站点
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
val blackLatLons = mutableListOf<AutoPilotLonLat>()
|
||||
// 黑名单点
|
||||
if (!contrai.blackPoints.isNullOrEmpty()) {
|
||||
for (mogoLatLng in contrai.blackPoints!!) {
|
||||
blackLatLons.add(
|
||||
AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lat,
|
||||
when (mogoLatLng.pointType) {
|
||||
1 -> {//途径点
|
||||
false
|
||||
}
|
||||
|
||||
2 -> {//禁行点
|
||||
false
|
||||
}
|
||||
|
||||
3 -> {//站点
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
val (wayLatLons, blackLatLons) = getWayBlackLatLons(contrai.passPoints, contrai.blackPoints)
|
||||
|
||||
parameters?.wayLatLons = wayLatLons
|
||||
parameters?.blackLatLons = blackLatLons
|
||||
@@ -411,6 +354,73 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
return parameters
|
||||
}
|
||||
|
||||
fun getWayBlackLatLons(
|
||||
passPoints: MutableList<BusStationBean>?,
|
||||
blackPoints: MutableList<BusStationBean>?
|
||||
): Pair<MutableList<AutoPilotLonLat>, MutableList<AutoPilotLonLat>> {
|
||||
val wayLatLons = mutableListOf<AutoPilotLonLat>()
|
||||
// 途经点
|
||||
if (!passPoints.isNullOrEmpty()) {
|
||||
for (mogoLatLng in passPoints) {
|
||||
wayLatLons.add(
|
||||
AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lon,
|
||||
when (mogoLatLng.pointType) {
|
||||
1 -> {//途径点
|
||||
false
|
||||
}
|
||||
|
||||
2 -> {//禁行点
|
||||
false
|
||||
}
|
||||
|
||||
3 -> {//站点
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
val blackLatLons = mutableListOf<AutoPilotLonLat>()
|
||||
// 黑名单点
|
||||
if (!blackPoints.isNullOrEmpty()) {
|
||||
for (mogoLatLng in blackPoints) {
|
||||
blackLatLons.add(
|
||||
AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lat,
|
||||
when (mogoLatLng.pointType) {
|
||||
1 -> {//途径点
|
||||
false
|
||||
}
|
||||
|
||||
2 -> {//禁行点
|
||||
false
|
||||
}
|
||||
|
||||
3 -> {//站点
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
return Pair(wayLatLons,blackLatLons)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 启动自动驾驶
|
||||
fun startAutopilot() {
|
||||
|
||||
|
||||
@@ -266,10 +266,20 @@ data class TrajectoryListRespBean(var data: MutableList<Result>?) : BaseData() {
|
||||
var csvFileMd5DPQP: String,
|
||||
var txtFileUrlDPQP: String,
|
||||
var txtFileMd5DPQP: String,
|
||||
var contrailSaveTimeDPQP: Long
|
||||
var contrailSaveTimeDPQP: Long,
|
||||
var passPoints: MutableList<RoutingSite>?, // 用于算路的经停点
|
||||
var blackPoints: MutableList<RoutingSite>?, // 用于算路的黑名單點
|
||||
){
|
||||
fun toCommonContraiInfo(): ContraiInfo {
|
||||
val result = ContraiInfo(lineId,csvFileUrl,csvFileMd5,txtFileUrl,txtFileMd5,contrailSaveTime,source = source)
|
||||
val tempPassPoints = mutableListOf<BusStationBean>()
|
||||
passPoints?.forEach {
|
||||
tempPassPoints.add(it.toBusStationBean())
|
||||
}
|
||||
val tempblackPoints = mutableListOf<BusStationBean>()
|
||||
blackPoints?.forEach {
|
||||
tempPassPoints.add(it.toBusStationBean())
|
||||
}
|
||||
val result = ContraiInfo(lineId,csvFileUrl,csvFileMd5,txtFileUrl,txtFileMd5,contrailSaveTime,tempPassPoints,tempblackPoints,source)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ object TaxiTaskModel {
|
||||
}
|
||||
|
||||
override fun onAutopilotGuardian(guardianInfo: MogoReportMessage?, lineId: Long) {
|
||||
TaxiTrajectoryManager.getInstance().onAutopilotGuardian(guardianInfo,lineId)
|
||||
TaxiTrajectoryManager.onAutopilotGuardian(guardianInfo,lineId)
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponseFromCan(state: Int) {
|
||||
|
||||
@@ -355,7 +355,7 @@ class ItineraryCurrentModel : BaseViewModel<UnmannedState, TaskUiIntent>(),
|
||||
}
|
||||
|
||||
override fun onTaskTrajectoryDataChanged(data: TrajectoryListRespBean?) {
|
||||
TaxiTrajectoryManager.getInstance().syncTrajectoryInfo() //同步轨迹信息
|
||||
TaxiTrajectoryManager.syncTrajectoryInfo() //同步轨迹信息
|
||||
}
|
||||
|
||||
override fun onOrderCancel() {
|
||||
|
||||
@@ -1,288 +1,272 @@
|
||||
package com.mogo.och.unmanned.taxi.utils;
|
||||
package com.mogo.och.unmanned.taxi.utils
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager;
|
||||
import com.mogo.och.unmanned.taxi.bean.OrderDetail;
|
||||
import com.mogo.och.unmanned.taxi.bean.QueryCurrentTaskRespBean;
|
||||
import com.mogo.och.unmanned.taxi.bean.TrajectoryListRespBean;
|
||||
import com.mogo.och.unmanned.taxi.constant.TaskStatusEnum;
|
||||
import com.mogo.och.unmanned.taxi.constant.TaxiUnmannedConst;
|
||||
import com.mogo.och.unmanned.taxi.ui.debug.DebugView;
|
||||
import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLine
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendTrajectoryDownloadReq
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.och.common.module.manager.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager.writeChainLog
|
||||
import com.mogo.och.unmanned.taxi.bean.TrajectoryListRespBean
|
||||
import com.mogo.och.unmanned.taxi.constant.TaskStatusEnum
|
||||
import com.mogo.och.unmanned.taxi.constant.TaxiUnmannedConst
|
||||
import com.mogo.och.unmanned.taxi.ui.debug.DebugView.Companion.printInfoMsg
|
||||
import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel.getCurrentOrderTrajectoryList
|
||||
import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel.getCurrentTaskTrajectory
|
||||
import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel.getCurrentTaskWithOrder
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.functions.Function
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import mogo_msg.MogoReportMsg.MogoReportMessage
|
||||
import java.util.Arrays
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* Taxi轨迹管理:给MEC下发用于轨迹下载的信息
|
||||
* Created on 2022/6/22
|
||||
*/
|
||||
public class TaxiTrajectoryManager {
|
||||
private static final String TAG = TaxiTrajectoryManager.class.getSimpleName();
|
||||
object TaxiTrajectoryManager {
|
||||
|
||||
private val TAG: String = TaxiTrajectoryManager::class.java.simpleName
|
||||
|
||||
//载类型: 0:正常下载 1:预下载
|
||||
private static final int COMMON_LOADING = 0;
|
||||
private static final int PRE_LOADING = 1;
|
||||
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final TaxiTrajectoryManager INSTANCE = new TaxiTrajectoryManager();
|
||||
}
|
||||
|
||||
public static TaxiTrajectoryManager getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
private const val COMMON_LOADING = 0
|
||||
private const val PRE_LOADING = 1
|
||||
|
||||
//正常加载的路线
|
||||
private AutopilotControlParameters.AutoPilotLine mAutoPilotLine = null;
|
||||
private var mAutoPilotLine: AutopilotControlParameters? = null
|
||||
|
||||
//预加载的路线
|
||||
private AutopilotControlParameters.AutoPilotLine mPreAutoPilotLine = null;
|
||||
private var mPreAutoPilotLine: AutopilotControlParameters? = null
|
||||
|
||||
private Disposable mSendReqDisposable = null;
|
||||
private String mPrevTaskLineId = "";
|
||||
private var mSendReqDisposable: Disposable? = null
|
||||
private var mPrevTaskLineId = ""
|
||||
|
||||
public TaxiTrajectoryManager() {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1, "",
|
||||
"", "", "", "", 0, "",
|
||||
"", "", "", "", 0);
|
||||
|
||||
mPreAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1, "",
|
||||
"", "", "", "", 0, "",
|
||||
"", "", "", "", 0);
|
||||
init {
|
||||
mAutoPilotLine = AutopilotControlParameters()
|
||||
mPreAutoPilotLine = AutopilotControlParameters()
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步订单信息
|
||||
*/
|
||||
public void syncTrajectoryInfo() {
|
||||
OchChainLogManager.writeChainLog("轨迹监控","开始或者结束下发轨迹 轨迹id"+mAutoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
QueryCurrentTaskRespBean.Result taskAndOrder = TaxiTaskModel.INSTANCE.getCurrentTaskWithOrder();
|
||||
if (taskAndOrder == null || taskAndOrder.getCurrentStatus() >= TaskStatusEnum.StartTask.getCode()) {
|
||||
CallerLogger.d(M_TAXI + TAG, "syncTrajectoryInfo() stop.");
|
||||
stopTrajReqLoop();
|
||||
fun syncTrajectoryInfo() {
|
||||
writeChainLog(
|
||||
"轨迹监控",
|
||||
"开始或者结束下发轨迹 轨迹id" + mAutoPilotLine?.autoPilotLine?.lineId,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
)
|
||||
val taskAndOrder = getCurrentTaskWithOrder()
|
||||
if (taskAndOrder == null || taskAndOrder.currentStatus >= TaskStatusEnum.StartTask.code) {
|
||||
d(SceneConstant.M_TAXI + TAG, "syncTrajectoryInfo() stop.")
|
||||
stopTrajReqLoop()
|
||||
} else {
|
||||
if (mPrevTaskLineId.equals(String.valueOf(taskAndOrder.getLineId()))) {
|
||||
CallerLogger.d(M_TAXI + TAG, "syncTrajectoryInfo() 重复订单.");
|
||||
if (mPrevTaskLineId == taskAndOrder.lineId.toString()) {
|
||||
d(SceneConstant.M_TAXI + TAG, "syncTrajectoryInfo() 重复订单.")
|
||||
} else {
|
||||
mPrevTaskLineId = String.valueOf(taskAndOrder.getLineId());
|
||||
CallerLogger.d(M_TAXI + TAG, "syncTrajectoryInfo() start.");
|
||||
startTrajReqLoop();
|
||||
mPrevTaskLineId = taskAndOrder.lineId.toString()
|
||||
d(SceneConstant.M_TAXI + TAG, "syncTrajectoryInfo() start.")
|
||||
startTrajReqLoop()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo,long lineId) {
|
||||
onAutopilotGuardian(guardianInfo);
|
||||
fun onAutopilotGuardian(guardianInfo: MogoReportMessage?, lineId: Long) {
|
||||
onAutopilotGuardian(guardianInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口MEC反馈的常规信息(MAP v2.5.0新增轨迹相关信息)
|
||||
* @param guardianInfo
|
||||
*/
|
||||
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
if (guardianInfo == null || !guardianInfo.hasCode()) return;
|
||||
if ("ISYS_INIT_TRAJECTORY_START".equals(guardianInfo.getCode())) {
|
||||
stopTrajReqLoop();
|
||||
} else if ("ISYS_INIT_TRAJECTORY_TIMEOUT".equals(guardianInfo.getCode())) {
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载超时", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
fun onAutopilotGuardian(guardianInfo: MogoReportMessage?) {
|
||||
if (guardianInfo == null || !guardianInfo.hasCode()) return
|
||||
if ("ISYS_INIT_TRAJECTORY_START" == guardianInfo.code) {
|
||||
stopTrajReqLoop()
|
||||
} else if ("ISYS_INIT_TRAJECTORY_TIMEOUT" == guardianInfo.code) {
|
||||
writeChainLog(
|
||||
"轨迹监控",
|
||||
"onAutopilotGuardian() 轨迹下载超时",
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setupAutoPilotLine() {
|
||||
QueryCurrentTaskRespBean.Result taskAndOrder = TaxiTaskModel.INSTANCE.getCurrentTaskWithOrder();
|
||||
private fun setupAutoPilotLine() {
|
||||
val taskAndOrder = getCurrentTaskWithOrder()
|
||||
|
||||
if (taskAndOrder == null || taskAndOrder.getEndSite() == null) {
|
||||
CallerLogger.e(M_TAXI + TAG,
|
||||
"setupAutoPilotLine(): taskAndOrder or taskAndOrder.getEndSite() is null.");
|
||||
if (taskAndOrder?.endSite == null) {
|
||||
e(
|
||||
SceneConstant.M_TAXI + TAG,
|
||||
"setupAutoPilotLine(): taskAndOrder or taskAndOrder.getEndSite() is null."
|
||||
)
|
||||
} else {
|
||||
/**
|
||||
* 主要加载和预加载轨迹方案
|
||||
* 1、获取当前跑的任务的lineId
|
||||
* 2、当前任务lineId是否在运营单的轨迹集合里
|
||||
* 3、存在, 通知下载加载当前任务的轨迹以及预加载lineId在集合对应的下一个lineId对应的轨迹
|
||||
* 4、若不存在,说明当前的执行的任务是与订单无关的演练任务,通知下载加载当前任务的轨迹以及预加载订单轨迹集合的第一个
|
||||
* 1、获取当前跑的任务的lineId
|
||||
* 2、当前任务lineId是否在运营单的轨迹集合里
|
||||
* 3、存在, 通知下载加载当前任务的轨迹以及预加载lineId在集合对应的下一个lineId对应的轨迹
|
||||
* 4、若不存在,说明当前的执行的任务是与订单无关的演练任务,通知下载加载当前任务的轨迹以及预加载订单轨迹集合的第一个
|
||||
*/
|
||||
|
||||
final TrajectoryListRespBean.Result curTaskContrail = TaxiTaskModel.INSTANCE.getCurrentTaskTrajectory();
|
||||
if (curTaskContrail == null) return;
|
||||
/**
|
||||
* 主要加载和预加载轨迹方案
|
||||
* 1、获取当前跑的任务的lineId
|
||||
* 2、当前任务lineId是否在运营单的轨迹集合里
|
||||
* 3、存在, 通知下载加载当前任务的轨迹以及预加载lineId在集合对应的下一个lineId对应的轨迹
|
||||
* 4、若不存在,说明当前的执行的任务是与订单无关的演练任务,通知下载加载当前任务的轨迹以及预加载订单轨迹集合的第一个
|
||||
*/
|
||||
|
||||
long curLineId = taskAndOrder.getLineId();
|
||||
val curTaskContrail = getCurrentTaskTrajectory() ?: return
|
||||
|
||||
if (mAutoPilotLine == null) {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(curTaskContrail.getLineId(), curTaskContrail.getLineName(),
|
||||
curTaskContrail.getCsvFileUrl(), curTaskContrail.getCsvFileMd5(), curTaskContrail.getTxtFileUrl(),
|
||||
curTaskContrail.getTxtFileMd5(), curTaskContrail.getContrailSaveTime(), String.valueOf(TaxiUnmannedConst.BUSINESSTYPE),
|
||||
curTaskContrail.getCsvFileUrlDPQP(), curTaskContrail.getCsvFileMd5DPQP(), curTaskContrail.getTxtFileUrlDPQP(),
|
||||
curTaskContrail.getTxtFileMd5DPQP(), curTaskContrail.getContrailSaveTimeDPQP());
|
||||
} else {
|
||||
mAutoPilotLine.setLineId(curTaskContrail.getLineId());
|
||||
mAutoPilotLine.setLineName(curTaskContrail.getLineName());
|
||||
mAutoPilotLine.setTrajUrl(curTaskContrail.getCsvFileUrl());
|
||||
mAutoPilotLine.setTrajMd5(curTaskContrail.getCsvFileMd5());
|
||||
mAutoPilotLine.setStopUrl(curTaskContrail.getTxtFileUrl());
|
||||
mAutoPilotLine.setStopMd5(curTaskContrail.getTxtFileMd5());
|
||||
mAutoPilotLine.setTimestamp(curTaskContrail.getContrailSaveTime());
|
||||
mAutoPilotLine.setVehicleModel(String.valueOf(TaxiUnmannedConst.BUSINESSTYPE));
|
||||
mAutoPilotLine.setTrajUrl_dpqp(curTaskContrail.getCsvFileUrlDPQP());
|
||||
mAutoPilotLine.setTrajMd5_dpqp(curTaskContrail.getCsvFileMd5DPQP());
|
||||
mAutoPilotLine.setStopUrl_dpqp(curTaskContrail.getTxtFileUrlDPQP());
|
||||
mAutoPilotLine.setStopMd5_dpqp(curTaskContrail.getTxtFileMd5DPQP());
|
||||
mAutoPilotLine.setTimestamp_dpqp(curTaskContrail.getContrailSaveTimeDPQP());
|
||||
}
|
||||
val curLineId = taskAndOrder.lineId
|
||||
|
||||
final OrderDetail orderDetail = taskAndOrder.getOrder();
|
||||
TrajectoryListRespBean.Result preloadContrail = null; //预加载的轨迹
|
||||
final List<TrajectoryListRespBean.Result> orderContrails = TaxiTaskModel.INSTANCE.getCurrentOrderTrajectoryList();
|
||||
mAutoPilotLine = LineManager.initAutopilotControlParameters()
|
||||
|
||||
if (orderDetail != null && orderContrails != null && orderContrails.size() != 0 ){
|
||||
List<Long> lineIds = new ArrayList<>();
|
||||
lineIds.addAll(Arrays.asList(orderDetail.getPlanningLines())); // 接驾
|
||||
lineIds.add(orderDetail.getOrderLine());//送驾
|
||||
val orderDetail = taskAndOrder.order
|
||||
var preloadContrail: TrajectoryListRespBean.Result? = null //预加载的轨迹
|
||||
val orderContrails: List<TrajectoryListRespBean.Result> =
|
||||
getCurrentOrderTrajectoryList()
|
||||
|
||||
if (lineIds.contains(curLineId)){ //当前任务在lineIds集合里
|
||||
//计算预加载的下一个轨迹
|
||||
int preLoadIndex = lineIds.indexOf(curLineId) + 1;
|
||||
if (lineIds.size() -1 >= preLoadIndex){
|
||||
long preLoadLineId = lineIds.get(preLoadIndex);
|
||||
for (int i = 0; i< orderContrails.size() ; i++){
|
||||
if (orderContrails.get(i).getLineId() == preLoadLineId){
|
||||
preloadContrail = orderContrails.get(i);
|
||||
break;
|
||||
if (orderDetail != null && orderContrails != null && orderContrails.size != 0) {
|
||||
val lineIds: MutableList<Long> = ArrayList()
|
||||
lineIds.addAll(Arrays.asList(*orderDetail.planningLines)) // 接驾
|
||||
lineIds.add(orderDetail.orderLine) //送驾
|
||||
|
||||
if (lineIds.contains(curLineId)) { //当前任务在lineIds集合里
|
||||
//计算预加载的下一个轨迹
|
||||
val preLoadIndex = lineIds.indexOf(curLineId) + 1
|
||||
if (lineIds.size - 1 >= preLoadIndex) {
|
||||
val preLoadLineId = lineIds[preLoadIndex]
|
||||
for (i in orderContrails.indices) {
|
||||
if (orderContrails[i].lineId == preLoadLineId) {
|
||||
preloadContrail = orderContrails[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {//说明当前任务轨迹在接驾/送驾轨迹集合里没有, 直接加载轨迹集合第一个
|
||||
preloadContrail = orderContrails.get(0);
|
||||
} else { //说明当前任务轨迹在接驾/送驾轨迹集合里没有, 直接加载轨迹集合第一个
|
||||
preloadContrail = orderContrails[0]
|
||||
}
|
||||
}
|
||||
|
||||
if (preloadContrail == null) return;
|
||||
if (preloadContrail == null) return
|
||||
|
||||
if (mPreAutoPilotLine == null) {
|
||||
mPreAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(preloadContrail.getLineId(), preloadContrail.getLineName(),
|
||||
preloadContrail.getCsvFileUrl(), preloadContrail.getCsvFileMd5(), preloadContrail.getTxtFileUrl(),
|
||||
preloadContrail.getTxtFileMd5(), preloadContrail.getContrailSaveTime(), String.valueOf(TaxiUnmannedConst.BUSINESSTYPE),
|
||||
preloadContrail.getCsvFileUrlDPQP(), preloadContrail.getCsvFileMd5DPQP(), preloadContrail.getTxtFileUrlDPQP(),
|
||||
preloadContrail.getTxtFileMd5DPQP(), preloadContrail.getContrailSaveTimeDPQP());
|
||||
} else {
|
||||
mPreAutoPilotLine.setLineId(preloadContrail.getLineId());
|
||||
mPreAutoPilotLine.setLineName(preloadContrail.getLineName());
|
||||
mPreAutoPilotLine.setTrajUrl(preloadContrail.getCsvFileUrl());
|
||||
mPreAutoPilotLine.setTrajMd5(preloadContrail.getCsvFileMd5());
|
||||
mPreAutoPilotLine.setStopUrl(preloadContrail.getTxtFileUrl());
|
||||
mPreAutoPilotLine.setStopMd5(preloadContrail.getTxtFileMd5());
|
||||
mPreAutoPilotLine.setTimestamp(preloadContrail.getContrailSaveTime());
|
||||
mPreAutoPilotLine.setVehicleModel(String.valueOf(TaxiUnmannedConst.BUSINESSTYPE));
|
||||
mPreAutoPilotLine.setTrajUrl_dpqp(preloadContrail.getCsvFileUrlDPQP());
|
||||
mPreAutoPilotLine.setTrajMd5_dpqp(preloadContrail.getCsvFileMd5DPQP());
|
||||
mPreAutoPilotLine.setStopUrl_dpqp(preloadContrail.getTxtFileUrlDPQP());
|
||||
mPreAutoPilotLine.setStopMd5_dpqp(preloadContrail.getTxtFileMd5DPQP());
|
||||
mPreAutoPilotLine.setTimestamp_dpqp(preloadContrail.getContrailSaveTimeDPQP());
|
||||
mPreAutoPilotLine = AutopilotControlParameters()
|
||||
}
|
||||
if(mPreAutoPilotLine?.autoPilotLine==null){
|
||||
mPreAutoPilotLine?.autoPilotLine = AutoPilotLine()
|
||||
}
|
||||
mPreAutoPilotLine?.autoPilotLine?.lineId = preloadContrail.lineId
|
||||
mPreAutoPilotLine?.autoPilotLine?.lineName = preloadContrail.lineName
|
||||
mPreAutoPilotLine?.autoPilotLine?.trajUrl = preloadContrail.csvFileUrl
|
||||
mPreAutoPilotLine?.autoPilotLine?.trajMd5 = preloadContrail.csvFileMd5
|
||||
mPreAutoPilotLine?.autoPilotLine?.stopUrl = preloadContrail.txtFileUrl
|
||||
mPreAutoPilotLine?.autoPilotLine?.stopMd5 = preloadContrail.txtFileMd5
|
||||
mPreAutoPilotLine?.autoPilotLine?.timestamp = preloadContrail.contrailSaveTime
|
||||
mPreAutoPilotLine?.autoPilotLine?.vehicleModel = TaxiUnmannedConst.BUSINESSTYPE.toString()
|
||||
mPreAutoPilotLine?.autoPilotLine?.trajUrl_dpqp = preloadContrail.csvFileUrlDPQP
|
||||
mPreAutoPilotLine?.autoPilotLine?.trajMd5_dpqp = preloadContrail.csvFileMd5DPQP
|
||||
mPreAutoPilotLine?.autoPilotLine?.stopUrl_dpqp = preloadContrail.txtFileUrlDPQP
|
||||
mPreAutoPilotLine?.autoPilotLine?.stopMd5_dpqp = preloadContrail.txtFileMd5DPQP
|
||||
mPreAutoPilotLine?.autoPilotLine?.timestamp_dpqp = preloadContrail.contrailSaveTimeDPQP
|
||||
|
||||
val toCommonContraiInfo = preloadContrail.toCommonContraiInfo()
|
||||
val (wayLatLons, blackLatLons) = LineManager.getWayBlackLatLons(
|
||||
toCommonContraiInfo.passPoints,
|
||||
toCommonContraiInfo.blackPoints
|
||||
)
|
||||
mPreAutoPilotLine?.wayLatLons = wayLatLons
|
||||
mPreAutoPilotLine?.blackLatLons = blackLatLons
|
||||
}
|
||||
}
|
||||
|
||||
private void clearAutoPilotLine() {
|
||||
if (mAutoPilotLine != null){
|
||||
mAutoPilotLine.setLineId(-1);
|
||||
mAutoPilotLine.setLineName("");
|
||||
mAutoPilotLine.setTrajUrl("");
|
||||
mAutoPilotLine.setTrajMd5("");
|
||||
mAutoPilotLine.setStopUrl("");
|
||||
mAutoPilotLine.setStopMd5("");
|
||||
mAutoPilotLine.setTimestamp(0);
|
||||
mAutoPilotLine.setVehicleModel("");
|
||||
mAutoPilotLine.setTrajUrl_dpqp("");
|
||||
mAutoPilotLine.setTrajMd5_dpqp("");
|
||||
mAutoPilotLine.setStopUrl_dpqp("");
|
||||
mAutoPilotLine.setStopMd5_dpqp("");
|
||||
mAutoPilotLine.setTimestamp_dpqp(0);
|
||||
}
|
||||
|
||||
if (mPreAutoPilotLine != null){
|
||||
mPreAutoPilotLine.setLineId(-1);
|
||||
mPreAutoPilotLine.setLineName("");
|
||||
mPreAutoPilotLine.setTrajUrl("");
|
||||
mPreAutoPilotLine.setTrajMd5("");
|
||||
mPreAutoPilotLine.setStopUrl("");
|
||||
mPreAutoPilotLine.setStopMd5("");
|
||||
mPreAutoPilotLine.setTimestamp(0);
|
||||
mPreAutoPilotLine.setVehicleModel("");
|
||||
mPreAutoPilotLine.setTrajUrl_dpqp("");
|
||||
mPreAutoPilotLine.setTrajMd5_dpqp("");
|
||||
mPreAutoPilotLine.setStopUrl_dpqp("");
|
||||
mPreAutoPilotLine.setStopMd5_dpqp("");
|
||||
mPreAutoPilotLine.setTimestamp_dpqp(0);
|
||||
}
|
||||
private fun clearAutoPilotLine() {
|
||||
mAutoPilotLine = null
|
||||
mPreAutoPilotLine = null
|
||||
}
|
||||
|
||||
private void startTrajReqLoop() {
|
||||
OchChainLogManager.writeChainLog("轨迹监控","开始下发轨迹 轨迹id"+mAutoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
if (mSendReqDisposable != null && !mSendReqDisposable.isDisposed()) {
|
||||
return;
|
||||
private fun startTrajReqLoop() {
|
||||
writeChainLog(
|
||||
"轨迹监控",
|
||||
"开始下发轨迹 轨迹id" + mAutoPilotLine?.autoPilotLine?.lineId,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
)
|
||||
if (mSendReqDisposable != null && !mSendReqDisposable!!.isDisposed) {
|
||||
return
|
||||
}
|
||||
DebugView.Companion.printInfoMsg("[下发轨迹] startTrajectoryReqLoop");
|
||||
CallerLogger.d(M_TAXI + TAG, "startTrajReqLoop()");
|
||||
setupAutoPilotLine();
|
||||
mSendReqDisposable = Observable.interval(TaxiUnmannedConst.LOOP_DELAY,
|
||||
TaxiUnmannedConst.LOOP_PERIOD_10S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> {
|
||||
if (aLong > TaxiUnmannedConst.LOOP_SEND_TRAJ_TIMES) {
|
||||
mPrevTaskLineId = ""; //重发超时后将mPrevOrderNo置空,这样订单进入下个状态时还可以重发
|
||||
stopTrajReqLoop();
|
||||
return;
|
||||
}
|
||||
CallerLogger.d(M_TAXI + TAG, "loop sendTrajectoryReq: " + aLong);
|
||||
sendTrajectoryReq();
|
||||
});
|
||||
printInfoMsg("[下发轨迹] startTrajectoryReqLoop")
|
||||
d(SceneConstant.M_TAXI + TAG, "startTrajReqLoop()")
|
||||
setupAutoPilotLine()
|
||||
mSendReqDisposable = Observable.interval(
|
||||
TaxiUnmannedConst.LOOP_DELAY,
|
||||
TaxiUnmannedConst.LOOP_PERIOD_10S, TimeUnit.MILLISECONDS
|
||||
)
|
||||
.map((Function { aLong: Long -> aLong + 1 }))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { aLong: Long ->
|
||||
if (aLong > TaxiUnmannedConst.LOOP_SEND_TRAJ_TIMES) {
|
||||
mPrevTaskLineId = "" //重发超时后将mPrevOrderNo置空,这样订单进入下个状态时还可以重发
|
||||
stopTrajReqLoop()
|
||||
return@subscribe
|
||||
}
|
||||
d(SceneConstant.M_TAXI + TAG, "loop sendTrajectoryReq: $aLong")
|
||||
sendTrajectoryReq()
|
||||
}
|
||||
}
|
||||
|
||||
private void stopTrajReqLoop() {
|
||||
OchChainLogManager.writeChainLog("轨迹监控","结束下发轨迹 轨迹id"+mAutoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
DebugView.Companion.printInfoMsg("[下发轨迹] stopTrajectoryReqLoop");
|
||||
private fun stopTrajReqLoop() {
|
||||
writeChainLog(
|
||||
"轨迹监控",
|
||||
"结束下发轨迹 轨迹id" + mAutoPilotLine?.autoPilotLine?.lineId,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
)
|
||||
printInfoMsg("[下发轨迹] stopTrajectoryReqLoop")
|
||||
if (mSendReqDisposable != null) {
|
||||
CallerLogger.d(M_TAXI + TAG, "stopTrajReqLoop()");
|
||||
mSendReqDisposable.dispose();
|
||||
mSendReqDisposable = null;
|
||||
clearAutoPilotLine();
|
||||
d(SceneConstant.M_TAXI + TAG, "stopTrajReqLoop()")
|
||||
mSendReqDisposable!!.dispose()
|
||||
mSendReqDisposable = null
|
||||
clearAutoPilotLine()
|
||||
}
|
||||
}
|
||||
|
||||
private void sendTrajectoryReq() {
|
||||
private fun sendTrajectoryReq() {
|
||||
if (mAutoPilotLine != null) {
|
||||
DebugView.Companion.printInfoMsg("[下发轨迹] sendTrajectoryDownloadReq, lindId=" + mAutoPilotLine.getLineId() + ", lineName=" + mAutoPilotLine.getLineName());
|
||||
OchChainLogManager.writeChainLog("轨迹监控","sendTrajectoryReq() 下发轨迹 轨迹id"+mAutoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
CallerAutoPilotControlManager.INSTANCE.sendTrajectoryDownloadReq(mAutoPilotLine,COMMON_LOADING);
|
||||
}else {
|
||||
CallerLogger.e(M_TAXI + TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!");
|
||||
printInfoMsg("[下发轨迹] sendTrajectoryDownloadReq, lindId=" + mAutoPilotLine?.autoPilotLine?.lineId + ", lineName=" + mAutoPilotLine?.autoPilotLine?.lineName)
|
||||
writeChainLog(
|
||||
"轨迹监控",
|
||||
"sendTrajectoryReq() 下发轨迹 轨迹id" + mAutoPilotLine?.autoPilotLine?.lineId,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
)
|
||||
sendTrajectoryDownloadReq(mAutoPilotLine!!, COMMON_LOADING)
|
||||
} else {
|
||||
e(SceneConstant.M_TAXI + TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!")
|
||||
}
|
||||
|
||||
if (mPreAutoPilotLine != null){
|
||||
DebugView.Companion.printInfoMsg("[下发预加载轨迹] sendTrajectoryDownloadReq, lindId=" + mPreAutoPilotLine.getLineId() + ", lineName=" + mPreAutoPilotLine.getLineName());
|
||||
CallerAutoPilotControlManager.INSTANCE.sendTrajectoryDownloadReq(mPreAutoPilotLine, PRE_LOADING);
|
||||
}else {
|
||||
CallerLogger.e(M_TAXI + TAG, "sendTrajectoryReq(): mPreAutoPilotLine is null!!!");
|
||||
|
||||
if (mPreAutoPilotLine != null) {
|
||||
printInfoMsg("[下发预加载轨迹] sendTrajectoryDownloadReq, lindId=" + mPreAutoPilotLine?.autoPilotLine?.lineId + ", lineName=" + mPreAutoPilotLine?.autoPilotLine?.lineName)
|
||||
sendTrajectoryDownloadReq(mPreAutoPilotLine!!, PRE_LOADING)
|
||||
} else {
|
||||
e(SceneConstant.M_TAXI + TAG, "sendTrajectoryReq(): mPreAutoPilotLine is null!!!")
|
||||
}
|
||||
CallerLogger.d(M_TAXI + TAG, "sendTrajectoryReq(): common_load = "
|
||||
+ GsonUtils.toJson(mAutoPilotLine) + ", pre_load" + GsonUtils.toJson(mPreAutoPilotLine));
|
||||
d(
|
||||
SceneConstant.M_TAXI + TAG, "sendTrajectoryReq(): common_load = "
|
||||
+ GsonUtils.toJson(mAutoPilotLine) + ", pre_load" + GsonUtils.toJson(
|
||||
mPreAutoPilotLine
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -182,6 +182,8 @@ class AutopilotControlParameters {
|
||||
var stopMd5_dpqp = "" //轨迹文件md5,默认“”
|
||||
var timestamp_dpqp = 0L //上传轨迹完成时间戳(ms):用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
|
||||
|
||||
constructor()
|
||||
|
||||
constructor(lineId: Long, trajUrl: String,
|
||||
trajMd5: String, stopUrl: String,
|
||||
stopMd5: String, timestamp: Long,
|
||||
@@ -223,6 +225,22 @@ class AutopilotControlParameters {
|
||||
fun deepCopy(): AutoPilotLine {
|
||||
return AutoPilotLine(this.lineId, this.lineName, this.trajUrl, this.trajMd5, this.stopUrl, this.stopMd5, this.timestamp, this.vehicleModel, this.trajUrl_dpqp, this.trajMd5_dpqp, this.stopUrl_dpqp, this.stopMd5_dpqp, this.timestamp_dpqp)
|
||||
}
|
||||
|
||||
fun reset(){
|
||||
lineId = -1
|
||||
lineName = ""
|
||||
trajUrl = ""
|
||||
trajMd5 = ""
|
||||
stopUrl = ""
|
||||
stopMd5 = ""
|
||||
timestamp = 0
|
||||
vehicleModel = ""
|
||||
trajUrl_dpqp = ""
|
||||
trajMd5_dpqp = ""
|
||||
stopUrl_dpqp = ""
|
||||
stopMd5_dpqp = ""
|
||||
timestamp_dpqp = 0
|
||||
}
|
||||
}
|
||||
|
||||
class AutoPilotLonLat {
|
||||
|
||||
@@ -206,11 +206,11 @@ object CallerAutoPilotControlManager {
|
||||
/**
|
||||
* 发送 轨迹下载请求。带有Routing的参数,让MAP进行离线算路。
|
||||
*/
|
||||
fun sendTrajectoryDownloadReq(autopilotControlParameters: AutopilotControlParameters) {
|
||||
fun sendTrajectoryDownloadReq(autopilotControlParameters: AutopilotControlParameters,downloadType: Int=0) {
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
// Routing 需要传参 routeInfo
|
||||
providerApi?.sendTrajectoryDownloadReq(autopilotControlParameters.autoPilotLine!!, autopilotControlParameters.toRouteInfo())
|
||||
CallerAutoPilotStatusListenerManager.invokeTrajectoryDownloadReq(autopilotControlParameters.autoPilotLine!!, 0)
|
||||
CallerAutoPilotStatusListenerManager.invokeTrajectoryDownloadReq(autopilotControlParameters.autoPilotLine!!, downloadType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user