[6.7.0]
[fea] [自驾状态添加fsm判断]
This commit is contained in:
@@ -96,4 +96,6 @@ public interface IOchAutopilotStatusListener {
|
||||
*/
|
||||
default void onAutopilotStatusResponseFromCan(int state) {}
|
||||
|
||||
default void onFsmCanStartAutopilot(boolean can){}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,36 +5,24 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.msgbox.AutopilotMsg
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoFsm2024Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoReceiveReceivedAckListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerFsm2024ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerReceiveReceivedAckListenerManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.SessionWithTime
|
||||
import com.mogo.och.common.module.manager.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.zhjt.mogo.adas.common.MessageType
|
||||
import com.zhjt.mogo.adas.data.bean.ReceivedAck
|
||||
import com.zhjt.mogo.adas.data.bean.ReceivedAck.Status
|
||||
import fsm.Fsm2024
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listener {
|
||||
object OchAutoPilotManager {
|
||||
|
||||
const val TAG = "OchAutoPilotManager"
|
||||
|
||||
private val globalSessionId = AtomicReference<SessionWithTime>()
|
||||
private val fsmBackSessionId = AtomicLong(-1L)
|
||||
|
||||
init {
|
||||
CallerReceiveReceivedAckListenerManager.addListener(TAG,this)
|
||||
CallerFsm2024ListenerManager.addListener(TAG,this)
|
||||
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -101,7 +89,7 @@ object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listen
|
||||
}
|
||||
|
||||
fun clearGlobalSessionId(log:String){
|
||||
OchChainLogManager.writeChainLogAutopilot("自驾流程","清理SessiongId${globalSessionId}_${fsmBackSessionId}_${log}")
|
||||
OchChainLogManager.writeChainLogAutopilot("自驾流程","清理SessiongId${globalSessionId}_${OchAutoPilotStatusListenerManager.fsmBackSessionId}_${log}")
|
||||
globalSessionId.set(null)
|
||||
}
|
||||
|
||||
@@ -109,36 +97,21 @@ object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listen
|
||||
fun startAutoPilot(controlParameters: AutopilotControlParameters?): Long {
|
||||
val sessionId = CallerAutoPilotControlManager.startAutoPilot(controlParameters)
|
||||
globalSessionId.set(SessionWithTime(sessionId,System.currentTimeMillis()))
|
||||
fsmBackSessionId.set(-1L)
|
||||
OchAutoPilotStatusListenerManager.fsmBackSessionId.set(-1L)
|
||||
OchAutopilotAnalytics.triggerStartAutopilotParameters(controlParameters, sessionId)
|
||||
return sessionId
|
||||
}
|
||||
|
||||
// 启动自驾底盘反馈信息
|
||||
override fun onReceiveReceivedAck(receivedAck: ReceivedAck) {
|
||||
if (receivedAck.messageType == MessageType.TYPE_SEND_SET_AUTOPILOT_MODE_REQ) {
|
||||
OchAutopilotAnalytics.triggerStartAutopilotParametersAck(receivedAck.toString(),receivedAck.status == Status.NORMAL)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
override fun onFSM2024State(fsmState: Fsm2024.FSMStateMsg) {
|
||||
fsmBackSessionId.set(fsmState.failToPilotSessionId)
|
||||
CallerLogger.e(TAG,"收到FSM2024的SeesiongId:${fsmState.failToPilotSessionId}")
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动自驾失败切 FSM返回的Session和启动SessionId 不同
|
||||
*/
|
||||
fun checkStartSessionAndFailSessionId(){
|
||||
val sessionInfo = globalSessionId.get()
|
||||
if(sessionInfo!=null) {
|
||||
if (sessionInfo.sessionId != fsmBackSessionId.get()) {
|
||||
if (sessionInfo.sessionId != OchAutoPilotStatusListenerManager.fsmBackSessionId.get()) {
|
||||
OchAutopilotAnalytics.triggerStartAutopilotFailCheckSessionDiff(
|
||||
sessionInfo,
|
||||
fsmBackSessionId.get()
|
||||
OchAutoPilotStatusListenerManager.fsmBackSessionId.get()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,14 @@ package com.mogo.och.common.module.manager.autopilot.autopilot
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoFsm2024Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoReceiveReceivedAckListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerFsm2024ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerReceiveReceivedAckListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.R
|
||||
@@ -14,20 +19,27 @@ import com.mogo.och.common.module.manager.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.manager.autopilot.trajectory.TrajectoryManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.utils.CallerBase
|
||||
import com.zhjt.mogo.adas.common.MessageType
|
||||
import com.zhjt.mogo.adas.data.AdasConstants
|
||||
import com.zhjt.mogo.adas.data.bean.MogoReport
|
||||
import com.zhjt.mogo.adas.data.bean.ReceivedAck
|
||||
import com.zhjt.mogo.adas.data.bean.ReceivedAck.Status
|
||||
import fsm.Fsm2024
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
import system_master.SsmInfo
|
||||
import system_master.SystemStatusInfo
|
||||
import java.lang.Exception
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
object OchAutoPilotStatusListenerManager : CallerBase<IOchAutopilotStatusListener>(),IMoGoAutopilotStatusListener,
|
||||
(Boolean) -> Unit {
|
||||
(Boolean) -> Unit, IMoGoFsm2024Listener, IMoGoReceiveReceivedAckListener {
|
||||
|
||||
const val TAG = "OCHAutoPilotStatusListenerManager"
|
||||
|
||||
val fsmBackSessionId = AtomicLong(-1L)
|
||||
|
||||
private var canStartAutopilot:Boolean? by Delegates.observable(null) { _, oldValue, newValue ->
|
||||
if (oldValue != newValue) {
|
||||
M_LISTENERS.forEach {
|
||||
@@ -36,6 +48,18 @@ object OchAutoPilotStatusListenerManager : CallerBase<IOchAutopilotStatusListene
|
||||
}
|
||||
}
|
||||
}
|
||||
private var _canStartAutopilotFromFSM:Boolean by Delegates.observable(true) { _, oldValue, newValue ->
|
||||
if (oldValue != newValue) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onFsmCanStartAutopilot(newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val canStartAutopilotFromFSM:Boolean
|
||||
get() = _canStartAutopilotFromFSM
|
||||
|
||||
private var _autopilotState: Int by Delegates.observable(0) { _, oldValue, newValue ->
|
||||
if (oldValue != newValue) {
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
@@ -67,6 +91,8 @@ object OchAutoPilotStatusListenerManager : CallerBase<IOchAutopilotStatusListene
|
||||
//2021.11.1 鹰眼架构整合,由IMoGoAutopilotStatusListener逐步替代IMogoAdasOCHCallback接口
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
CallerAutoPilotControlManager.addStartAutopilotStateListener(TAG,this)
|
||||
CallerFsm2024ListenerManager.addListener(TAG,this)
|
||||
CallerReceiveReceivedAckListenerManager.addListener(TAG,this)
|
||||
}
|
||||
|
||||
override fun doSomeAfterAddListener(tag: String, listener: IOchAutopilotStatusListener) {
|
||||
@@ -244,4 +270,18 @@ object OchAutoPilotStatusListenerManager : CallerBase<IOchAutopilotStatusListene
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFSM2024State(fsmState: Fsm2024.FSMStateMsg) {
|
||||
fsmBackSessionId.set(fsmState.failToPilotSessionId)
|
||||
CallerLogger.e(TAG,"收到FSM2024的SeesiongId:${fsmState.failToPilotSessionId}")
|
||||
CallerLogger.e(TAG,"收到FSM2024的是否可启动自驾:${fsmState.pilotStandbyFlag}")
|
||||
OchChainLogManager.writeChainLogAutopilot("FSM2024数据","收到FSM2024的SeesiongId:${fsmState.failToPilotSessionId}_收到FSM2024的是否可启动自驾:${fsmState.pilotStandbyFlag}")
|
||||
_canStartAutopilotFromFSM = fsmState.pilotStandbyFlag
|
||||
}
|
||||
|
||||
override fun onReceiveReceivedAck(receivedAck: ReceivedAck) {
|
||||
if (receivedAck.messageType == MessageType.TYPE_SEND_SET_AUTOPILOT_MODE_REQ) {
|
||||
OchAutopilotAnalytics.triggerStartAutopilotParametersAck(receivedAck.toString(),receivedAck.status == Status.NORMAL)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.debug.autopilot.AutopilotStateDebug
|
||||
import com.mogo.och.common.module.debug.autopilot.IOchDebugAutopilotStatusListener
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
import com.mogo.och.common.module.manager.autopilot.line.ILineCallback
|
||||
import com.mogo.och.common.module.manager.autopilot.line.LineManager
|
||||
@@ -85,6 +86,11 @@ class AutopilotStateModel : ViewModel(), IOchAutopilotStatusListener, ILineCall
|
||||
autopilotStateChange()
|
||||
}
|
||||
|
||||
override fun onFsmCanStartAutopilot(can: Boolean) {
|
||||
OchChainLogManager.writeChainLog("自驾信息","FSM能否启动自驾:${can}")
|
||||
autopilotStateChange()
|
||||
}
|
||||
|
||||
private fun autopilotStateChange(){
|
||||
// 正在起自驾过程中
|
||||
// 自驾状态变化为非自驾状态
|
||||
@@ -105,7 +111,7 @@ class AutopilotStateModel : ViewModel(), IOchAutopilotStatusListener, ILineCall
|
||||
this.viewCallback?.autopilotDisable()
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE-> {
|
||||
if (!CallerAutoPilotControlManager.isCanStartAutopilot(false)) {// 不可用
|
||||
if (!CallerAutoPilotControlManager.isCanStartAutopilot(false) && !OchAutoPilotStatusListenerManager.canStartAutopilotFromFSM) {// 不可用
|
||||
this.viewCallback?.autopilotDisable()
|
||||
} else {// 部分可用
|
||||
this.viewCallback?.canStartAutopilot()
|
||||
|
||||
Reference in New Issue
Block a user