[680][adas]启动自驾成功切换数据来源,当FSM2024 2.0及版本以上使用fsm中的Session结果进行判断,当存在fsm2.0以下时使用fsm自动驾驶状态判断,否则使用底盘数据
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.zhjt.mogo.adas.data.bean;
|
package com.zhjt.mogo.adas.data.bean;
|
||||||
|
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import fsm.Fsm2024;
|
import fsm.Fsm2024;
|
||||||
@@ -18,7 +19,7 @@ public class AutopilotStatistics {
|
|||||||
/**
|
/**
|
||||||
* 成功
|
* 成功
|
||||||
*/
|
*/
|
||||||
int SUCCESSFUL = 0;
|
int SUCCEED = 0;
|
||||||
/**
|
/**
|
||||||
* 失败
|
* 失败
|
||||||
*/
|
*/
|
||||||
@@ -29,6 +30,14 @@ public class AutopilotStatistics {
|
|||||||
int CANCEL = 2;
|
int CANCEL = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum Source {
|
||||||
|
LIB,//ADAS库 [用在下取消]
|
||||||
|
REPORT,//系统监控 [用在失败]
|
||||||
|
FSM, //老版FSM [用在成功]
|
||||||
|
FSM2024, //新版FSM [用在成功和失败]
|
||||||
|
CHASSIS//底盘 [用在成功]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动自动驾驶后状态
|
* 启动自动驾驶后状态
|
||||||
* 0 成功
|
* 0 成功
|
||||||
@@ -62,9 +71,16 @@ public class AutopilotStatistics {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public final MogoReportMsg.MogoReportMessage failedMessage;
|
public final MogoReportMsg.MogoReportMessage failedMessage;
|
||||||
|
|
||||||
public AutopilotStatistics(int status, long usedTime, @Nullable MessagePad.SetAutopilotModeReq req, @Nullable Fsm2024.FSMStateMsg fsmState, @Nullable MogoReportMsg.MogoReportMessage failedMessage) {
|
/**
|
||||||
|
* 数据来源
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public final Source source;
|
||||||
|
|
||||||
|
public AutopilotStatistics(int status, long usedTime, @NonNull Source source, @Nullable MessagePad.SetAutopilotModeReq req, @Nullable Fsm2024.FSMStateMsg fsmState, @Nullable MogoReportMsg.MogoReportMessage failedMessage) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.usedTime = usedTime;
|
this.usedTime = usedTime;
|
||||||
|
this.source = source;
|
||||||
this.req = req;
|
this.req = req;
|
||||||
this.fsmState = fsmState;
|
this.fsmState = fsmState;
|
||||||
this.failedMessage = failedMessage;
|
this.failedMessage = failedMessage;
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ public class AutopilotReview {
|
|||||||
void onReview(AutopilotStatistics statistics);
|
void onReview(AutopilotStatistics statistics);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCallback(@Define.AutopilotStartStatus int status) {
|
private void onCallback(@Define.AutopilotStartStatus int status, @NonNull AutopilotStatistics.Source source) {
|
||||||
long usedTime = SystemClock.elapsedRealtime() - startTime;
|
long usedTime = SystemClock.elapsedRealtime() - startTime;
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onReview(new AutopilotStatistics(status, usedTime, startReq, fsmState, failedMessage));
|
listener.onReview(new AutopilotStatistics(status, usedTime, source, startReq, fsmState, failedMessage));
|
||||||
}
|
}
|
||||||
startTime = 0;
|
startTime = 0;
|
||||||
startReq = null;
|
startReq = null;
|
||||||
@@ -68,7 +68,7 @@ public class AutopilotReview {
|
|||||||
startReq = null;
|
startReq = null;
|
||||||
failedMessage = null;
|
failedMessage = null;
|
||||||
fsmState = null;
|
fsmState = null;
|
||||||
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.CANCEL);
|
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.CANCEL, AutopilotStatistics.Source.LIB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,26 +82,38 @@ public class AutopilotReview {
|
|||||||
if (AutopilotAbilityManager.getInstance().getFsm2024Version() >= 20) {
|
if (AutopilotAbilityManager.getInstance().getFsm2024Version() >= 20) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (startReq != null && message != null) {
|
failedMessage = message;
|
||||||
failedMessage = message;
|
if (message != null) {
|
||||||
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED);
|
if (startReq == null) {
|
||||||
|
this.failedMessage = null;
|
||||||
|
} else {
|
||||||
|
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED, AutopilotStatistics.Source.REPORT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setFSM2024State(Fsm2024.FSMStateMsg fsmState) {
|
public void setFSM2024State(Fsm2024.FSMStateMsg fsmState, int autopilotState) {
|
||||||
this.fsmState = fsmState;
|
this.fsmState = fsmState;
|
||||||
if (startReq != null && fsmState != null) {
|
if (fsmState != null) {
|
||||||
if (fsmState.hasSession()) {
|
if (startReq == null) {
|
||||||
Fsm2024.Session session = fsmState.getSession();
|
this.fsmState = null;
|
||||||
if (session.hasSessionActiveMode() && session.hasSessionResult()) {
|
} else {
|
||||||
if (session.getSessionActiveMode() == Fsm2024.ActiveMode.PILOT_ACTIVE &&
|
if (fsmState.hasSession()) {
|
||||||
session.getSessionResult() == Fsm2024.SessionResult.REQUEST_FAILED) {
|
Fsm2024.Session session = fsmState.getSession();
|
||||||
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED);
|
if (session.hasSessionActiveMode() && session.hasSessionResult()) {
|
||||||
|
if (session.getSessionActiveMode() == Fsm2024.ActiveMode.PILOT_ACTIVE) {
|
||||||
|
if (session.getSessionResult() == Fsm2024.SessionResult.REQUEST_SUCCEED) {
|
||||||
|
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.SUCCEED, AutopilotStatistics.Source.FSM2024);
|
||||||
|
} else if (session.getSessionResult() == Fsm2024.SessionResult.REQUEST_FAILED) {
|
||||||
|
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED, AutopilotStatistics.Source.FSM2024);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onAutopilotResult(autopilotState, AutopilotStatistics.Source.FSM2024);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -109,9 +121,13 @@ public class AutopilotReview {
|
|||||||
*
|
*
|
||||||
* @param autopilotState
|
* @param autopilotState
|
||||||
*/
|
*/
|
||||||
public void onAutopilotResult(int autopilotState) {
|
public void onAutopilotResult(int autopilotState, @NonNull AutopilotStatistics.Source source) {
|
||||||
|
//FSM2024版本大于等于2.0时使用FSM的数据进行判断是否失败
|
||||||
|
if (AutopilotAbilityManager.getInstance().getFsm2024Version() >= 20) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (startReq != null && autopilotState == 2) {
|
if (startReq != null && autopilotState == 2) {
|
||||||
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.SUCCESSFUL);
|
onCallback(AutopilotStatistics.AUTOPILOT_START_STATUS.SUCCEED, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public final class Define {
|
|||||||
public @interface SubscribeType {
|
public @interface SubscribeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
@IntDef(flag = true, value = {AutopilotStatistics.AUTOPILOT_START_STATUS.SUCCESSFUL,
|
@IntDef(flag = true, value = {AutopilotStatistics.AUTOPILOT_START_STATUS.SUCCEED,
|
||||||
AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED,
|
AutopilotStatistics.AUTOPILOT_START_STATUS.FAILED,
|
||||||
AutopilotStatistics.AUTOPILOT_START_STATUS.CANCEL})
|
AutopilotStatistics.AUTOPILOT_START_STATUS.CANCEL})
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.zhidao.support.adas.high.common.CupidLogUtils;
|
|||||||
import com.zhidao.support.adas.high.common.ParallelDrivingManager;
|
import com.zhidao.support.adas.high.common.ParallelDrivingManager;
|
||||||
import com.zhidao.support.adas.high.protocol.RawData;
|
import com.zhidao.support.adas.high.protocol.RawData;
|
||||||
import com.zhjt.mogo.adas.data.AdasConstants;
|
import com.zhjt.mogo.adas.data.AdasConstants;
|
||||||
|
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
|
||||||
|
|
||||||
import mogo.telematics.pad.MessagePad;
|
import mogo.telematics.pad.MessagePad;
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ public class AutopilotStateMessage extends MyAbstractMessageHandler {
|
|||||||
if (AdasManager.getInstance().getNodeStateInfo(AdasConstants.NodeName.FSM2024).getExistState() != AdasConstants.NodeExistState.NODE_EXIST_NORMAL) {
|
if (AdasManager.getInstance().getNodeStateInfo(AdasConstants.NodeName.FSM2024).getExistState() != AdasConstants.NodeExistState.NODE_EXIST_NORMAL) {
|
||||||
ParallelDrivingManager.getInstance().setAutopilotState(autopilotState.getState());
|
ParallelDrivingManager.getInstance().setAutopilotState(autopilotState.getState());
|
||||||
if (autopilotReview != null) {
|
if (autopilotReview != null) {
|
||||||
autopilotReview.onAutopilotResult(autopilotState.getState());
|
autopilotReview.onAutopilotResult(autopilotState.getState(), AutopilotStatistics.Source.CHASSIS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AdasChannel.calculateTimeConsumingBusiness("自动驾驶状态", nowTime);
|
AdasChannel.calculateTimeConsumingBusiness("自动驾驶状态", nowTime);
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ public class FSM2024StateMessage extends MyAbstractMessageHandler {
|
|||||||
nowTime = SystemClock.elapsedRealtime();
|
nowTime = SystemClock.elapsedRealtime();
|
||||||
ParallelDrivingManager.getInstance().setAutopilotState(autopilotState);
|
ParallelDrivingManager.getInstance().setAutopilotState(autopilotState);
|
||||||
if (autopilotReview != null) {
|
if (autopilotReview != null) {
|
||||||
autopilotReview.setFSM2024State(fsmState);
|
autopilotReview.setFSM2024State(fsmState, autopilotState);
|
||||||
autopilotReview.onAutopilotResult(autopilotState);
|
|
||||||
}
|
}
|
||||||
if (adasListener != null) {
|
if (adasListener != null) {
|
||||||
if (fsmState.getRepeatedPilotNotStandbyReasonCount() == 0) {
|
if (fsmState.getRepeatedPilotNotStandbyReasonCount() == 0) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.zhidao.support.adas.high.common.CupidLogUtils;
|
|||||||
import com.zhidao.support.adas.high.common.ParallelDrivingManager;
|
import com.zhidao.support.adas.high.common.ParallelDrivingManager;
|
||||||
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
|
import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager;
|
||||||
import com.zhidao.support.adas.high.protocol.RawData;
|
import com.zhidao.support.adas.high.protocol.RawData;
|
||||||
|
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -107,7 +108,7 @@ public class FunctionStatesMessage extends MyAbstractMessageHandler {
|
|||||||
adasListener.onAutopilotState(header.toBuilder().setMsgType(MessagePad.MessageType.MsgTypeAutopilotState).build(), autopilotState);
|
adasListener.onAutopilotState(header.toBuilder().setMsgType(MessagePad.MessageType.MsgTypeAutopilotState).build(), autopilotState);
|
||||||
ParallelDrivingManager.getInstance().setAutopilotState(autopilotState.getState());
|
ParallelDrivingManager.getInstance().setAutopilotState(autopilotState.getState());
|
||||||
if (autopilotReview != null) {
|
if (autopilotReview != null) {
|
||||||
autopilotReview.onAutopilotResult(autopilotState.getState());
|
autopilotReview.onAutopilotResult(autopilotState.getState(), AutopilotStatistics.Source.FSM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user