[680][adas]启动自动驾驶失败来源切换到FSM2024,移除无用接口
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package com.zhjt.mogo.adas.data.bean;
|
||||
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import fsm.Fsm2024;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
@@ -36,25 +39,34 @@ public class AutopilotStatistics {
|
||||
public final int status;
|
||||
|
||||
/**
|
||||
* 用时
|
||||
* 用时 取消自动驾驶时不赋值
|
||||
* 单位:ms
|
||||
*/
|
||||
public final long usedTime;
|
||||
|
||||
/**
|
||||
* 下发的启动自动驾驶命令
|
||||
* 下发的启动自动驾驶命令 取消自动驾驶时不赋值
|
||||
*/
|
||||
@Nullable
|
||||
public final MessagePad.SetAutopilotModeReq req;
|
||||
|
||||
/**
|
||||
* 失败的消息
|
||||
* 回调启动自驾成功/失败的时候赋值
|
||||
*/
|
||||
@Nullable
|
||||
public final Fsm2024.FSMStateMsg fsmState;
|
||||
|
||||
/**
|
||||
* 失败的消息 存在FSM2024时 失败此字段不赋值
|
||||
*/
|
||||
@Nullable
|
||||
public final MogoReportMsg.MogoReportMessage failedMessage;
|
||||
|
||||
public AutopilotStatistics(int status, long usedTime, MessagePad.SetAutopilotModeReq req, MogoReportMsg.MogoReportMessage failedMessage) {
|
||||
public AutopilotStatistics(int status, long usedTime, @Nullable MessagePad.SetAutopilotModeReq req, @Nullable Fsm2024.FSMStateMsg fsmState, @Nullable MogoReportMsg.MogoReportMessage failedMessage) {
|
||||
this.status = status;
|
||||
this.usedTime = usedTime;
|
||||
this.req = req;
|
||||
this.fsmState = fsmState;
|
||||
this.failedMessage = failedMessage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1833,6 +1833,17 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
return AutopilotAbilityManager.getInstance().getNodeStateInfo(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取FSM2024版本
|
||||
* 正常版本好例如FSM2024发送的为2.0解析后为20;12.1解析后为121
|
||||
* 与FSM开发同学确认 点后的子版本不会出现十位数以上
|
||||
*
|
||||
* @return -1:未初始化 0:SSM判断存在FSM2024节点但并不知具体版本或根据FMS中Version解析失败 其他数值:根据FSM数据中的version 判断得出
|
||||
*/
|
||||
public int getFsm2024Version() {
|
||||
return AutopilotAbilityManager.getInstance().getFsm2024Version();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取域控PING 地址列表
|
||||
*
|
||||
|
||||
@@ -644,16 +644,6 @@ public interface OnAdasListener {
|
||||
*/
|
||||
void onReceiveReceivedAck(@NonNull ReceivedAck receivedAck);
|
||||
|
||||
/**
|
||||
* 启动自动驾驶失败回调
|
||||
* 根据MAP 系统监控状态返回过滤
|
||||
* message.getMsg() 获取详细错误说明
|
||||
* message.getCode() 可用于判断属于什么类型
|
||||
*
|
||||
* @param message 数据
|
||||
*/
|
||||
void onStartAutopilotFailed(MogoReportMsg.MogoReportMessage message);
|
||||
|
||||
/**
|
||||
* 启动自动驾驶状态统计
|
||||
* 触发机制:下发启动自动驾驶命令,根据MAP返回状态判断成功或失败
|
||||
|
||||
@@ -4,8 +4,10 @@ import android.os.SystemClock;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
|
||||
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
|
||||
|
||||
import fsm.Fsm2024;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
@@ -16,13 +18,18 @@ public class AutopilotReview {
|
||||
/**
|
||||
* 下发的启动自动驾驶命令
|
||||
*/
|
||||
public MessagePad.SetAutopilotModeReq startReq;
|
||||
private MessagePad.SetAutopilotModeReq startReq;
|
||||
private long startTime;//自动驾驶命令下发启动时间
|
||||
|
||||
/**
|
||||
* 失败的消息
|
||||
*/
|
||||
public MogoReportMsg.MogoReportMessage failedMessage;
|
||||
private MogoReportMsg.MogoReportMessage failedMessage;
|
||||
|
||||
/**
|
||||
* 回调启动自驾成功/失败的时候赋值
|
||||
*/
|
||||
private Fsm2024.FSMStateMsg fsmState;
|
||||
|
||||
private final OnAutopilotReviewListener listener;
|
||||
|
||||
@@ -37,11 +44,12 @@ public class AutopilotReview {
|
||||
private void onCallback(@Define.AutopilotStartStatus int status) {
|
||||
long usedTime = SystemClock.elapsedRealtime() - startTime;
|
||||
if (listener != null) {
|
||||
listener.onReview(new AutopilotStatistics(status, usedTime, startReq, failedMessage));
|
||||
listener.onReview(new AutopilotStatistics(status, usedTime, startReq, fsmState, failedMessage));
|
||||
}
|
||||
startTime = 0;
|
||||
startReq = null;
|
||||
failedMessage = null;
|
||||
fsmState = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +64,10 @@ public class AutopilotReview {
|
||||
startReq = req;
|
||||
startTime = SystemClock.elapsedRealtime();
|
||||
} else {
|
||||
startTime = 0;
|
||||
startReq = null;
|
||||
failedMessage = null;
|
||||
fsmState = null;
|
||||
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.CANCEL);
|
||||
}
|
||||
}
|
||||
@@ -66,12 +78,32 @@ public class AutopilotReview {
|
||||
* @param message
|
||||
*/
|
||||
public void onReportResult(MogoReportMsg.MogoReportMessage message) {
|
||||
//FSM2024版本大于等于2.0时使用FSM的数据进行判断是否失败
|
||||
if (AutopilotAbilityManager.getInstance().getFsm2024Version() >= 20) {
|
||||
return;
|
||||
}
|
||||
if (startReq != null && message != null) {
|
||||
failedMessage = message;
|
||||
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setFSM2024State(Fsm2024.FSMStateMsg fsmState) {
|
||||
this.fsmState = fsmState;
|
||||
if (startReq != null && fsmState != null) {
|
||||
if (fsmState.hasSession()) {
|
||||
Fsm2024.Session session = fsmState.getSession();
|
||||
if (session.hasSessionActiveMode() && session.hasSessionResult()) {
|
||||
if (session.getSessionActiveMode() == Fsm2024.ActiveMode.PILOT_ACTIVE &&
|
||||
session.getSessionResult() == Fsm2024.SessionResult.REQUEST_FAILED) {
|
||||
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态 目前只用于自动驾驶成功结果
|
||||
*
|
||||
|
||||
@@ -75,7 +75,7 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener {
|
||||
private final AtomicBoolean isInitCarConfig = new AtomicBoolean(false);//车辆信息是否初始化
|
||||
private final AtomicInteger isSupportFSM2024 = new AtomicInteger(-1);//-1:未初始化 0:不支持 1:通过SSM V2判断支持 2:通过FSM数据源判断支持
|
||||
private final Map<AdasConstants.NodeName, NodeStateInfo> nodeStateInfos = new ConcurrentHashMap<>();
|
||||
|
||||
private int fsm2024Version = -1;//FSM2024版本 -1:未初始化 0:SSM判断存在FSM2024但是并不知道具体版本或根据FMS中Version解析失败 其他数值:根据FSM数据中的version 判断得出
|
||||
|
||||
private AutopilotAbilityManager() {
|
||||
}
|
||||
@@ -115,6 +115,11 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getFsm2024Version() {
|
||||
return fsm2024Version;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加不能启动自驾的原因
|
||||
*
|
||||
@@ -206,6 +211,17 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener {
|
||||
}
|
||||
|
||||
public void setFSM2024State(Fsm2024.FSMStateMsg fsmState) {
|
||||
if (fsm2024Version <= 0) {
|
||||
if (fsmState.hasVersion()) {
|
||||
String tem = fsmState.getVersion();
|
||||
try {
|
||||
fsm2024Version = Integer.parseInt(tem.replace(".", ""));
|
||||
} catch (Exception e) {
|
||||
fsm2024Version = 0;
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
updateFSMNormalStateFromFSM();
|
||||
onCallFSMTimeout(false);
|
||||
if (autopilotAbilityFsm != null) {
|
||||
@@ -274,6 +290,9 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isSupport && fsm2024Version == -1) {
|
||||
fsm2024Version = 0;
|
||||
}
|
||||
updateFSMStateFromSSM(isSupport ? 1 : 0);
|
||||
}
|
||||
}
|
||||
@@ -370,6 +389,7 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener {
|
||||
if (!isInitCarConfig.get() && AdasManager.getInstance().getIpcConnectionStatus() == AdasConstants.IpcConnectionStatus.CONNECTED) {
|
||||
mapVersion = 20300;
|
||||
isSupportFSM2024.set(-1);
|
||||
fsm2024Version = -1;
|
||||
initAutopilotAbility();
|
||||
isInitAutopilotAbility.set(false);
|
||||
}
|
||||
@@ -560,6 +580,7 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener {
|
||||
initStopData();
|
||||
isInitAutopilotAbility.set(false);
|
||||
isSupportFSM2024.set(-1);
|
||||
fsm2024Version = -1;
|
||||
isInitCarConfig.set(false);
|
||||
mapVersion = -1;
|
||||
isFutianSweeper = false;
|
||||
|
||||
@@ -33,6 +33,11 @@ public class FSM2024StateMessage extends MyAbstractMessageHandler {
|
||||
long nowTime = 0;
|
||||
if (CupidLogUtils.isEnableLog())
|
||||
nowTime = SystemClock.elapsedRealtime();
|
||||
ParallelDrivingManager.getInstance().setAutopilotState(autopilotState);
|
||||
if (autopilotReview != null) {
|
||||
autopilotReview.setFSM2024State(fsmState);
|
||||
autopilotReview.onAutopilotResult(autopilotState);
|
||||
}
|
||||
if (adasListener != null) {
|
||||
if (fsmState.getRepeatedPilotNotStandbyReasonCount() == 0) {
|
||||
Fsm2024.FSMStateMsg.Builder builder = fsmState.toBuilder();
|
||||
@@ -42,11 +47,6 @@ public class FSM2024StateMessage extends MyAbstractMessageHandler {
|
||||
adasListener.onFSM2024State(raw.getHeader(), fsmState, autopilotState, mode);
|
||||
}
|
||||
}
|
||||
ParallelDrivingManager.getInstance().setAutopilotState(autopilotState);
|
||||
if (autopilotReview != null) {
|
||||
autopilotReview.onAutopilotResult(autopilotState);
|
||||
}
|
||||
|
||||
AdasChannel.calculateTimeConsumingBusiness("FSM状态", nowTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,9 +82,6 @@ public class ReportMessage extends MyAbstractMessageHandler {
|
||||
//分发自动驾驶启动失败相关回调
|
||||
String code = mogoReportMessage.getCode();
|
||||
if (startAutopilotFailCode.contains(code)) {
|
||||
if (adasListener != null) {
|
||||
adasListener.onStartAutopilotFailed(mogoReportMessage);//启动自动驾驶失败回调
|
||||
}
|
||||
if (autopilotReview != null) {
|
||||
autopilotReview.onReportResult(mogoReportMessage);//统计启动自动驾驶失败原因
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user