[670][adas][data-center] 新增冷启动状态查询以及响应接口;新增环形路线功能:启动自驾新增字段、新增启动自驾新字段查询以及响应接口、新增到站查询和响应接口;新增电源盒协议接口相关接口:

This commit is contained in:
xinfengkun
2024-09-18 16:29:48 +08:00
parent f6f6d8b306
commit 9dd1f61583
33 changed files with 2279 additions and 31 deletions

View File

@@ -9,6 +9,7 @@ import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.autopilot.toAutoPilotCmdInfo
import com.mogo.eagle.core.data.autopilot.toAutoPilotLine
import com.mogo.eagle.core.data.autopilot.toRouteInfo
import com.mogo.eagle.core.data.biz.trafficlight.TrafficLightResult
@@ -66,6 +67,7 @@ import com.zhidao.support.adas.high.chain.AdasChain
import com.zhidao.support.adas.high.common.Constants
import com.zhidao.support.adas.high.common.CupidLogUtils
import com.zhjt.mogo.adas.common.MessageType
import com.zhjt.mogo.adas.common.power.PowerUnitChannel
import com.zhjt.mogo.adas.data.Adas
import com.zhjt.mogo.adas.data.AdasConstants
import com.zhjt.mogo.adas.data.bean.MogoReport
@@ -391,12 +393,12 @@ class MoGoAutopilotControlProvider :
private fun startAutoPilotWithNoParameter(source: Int) {
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
val invokeResult = AdasManager.getInstance()
.sendAutoPilotModeReq(1, source, null)
.sendAutoPilotModeReq(1, source, null, null)
invokeAutoPilotResult(if (invokeResult > -1) "无参自动驾驶调用成功:${invokeResult}" else "自动驾驶调用失败, socket 或者 rawPack 可能为空")
} else {
if (AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) {
val invokeResult = AdasManager.getInstance()
.sendAutoPilotModeReq(1, source, null)
.sendAutoPilotModeReq(1, source, null, null)
invokeAutoPilotResult(if (invokeResult > -1) "无参自动驾驶调用成功:${invokeResult}" else "自动驾驶调用失败, socket 或者 rawPack 可能为空")
} else {
invokeAutoPilotResult("车机与工控机链接失败,无法开启自动驾驶 无参")
@@ -407,13 +409,13 @@ class MoGoAutopilotControlProvider :
private fun startAutoPilot(controlParameters: AutopilotControlParameters, source: Int): Long {
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
val invokeResult = AdasManager.getInstance()
.sendAutoPilotModeReq(1, source, controlParameters.toRouteInfo())
.sendAutoPilotModeReq(1, source, controlParameters.toRouteInfo(), controlParameters.toAutoPilotCmdInfo())
invokeAutoPilotResult(if (invokeResult > -1) "自动驾驶调用成功:${invokeResult}" else "自动驾驶调用失败, socket 或者 rawPack 可能为空")
return invokeResult
} else {
if (AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) {
val invokeResult = AdasManager.getInstance()
.sendAutoPilotModeReq(1, source, controlParameters.toRouteInfo())
.sendAutoPilotModeReq(1, source, controlParameters.toRouteInfo(), controlParameters.toAutoPilotCmdInfo())
invokeAutoPilotResult(if (invokeResult > -1) "自动驾驶调用成功:${invokeResult}" else "自动驾驶调用失败, socket 或者 rawPack 可能为空")
return invokeResult
} else {
@@ -463,7 +465,7 @@ class MoGoAutopilotControlProvider :
override fun cancelAutoPilot() {
if (AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) {
val invokeResult = AdasManager.getInstance().sendAutoPilotModeReq(0, 1, null)
val invokeResult = AdasManager.getInstance().sendAutoPilotModeReq(0, 1, null, null)
invokeAutoPilotResult(if (invokeResult > -1) "取消自动驾驶调用成功:${invokeResult}" else "取消自动驾驶调用失败, socket 或者 rawPack 可能为空")
} else {
invokeAutoPilotResult("车机与工控机链接失败,无法取消自动驾驶")
@@ -1032,11 +1034,11 @@ class MoGoAutopilotControlProvider :
*/
override fun setControlAutopilotCarAuto(isEnable: Boolean) {
if (isEnable) {
AdasManager.getInstance().sendAutoPilotModeReq(1, 0, null)
AdasManager.getInstance().sendAutoPilotModeReq(1, 0, null, null)
} else {
// 司机屏才可关闭自动驾驶
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
AdasManager.getInstance().sendAutoPilotModeReq(0, 0, null)
AdasManager.getInstance().sendAutoPilotModeReq(0, 0, null, null)
}
}
}
@@ -1269,6 +1271,82 @@ class MoGoAutopilotControlProvider :
return AdasManager.getInstance().sendSweeperCloudSuspendResumeTaskResp(reqNo, bigTaskActionResp) > -1
}
/**
* 发送电源状态查询请求
*
* @return 消息是否添加到WS消息发送队列返回值为非0的正整数时表示下发消息的消息ID
* * >=0表示添加到WS发送消息队列
* * =0表示乘客屏模式添加到WS发送消息队列
* * -1L添加到WS发送消息队列失败
*/
override fun sendPowerUnitSTSRequest(): Long {
return AdasManager.getInstance().sendPowerUnitSTSRequest()
}
/**
* 发送单通道电源控制请求
*
* @param channel 通道
* @param cmd 0关闭1打开
* @return 消息是否添加到WS消息发送队列返回值为非0的正整数时表示下发消息的消息ID
* * >=0表示添加到WS发送消息队列
* * =0表示乘客屏模式添加到WS发送消息队列
* * -1L添加到WS发送消息队列失败
*/
override fun sendPowerUnitSingleChannelControl(channel: PowerUnitChannel, cmd: Int): Long {
return AdasManager.getInstance().sendPowerUnitSingleChannelControl(channel,cmd)
}
/**
* 发送电源控制重置请求
*
* @return 消息是否添加到WS消息发送队列返回值为非0的正整数时表示下发消息的消息ID
* * >=0表示添加到WS发送消息队列
* * =0表示乘客屏模式添加到WS发送消息队列
* * -1L添加到WS发送消息队列失败
*/
override fun sendPowerUnitReset(): Long {
return AdasManager.getInstance().sendPowerUnitReset()
}
/**
* 查询冷启动状态
*
* @return 消息是否添加到WS消息发送队列返回值为非0的正整数时表示下发消息的消息ID
* * >=0表示添加到WS发送消息队列
* * =0表示乘客屏模式添加到WS发送消息队列
* * -1L添加到WS发送消息队列失败
*/
override fun sendSsmFuncQueryColdStartState(): Long {
return AdasManager.getInstance().sendSsmFuncQueryColdStartState()
}
/**
* 查询自驾命令状态
* 查询:是否首次进自驾、订单号、次数
*
* @return 消息是否添加到WS消息发送队列返回值为非0的正整数时表示下发消息的消息ID
* * >=0表示添加到WS发送消息队列
* * =0表示乘客屏模式添加到WS发送消息队列
* * -1L添加到WS发送消息队列失败
*/
override fun sendSsmFuncQueryAutoPilotInfo(): Long {
return AdasManager.getInstance().sendSsmFuncQueryAutoPilotInfo()
}
/**
* 查询到站信息
*
* @param orderId 订单号
* @return 消息是否添加到WS消息发送队列返回值为非0的正整数时表示下发消息的消息ID
* * >=0表示添加到WS发送消息队列
* * =0表示乘客屏模式添加到WS发送消息队列
* * -1L添加到WS发送消息队列失败
*/
override fun sendSsmFuncQueryAutoPilotStation(orderId: String): Long {
return AdasManager.getInstance().sendSsmFuncQueryAutoPilotStation(orderId)
}
override fun sendParallelDrivingReq(
reqNo: String,
parallelRequest: ParallelDrivingRequest.ParallelRequest

View File

@@ -8,8 +8,11 @@ import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.HdMapBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_ARRIVE
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_ARRIVE_QUERY
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_AUTOPILOT_INFO
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_CAR_CONFIG
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_CAR_LOC
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_COLD_START_STATE
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_FM_MSG
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_FSM_MSG
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_GUARDIAN
@@ -35,6 +38,8 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.SSMMsg
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeArriveAtStation
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutoPilotInfo
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutoPilotStation
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotSNRequest
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotStatusRespByQuery
@@ -58,6 +63,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerBackCameraVideoListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisDoorStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerColdStartStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerFaultManagementStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerFsm2024ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerLocalizationStateListenerManager
@@ -98,6 +104,7 @@ import com.zhjt.mogo.adas.data.bean.LaunchConditionData
import com.zhjt.mogo.adas.data.bean.NodeStateInfo
import com.zhjt.mogo.adas.data.bean.ReceivedAck
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
import com.zhjt.mogo.adas.data.bean.power.PowerData
import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask
import com.zhjt.mogo.adas.data.sweeper.task.big.SweeperBigTaskStatus
@@ -414,6 +421,160 @@ class MoGoAdasListenerImpl : OnAdasListener {
override fun onWarn(header: MessagePad.Header, warn: MessagePad.Warn?) {
}
/**
* 冷启动状态变更上报以及查询状态
*
* @param header 头
* @param token 唯一消息ID
* @param timestamp 消息发送时间 单位:毫秒
* @param isQuery 是否是查询 ture查询相应的结果 false表示状态变动域控主动推送
* @param coldStartState 数据 null表示 PadSsmMsg中的消息体为null
*/
override fun onColdStartState(
header: MessagePad.Header?,
token: Long,
timestamp: Long,
isQuery: Boolean,
coldStartState: SsmInfo.ColdStartState?
) {
CallerColdStartStateListenerManager.invokeColdStartState(
token,
timestamp,
isQuery,
coldStartState
)
if (coldStartState == null) {
coldStartStateError(
token,
timestamp,
isQuery,
"PadSsmMsg中的消息体为null"
)
} else {
coldStartState(
token,
timestamp,
isQuery,
coldStartState
)
}
}
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_COLD_START_STATE,
paramIndexes = [0, 1, 2, 3]
)
private fun coldStartState(
token: Long,
timestamp: Long,
isQuery: Boolean,
coldStartState: SsmInfo.ColdStartState,
) {
}
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_COLD_START_STATE,
paramIndexes = [0, 1, 2, 3]
)
private fun coldStartStateError(
token: Long,
timestamp: Long,
isQuery: Boolean,
autoPilotInfo: String,
) {
}
/**
* 自驾命令状态查询响应
* 返回 是否首次进自驾、订单号、次数
*
* @param header 头
* @param token 唯一消息ID
* @param timestamp 消息发送时间 单位:毫秒
* @param autoPilotInfo 数据 null表示 PadSsmMsg中的消息体为null
*/
override fun onAutoPilotInfo(
header: MessagePad.Header?,
token: Long,
timestamp: Long,
autoPilotInfo: SsmInfo.AutoPilotInfo?
) {
invokeAutoPilotInfo(token, timestamp, autoPilotInfo)
val msg: String
if (autoPilotInfo == null) {
msg = "PadSsmMsg中的消息体为null"
} else {
val temB: String = autoPilotInfo.firstAutopilotFlag.toString()
val temS: String = autoPilotInfo.orderId ?: ""
msg = "firstAutopilotFlag:" + temB + "orderId:" + temS + "count:" + autoPilotInfo.count
}
autoPilotInfoResponse(
token,
timestamp,
msg
)
}
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_AUTOPILOT_INFO,
paramIndexes = [0, 1, 2]
)
private fun autoPilotInfoResponse(
token: Long,
timestamp: Long,
autoPilotInfo: String,
) {
}
/**
* 到站信息查询响应
*
* @param header 头
* @param token 唯一消息ID
* @param timestamp 消息发送时间 单位:毫秒
* @param autoPilotStation 数据 null表示 PadSsmMsg中的消息体为null
*/
override fun onAutoPilotStation(
header: MessagePad.Header?,
token: Long,
timestamp: Long,
autoPilotStation: SsmInfo.AutoPilotStation?
) {
invokeAutoPilotStation(token, timestamp, autoPilotStation)
val msg: String
if (autoPilotStation == null) {
msg = "PadSsmMsg中的消息体为null"
} else {
val temB: String = autoPilotStation.arrivedStationFlag.toString()
val temS: String = autoPilotStation.orderId ?: ""
msg = "arrivedStationFlag:" + temB + "orderId:" + temS
}
autoPilotStationResponse(
token,
timestamp,
msg
)
}
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_ARRIVE_QUERY,
paramIndexes = [0, 1, 2]
)
private fun autoPilotStationResponse(
token: Long,
timestamp: Long,
autoPilotStation: String,
) {
}
//到站回调
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
@@ -1052,6 +1213,20 @@ class MoGoAdasListenerImpl : OnAdasListener {
}
/**
* 电源盒协议接口
* <p>
* {@link PowerData}使用方法
* 1.先判断数据中的{@link PowerData#protocolStatus} 是否是 {@link PowerProtocolStatus#SUCCEED} 如果是则表示数据解析正常可以正常使用,进行下一步
* 2.判断 {@link PowerData#frameType} 数据类型
*
* @param header 头
* @param data 数据
*/
override fun onPowerUnit(header: MessagePad.Header, data: PowerData) {
}
/**
* 所连接的域控的节点状态信息
* 目前包含状态 节点是否存在;节点是否超时;