[8.4.0][司机屏] 无人化,任务管理相关逻辑
This commit is contained in:
@@ -35,6 +35,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop.StopTaskResp
|
||||
import com.zhjt.mogo.adas.data.AdasConstants
|
||||
import com.zhjt.mogo.adas.data.bean.NodeStateInfo
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendResume.BigTaskActionResp
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.Trajectory
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import com.zhjt.service_biz.BizConfig
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -90,6 +91,32 @@ object CallerAutoPilotControlManager {
|
||||
return sessionId
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启自动驾驶
|
||||
*
|
||||
* @param controlParameters 开启自动驾驶的控制参数
|
||||
*/
|
||||
fun unmannedStartAutoPilot(taskId: Long, traj: Trajectory?, controlParameters: AutopilotControlParameters): Long {
|
||||
if (traj == null) {
|
||||
//LogUtils.eTag(TAG, "自动驾驶控制参数异常,请检查参数信息")
|
||||
return -1L
|
||||
}
|
||||
val sessionId = providerApi?.sendTaskManagerAutopilotStart(taskId, traj) ?: -1L
|
||||
// 更新记录在全局的控制参数
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(controlParameters)
|
||||
return sessionId
|
||||
}
|
||||
//TODO 任务管理继续
|
||||
// fun unmannedAutoPilotContinue(trackId: Long, taskId: Long, stationId: Long, stationName: String, stationSeq: Int, lon: Double, lat: Double): Long {
|
||||
// if (traj == null) {
|
||||
// //LogUtils.eTag(TAG, "自动驾驶控制参数异常,请检查参数信息")
|
||||
// return -1L
|
||||
// }
|
||||
// val sessionId = providerApi?.sendTaskManagerAutopilotContinue(trackId, taskId, stationId, stationName, stationSeq, lon, lat) ?: -1L
|
||||
// // 更新记录在全局的控制参数
|
||||
// CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(controlParameters)
|
||||
// return sessionId
|
||||
// }
|
||||
/**
|
||||
* 启自驾前,是否要拦截
|
||||
* @param isShowTip true: 展示Toast+语音提示; false:不展示Toast+语音提示
|
||||
@@ -253,6 +280,15 @@ object CallerAutoPilotControlManager {
|
||||
}
|
||||
return result
|
||||
}
|
||||
/**
|
||||
* 结束自动驾驶
|
||||
*/
|
||||
fun cancelAutoPilot(taskId: Long) {
|
||||
// 司机屏才能取消自动驾驶
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
cancelAutoPilotInner(taskId)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束自动驾驶
|
||||
@@ -273,8 +309,8 @@ object CallerAutoPilotControlManager {
|
||||
}
|
||||
}
|
||||
|
||||
private fun cancelAutoPilotInner() {
|
||||
providerApi?.cancelAutoPilot()
|
||||
private fun cancelAutoPilotInner(taskId: Long = (-1).toLong()) {
|
||||
providerApi?.cancelAutoPilot(taskId)
|
||||
// 更新记录在全局的控制参数
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.Locale
|
||||
*/
|
||||
object CallerFsm2024ListenerManager : CallerBase<IMoGoFsm2024Listener>() {
|
||||
var fsmLocaleLanguage = "chs"
|
||||
private var placeOrderStandby = false //车端走任务管理时用于判断是否能下发订单
|
||||
|
||||
init {
|
||||
val locale = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
@@ -36,7 +37,12 @@ object CallerFsm2024ListenerManager : CallerBase<IMoGoFsm2024Listener>() {
|
||||
}
|
||||
}
|
||||
|
||||
fun getPlaceOrderStandby(): Boolean {
|
||||
return placeOrderStandby
|
||||
}
|
||||
|
||||
fun invokeFSM2024State(fsmState: Fsm2024.FSMStateMsg) {
|
||||
placeOrderStandby = fsmState.placeOrderStandbyFlag
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onFSM2024State(fsmState)
|
||||
@@ -54,7 +60,7 @@ object CallerFsm2024ListenerManager : CallerBase<IMoGoFsm2024Listener>() {
|
||||
if (fsmEvent.activeMode == Fsm2024.ActiveMode.PILOT_ACTIVE) {
|
||||
if (fsmEvent.event == Fsm2024.Event.FAIL_TO_ENTER_ACTIVE || fsmEvent.event == Fsm2024.Event.ABNORMAL_EXIT_ACTIVE) {
|
||||
val title =
|
||||
StringUtils.getString(if (fsmEvent.event == Fsm2024.Event.FAIL_TO_ENTER_ACTIVE) R.string.module_mogo_core_fail_to_enter_active else R.string.module_mogo_core_abnormal_exit_active)
|
||||
StringUtils.getString(if (fsmEvent.event == Fsm2024.Event.FAIL_TO_ENTER_ACTIVE) R.string.module_mogo_core_fail_to_enter_active else R.string.module_mogo_core_abnormal_exit_active)
|
||||
var content = StringUtils.getString(R.string.module_mogo_core_unknown_cause_fault)
|
||||
var summaryContent = ""
|
||||
if (fsmEvent.transitionReasonsMultiLangCount > 0) {
|
||||
@@ -89,10 +95,10 @@ object CallerFsm2024ListenerManager : CallerBase<IMoGoFsm2024Listener>() {
|
||||
System.currentTimeMillis()
|
||||
}
|
||||
CallerMsgBoxManager.saveMsgBoxNoTrace(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.FSM_EVENT,
|
||||
FSMEventMsg(title, summaryContent, content, time)
|
||||
)
|
||||
MsgBoxBean(
|
||||
MsgBoxType.FSM_EVENT,
|
||||
FSMEventMsg(title, summaryContent, content, time)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user