diff --git a/OCH/common/bridge/src/main/java/com/mogo/och/bridge/autopilot/autopilot/OchAutoPilotStatusListenerManager.kt b/OCH/common/bridge/src/main/java/com/mogo/och/bridge/autopilot/autopilot/OchAutoPilotStatusListenerManager.kt index 4bb2db0970..136abe3360 100644 --- a/OCH/common/bridge/src/main/java/com/mogo/och/bridge/autopilot/autopilot/OchAutoPilotStatusListenerManager.kt +++ b/OCH/common/bridge/src/main/java/com/mogo/och/bridge/autopilot/autopilot/OchAutoPilotStatusListenerManager.kt @@ -234,6 +234,10 @@ object OchAutoPilotStatusListenerManager : CallerBase() { private var endStation: BusStationBean? = null var isFirstStartAutopilot = true + var teleIsFirstStartAutopilot = true /** - * 线路、轨迹、站点 三者确定的id + * 线路、och业务id、站点 三者确定的id */ private var autopilotId: String by Delegates.observable("") { _, oldValue, newValue -> if (oldValue != newValue) { @@ -103,8 +104,18 @@ object LineManager : CallerBase() { } } + /** + * 线路、och业务id、当前线路的所有站点 三者确定的id + */ + private var teleOrderId: String by Delegates.observable("") { _, oldValue, newValue -> + if (oldValue != newValue) { + teleIsFirstStartAutopilot = true + } + } - // 自车定位 + /** + * 当前车辆经纬度 + */ private val mMapLocationListener = object : IMoGoChassisLocationGCJ02Listener { override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) { if (null == mogoLocation) return @@ -116,28 +127,43 @@ object LineManager : CallerBase() { mogoLocation.longitude, mogoLocation.latitude ) if (distance <= OchCommonConst.ARRIVE_AT_END_STATION_DISTANCE) { - val token = CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotStation(autopilotId) + /** + * 在终点10m 范围内向地盘查询是否到站 + * [com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager.onAutoPilotStation] + */ + val token = CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotStation(teleOrderId) OchChainLogManager.writeChainLogAutopilot("到站逻辑","距离站点:$distance 请求token:$token") } } } } - + /** + * [mMapLocationListener] 距离终点小于[OchCommonConst.ARRIVE_AT_END_STATION_DISTANCE]后向底盘请求的返回值调用 + * @param orderId 和线路相关的值 + * @param arrivedStationFlag 是否到站 true 到站 false 没有到站 + */ fun invokeArrivedStation(orderId: String, arrivedStationFlag: Boolean) { - if (this.autopilotId==orderId&&arrivedStationFlag){ + if (this.teleOrderId == orderId && arrivedStationFlag) { M_LISTENERS.forEach { it.value.arrivedStationSuccessBySearch() } } } + fun searchAutopilotState(){ + CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotInfo() + } + + /** + * [searchAutopilotState] 方法请求的返回值 + */ fun invokeSetIsFirstAutopilot(orderId: String?, firstAutopilotFlag: Boolean, count: Int) { - if (this.autopilotId==orderId){ + if (this.teleOrderId==orderId){ if(count>=1){ - isFirstStartAutopilot = false + teleIsFirstStartAutopilot = false }else{ - isFirstStartAutopilot = true + teleIsFirstStartAutopilot = true } } } @@ -146,9 +172,6 @@ object LineManager : CallerBase() { * 设置站点信息 */ fun setStartAndEndStation(startStation: BusStationBean?, endStation: BusStationBean?) { - if(this.startStation!=startStation||this.endStation!=endStation){ - isFirstStartAutopilot = true - } this.startStation = startStation this.endStation = endStation if(startStation==null||endStation==null){ @@ -168,6 +191,7 @@ object LineManager : CallerBase() { @JvmStatic fun setLineInfo(lineInfo: LineInfo?) { if (lineInfo == null) { + teleOrderId = "" clearGlobalTrajectory(true) CallerEagleBaseFunctionCall4OchManager.updateOrderLine("") } @@ -180,10 +204,11 @@ object LineManager : CallerBase() { line.multiMap?.forEach { sb.append(it.value) } + OchChainLogManager.writeChainLogAutopilot("设置线路", "$sb") CallerEagleBaseFunctionCall4OchManager.updateOrderLine(sb.toString()) } } - OchChainLogManager.writeChainLogAutopilot("自驾参数", "线路信息:$contraiInfo") + OchChainLogManager.writeChainLogAutopilot("设置线路", "线路信息:$_lineInfos") } fun getStations(): Pair { @@ -280,9 +305,7 @@ object LineManager : CallerBase() { searchAutopilotState() } } - fun searchAutopilotState(){ - CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotInfo() - } + private fun clearAutopilotControlParameters(){ CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null) TrajectoryAndDistanceManager.setStationPoint(null, null, null) @@ -324,6 +347,7 @@ object LineManager : CallerBase() { var parameters: AutopilotControlParameters? = null getStationsWithLine { start, end, lineInfo -> this.autopilotId = "${lineInfo.lineId}_${start.siteId}_${end.siteId}_${lineInfo.orderId}" + this.teleOrderId = lineInfo.genAutopilotId() } getStationsWithLineAndContrai { start, end, lineInfo, contrai -> parameters = AutopilotControlParameters() @@ -334,8 +358,8 @@ object LineManager : CallerBase() { parameters?.startLatLon = AutoPilotLonLat(start.lat, start.lon) parameters?.endLatLon = AutoPilotLonLat(end.lat, end.lon) parameters?.vehicleType = 10 - parameters?.orderId = this.autopilotId - parameters?.firstAutopilotFlag = isFirstStartAutopilot + parameters?.orderId = this.teleOrderId + parameters?.firstAutopilotFlag = teleIsFirstStartAutopilot if (parameters?.autoPilotLine == null) { parameters?.autoPilotLine = AutoPilotLine( @@ -355,7 +379,7 @@ object LineManager : CallerBase() { ) } - val (wayLatLons, blackLatLons) = getWayBlackLatLons(contrai.passPoints, contrai.blackPoints) + val (wayLatLons, blackLatLons) = contrai.getWayBlackLatLons() parameters?.wayLatLons = wayLatLons parameters?.blackLatLons = blackLatLons @@ -545,7 +569,9 @@ object LineManager : CallerBase() { type, source ) - if(send){ + if(send){// 启动自驾成功回调 + teleIsFirstStartAutopilot = false + isFirstStartAutopilot = false M_LISTENERS.forEach { it.value.startAutopilotSuccess(source,autopilotId) } @@ -575,7 +601,7 @@ object LineManager : CallerBase() { } fun compareFSMAndOchOrderId(autopilotIdFromFsm: String?) { - if(autopilotIdFromFsm == autopilotId){ + if(autopilotIdFromFsm == teleOrderId){ // 地盘有和上层一样 不用操作 }else{ if(autopilotIdFromFsm.isNullOrEmpty()){ @@ -583,8 +609,8 @@ object LineManager : CallerBase() { }else{ // 地盘有但是和och出不一样 // todo 需要och 重新出发轨迹下载操作 - ToastUtils.showShort("${autopilotIdFromFsm}_${autopilotId}_自动驾驶id不同请排查") - OchChainLogManager.writeChainLogAutopilot("自驾Id","${autopilotIdFromFsm}_${autopilotId}_自动驾驶id不同请排查") + ToastUtils.showShort("${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查") + OchChainLogManager.writeChainLogAutopilot("自驾Id","${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查") // val initAutopilotControlParameters = initAutopilotControlParameters() // if (initAutopilotControlParameters!==null&&initAutopilotControlParameters.autoPilotLine!=null // && contraiInfo!=null diff --git a/OCH/common/data/src/main/java/com/mogo/och/data/bean/ContraiInfo.kt b/OCH/common/data/src/main/java/com/mogo/och/data/bean/ContraiInfo.kt index 5ae6b1ca1c..59ed5743d6 100644 --- a/OCH/common/data/src/main/java/com/mogo/och/data/bean/ContraiInfo.kt +++ b/OCH/common/data/src/main/java/com/mogo/och/data/bean/ContraiInfo.kt @@ -1,5 +1,7 @@ package com.mogo.och.data.bean +import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLonLat + data class ContraiInfo( /** * 线路id @@ -34,4 +36,67 @@ data class ContraiInfo( var passPoints: MutableList?=null, // 用于算路的经停点 var blackPoints: MutableList?=null, // 用于算路的黑名單點 val source:Int = 1, //轨迹来源:1 录制;2 自主计算 -) +){ + fun getWayBlackLatLons( + ): Pair, MutableList> { + val wayLatLons = mutableListOf() + // 途经点 + 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() + // 黑名单点 + 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) + } +} diff --git a/OCH/common/data/src/main/java/com/mogo/och/data/bean/LineInfo.kt b/OCH/common/data/src/main/java/com/mogo/och/data/bean/LineInfo.kt index e76a098408..cafce9c0cb 100644 --- a/OCH/common/data/src/main/java/com/mogo/och/data/bean/LineInfo.kt +++ b/OCH/common/data/src/main/java/com/mogo/och/data/bean/LineInfo.kt @@ -35,4 +35,19 @@ data class LineInfo( tempAutopilotId.append(orderId) return tempAutopilotId.toString() } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + + other as LineInfo + + return lineId == other.lineId + } + + override fun hashCode(): Int { + return lineId.hashCode() + } + + } diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/utils/TaxiTrajectoryManager.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/utils/TaxiTrajectoryManager.kt index f36ea177ab..2e9e75135a 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/utils/TaxiTrajectoryManager.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/utils/TaxiTrajectoryManager.kt @@ -176,10 +176,7 @@ object TaxiTrajectoryManager : ITrajectoryListListener { preloadContrail.contrailSaveTimeDPQP val toCommonContraiInfo = preloadContrail.toCommonContraiInfo() - val (wayLatLons, blackLatLons) = LineManager.getWayBlackLatLons( - toCommonContraiInfo.passPoints, - toCommonContraiInfo.blackPoints - ) + val (wayLatLons, blackLatLons) = toCommonContraiInfo.getWayBlackLatLons() mPreAutopilotControlParameters?.wayLatLons = wayLatLons mPreAutopilotControlParameters?.blackLatLons = blackLatLons } diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/biz/DataCenterBizProvider.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/biz/DataCenterBizProvider.kt index 427a56534d..a3db3c79ad 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/biz/DataCenterBizProvider.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/biz/DataCenterBizProvider.kt @@ -49,10 +49,6 @@ class DataCenterBizProvider:IDataCenterBizProvider { CallerDataCenterBizListener.invokeLoginStatus(isLogin) } - override fun notifyOrderID(orderID: String) { - CallerDataCenterBizListener.invokeOrderID(orderID) - } - override fun onDestroy() { } diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/datacenter/IDataCenterBizListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/datacenter/IDataCenterBizListener.kt index a438924c41..cb7ab6d0f4 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/datacenter/IDataCenterBizListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/datacenter/IDataCenterBizListener.kt @@ -25,7 +25,6 @@ interface IDataCenterBizListener { return false } - fun invokeAutopilotOrderId(orderID:String){} fun invokeOchInfo(ochInfo: OchInfo) {} } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/och/IOchFunctionCallNotify.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/och/IOchFunctionCallNotify.kt index 722eb0cd57..4d3e687e22 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/och/IOchFunctionCallNotify.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/och/IOchFunctionCallNotify.kt @@ -35,5 +35,4 @@ interface IOchFunctionCallNotify { // 登录状态变化 fun notifyLoginStatus(isLogin: Boolean) - fun notifyOrderID(orderID:String) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizListener.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizListener.kt index e32ebbfd83..2e6e6ae5d9 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizListener.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizListener.kt @@ -24,9 +24,6 @@ object CallerDataCenterBizListener : CallerBase() { @Volatile private var inOrder: Boolean = false - @Volatile - private var orderId: String = "" - private val isLoginStatus by lazy { AtomicBoolean(false) } override fun doSomeAfterAddListener(tag: String, listener: IDataCenterBizListener) { @@ -35,7 +32,6 @@ object CallerDataCenterBizListener : CallerBase() { listener.invokeLoginNo(loginNo) listener.invokeCarNo(no) listener.invokeOrderStatus(inOrder) - listener.invokeAutopilotOrderId(orderId) } fun invokeLoginNo(loginNo: String?) { @@ -96,23 +92,12 @@ object CallerDataCenterBizListener : CallerBase() { return isLoginStatus.get() } - fun invokeOrderID(orderId: String) { - this.orderId = orderId - M_LISTENERS.forEach { - it.value.invokeAutopilotOrderId(orderId) - } - } - fun invokeOchInfo(ochInfo: OchInfo) { M_LISTENERS.forEach { it.value.invokeOchInfo(ochInfo) } } - fun getOrderId(): String { - return orderId - } - fun getCarModel(): Carmodel? { return carModel } diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizManager.kt index f0abf4c039..29939a3444 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/datacenter/CallerDataCenterBizManager.kt @@ -48,8 +48,4 @@ object CallerDataCenterBizManager: IOchFunctionCallNotify { dataCenterBizProviderApi?.notifyLoginStatus(isLogin) } - override fun notifyOrderID(orderID: String) { - dataCenterBizProviderApi?.notifyOrderID(orderID) - } - } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/och/CallerEagleBaseFunctionCall4OchManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/och/CallerEagleBaseFunctionCall4OchManager.kt index 16848d7eeb..104bbc8e86 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/och/CallerEagleBaseFunctionCall4OchManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/och/CallerEagleBaseFunctionCall4OchManager.kt @@ -130,8 +130,4 @@ object CallerEagleBaseFunctionCall4OchManager : IEagleBaseFunctionCall4Och { override fun onOrderRemoval() { CallerDataCenterBizManager.notifyOrderRemoval() } - - override fun setOchAutopilotOrderId(orderId: String) { - CallerDataCenterBizManager.notifyOrderID(orderId) - } } \ No newline at end of file