[600][adas][data-center]SSM定频接入;能否启动自驾兼容老版本;以及新版本、FSM、不同车型的兼容、不同域控版本兼容;处理数据中心能否启动自驾管理类 初始化调用获取域控连接状态导致的Netty重复初始化问题
This commit is contained in:
@@ -74,6 +74,7 @@ import com.mogo.och.common.module.utils.PinYinUtil
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.ArrivalNotification
|
||||
import mogo.telematics.pad.MessagePad.GlobalPathResp
|
||||
import system_master.SsmInfo
|
||||
import system_master.SystemStatusInfo
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
@@ -514,6 +515,8 @@ object BusPassengerModel{
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {}
|
||||
|
||||
override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {}
|
||||
}
|
||||
private val moGoAutopilotPlanningListener: IMoGoPlanningRottingListener =
|
||||
object : IMoGoPlanningRottingListener {
|
||||
|
||||
@@ -39,6 +39,7 @@ import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SsmInfo;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
@@ -248,6 +249,11 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginSuccess(DriverStatusQueryRespBean data) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, " loginStatus =" + LoginStatusManager.isLogin());
|
||||
|
||||
@@ -42,6 +42,7 @@ import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SsmInfo;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
@@ -260,6 +261,11 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginSuccess(DriverStatusQueryRespBean data) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, " loginStatus =" + LoginStatusManager.isLogin());
|
||||
|
||||
@@ -63,6 +63,7 @@ import io.reactivex.plugins.RxJavaPlugins;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import planning.RoboSweeperTaskIndexOuterClass;
|
||||
import system_master.SsmInfo;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
@@ -642,6 +643,11 @@ public class SweeperTaskModel implements IMoGoSweeperFutianCloudTaskListener, IM
|
||||
// CallerLogger.INSTANCE.d(M_SWEEPER + TAG, "onAutopilotStatusRespByQuery status:" + status.getSysState().getNumber());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotRouteLineId(long lineId) {
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ import chassis.ChassisStatesOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import planning.RoboSweeperTaskIndexOuterClass;
|
||||
import system_master.SsmInfo;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
@@ -229,6 +230,10 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(@Nullable MessagePad.ArrivalNotification arrivalNotification) {
|
||||
SweeperTaskModel.getInstance().onArriveTaskEnd(arrivalNotification);
|
||||
|
||||
@@ -91,6 +91,7 @@ import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.ArrivalNotification
|
||||
import mogo.telematics.pad.MessagePad.GlobalPathResp
|
||||
import mogo_msg.MogoReportMsg.MogoReportMessage
|
||||
import system_master.SsmInfo
|
||||
import system_master.SystemStatusInfo
|
||||
import java.io.IOException
|
||||
|
||||
@@ -864,6 +865,8 @@ object TaxiModel {
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {}
|
||||
|
||||
override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {}
|
||||
}
|
||||
|
||||
private fun arriveTerminal() {
|
||||
|
||||
@@ -98,6 +98,7 @@ import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SsmInfo;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
@@ -1297,6 +1298,9 @@ public class TaxiModel {
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
}
|
||||
@Override
|
||||
public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) {
|
||||
}
|
||||
};
|
||||
|
||||
private final IMoGoPlanningRottingListener moGoAutopilotPlanningListener = new IMoGoPlanningRottingListener() {
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
|
||||
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
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeSystemStatus
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutoPilotDockerInfo
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutoPilotStatus
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager.invokeAutopilotAbility
|
||||
@@ -75,6 +76,7 @@ import perception.TrafficLightOuterClass
|
||||
import planning.RoboSweeperTaskIndexOuterClass
|
||||
import prediction.Prediction
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import system_master.SsmInfo
|
||||
import system_master.SystemStatusInfo
|
||||
|
||||
/**
|
||||
@@ -438,6 +440,10 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
invokeAutopilotStatusRespByQuery(statusInfo)
|
||||
}
|
||||
|
||||
override fun onSystemStatus(header: MessagePad.Header?, statusInf: SsmInfo.SsmStatusInf?) {
|
||||
invokeSystemStatus(statusInf)
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据采集配置应答
|
||||
*/
|
||||
|
||||
@@ -38,6 +38,7 @@ class MoGoAdasMsgConnectStatusListenerImpl :
|
||||
|
||||
init {
|
||||
CallerCloudListenerManager.addListener(TAG, this)
|
||||
CallerAutopilotActionsListenerManager.setConnected(AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED)
|
||||
}
|
||||
|
||||
override fun onConnectionIPCStatus(ipcConnectionStatus: Int, reason: String?) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
|
||||
import kotlinx.coroutines.Job
|
||||
import mogo_msg.MogoReportMsg.MogoReportMessage
|
||||
import planning.RoboSweeperTaskIndexOuterClass
|
||||
import system_master.SsmInfo
|
||||
import system_master.SystemStatusInfo.StatusInfo
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
@@ -115,6 +116,14 @@ internal class CanImpl(ctx: Context) :
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {
|
||||
val state = statusInf.healthInfoList?.find { "can_adapter".equals(it.name, true) }?.state?.ordinal
|
||||
Log.d(TAG, "state: $state")
|
||||
if (state != null) {
|
||||
this.state.set(state)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
job?.safeCancel()
|
||||
|
||||
@@ -16,7 +16,8 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import system_master.SystemStatusInfo.HealthInfo
|
||||
import system_master.SsmInfo
|
||||
import system_master.SsmBase.HealthInfo
|
||||
import system_master.SystemStatusInfo.StatusInfo
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
@@ -72,6 +73,17 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {
|
||||
check?.takeIf { it.isActive }?.cancel()
|
||||
isOldVersion.set(false)
|
||||
val info = statusInf.healthInfoList?.find { "localization".equals(it.name, true) }
|
||||
Log.d(TAG, "info: $info")
|
||||
if (info != null) {
|
||||
healthInfo.set(info)
|
||||
send(RTKStatus(getDesc(), getCode()))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) {
|
||||
super.onAutopilotIpcConnectStatusChanged(status, reason)
|
||||
if (!CallerAutoPilotControlManager.isConnected()) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SsmInfo;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
public class MogoRouteOverlayManager implements
|
||||
@@ -134,6 +135,10 @@ public class MogoRouteOverlayManager implements
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRouteLineId(long lineId) {
|
||||
|
||||
|
||||
@@ -61,6 +61,12 @@ interface IMoGoAutopilotStatusListener {
|
||||
*/
|
||||
fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {}
|
||||
|
||||
/**
|
||||
* 定频SSM
|
||||
* 老版本 SSM(SystemStatusInfo.StatusInfo) HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用
|
||||
*/
|
||||
fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {}
|
||||
|
||||
/**
|
||||
* 自动驾驶路线ID回调
|
||||
*/
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
import system_master.SsmInfo
|
||||
import system_master.SystemStatusInfo
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
@@ -207,6 +208,19 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 定频SSM
|
||||
* 老版本 SSM(SystemStatusInfo.StatusInfo) HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用
|
||||
*/
|
||||
fun invokeSystemStatus(statusInf: SsmInfo.SsmStatusInf?) {
|
||||
statusInf?.also {
|
||||
M_LISTENERS.forEach { itx ->
|
||||
val listener = itx.value
|
||||
listener.onSystemStatus(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新自动驾驶控制参数,结束自动驾驶时候需要更新为null,且更新时候同时触发onAutopilotStatusResponse回调
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.isConnected
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason
|
||||
|
||||
@@ -17,10 +15,9 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
|
||||
private var unableAutopilotReasons: ArrayList<UnableAutopilotReason>? = null
|
||||
|
||||
init {
|
||||
// isConnected = isConnected() //TODO 重复初始
|
||||
isAutopilotAbility = false
|
||||
unableAutopilotReasons = disconnectedReason()
|
||||
printLog("初始化")
|
||||
// printLog("初始化")
|
||||
}
|
||||
|
||||
private fun disconnectedReason(): ArrayList<UnableAutopilotReason> {
|
||||
@@ -50,7 +47,7 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
|
||||
this.isAutopilotAbility = isConnected
|
||||
unableAutopilotReasons = if (isConnected) null else disconnectedReason()
|
||||
notification()
|
||||
printLog("更新数据 连接状态变更")
|
||||
// printLog("更新数据 连接状态变更")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,23 +63,23 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
|
||||
this.unableAutopilotReasons?.let { old ->
|
||||
old.sortWith(compareBy(UnableAutopilotReason::hashCode));
|
||||
isEquals = onw.toTypedArray() contentEquals old.toTypedArray()
|
||||
Log.i(
|
||||
"ddd",
|
||||
"都不为null时=${isEquals}=${this.isAutopilotAbility} ${(if (this.unableAutopilotReasons == null) null else this.unableAutopilotReasons.toString())}"
|
||||
)
|
||||
// Log.i(
|
||||
// "ddd",
|
||||
// "都不为null时=${isEquals}=${this.isAutopilotAbility} ${(if (this.unableAutopilotReasons == null) null else this.unableAutopilotReasons.toString())}"
|
||||
// )
|
||||
}
|
||||
}
|
||||
} else isEquals =
|
||||
!(unableAutopilotReasons != null || this.unableAutopilotReasons != null)
|
||||
Log.i(
|
||||
"ddd",
|
||||
" 两个List是否相同=${isEquals} 新是否能启动自驾=${isAutopilotAbility} 老是否能启动自驾=${this.isAutopilotAbility} 新List是否为空=${unableAutopilotReasons == null} 老List是否为空=${this.unableAutopilotReasons == null}"
|
||||
)
|
||||
// Log.i(
|
||||
// "ddd",
|
||||
// " 两个List是否相同=${isEquals} 新是否能启动自驾=${isAutopilotAbility} 老是否能启动自驾=${this.isAutopilotAbility} 新List是否为空=${unableAutopilotReasons == null} 老List是否为空=${this.unableAutopilotReasons == null}"
|
||||
// )
|
||||
if (this.isAutopilotAbility != isAutopilotAbility || !isEquals) {
|
||||
this.isAutopilotAbility = isAutopilotAbility
|
||||
this.unableAutopilotReasons = unableAutopilotReasons
|
||||
notification()
|
||||
printLog("更新数据")
|
||||
// printLog("更新数据")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,10 +91,10 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
|
||||
}
|
||||
}
|
||||
|
||||
fun printLog(tag: String) {
|
||||
Log.i(
|
||||
"ddd",
|
||||
"${tag}=${isAutopilotAbility} ${(if (unableAutopilotReasons == null) null else unableAutopilotReasons.toString())}"
|
||||
)
|
||||
}
|
||||
// fun printLog(tag: String) {
|
||||
// Log.i(
|
||||
// "xfk",
|
||||
// "${tag}=${isAutopilotAbility} ${(if (unableAutopilotReasons == null) null else unableAutopilotReasons.toString())}"
|
||||
// )
|
||||
// }
|
||||
}
|
||||
@@ -32,6 +32,7 @@ enum MessageType
|
||||
MsgTypeFunctionStates = 0x1000c; //重构后的功能状态, 透传
|
||||
MsgTypeBackCameraVideo = 0x1000d; //后部摄像头视频 10hz
|
||||
MsgTypeM1StitchedVideo = 0x1000e; //m1拼接视频 10hz
|
||||
MsgTypeSSMState = 0x1000f; //ssm 系统状态 1hz hq m1 MAP350开始支持,其他车型MAP360开始支持
|
||||
|
||||
MsgTypeBasicInfoReq = 0x10100; //自动驾驶设备基础信息请求
|
||||
MsgTypeBasicInfoResp = 0x10101; //自动驾驶设备基础信息应答
|
||||
@@ -709,3 +710,6 @@ message SessionInfo
|
||||
uint64 connectedTimeStamp = 4;
|
||||
string version = 5;
|
||||
}
|
||||
|
||||
//message definition for MsgTypeSSMState
|
||||
//refer to ssm_info.proto for details
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package system_master;
|
||||
|
||||
|
||||
enum HealthState {
|
||||
NORMAL = 0;
|
||||
FAULT = 1;
|
||||
UNKNOW = 2;
|
||||
}
|
||||
|
||||
message HealthInfo{
|
||||
required string name = 1; //node name
|
||||
required HealthState state = 2; //health state
|
||||
optional string code = 3; //code 与系统事件错误码对应,如有该错误填写,没有不填
|
||||
optional string desc = 4; //补充描述,用于未知情况
|
||||
}
|
||||
|
||||
54
libraries/mogo-adas-data/src/main/proto/ssm_info.proto
Normal file
54
libraries/mogo-adas-data/src/main/proto/ssm_info.proto
Normal file
@@ -0,0 +1,54 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package system_master;
|
||||
import "personal/ssm_base.proto";
|
||||
|
||||
enum NodeState {
|
||||
NONE = 0; //未知状态None
|
||||
WAITING = 1; //依赖未就绪Waiting
|
||||
STARTING = 2; //启动中Starting
|
||||
RUNNING = 3; //运行running
|
||||
STOPPING = 4; //停止stopping
|
||||
BROKEN = 5; //无法启动状态
|
||||
MAN_RUN = 6; //非自动启动状态
|
||||
MAN_STOP = 7; //非自动关闭状态
|
||||
}
|
||||
|
||||
enum AgentState {
|
||||
DISCONNECT = 0; //未连接或断开连接
|
||||
CONNECTED = 1; //连接状态
|
||||
}
|
||||
|
||||
enum ModeState {
|
||||
MODE_STOP_UNREADY = 0; //停止模式-未就绪
|
||||
MODE_STOP_READY = 1; //运行模式-就绪 (所有节点关闭)
|
||||
MODE_RUN_UNREADY = 2; //运行模式-未就绪
|
||||
MODE_RUN_READY = 3; //运行模式-就绪 (所有节点启动)
|
||||
MODE_IDLE_UNREADY = 4; //空闲模式-未就绪
|
||||
MODE_IDLE_READY = 5; //空闲模式-就绪 (非驾驶状态)
|
||||
}
|
||||
|
||||
|
||||
message NodeInf {
|
||||
optional string node_name = 1; //node name
|
||||
optional string launch_name = 2; //launch name
|
||||
optional NodeState state = 3;
|
||||
}
|
||||
|
||||
message SsmStatusInf {
|
||||
required ModeState mode_state = 1; // 当前系统模式状态
|
||||
optional string map_version = 2; // MAP 版本信息
|
||||
optional string master_version = 3; // SSM 版本信息
|
||||
required bool auto_pilot_ready = 4; // 自动驾驶状态就绪
|
||||
required bool remote_pilot_ready = 5; // 平行驾驶状态就绪
|
||||
repeated NodeInf auto_pilot_unready_list = 6; //自驾未就绪节点列表
|
||||
repeated NodeInf remote_pilot_unready_list = 7; //平行驾驶未就绪列表
|
||||
optional string auto_pilot_unready_reason = 8; //自动驾驶状态未就绪原因描述
|
||||
optional string remote_pilot_unready_reason = 9; //平行驾驶状态未就绪原因描述
|
||||
repeated HealthInfo health_info=10; // 健康检查状态信息
|
||||
|
||||
optional uint64 cur_used_lineid = 20 [default = 0]; //0:当前无可用轨迹,需要下单,other: 可用轨迹id
|
||||
optional string hd_map_ver = 21; //高精地图版本
|
||||
optional string slam_map_ver = 22; //slam地图版本
|
||||
optional string grid_map_ver = 23; //栅格地图版本
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package system_master;
|
||||
import "personal/ssm_base.proto";
|
||||
|
||||
enum SystemState {
|
||||
SYS_STARTING = 0; //系统正在启动
|
||||
@@ -14,19 +15,6 @@ enum SystemState {
|
||||
REMOTE_PILOT_RUNNING = 8; //平行驾驶运行中
|
||||
}
|
||||
|
||||
enum HealthState {
|
||||
NORMAL = 0;//正常
|
||||
FAULT = 1;//异常
|
||||
UNKNOW = 2;//未知
|
||||
}
|
||||
|
||||
message HealthInfo{
|
||||
required string name = 1; //node name
|
||||
required HealthState state = 2; //health state
|
||||
optional string code = 3; //code 与系统事件错误码对应,如有该错误填写,没有不填
|
||||
optional string desc = 4; //补充描述,用于未知情况
|
||||
}
|
||||
|
||||
message TopicInfo{
|
||||
optional string name = 1; //topic name
|
||||
optional int32 hz = 2; //Topic发送的频率
|
||||
@@ -50,7 +38,7 @@ message NodeFaultList{
|
||||
|
||||
message StatusInfo {
|
||||
required SystemState sys_state=1; // 当前系统状态
|
||||
repeated HealthInfo health_info=2; // 健康检查状态信息
|
||||
repeated HealthInfo health_info=2; // 健康检查状态信息
|
||||
optional DropTopic topic_drop_info=3; // topic 掉频信息, 如有掉频添加没有不添加
|
||||
optional string reserved = 4; // 用于表示idle模式,'idle' 表示idle模式 'work' 表示正常工作
|
||||
// add by liyl 20220907
|
||||
@@ -63,5 +51,9 @@ message StatusInfo {
|
||||
optional NodeFaultList remote_pilot_unready_list = 11; //平行驾驶未就绪列表, 20221128 增加
|
||||
optional string auto_pilot_unready_reason = 12; //自动驾驶状态未就绪原因描述
|
||||
optional string remote_pilot_unready_reason = 13; //平行驾驶状态未就绪原因描述
|
||||
}
|
||||
|
||||
optional uint64 cur_used_lineid = 20 [default = 0]; //0:当前无可用轨迹,需要下单,other: 可用轨迹id
|
||||
optional string hd_map_ver = 21; //高精地图版本
|
||||
optional string slam_map_ver = 22; //slam地图版本
|
||||
optional string grid_map_ver = 23; //栅格地图版本
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ android {
|
||||
versionName rootProject.versionName
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
multiDexEnabled true
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
||||
@@ -1136,8 +1136,16 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
@Deprecated//HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用
|
||||
@Override
|
||||
public boolean sendStatusQueryReq() {
|
||||
MessagePad.CarConfigResp config = AdasManager.getInstance().getCarConfig();
|
||||
if (config != null) {
|
||||
//HQ和M1 MAP>=350开始走定频SSM,其他车型360开始
|
||||
if ((config.getMapVersion() >= 30500 && (config.getIsJinlvM1() || config.getIsHQ())) || config.getMapVersion() >= 30600) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
MessagePad.StatusQueryReq req = MessagePad.StatusQueryReq
|
||||
.newBuilder()
|
||||
.build();
|
||||
|
||||
@@ -578,6 +578,7 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
@Deprecated//HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用
|
||||
@Override
|
||||
public boolean sendStatusQueryReq() {
|
||||
return mChannel != null && mChannel.sendStatusQueryReq();
|
||||
|
||||
@@ -266,6 +266,7 @@ public interface IAdasNetCommApi {
|
||||
*
|
||||
* @return 加入WS发送消息队列是否成功
|
||||
*/
|
||||
@Deprecated//HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用
|
||||
boolean sendStatusQueryReq();
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.zhjt.mogo.adas.data.sweeper.task.status.SweeperTaskStatus;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import bag_manager.BagManagerOuterClass;
|
||||
import chassis.ChassisStatesOuterClass;
|
||||
@@ -34,6 +33,7 @@ import perception.TrafficLightOuterClass;
|
||||
import planning.RoboSweeperTaskIndexOuterClass;
|
||||
import prediction.Prediction;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
import system_master.SsmInfo;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
@@ -197,8 +197,19 @@ public interface OnAdasListener {
|
||||
* @param header 头
|
||||
* @param statusInfo 数据
|
||||
*/
|
||||
@Deprecated//HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用
|
||||
void onStatusQueryResp(MessagePad.Header header, SystemStatusInfo.StatusInfo statusInfo);
|
||||
|
||||
/**
|
||||
* 定频SSM接口
|
||||
* 1hz hq m1 MAP350开始支持,其他车型MAP360开始支持
|
||||
* 定频SSM接入后 onStatusQueryResp 状态查询应答接口将弃用
|
||||
*
|
||||
* @param header 头
|
||||
* @param statusInf 数据
|
||||
*/
|
||||
void onSystemStatus(MessagePad.Header header, SsmInfo.SsmStatusInf statusInf);
|
||||
|
||||
/**
|
||||
* 数据采集配置应答
|
||||
*
|
||||
|
||||
@@ -30,6 +30,7 @@ public enum MessageType {
|
||||
TYPE_RECEIVE_FUNCTION_STATES(MessagePad.MessageType.MsgTypeFunctionStates, "重构后功能状态"),
|
||||
TYPE_RECEIVE_BACK_CAMERA_VIDEO(MessagePad.MessageType.MsgTypeBackCameraVideo, "后摄像头"),
|
||||
TYPE_RECEIVE_M1_STITCHED_VIDEO(MessagePad.MessageType.MsgTypeM1StitchedVideo, "M1拼接视频"),
|
||||
TYPE_RECEIVE_SSM(MessagePad.MessageType.MsgTypeSSMState, "SSM系统状态"),
|
||||
|
||||
TYPE_RECEIVE_BASIC_INFO_REQ(MessagePad.MessageType.MsgTypeBasicInfoReq, "自动驾驶设备基础信息请求"),
|
||||
TYPE_SEND_BASIC_INFO_RESP(MessagePad.MessageType.MsgTypeBasicInfoResp, "自动驾驶设备基础信息应答"),
|
||||
|
||||
@@ -53,7 +53,7 @@ public class AutopilotAbility230 {
|
||||
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
|
||||
if (!AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear)) {
|
||||
isAutopilotAbility = false;
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "当前档位无法启动自驾");
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "档位异常");
|
||||
}
|
||||
}
|
||||
//TODO 关于手刹:不同车型的实现不同所以目前没法使用此字段
|
||||
|
||||
@@ -79,17 +79,14 @@ public class AutopilotAbility250 {
|
||||
SystemStatusInfo.NodeFaultList nodeFaultList = statusInfo.getAutoPilotUnreadyList();
|
||||
if (nodeFaultList.getSum() > 0) {
|
||||
List<SystemStatusInfo.NodeInfo> list = nodeFaultList.getNodeList();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (SystemStatusInfo.NodeInfo info : list) {
|
||||
builder.append(info.getNodeName());
|
||||
String nodeName = info.getNodeName();
|
||||
int state = info.getState();
|
||||
if (state < AutopilotAbilityManager.NODE_INFO_STATE.length) {
|
||||
builder.append(AutopilotAbilityManager.NODE_INFO_STATE[state]);
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + AutopilotAbilityManager.NODE_INFO_STATE[state]);
|
||||
} else {
|
||||
builder.append("未知异常 ");
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + "未知异常");
|
||||
}
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, builder.toString());
|
||||
builder.setLength(0);
|
||||
}
|
||||
} else {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, "未知异常节点");
|
||||
@@ -144,7 +141,7 @@ public class AutopilotAbility250 {
|
||||
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
|
||||
if (!AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear)) {
|
||||
isAutopilotAbility = false;
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "当前档位无法启动自驾");
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "档位异常");
|
||||
}
|
||||
}
|
||||
//TODO 关于手刹:不同车型的实现不同所以目前没法使用此字段
|
||||
|
||||
@@ -82,17 +82,14 @@ public class AutopilotAbility330 {
|
||||
SystemStatusInfo.NodeFaultList nodeFaultList = statusInfo.getAutoPilotUnreadyList();
|
||||
if (nodeFaultList.getSum() > 0) {
|
||||
List<SystemStatusInfo.NodeInfo> list = nodeFaultList.getNodeList();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (SystemStatusInfo.NodeInfo info : list) {
|
||||
builder.append(info.getNodeName());
|
||||
String nodeName = info.getNodeName();
|
||||
int state = info.getState();
|
||||
if (state < AutopilotAbilityManager.NODE_INFO_STATE.length) {
|
||||
builder.append(AutopilotAbilityManager.NODE_INFO_STATE[state]);
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + AutopilotAbilityManager.NODE_INFO_STATE[state]);
|
||||
} else {
|
||||
builder.append("未知异常 ");
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + "未知异常");
|
||||
}
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, builder.toString());
|
||||
builder.setLength(0);
|
||||
}
|
||||
} else {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, "未知异常节点");
|
||||
@@ -145,7 +142,7 @@ public class AutopilotAbility330 {
|
||||
}
|
||||
}
|
||||
if (unableAutopilotReasons == null || unableAutopilotReasons.isEmpty()) {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "FSM未给出原因");
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "FSM数据异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.zhidao.support.adas.high.common.autopilot.ability;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import chassis.Chassis;
|
||||
import chassis.ChassisStatesOuterClass;
|
||||
import system_master.SsmInfo;
|
||||
|
||||
/**
|
||||
* 是否可以启动自动驾驶能力检测 工控机版本>=350&&(isHQ||isJinlvM1) || 工控机版本>=360&&!isFutianSweeper 使用此类
|
||||
* 目前监控了定频SSM的数据和FSM状态原因查询
|
||||
* 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知
|
||||
* <p>
|
||||
*/
|
||||
public class AutopilotAbility350And360 {
|
||||
private static final String TAG = AutopilotAbility250.class.getSimpleName();
|
||||
private ChassisStatesOuterClass.ChassisStates chassisStates;
|
||||
private int masterVersion = -1;//Master版本
|
||||
private OnAutopilotAbilityListener listener;
|
||||
|
||||
protected interface OnAutopilotAbilityListener {
|
||||
void onAutopilotAbility(boolean isAutopilotAbility, @Nullable ArrayList<UnableAutopilotReason> unableAutopilotReasons);
|
||||
|
||||
}
|
||||
|
||||
protected AutopilotAbility350And360() {
|
||||
this.masterVersion = -1;
|
||||
}
|
||||
|
||||
|
||||
protected void setStatusInfo(SsmInfo.SsmStatusInf statusInfo) {
|
||||
|
||||
onCallback(statusInfo);
|
||||
}
|
||||
|
||||
protected void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) {
|
||||
this.chassisStates = chassisStates;
|
||||
}
|
||||
|
||||
private void onCallback(SsmInfo.SsmStatusInf statusInfo) {
|
||||
boolean isAutopilotAbility = true;//是否能启动自动驾驶
|
||||
ArrayList<UnableAutopilotReason> unableAutopilotReasons = null;//不能启动自动驾驶原因
|
||||
//检测节点状态相关
|
||||
if (statusInfo != null) {
|
||||
if (masterVersion == -1 && statusInfo.hasMasterVersion()) {
|
||||
//截取Master Version
|
||||
masterVersion = AdasManager.getInstance().parseVersion(false, statusInfo.getMasterVersion());
|
||||
}
|
||||
CupidLogUtils.i(TAG, "MasterVersion=" + masterVersion);
|
||||
//SSM 3版本兼容
|
||||
if (masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) {
|
||||
isAutopilotAbility = statusInfo.getAutoPilotReady();
|
||||
if (!isAutopilotAbility) {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, statusInfo.getAutoPilotUnreadyReason());
|
||||
}
|
||||
} else if (masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1,还需要判断AutoPilotReady字段是否存在,以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行
|
||||
isAutopilotAbility = statusInfo.getAutoPilotReady();
|
||||
if (!isAutopilotAbility) {
|
||||
int count = statusInfo.getAutoPilotUnreadyListCount();
|
||||
if (count > 0) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
SsmInfo.NodeInf info = statusInfo.getAutoPilotUnreadyList(i);
|
||||
String nodeName = info.getNodeName();
|
||||
int state = info.getState().getNumber();
|
||||
if (state < AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY.length) {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY[state]);
|
||||
} else {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + "未知异常");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, "未知异常节点");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SsmInfo.ModeState modeState = statusInfo.getModeState();
|
||||
if (modeState != SsmInfo.ModeState.MODE_RUN_UNREADY && modeState != SsmInfo.ModeState.MODE_RUN_READY) {
|
||||
isAutopilotAbility = false;
|
||||
String unableAutopilotReason = null;
|
||||
if (modeState == SsmInfo.ModeState.MODE_STOP_UNREADY) {
|
||||
unableAutopilotReason = "系统处于停止模式(未就绪)";
|
||||
} else if (modeState == SsmInfo.ModeState.MODE_STOP_READY) {
|
||||
unableAutopilotReason = "系统处于停止模式";
|
||||
} else if (modeState == SsmInfo.ModeState.MODE_IDLE_UNREADY) {
|
||||
unableAutopilotReason = "系统处于空闲模式(未就绪)";
|
||||
} else if (modeState == SsmInfo.ModeState.MODE_IDLE_READY) {
|
||||
unableAutopilotReason = "系统处于空闲模式";
|
||||
} else {
|
||||
unableAutopilotReason = "未知系统模式";
|
||||
}
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, unableAutopilotReason);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isAutopilotAbility = false;//是否能启动自动驾驶
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "SSM数据异常");
|
||||
}
|
||||
//检测底盘相关
|
||||
if (chassisStates != null) {
|
||||
if (chassisStates.hasBrakeSystemStates()) {
|
||||
float brake = chassisStates.getBrakeSystemStates().getBrakePedalResponsePosition();
|
||||
if (brake > 0) {
|
||||
isAutopilotAbility = false;
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "制动踏板被踩下");
|
||||
}
|
||||
}
|
||||
if (chassisStates.hasGearSystemStates()) {
|
||||
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
|
||||
if (!AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear)) {
|
||||
isAutopilotAbility = false;
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "档位异常");
|
||||
}
|
||||
}
|
||||
//TODO 关于手刹:不同车型的实现不同所以目前没法使用此字段
|
||||
|
||||
// //电子驻车制动系统
|
||||
// if (chassisStates.hasEpbSystemStates()) {
|
||||
// ChassisStatesOuterClass.EPBSystemStates epb = chassisStates.getEpbSystemStates();
|
||||
// if (epb.hasEpbEnableState()){
|
||||
// epb.getEpbWorkState();
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReasons);
|
||||
}
|
||||
}
|
||||
|
||||
protected void start(OnAutopilotAbilityListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
protected void stop() {
|
||||
this.chassisStates = null;
|
||||
this.masterVersion = -1;
|
||||
this.listener = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.zhidao.support.adas.high.common.autopilot.ability;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import function_state_management.FSMStatusReasonQueryOuterClass;
|
||||
import system_master.SsmInfo;
|
||||
|
||||
/**
|
||||
* 是否可以启动自动驾驶能力检测 工控机版本>=360&&isFutianSweeper 使用此类
|
||||
* TODO 目前只用于清扫车,其他车型需要MAP支持 FSM的相关功能
|
||||
* 目前监控了定频SSM的数据和FSM状态原因查询
|
||||
* 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知
|
||||
*/
|
||||
public class AutopilotAbility360 {
|
||||
private static final String TAG = AutopilotAbility360.class.getSimpleName();
|
||||
|
||||
private volatile FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond;//自动驾驶状态为OFF的原因
|
||||
private int masterVersion = -1;//Master版本
|
||||
private OnAutopilotAbilityListener listener;
|
||||
|
||||
protected interface OnAutopilotAbilityListener {
|
||||
void onAutopilotAbility(boolean isAutopilotAbility, @Nullable ArrayList<UnableAutopilotReason> unableAutopilotReasons);
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected AutopilotAbility360() {
|
||||
this.masterVersion = -1;
|
||||
}
|
||||
|
||||
protected synchronized void setFsmStatusReasonRespond(FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond) {
|
||||
this.fsmStatusReasonRespond = fsmStatusReasonRespond;
|
||||
}
|
||||
|
||||
protected void setStatusInfo(SsmInfo.SsmStatusInf statusInfo) {
|
||||
onCallback(statusInfo);
|
||||
}
|
||||
|
||||
|
||||
private void onCallback(SsmInfo.SsmStatusInf statusInfo) {
|
||||
boolean isAutopilotAbility = true;//是否能启动自动驾驶
|
||||
ArrayList<UnableAutopilotReason> unableAutopilotReasons = null;//不能启动自动驾驶原因
|
||||
//检测节点状态相关
|
||||
if (statusInfo != null) {
|
||||
if (masterVersion == -1 && statusInfo.hasMasterVersion()) {
|
||||
//截取Master Version
|
||||
masterVersion = AdasManager.getInstance().parseVersion(false, statusInfo.getMasterVersion());
|
||||
}
|
||||
CupidLogUtils.i(TAG, "MasterVersion=" + masterVersion);
|
||||
//SSM 3版本兼容
|
||||
if (masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) {
|
||||
isAutopilotAbility = statusInfo.getAutoPilotReady();
|
||||
if (!isAutopilotAbility) {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, statusInfo.getAutoPilotUnreadyReason());
|
||||
}
|
||||
} else if (masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1,还需要判断AutoPilotReady字段是否存在,以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行
|
||||
isAutopilotAbility = statusInfo.getAutoPilotReady();
|
||||
if (!isAutopilotAbility) {
|
||||
int count = statusInfo.getAutoPilotUnreadyListCount();
|
||||
if (count > 0) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
SsmInfo.NodeInf info = statusInfo.getAutoPilotUnreadyList(i);
|
||||
String nodeName = info.getNodeName();
|
||||
int state = info.getState().getNumber();
|
||||
if (state < AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY.length) {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + AutopilotAbilityManager.NODE_INFO_STATE_FIXED_FREQUENCY[state]);
|
||||
} else {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, nodeName + "未知异常");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, "未知异常节点");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SsmInfo.ModeState modeState = statusInfo.getModeState();
|
||||
if (modeState != SsmInfo.ModeState.MODE_RUN_UNREADY && modeState != SsmInfo.ModeState.MODE_RUN_READY) {
|
||||
isAutopilotAbility = false;
|
||||
String unableAutopilotReason = null;
|
||||
if (modeState == SsmInfo.ModeState.MODE_STOP_UNREADY) {
|
||||
unableAutopilotReason = "系统处于停止模式(未就绪)";
|
||||
} else if (modeState == SsmInfo.ModeState.MODE_STOP_READY) {
|
||||
unableAutopilotReason = "系统处于停止模式";
|
||||
} else if (modeState == SsmInfo.ModeState.MODE_IDLE_UNREADY) {
|
||||
unableAutopilotReason = "系统处于空闲模式(未就绪)";
|
||||
} else if (modeState == SsmInfo.ModeState.MODE_IDLE_READY) {
|
||||
unableAutopilotReason = "系统处于空闲模式";
|
||||
} else {
|
||||
unableAutopilotReason = "未知系统模式";
|
||||
}
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, unableAutopilotReason);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isAutopilotAbility = false;//是否能启动自动驾驶
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "SSM数据异常");
|
||||
}
|
||||
if (fsmStatusReasonRespond != null) {
|
||||
int count = fsmStatusReasonRespond.getFsmStatusReasonRespondCount();
|
||||
if (count > 0) {
|
||||
isAutopilotAbility = false;
|
||||
for (int i = 0; i < count; i++) {
|
||||
String respond = fsmStatusReasonRespond.getFsmStatusReasonRespond(i);
|
||||
if (!TextUtils.isEmpty(respond)) {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.FSM, respond);
|
||||
}
|
||||
}
|
||||
if (unableAutopilotReasons == null || unableAutopilotReasons.isEmpty()) {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "FSM数据异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReasons);
|
||||
}
|
||||
}
|
||||
|
||||
protected void start(OnAutopilotAbilityListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
protected void stop() {
|
||||
this.masterVersion = -1;
|
||||
this.listener = null;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.zhidao.support.adas.high.common.autopilot.ability;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -20,6 +21,7 @@ import chassis.Chassis;
|
||||
import chassis.ChassisStatesOuterClass;
|
||||
import function_state_management.FSMStatusReasonQueryOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import system_master.SsmInfo;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
@@ -29,21 +31,26 @@ import system_master.SystemStatusInfo;
|
||||
* <p>
|
||||
* 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态
|
||||
*/
|
||||
public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotAbilityListener, AutopilotAbility250.OnAutopilotAbilityListener, AutopilotAbility330.OnAutopilotAbilityListener {
|
||||
public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotAbilityListener, AutopilotAbility250.OnAutopilotAbilityListener, AutopilotAbility330.OnAutopilotAbilityListener, AutopilotAbility350And360.OnAutopilotAbilityListener, AutopilotAbility360.OnAutopilotAbilityListener {
|
||||
private static final String TAG = AutopilotAbilityManager.class.getSimpleName();
|
||||
protected static final int WHAT_TIMEOUT = 0;
|
||||
protected static final int DEFAULT_TIMEOUT = 2500;
|
||||
protected static final long DEFAULT_DETECTION_TIME = 3 * 1000L;//默认检测周期
|
||||
protected static final String[] NODE_INFO_STATE = {"未知状态 ", "依赖未就绪 ", "启动中 ", "运行 ", "停止 ", "无法启动状态 ", "人为启动状态 ", "人为关闭状态 "};
|
||||
protected static final String[] NODE_INFO_STATE = {"未知状态", "依赖未就绪", "启动中", "运行", "停止", "无法启动状态", "人为启动状态", "人为关闭状态"};
|
||||
protected static final String[] NODE_INFO_STATE_FIXED_FREQUENCY = {"未知状态", "依赖未就绪", "启动中", "运行", "停止", "无法启动状态", "非自动启动状态", "非自动关闭状态"};
|
||||
private static volatile AutopilotAbilityManager INSTANCE;
|
||||
private OnAdasListener listener;
|
||||
private Handler handler;
|
||||
private OnAutopilotAbilityListener onAutopilotAbilityListener;
|
||||
private int mapVersion = -1;//工控机版本
|
||||
private boolean isFutianSweeper = false;//是否是福田清扫车
|
||||
private boolean isJinlvM1 = false;//是否是M1
|
||||
private boolean isHQ = false;//是否是HQ
|
||||
private AutopilotAbility230 autopilotAbility230;
|
||||
private AutopilotAbility250 autopilotAbility250;
|
||||
private AutopilotAbility330 autopilotAbility330;
|
||||
private AutopilotAbility350And360 autopilotAbility350And360;
|
||||
private AutopilotAbility360 autopilotAbility360;
|
||||
private Timer startTimer;
|
||||
/**
|
||||
* 不能启动自动驾驶的档位
|
||||
@@ -106,6 +113,8 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
|
||||
public void setCarConfig(MessagePad.CarConfigResp carConfig) {
|
||||
mapVersion = carConfig.getMapVersion();
|
||||
isFutianSweeper = carConfig.getIsFutianSweeper();
|
||||
isJinlvM1 = carConfig.getIsJinlvM1();
|
||||
isHQ = carConfig.getIsHQ();
|
||||
if (mapVersion != -1) {
|
||||
stopTimer();
|
||||
CupidLogUtils.i(TAG, "工控机版本=" + mapVersion);
|
||||
@@ -171,6 +180,15 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
|
||||
}
|
||||
}
|
||||
|
||||
public void setStatusInfo(SsmInfo.SsmStatusInf statusInfo) {
|
||||
if (autopilotAbility350And360 != null) {
|
||||
autopilotAbility350And360.setStatusInfo(statusInfo);
|
||||
}
|
||||
if (autopilotAbility360 != null) {
|
||||
autopilotAbility360.setStatusInfo(statusInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 底盘状态更新
|
||||
*
|
||||
@@ -183,6 +201,9 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
|
||||
if (autopilotAbility250 != null) {
|
||||
autopilotAbility250.setChassisStates(chassisStates);
|
||||
}
|
||||
if (autopilotAbility350And360 != null) {
|
||||
autopilotAbility350And360.setChassisStates(chassisStates);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,6 +215,9 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
|
||||
if (autopilotAbility330 != null) {
|
||||
autopilotAbility330.setFsmStatusReasonRespond(fsmStatusReasonRespond);
|
||||
}
|
||||
if (autopilotAbility360 != null) {
|
||||
autopilotAbility360.setFsmStatusReasonRespond(fsmStatusReasonRespond);
|
||||
}
|
||||
}
|
||||
|
||||
public void onHandleMessage(Message msg) {
|
||||
@@ -208,27 +232,54 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
|
||||
}
|
||||
|
||||
private void initAutopilotAbility() {
|
||||
//目前只有MAP330的清扫车用的新的FSM状态原因查询
|
||||
if (mapVersion >= 30300 && isFutianSweeper) {
|
||||
CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用330版本");
|
||||
if (mapVersion >= 30600 && isFutianSweeper) {
|
||||
Log.i(TAG, "能否启动自驾能力检测使用版本:360清扫车专用");
|
||||
stop230();
|
||||
stop250();
|
||||
stop330();
|
||||
stop350And360();
|
||||
if (autopilotAbility360 == null) {
|
||||
autopilotAbility360 = new AutopilotAbility360();
|
||||
autopilotAbility360.start(this);
|
||||
}
|
||||
|
||||
} else if ((mapVersion >= 30500 && (isJinlvM1 || isHQ)) || mapVersion >= 30600) {
|
||||
Log.i(TAG, "能否启动自驾能力检测使用版本:350和360共用");
|
||||
stop230();
|
||||
stop250();
|
||||
stop330();
|
||||
stop360();
|
||||
if (autopilotAbility350And360 == null) {
|
||||
autopilotAbility350And360 = new AutopilotAbility350And360();
|
||||
autopilotAbility350And360.start(this);
|
||||
}
|
||||
|
||||
} else if (mapVersion >= 30300 && isFutianSweeper) {//目前只有MAP330的清扫车用的新的FSM状态原因查询
|
||||
Log.i(TAG, "能否启动自驾能力检测使用版本:330清扫车专用");
|
||||
stop230();
|
||||
stop250();
|
||||
stop350And360();
|
||||
stop360();
|
||||
if (autopilotAbility330 == null) {
|
||||
autopilotAbility330 = new AutopilotAbility330(mapVersion);
|
||||
autopilotAbility330.start(this);
|
||||
}
|
||||
} else if (mapVersion >= 20500) {
|
||||
CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用250版本");
|
||||
Log.i(TAG, "能否启动自驾能力检测使用版本:250");
|
||||
stop230();
|
||||
stop330();
|
||||
stop350And360();
|
||||
stop360();
|
||||
if (autopilotAbility250 == null) {
|
||||
autopilotAbility250 = new AutopilotAbility250(mapVersion);
|
||||
autopilotAbility250.start(this);
|
||||
}
|
||||
} else {
|
||||
CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用230版本");
|
||||
Log.i(TAG, "能否启动自驾能力检测使用版本:230");
|
||||
stop250();
|
||||
stop330();
|
||||
stop350And360();
|
||||
stop360();
|
||||
if (autopilotAbility230 == null) {
|
||||
autopilotAbility230 = new AutopilotAbility230();
|
||||
autopilotAbility230.start(this);
|
||||
@@ -258,6 +309,20 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
|
||||
}
|
||||
}
|
||||
|
||||
private void stop350And360() {
|
||||
if (autopilotAbility350And360 != null) {
|
||||
autopilotAbility350And360.stop();
|
||||
autopilotAbility350And360 = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void stop360() {
|
||||
if (autopilotAbility360 != null) {
|
||||
autopilotAbility360.stop();
|
||||
autopilotAbility360 = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void stopTimer() {
|
||||
if (startTimer != null) {
|
||||
startTimer.cancel();
|
||||
@@ -280,7 +345,7 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
|
||||
initAutopilotAbility();
|
||||
}
|
||||
}
|
||||
}, 8000L);//延迟执行,避免刚连接成功后底盘信息无法及时同步
|
||||
}, 8000L);//8秒原因:需要后去CarConfig 对象,两个地方调用initAutopilotAbility(); 初始化 一个在这,另一个在setCarConfig(),如果setCarConfig() 证明获取版本还未成功,获取版本会重试3次每次间隔两秒
|
||||
}
|
||||
|
||||
}
|
||||
@@ -290,9 +355,13 @@ public class AutopilotAbilityManager implements AutopilotAbility230.OnAutopilotA
|
||||
stop230();
|
||||
stop250();
|
||||
stop330();
|
||||
stop350And360();
|
||||
stop360();
|
||||
handler = null;
|
||||
mapVersion = -1;
|
||||
isFutianSweeper = false;
|
||||
isHQ = false;
|
||||
isJinlvM1 = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ public class MyMessageFactory implements IMyMessageFactory {
|
||||
private IMsg warnMessage;//预警数据
|
||||
private IMsg arrivalNotificationMessage;//到站提醒
|
||||
private IMsg statusQueryRespMessage;//状态查询应答
|
||||
private IMsg systemStatusMessage;//定频SSM
|
||||
private IMsg recordDataConfigRespMessage;//数据采集配置应答
|
||||
private IMsg planningDecisionStateMessage;//planning决策状态
|
||||
private IMsg obuWarningDataMessage;//工控机透传OBU V2I数据
|
||||
@@ -161,6 +162,12 @@ public class MyMessageFactory implements IMyMessageFactory {
|
||||
statusQueryRespMessage = new StatusQueryRespMessage();
|
||||
}
|
||||
return statusQueryRespMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_SSM.typeCode) {
|
||||
//定频SSM
|
||||
if (systemStatusMessage == null) {
|
||||
systemStatusMessage = new SystemStatusMessage();
|
||||
}
|
||||
return systemStatusMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_RECORD_DATA_CONFIG_RESP.typeCode) {
|
||||
//数据采集配置应答
|
||||
if (recordDataConfigRespMessage == null) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import system_master.SystemStatusInfo;
|
||||
/**
|
||||
* 状态查询应答
|
||||
*/
|
||||
@Deprecated//HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用
|
||||
public class StatusQueryRespMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import android.os.SystemClock;
|
||||
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.AdasChannel;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
|
||||
import com.zhidao.support.adas.high.protocol.RawData;
|
||||
|
||||
import system_master.SsmInfo;
|
||||
|
||||
/**
|
||||
* 定频SSM 接口
|
||||
*/
|
||||
public class SystemStatusMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
SsmInfo.SsmStatusInf statusInfo = SsmInfo.SsmStatusInf.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue());
|
||||
AdasChannel.calculateTimeConsumingOnDispatchRaw("定频SSM", raw.receiveTime);
|
||||
AutopilotAbilityManager.getInstance().setStatusInfo(statusInfo);
|
||||
long nowTime = 0;
|
||||
if (CupidLogUtils.isEnableLog())
|
||||
nowTime = SystemClock.elapsedRealtime();
|
||||
if (adasListener != null) {
|
||||
adasListener.onSystemStatus(raw.getHeader(), statusInfo);
|
||||
}
|
||||
AdasChannel.calculateTimeConsumingBusiness("定频SSM", nowTime);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user