Merge branch 'dev_robotaxi-d_230809_6.0.0' into 6.0.0merge2master
# Conflicts: # OCH/sweeper/sweeper-cloud/src/main/java/com/mogo/och/sweepercloud/model/SweeperTaskModel.java # libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java # libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java
This commit is contained in:
@@ -3,4 +3,5 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
</manifest>
|
||||
|
||||
@@ -11,6 +11,7 @@ import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_SOURCE_ADAS;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_TYPE_INIT_STATUS;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_TYPE_SOCKET_AUTOPILOT;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
@@ -139,6 +140,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
*/
|
||||
private SubscribeInterface subscribeInterface;
|
||||
private Timer carConfigReqTimer;//车辆基础信息请求 多次请求防止无法收到基础信息情况出现
|
||||
private Context context;
|
||||
|
||||
public void setOnMultiDeviceListener(OnMultiDeviceListener onMultiDeviceListener) {
|
||||
this.onMultiDeviceListener = onMultiDeviceListener;
|
||||
@@ -170,7 +172,8 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
* @param options
|
||||
* @param onAdasConnectStatusListener
|
||||
*/
|
||||
AdasChannel(AdasOptions options, OnAdasConnectStatusListener onAdasConnectStatusListener) {
|
||||
AdasChannel(Context context, AdasOptions options, OnAdasConnectStatusListener onAdasConnectStatusListener) {
|
||||
this.context = context;
|
||||
this.adasConnectStatusListener = onAdasConnectStatusListener;
|
||||
//配置为null默认是乘客屏幕
|
||||
if (options == null) {
|
||||
@@ -280,7 +283,8 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
nodeAliasCode = CHAIN_CODE_ADAS_INIT,
|
||||
paramIndexes = {-1})
|
||||
private void initSocket() {
|
||||
mSocket = new FpgaSocket();
|
||||
mSocket = new FpgaSocket(context);
|
||||
context = null;
|
||||
mSocket.setWebSocketListener(this);
|
||||
if (isUseQueue) {
|
||||
WebSocketQueueManager.getInstance().registerWebSocketListener(this);
|
||||
@@ -813,22 +817,41 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
/**
|
||||
* 自动驾驶设备基础信息应答
|
||||
*
|
||||
* @param sn SN
|
||||
* @param environment 环境 详情参见{@link Constants.ENVIRONMENT}1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境
|
||||
* @param role 终端角色 详情参见{@link Constants.TERMINAL_ROLE}
|
||||
* @param sn SN
|
||||
* @param environment 环境 详情参见{@link Constants.ENVIRONMENT}1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境
|
||||
* @param role 终端角色 详情参见{@link Constants.TERMINAL_ROLE}
|
||||
* @param versionCode 鹰眼版本号
|
||||
* @param versionName 鹰眼版本名
|
||||
* @param certification 鹰眼ssl证书
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role) {
|
||||
public boolean sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role, int versionCode, String versionName, byte[] certification) {
|
||||
if (sn == null) {
|
||||
sn = "";
|
||||
}
|
||||
MessagePad.BasicInfoResp resp = MessagePad.BasicInfoResp
|
||||
.newBuilder()
|
||||
MessagePad.BasicInfoResp.Builder builder = MessagePad.BasicInfoResp.newBuilder()
|
||||
.setSn(sn)
|
||||
.setEnvironment(environment)
|
||||
.setRole(role)
|
||||
.build();
|
||||
.setRole(role);
|
||||
String version = null;
|
||||
if (versionCode > 0) {
|
||||
version = String.valueOf(versionCode);
|
||||
}
|
||||
if (!TextUtils.isEmpty(versionName)) {
|
||||
if (version != null) {
|
||||
version += "," + versionName;
|
||||
} else {
|
||||
version = versionName;
|
||||
}
|
||||
}
|
||||
if (!TextUtils.isEmpty(version)) {
|
||||
builder.setVersion(version);
|
||||
}
|
||||
if (certification != null && certification.length > 0) {
|
||||
builder.setCertification(com.google.protobuf.ByteString.copyFrom(certification));
|
||||
}
|
||||
MessagePad.BasicInfoResp resp = builder.build();
|
||||
return sendPBMessage(MessageType.TYPE_SEND_BASIC_INFO_RESP.typeCode, resp.toByteArray());
|
||||
}
|
||||
|
||||
@@ -1091,7 +1114,8 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
/**
|
||||
* 发送 轨迹下载请求
|
||||
*
|
||||
* @param line 线路相关参数详情见PB message_pad.proto -> Line
|
||||
* @param line 线路相关参数详情见PB message_pad.proto -> Line
|
||||
* @param downloadType 下载类型: 0:正常下载 1:预下载
|
||||
* @return boolean
|
||||
*/
|
||||
@ChainLog(
|
||||
@@ -1101,10 +1125,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
paramIndexes = {0}
|
||||
)
|
||||
@Override
|
||||
public boolean sendTrajectoryDownloadReq(MessagePad.Line line) {
|
||||
public boolean sendTrajectoryDownloadReq(MessagePad.Line line, int downloadType) {
|
||||
MessagePad.TrajectoryDownloadReq.Builder builder = MessagePad.TrajectoryDownloadReq.newBuilder();
|
||||
builder.setSource(1);//指令来源: 0: default, 1:pad, 2:aicloud
|
||||
builder.setLine(line);
|
||||
if (downloadType > -1) {
|
||||
builder.setDownloadType(downloadType);
|
||||
}
|
||||
MessagePad.TrajectoryDownloadReq req = builder.build();
|
||||
return sendPBMessage(MessageType.TYPE_SEND_TRAJECTORY_DOWNLOAD_REQ.typeCode, req.toByteArray());
|
||||
}
|
||||
@@ -1114,8 +1141,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();
|
||||
@@ -1513,14 +1548,11 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
/**
|
||||
* 设置参数命令
|
||||
*
|
||||
* @param type 0:default 1:绕障类功能开关(bool) 2:变道绕障的目标障碍物速度阈值(double, m/s)
|
||||
* 3:AEB开关(bool) 4:限制绕障开关(bool)
|
||||
* 5:停车让行线前避让等待开关(bool) 6:地图限速功能开关(bool)
|
||||
* @param type 类型{@link AdasConstants.MapSystemParamType}
|
||||
* @param value 转成字符串的值
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendSetParamReq(int type, String value) {
|
||||
private boolean sendSetParamReq(int type, String value) {
|
||||
MessagePad.SetOneParam oneParam = MessagePad.SetOneParam
|
||||
.newBuilder().setType(type).setValue(value).build();
|
||||
MessagePad.SetParamReq req = MessagePad.SetParamReq
|
||||
@@ -1530,6 +1562,71 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
return sendPBMessage(MessageType.TYPE_SEND_SET_PARAM_REQ.typeCode, req.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置参数命令V2
|
||||
*/
|
||||
|
||||
private <T> boolean sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType paramSetType, T value) {
|
||||
ParamSetCmdOuterClass.ParamSetCmd.Builder builder = ParamSetCmdOuterClass.ParamSetCmd.newBuilder()
|
||||
.setSrc(1)
|
||||
.setType(paramSetType);
|
||||
if (paramSetType == ParamSetCmdOuterClass.ParamSetType.ParamSetTypeBlindArea
|
||||
|| paramSetType == ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2N
|
||||
|| paramSetType == ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2I) {
|
||||
builder.setBoolValue((Boolean) value);
|
||||
}
|
||||
ParamSetCmdOuterClass.ParamSetCmd req = builder.build();
|
||||
return sendPBMessage(MessageType.TYPE_SEND_SET_PARAM_REQ_V2.typeCode, req.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置参数命令
|
||||
*
|
||||
* @param param {@link AdasConstants.MapSystemParamType#DETOURING Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#DETOURING_SPEED Value类型:double或double类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#AEB Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#LANE_CHANGE_RESTRAIN_VALID Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#STOP_YIELD_VALID Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#HADMAP_SPEED_LIMIT_VALID Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#RAMP_THETA_VALID Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#WEAK_NET_SLOW_DOWN Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#BREAKDOWN_SLOW_DOWN Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#BLIND_AREA Value类型:boolean或boolean类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#V2N_TO_PNC Value类型:boolean或boolean类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#V2I_TO_PNC Value类型:boolean或boolean类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#FUSION_MODE Value类型:int或int类型String}
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendSetParamReq(@NonNull Map<AdasConstants.MapSystemParamType, Object> param) {
|
||||
boolean isV1 = true;
|
||||
boolean isV2BlindArea = true;
|
||||
boolean isV2V2N = true;
|
||||
boolean isV2V2NI = true;
|
||||
MessagePad.SetParamReq.Builder builder = MessagePad.SetParamReq.newBuilder();
|
||||
for (Map.Entry<AdasConstants.MapSystemParamType, Object> entry : param.entrySet()) {
|
||||
AdasConstants.MapSystemParamType key = entry.getKey();
|
||||
if (key != AdasConstants.MapSystemParamType.DEFAULT_TYPE && key != AdasConstants.MapSystemParamType.M1_STITCHED_VIDEO_SELF_VEHICLE_PARAM) {
|
||||
Object value = entry.getValue();
|
||||
if (key == AdasConstants.MapSystemParamType.BLIND_AREA) {
|
||||
isV2BlindArea = sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeBlindArea, (Boolean) value);
|
||||
} else if (key == AdasConstants.MapSystemParamType.V2N_TO_PNC) {
|
||||
isV2V2N = sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2N, (Boolean) value);
|
||||
} else if (key == AdasConstants.MapSystemParamType.V2I_TO_PNC) {
|
||||
isV2V2NI = sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2I, (Boolean) value);
|
||||
} else {
|
||||
builder.addReqs(MessagePad.SetOneParam.newBuilder().setType(key.getNumber()).setValue(String.valueOf(value)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (builder.getReqsCount() > 0) {
|
||||
MessagePad.SetParamReq req = builder.build();
|
||||
isV1 = sendPBMessage(MessageType.TYPE_SEND_SET_PARAM_REQ.typeCode, req.toByteArray());
|
||||
}
|
||||
return isV1 && isV2BlindArea && isV2V2N && isV2V2NI;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绕障类功能开关
|
||||
*
|
||||
@@ -1624,6 +1721,62 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
return sendSetParamReq(AdasConstants.MapSystemParamType.WEAK_NET_SLOW_DOWN_VALUE, String.valueOf(enable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 故障减速停车策路开关
|
||||
*
|
||||
* @param enable 0:关闭故障减速停车策略 1:使用故障减速停车策略
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendBreakdownSlowDown(int enable) {
|
||||
return sendSetParamReq(AdasConstants.MapSystemParamType.BREAKDOWN_SLOW_DOWN_VALUE, String.valueOf(enable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 融合模式
|
||||
*
|
||||
* @param cmd 1:全融合模式 2:盲区模式 3:超视距模式 4:透传模式 5:纯路侧模式,默认1
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendFusionMode(int cmd) {
|
||||
return sendSetParamReq(AdasConstants.MapSystemParamType.FUSION_MODE_VALUE, String.valueOf(cmd));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 盲区数据开关
|
||||
*
|
||||
* @param switchCmd 数据开关
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendBlindAreaCmd(boolean switchCmd) {
|
||||
return sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeBlindArea, switchCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制V2N进PnC
|
||||
*
|
||||
* @param switchCmd true:发给PnC,false:不发给PnC
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendV2nToPncCmd(boolean switchCmd) {
|
||||
return sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2N, switchCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制V2I进PnC
|
||||
*
|
||||
* @param switchCmd true:发给Pnc和鹰眼,false:不发给PnC和鹰眼
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendV2iToPncCmd(boolean switchCmd) {
|
||||
return sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2I, switchCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部参数
|
||||
* 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq, AdasParam)}
|
||||
@@ -1632,7 +1785,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
*/
|
||||
@Override
|
||||
public boolean sendGetAllParamReq() {
|
||||
return sendGetParamReq(null);
|
||||
return sendGetParamReq((AdasConstants.MapSystemParamType[]) null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1643,9 +1796,9 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendGetParamReq(AdasConstants.MapSystemParamType paramType) {
|
||||
public boolean sendGetParamReq(AdasConstants.MapSystemParamType... paramType) {
|
||||
MessagePad.SetParamReq req;
|
||||
if (paramType == null || paramType == AdasConstants.MapSystemParamType.DEFAULT_TYPE) {
|
||||
if (paramType == null || paramType[0] == null || (paramType.length == 1 && paramType[0] == AdasConstants.MapSystemParamType.DEFAULT_TYPE)) {
|
||||
req = MessagePad.SetParamReq
|
||||
.newBuilder()
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(AdasConstants.MapSystemParamType.DETOURING_VALUE))
|
||||
@@ -1657,12 +1810,20 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(AdasConstants.MapSystemParamType.RAMP_THETA_VALID_VALUE))
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(AdasConstants.MapSystemParamType.WEAK_NET_SLOW_DOWN_VALUE))
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(AdasConstants.MapSystemParamType.M1_STITCHED_VIDEO_SELF_VEHICLE_PARAM_VALUE))
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(AdasConstants.MapSystemParamType.BREAKDOWN_SLOW_DOWN_VALUE))
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(AdasConstants.MapSystemParamType.BLIND_AREA_VALUE))
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(AdasConstants.MapSystemParamType.V2N_TO_PNC_VALUE))
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(AdasConstants.MapSystemParamType.V2I_TO_PNC_VALUE))
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(AdasConstants.MapSystemParamType.FUSION_MODE_VALUE))
|
||||
.build();
|
||||
} else {
|
||||
req = MessagePad.SetParamReq
|
||||
.newBuilder()
|
||||
.addReqs(MessagePad.SetOneParam.newBuilder().setType(paramType.getNumber()))
|
||||
.build();
|
||||
MessagePad.SetParamReq.Builder builder = MessagePad.SetParamReq.newBuilder();
|
||||
for (AdasConstants.MapSystemParamType type : paramType) {
|
||||
if (type != AdasConstants.MapSystemParamType.DEFAULT_TYPE) {
|
||||
builder.addReqs(MessagePad.SetOneParam.newBuilder().setType(type.getNumber()));
|
||||
}
|
||||
}
|
||||
req = builder.build();
|
||||
}
|
||||
return sendPBMessage(MessageType.TYPE_SEND_GET_PARAM_REQ.typeCode, req.toByteArray());
|
||||
}
|
||||
@@ -1711,43 +1872,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
return sendPBMessage(MessageType.TYPE_SEND_BAG_MANAGER_CMD.typeCode, bagManager.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制V2N数据给车端PnC
|
||||
*
|
||||
* @param switchCmd true为发给PnC,false为不发给PnC
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendV2nToPncCmd(boolean switchCmd) {
|
||||
return sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2N, switchCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 盲区数据开关
|
||||
*
|
||||
* @param switchCmd 数据开关
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendBlindAreaCmd(boolean switchCmd) {
|
||||
return sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeBlindArea, switchCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置参数命令V2
|
||||
*/
|
||||
|
||||
private <T> boolean sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType paramSetType, T value) {
|
||||
ParamSetCmdOuterClass.ParamSetCmd.Builder builder = ParamSetCmdOuterClass.ParamSetCmd.newBuilder()
|
||||
.setSrc(1)
|
||||
.setType(paramSetType);
|
||||
if (paramSetType == ParamSetCmdOuterClass.ParamSetType.ParamSetTypeBlindArea || paramSetType == ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2N) {
|
||||
builder.setBoolValue((Boolean) value);
|
||||
}
|
||||
ParamSetCmdOuterClass.ParamSetCmd req = builder.build();
|
||||
return sendPBMessage(MessageType.TYPE_SEND_SET_PARAM_REQ_V2.typeCode, req.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* FSM状态原因查询
|
||||
* 当FSMFunctionStates的类型是XXX_DRIVING_OFF时查询OFF的原因
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -103,13 +104,13 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
* @param options 连接参数
|
||||
* @param onAdasConnectStatusListener 连接状态监听
|
||||
*/
|
||||
public synchronized void create(AdasOptions options, OnAdasConnectStatusListener onAdasConnectStatusListener) {
|
||||
public synchronized void create(Context context, AdasOptions options, OnAdasConnectStatusListener onAdasConnectStatusListener) {
|
||||
if (mChannel != null) {
|
||||
mChannel.disconnect();
|
||||
carConfig = null;
|
||||
mChannel = null;
|
||||
}
|
||||
mChannel = new AdasChannel(options, onAdasConnectStatusListener);
|
||||
mChannel = new AdasChannel(context, options, onAdasConnectStatusListener);
|
||||
|
||||
}
|
||||
|
||||
@@ -291,9 +292,51 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
* @param role 终端角色 详情参见{@link Constants.TERMINAL_ROLE}
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role) {
|
||||
return mChannel != null && mChannel.sendBasicInfoResp(sn, environment, role);
|
||||
return sendBasicInfoResp(sn, environment, role, -1, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶设备基础信息应答
|
||||
*
|
||||
* @param sn SN
|
||||
* @param environment 环境 详情参见{@link Constants.ENVIRONMENT}1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境
|
||||
* @param role 终端角色 详情参见{@link Constants.TERMINAL_ROLE}
|
||||
* @param versionCode 鹰眼版本号
|
||||
* @param versionName 鹰眼版本名
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean sendBasicInfoResp(@NonNull String sn, int environment, int role, int versionCode, String versionName) {
|
||||
return sendBasicInfoResp(sn, environment, role, versionCode, versionName, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶设备基础信息应答
|
||||
*
|
||||
* @param sn SN
|
||||
* @param environment 环境 详情参见{@link Constants.ENVIRONMENT}1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境
|
||||
* @param role 终端角色 详情参见{@link Constants.TERMINAL_ROLE}
|
||||
* @param certification 鹰眼ssl证书
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role, byte[] certification) {
|
||||
return sendBasicInfoResp(sn, environment, role, -1, null, certification);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶设备基础信息应答
|
||||
*
|
||||
* @param sn SN
|
||||
* @param environment 环境 详情参见{@link Constants.ENVIRONMENT}1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境
|
||||
* @param role 终端角色 详情参见{@link Constants.TERMINAL_ROLE}
|
||||
* @param versionCode 鹰眼版本号
|
||||
* @param versionName 鹰眼版本名
|
||||
* @param certification 鹰眼ssl证书
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role, int versionCode, String versionName, byte[] certification) {
|
||||
return mChannel != null && mChannel.sendBasicInfoResp(sn, environment, role, versionCode, versionName, certification);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -515,9 +558,20 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
* @param line 线路相关参数详情见PB message_pad.proto -> Line
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendTrajectoryDownloadReq(MessagePad.Line line) {
|
||||
return mChannel != null && mChannel.sendTrajectoryDownloadReq(line);
|
||||
return mChannel != null && mChannel.sendTrajectoryDownloadReq(line, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送 轨迹下载请求
|
||||
*
|
||||
* @param line 线路相关参数详情见PB message_pad.proto -> Line
|
||||
* @param downloadType 下载类型: 0:正常下载 1:预下载
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendTrajectoryDownloadReq(MessagePad.Line line, int downloadType) {
|
||||
return mChannel != null && mChannel.sendTrajectoryDownloadReq(line, downloadType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -525,6 +579,7 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
@Deprecated//HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用
|
||||
@Override
|
||||
public boolean sendStatusQueryReq() {
|
||||
return mChannel != null && mChannel.sendStatusQueryReq();
|
||||
@@ -810,18 +865,6 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
return mChannel != null && mChannel.sendOperatorCmdStopHonking();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置参数命令
|
||||
*
|
||||
* @param type 0:default 1:绕障类功能开关(bool) 2:变道绕障的目标障碍物速度阈值(double, m/s)
|
||||
* @param value 转成字符串的值
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendSetParamReq(int type, String value) {
|
||||
return mChannel != null && mChannel.sendSetParamReq(type, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绕障类功能开关
|
||||
*
|
||||
@@ -915,6 +958,84 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
return mChannel != null && mChannel.sendWeakNetSlowDown(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 故障减速停车策路开关
|
||||
*
|
||||
* @param enable 0:关闭故障减速停车策略 1:使用故障减速停车策略
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendBreakdownSlowDown(int enable) {
|
||||
return mChannel != null && mChannel.sendBreakdownSlowDown(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 融合模式
|
||||
*
|
||||
* @param cmd 1:全融合模式 2:盲区模式 3:超视距模式 4:透传模式 5:纯路侧模式,默认1
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendFusionMode(int cmd) {
|
||||
return mChannel != null && mChannel.sendFusionMode(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 盲区数据开关
|
||||
*
|
||||
* @param switchCmd 数据开关
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendBlindAreaCmd(boolean switchCmd) {
|
||||
return mChannel != null && mChannel.sendBlindAreaCmd(switchCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制V2N进PnC
|
||||
*
|
||||
* @param switchCmd true:发给PnC,false:不发给PnC
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendV2nToPncCmd(boolean switchCmd) {
|
||||
return mChannel != null && mChannel.sendV2nToPncCmd(switchCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制V2I进PnC
|
||||
*
|
||||
* @param switchCmd true:发给Pnc和鹰眼,false:不发给PnC和鹰眼
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendV2iToPncCmd(boolean switchCmd) {
|
||||
return mChannel != null && mChannel.sendV2iToPncCmd(switchCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置参数命令
|
||||
*
|
||||
* @param param {@link AdasConstants.MapSystemParamType#DETOURING Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#DETOURING_SPEED Value类型:double或double类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#AEB Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#LANE_CHANGE_RESTRAIN_VALID Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#STOP_YIELD_VALID Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#HADMAP_SPEED_LIMIT_VALID Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#RAMP_THETA_VALID Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#WEAK_NET_SLOW_DOWN Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#BREAKDOWN_SLOW_DOWN Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#BLIND_AREA Value类型:boolean或boolean类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#V2N_TO_PNC Value类型:boolean或boolean类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#V2I_TO_PNC Value类型:boolean或boolean类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#FUSION_MODE Value类型:int或int类型String}
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendSetParamReq(@NonNull Map<AdasConstants.MapSystemParamType, Object> param) {
|
||||
return mChannel != null && mChannel.sendSetParamReq(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部参数
|
||||
* 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq, AdasParam)}
|
||||
@@ -934,7 +1055,7 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendGetParamReq(AdasConstants.MapSystemParamType paramType) {
|
||||
public boolean sendGetParamReq(AdasConstants.MapSystemParamType... paramType) {
|
||||
return mChannel != null && mChannel.sendGetParamReq(paramType);
|
||||
}
|
||||
|
||||
@@ -967,28 +1088,6 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
return mChannel != null && mChannel.sendBagManagerCmd(bagManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制V2N数据给车端PnC
|
||||
*
|
||||
* @param switchCmd true为发给PnC,false为不发给PnC
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendV2nToPncCmd(boolean switchCmd) {
|
||||
return mChannel != null && mChannel.sendV2nToPncCmd(switchCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 盲区数据开关
|
||||
*
|
||||
* @param switchCmd 数据开关
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendBlindAreaCmd(boolean switchCmd) {
|
||||
return mChannel != null && mChannel.sendBlindAreaCmd(switchCmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* FSM状态原因查询
|
||||
* 当FSMFunctionStates的类型是XXX_DRIVING_OFF时查询OFF的原因
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import bag_manager.BagManagerOuterClass;
|
||||
@@ -77,12 +78,15 @@ public interface IAdasNetCommApi {
|
||||
/**
|
||||
* 自动驾驶设备基础信息应答
|
||||
*
|
||||
* @param sn SN
|
||||
* @param environment 环境 详情参见{@link Constants.ENVIRONMENT}1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境
|
||||
* @param role 终端角色 详情参见{@link Constants.TERMINAL_ROLE}
|
||||
* @return 加入WS发送消息队列是否成功
|
||||
* @param sn SN
|
||||
* @param environment 环境 详情参见{@link Constants.ENVIRONMENT}1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境
|
||||
* @param role 终端角色 详情参见{@link Constants.TERMINAL_ROLE}
|
||||
* @param versionCode 鹰眼版本号
|
||||
* @param versionName 鹰眼版本名
|
||||
* @param certification 鹰眼ssl证书
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role);
|
||||
boolean sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role, int versionCode, String versionName, byte[] certification);
|
||||
|
||||
/**
|
||||
* 设置自动驾驶模式 启动自动驾驶
|
||||
@@ -252,16 +256,18 @@ public interface IAdasNetCommApi {
|
||||
/**
|
||||
* 发送 轨迹下载请求
|
||||
*
|
||||
* @param line 线路相关参数详情见PB message_pad.proto -> Line
|
||||
* @param line 线路相关参数详情见PB message_pad.proto -> Line
|
||||
* @param downloadType 下载类型: 0:正常下载 1:预下载
|
||||
* @return 加入WS发送消息队列是否成功
|
||||
*/
|
||||
boolean sendTrajectoryDownloadReq(MessagePad.Line line);
|
||||
boolean sendTrajectoryDownloadReq(MessagePad.Line line, int downloadType);
|
||||
|
||||
/**
|
||||
* 发送 状态查询请求
|
||||
*
|
||||
* @return 加入WS发送消息队列是否成功
|
||||
*/
|
||||
@Deprecated//HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用
|
||||
boolean sendStatusQueryReq();
|
||||
|
||||
/**
|
||||
@@ -483,14 +489,7 @@ public interface IAdasNetCommApi {
|
||||
*/
|
||||
boolean sendOperatorCmdStopHonking();
|
||||
|
||||
/**
|
||||
* 设置参数命令
|
||||
*
|
||||
* @param type 0:default 1:绕障类功能开关(bool) 2:变道绕障的目标障碍物速度阈值(double, m/s)
|
||||
* @param value 转成字符串的值
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendSetParamReq(int type, String value);
|
||||
/*******************************设置参数命令 包括V1************************************/
|
||||
|
||||
/**
|
||||
* 绕障类功能开关
|
||||
@@ -563,6 +562,72 @@ public interface IAdasNetCommApi {
|
||||
*/
|
||||
boolean sendWeakNetSlowDown(int enable);
|
||||
|
||||
/**
|
||||
* 故障减速停车策路开关
|
||||
*
|
||||
* @param enable 0:关闭故障减速停车策略 1:使用故障减速停车策略
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendBreakdownSlowDown(int enable);
|
||||
|
||||
/**
|
||||
* 融合模式
|
||||
*
|
||||
* @param cmd 1:全融合模式 2:盲区模式 3:超视距模式 4:透传模式 5:纯路侧模式,默认1
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendFusionMode(int cmd);
|
||||
|
||||
/*******************************设置参数命令 V2************************************/
|
||||
/**
|
||||
* 盲区数据开关
|
||||
*
|
||||
* @param switchCmd 数据开关
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendBlindAreaCmd(boolean switchCmd);
|
||||
|
||||
|
||||
/**
|
||||
* 控制V2N进PnC
|
||||
*
|
||||
* @param switchCmd true:发给PnC,false:不发给PnC
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendV2nToPncCmd(boolean switchCmd);
|
||||
|
||||
/**
|
||||
* 控制V2I进PnC
|
||||
*
|
||||
* @param switchCmd true:发给Pnc和鹰眼,false:不发给PnC和鹰眼 默认false
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendV2iToPncCmd(boolean switchCmd);
|
||||
|
||||
/*******************************设置参数命令 批量设置************************************/
|
||||
|
||||
/**
|
||||
* 批量设置参数命令
|
||||
*
|
||||
* @param param {@link AdasConstants.MapSystemParamType#DETOURING Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#DETOURING_SPEED Value类型:double或double类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#AEB Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#LANE_CHANGE_RESTRAIN_VALID Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#STOP_YIELD_VALID Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#HADMAP_SPEED_LIMIT_VALID Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#RAMP_THETA_VALID Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#WEAK_NET_SLOW_DOWN Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#BREAKDOWN_SLOW_DOWN Value类型:int或int类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#BLIND_AREA Value类型:boolean或boolean类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#V2N_TO_PNC Value类型:boolean或boolean类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#V2I_TO_PNC Value类型:boolean或boolean类型String}
|
||||
* {@link AdasConstants.MapSystemParamType#FUSION_MODE Value类型:int或int类型String}
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendSetParamReq(@NonNull Map<AdasConstants.MapSystemParamType, Object> param);
|
||||
|
||||
/*******************************设置参数命令 获取参数************************************/
|
||||
|
||||
/**
|
||||
* 获取全部参数
|
||||
*
|
||||
@@ -576,9 +641,9 @@ public interface IAdasNetCommApi {
|
||||
* @param paramType 参数类型:libraries/mogo-adas-data/src/main/proto/personal/adas_constants.proto
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendGetParamReq(AdasConstants.MapSystemParamType paramType);
|
||||
|
||||
boolean sendGetParamReq(AdasConstants.MapSystemParamType... paramType);
|
||||
|
||||
/*******************************设置参数命令************************************/
|
||||
/**
|
||||
* 发生行程相关
|
||||
* type=1或2的时 需要参数 lineName
|
||||
@@ -602,22 +667,6 @@ public interface IAdasNetCommApi {
|
||||
*/
|
||||
boolean sendBagManagerCmd(BagManagerOuterClass.BagManager bagManager);
|
||||
|
||||
/**
|
||||
* 控制V2N数据给车端PnC
|
||||
*
|
||||
* @param switchCmd true为发给PnC,false为不发给PnC
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendV2nToPncCmd(boolean switchCmd);
|
||||
|
||||
/**
|
||||
* 盲区数据开关
|
||||
*
|
||||
* @param switchCmd 数据开关
|
||||
* @return boolean
|
||||
*/
|
||||
boolean sendBlindAreaCmd(boolean switchCmd);
|
||||
|
||||
/**
|
||||
* FSM状态原因查询
|
||||
* 当FSMFunctionStates的类型是XXX_DRIVING_OFF时查询OFF的原因
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
import com.zhjt.mogo.adas.data.AdasConstants;
|
||||
import com.zhjt.mogo.adas.data.bean.AdasParam;
|
||||
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
|
||||
import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason;
|
||||
import com.zhjt.mogo.adas.data.sweeper.SweeperCloudTask;
|
||||
import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask;
|
||||
@@ -19,6 +20,8 @@ import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume;
|
||||
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 bag_manager.BagManagerOuterClass;
|
||||
import chassis.ChassisStatesOuterClass;
|
||||
import chassis.VehicleStateOuterClass;
|
||||
@@ -31,6 +34,7 @@ import perception.TrafficLightOuterClass;
|
||||
import planning.RoboSweeperTaskIndexOuterClass;
|
||||
import prediction.Prediction;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
import system_master.SsmInfo;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
@@ -194,8 +198,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);
|
||||
|
||||
/**
|
||||
* 数据采集配置应答
|
||||
*
|
||||
@@ -406,7 +421,7 @@ public interface OnAdasListener {
|
||||
/**
|
||||
* 参数获取应答
|
||||
* <p>
|
||||
* 调用{@link AdasManager#sendGetAllParamReq()}或{@link AdasManager#sendGetParamReq(AdasConstants.MapSystemParamType)}
|
||||
* 调用{@link AdasManager#sendGetAllParamReq()}或{@link AdasManager#sendGetParamReq(AdasConstants.MapSystemParamType...)}
|
||||
* 如果对应的value是空串,说明没有这个param或者get失败了。重启后值还是在redis里
|
||||
*
|
||||
* @param header 头
|
||||
@@ -430,10 +445,11 @@ public interface OnAdasListener {
|
||||
/**
|
||||
* 是否有能力启动自动驾驶
|
||||
*
|
||||
* @param isAutopilotAbility 是否能启动自动驾驶
|
||||
* @param unableAutopilotReason 不能启动自动驾驶原因
|
||||
* @param isAutopilotAbility 是否能启动自动驾驶
|
||||
* @param unableAutopilotReasons 不能启动自动驾驶原因
|
||||
*/
|
||||
void onAutopilotAbility(boolean isAutopilotAbility, String unableAutopilotReason);
|
||||
void onAutopilotAbility(boolean isAutopilotAbility, @Nullable ArrayList<UnableAutopilotReason> unableAutopilotReasons);
|
||||
|
||||
|
||||
/**
|
||||
* 启动自动驾驶失败回调
|
||||
|
||||
@@ -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, "自动驾驶设备基础信息应答"),
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
package com.zhidao.support.adas.high.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.Network;
|
||||
import android.net.NetworkRequest;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@@ -13,15 +23,17 @@ public class ReconnectManager {
|
||||
private final AtomicBoolean isReconnection = new AtomicBoolean(false);//是否正在重连
|
||||
private final OnReconnectListener listener;
|
||||
private volatile Timer timer;
|
||||
private final Context context;
|
||||
private final AtomicBoolean isRegisterNetworkCallback = new AtomicBoolean(false);
|
||||
|
||||
public interface OnReconnectListener {
|
||||
void onReconnection();
|
||||
void onReconnection(String tag);
|
||||
}
|
||||
|
||||
|
||||
public ReconnectManager(OnReconnectListener listener) {
|
||||
public ReconnectManager(Context context, OnReconnectListener listener) {
|
||||
this.context = context;
|
||||
this.listener = listener;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,6 +48,12 @@ public class ReconnectManager {
|
||||
if (!isReconnection.get()) {
|
||||
CupidLogUtils.i(TAG, "开始重连");
|
||||
isReconnection.set(true);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkRequest networkRequest = new NetworkRequest.Builder().build();
|
||||
connMgr.registerNetworkCallback(networkRequest, networkCallback);
|
||||
isRegisterNetworkCallback.set(true);
|
||||
}
|
||||
if (timer == null) {
|
||||
timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@@ -43,7 +61,7 @@ public class ReconnectManager {
|
||||
public void run() {
|
||||
if (isReconnection.get()) {
|
||||
if (listener != null)
|
||||
listener.onReconnection();
|
||||
listener.onReconnection("定时器");
|
||||
}
|
||||
}
|
||||
}, 0, RECONNECT_INTERVAL);//延时
|
||||
@@ -54,11 +72,26 @@ public class ReconnectManager {
|
||||
public synchronized void stop() {
|
||||
CupidLogUtils.i(TAG, "停止重连");
|
||||
isReconnection.set(false);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && isRegisterNetworkCallback.get()) {
|
||||
ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
connMgr.unregisterNetworkCallback(networkCallback);
|
||||
isRegisterNetworkCallback.set(false);
|
||||
}
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
private final ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback() {
|
||||
@Override
|
||||
public void onAvailable(@NonNull Network network) {
|
||||
super.onAvailable(network);
|
||||
Log.i(TAG, "网络连接成功");
|
||||
if (listener != null)
|
||||
listener.onReconnection("网络监听");
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.zhidao.support.adas.high.common.autopilot.ability;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
@@ -15,41 +20,44 @@ import chassis.ChassisStatesOuterClass;
|
||||
*/
|
||||
public class AutopilotAbility230 {
|
||||
private static final String TAG = AutopilotAbility230.class.getSimpleName();
|
||||
private static final long DEFAULT_DETECTION_TIME = 3 * 1000L;//默认检测时间
|
||||
private volatile Timer timer;
|
||||
private ChassisStatesOuterClass.ChassisStates chassisStates;
|
||||
private OnAutopilotAbilityListener listener;
|
||||
|
||||
public AutopilotAbility230() {
|
||||
protected interface OnAutopilotAbilityListener {
|
||||
void onAutopilotAbility(boolean isAutopilotAbility, @Nullable ArrayList<UnableAutopilotReason> unableAutopilotReasons);
|
||||
}
|
||||
|
||||
protected AutopilotAbility230() {
|
||||
}
|
||||
|
||||
|
||||
public void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) {
|
||||
protected void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) {
|
||||
this.chassisStates = chassisStates;
|
||||
}
|
||||
|
||||
|
||||
private void onCallback() {
|
||||
boolean isAutopilotAbility = true;//是否能启动自动驾驶
|
||||
String unableAutopilotReason = null;//不能启动自动驾驶原因
|
||||
ArrayList<UnableAutopilotReason> unableAutopilotReasons = null;//不能启动自动驾驶原因
|
||||
//检测底盘相关
|
||||
if (chassisStates != null) {
|
||||
if (chassisStates.hasBrakeSystemStates()) {
|
||||
float brake = chassisStates.getBrakeSystemStates().getBrakePedalResponsePosition();
|
||||
if (brake > 0) {
|
||||
isAutopilotAbility = false;
|
||||
unableAutopilotReason = "制动踏板被踩下";
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "制动踏板被踩下");
|
||||
}
|
||||
}
|
||||
if (isAutopilotAbility) {
|
||||
if (chassisStates.hasGearSystemStates()) {
|
||||
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
|
||||
if (!AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear)) {
|
||||
isAutopilotAbility = false;
|
||||
unableAutopilotReason = "档位不正常";
|
||||
}
|
||||
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 (isAutopilotAbility) {
|
||||
|
||||
// //电子驻车制动系统
|
||||
// if (chassisStates.hasEpbSystemStates()) {
|
||||
// ChassisStatesOuterClass.EPBSystemStates epb = chassisStates.getEpbSystemStates();
|
||||
@@ -57,12 +65,15 @@ public class AutopilotAbility230 {
|
||||
// epb.getEpbWorkState();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReasons);
|
||||
}
|
||||
AutopilotAbilityManager.getInstance().onAutopilotAbility(isAutopilotAbility, unableAutopilotReason);
|
||||
}
|
||||
|
||||
public synchronized void start() {
|
||||
protected synchronized void start(OnAutopilotAbilityListener listener) {
|
||||
this.listener = listener;
|
||||
if (timer == null) {
|
||||
timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@@ -70,17 +81,16 @@ public class AutopilotAbility230 {
|
||||
public void run() {
|
||||
onCallback();
|
||||
}
|
||||
}, 2000L, DEFAULT_DETECTION_TIME);//延迟执行,避免刚连接成功后底盘信息无法及时同步
|
||||
}, 2000L, AutopilotAbilityManager.DEFAULT_DETECTION_TIME);//延迟执行,避免刚连接成功后底盘信息无法及时同步
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void stop() {
|
||||
protected synchronized void stop() {
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
}
|
||||
this.chassisStates = null;
|
||||
this.listener = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.zhidao.support.adas.high.common.autopilot.ability;
|
||||
|
||||
import android.os.Message;
|
||||
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 java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
@@ -22,36 +24,42 @@ import system_master.SystemStatusInfo;
|
||||
*/
|
||||
public class AutopilotAbility250 {
|
||||
private static final String TAG = AutopilotAbility250.class.getSimpleName();
|
||||
private static final int WHAT_TIMEOUT = 0;
|
||||
private static final int DEFAULT_TIMEOUT = 1500;
|
||||
private static final long DEFAULT_DETECTION_TIME = 3 * 1000L;//默认检测时间
|
||||
private static final String[] NODE_INFO_STATE = {"未知状态 ", "依赖未就绪 ", "启动中 ", "运行 ", "停止 ", "无法启动状态 ", "人为启动状态 ", "人为关闭状态 "};
|
||||
private volatile Timer timer;
|
||||
private ChassisStatesOuterClass.ChassisStates chassisStates;
|
||||
private int mapVersion = -1;//MAP版本
|
||||
private int masterVersion = -1;//Master版本
|
||||
private OnAutopilotAbilityListener listener;
|
||||
|
||||
public AutopilotAbility250(int mapVersion) {
|
||||
protected interface OnAutopilotAbilityListener {
|
||||
void onAutopilotAbility(boolean isAutopilotAbility, @Nullable ArrayList<UnableAutopilotReason> unableAutopilotReasons);
|
||||
|
||||
void onStatusQuery();
|
||||
|
||||
void onSendTimeoutMessages();
|
||||
|
||||
void onRemoveTimeoutMessages();
|
||||
}
|
||||
|
||||
protected AutopilotAbility250(int mapVersion) {
|
||||
this.mapVersion = mapVersion;
|
||||
this.masterVersion = -1;
|
||||
}
|
||||
|
||||
|
||||
public void setStatusInfo(SystemStatusInfo.StatusInfo statusInfo) {
|
||||
if (AutopilotAbilityManager.getInstance().getHandler() != null) {
|
||||
if (AutopilotAbilityManager.getInstance().getHandler().hasMessages(WHAT_TIMEOUT))
|
||||
AutopilotAbilityManager.getInstance().getHandler().removeMessages(WHAT_TIMEOUT);
|
||||
protected void setStatusInfo(SystemStatusInfo.StatusInfo statusInfo) {
|
||||
if (listener != null) {
|
||||
listener.onRemoveTimeoutMessages();
|
||||
}
|
||||
onCallback(statusInfo);
|
||||
}
|
||||
|
||||
public void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) {
|
||||
protected void setChassisStates(ChassisStatesOuterClass.ChassisStates chassisStates) {
|
||||
this.chassisStates = chassisStates;
|
||||
}
|
||||
|
||||
private void onCallback(SystemStatusInfo.StatusInfo statusInfo) {
|
||||
boolean isAutopilotAbility = true;//是否能启动自动驾驶
|
||||
String unableAutopilotReason = null;//不能启动自动驾驶原因
|
||||
ArrayList<UnableAutopilotReason> unableAutopilotReasons = null;//不能启动自动驾驶原因
|
||||
//检测节点状态相关
|
||||
if (statusInfo != null) {
|
||||
if (masterVersion == -1 && statusInfo.hasMasterVersion()) {
|
||||
@@ -63,7 +71,7 @@ public class AutopilotAbility250 {
|
||||
if (mapVersion >= 30400 && masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) {
|
||||
isAutopilotAbility = statusInfo.getAutoPilotReady();
|
||||
if (!isAutopilotAbility) {
|
||||
unableAutopilotReason = statusInfo.getAutoPilotUnreadyReason();
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, statusInfo.getAutoPilotUnreadyReason());
|
||||
}
|
||||
} else if (mapVersion >= 21000 && masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1,还需要判断AutoPilotReady字段是否存在,以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行
|
||||
isAutopilotAbility = statusInfo.getAutoPilotReady();
|
||||
@@ -71,19 +79,17 @@ 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 < NODE_INFO_STATE.length) {
|
||||
builder.append(NODE_INFO_STATE[state]);
|
||||
if (state < AutopilotAbilityManager.NODE_INFO_STATE.length) {
|
||||
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 + "未知异常");
|
||||
}
|
||||
}
|
||||
unableAutopilotReason = builder.toString();
|
||||
} else {
|
||||
unableAutopilotReason = "未知异常节点";
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, "未知异常节点");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -91,6 +97,7 @@ public class AutopilotAbility250 {
|
||||
// 目前已知可以下发启动自驾命令的状态: SystemState.SYS_RUNNING、SystemState.PILOT_READY、SystemState.AUTO_PILOT_STARTING、SystemState.AUTO_PILOT_RUNNING
|
||||
if (systemState != SystemStatusInfo.SystemState.SYS_RUNNING && systemState != SystemStatusInfo.SystemState.PILOT_READY) {
|
||||
isAutopilotAbility = false;
|
||||
String unableAutopilotReason = null;
|
||||
if (systemState == SystemStatusInfo.SystemState.SYS_STARTING) {
|
||||
unableAutopilotReason = "系统正在启动";
|
||||
} else if (systemState == SystemStatusInfo.SystemState.SYS_EXITING) {
|
||||
@@ -112,34 +119,33 @@ public class AutopilotAbility250 {
|
||||
} else {
|
||||
unableAutopilotReason = "未知系统状态";
|
||||
}
|
||||
if (!isAutopilotAbility) {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, unableAutopilotReason);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isAutopilotAbility = false;//是否能启动自动驾驶
|
||||
unableAutopilotReason = "SSM状态查询超时无响应";//不能启动自动驾驶原因
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "SSM状态查询超时无响应");
|
||||
}
|
||||
//检测底盘相关
|
||||
if (chassisStates != null) {
|
||||
if (isAutopilotAbility) {
|
||||
if (chassisStates.hasBrakeSystemStates()) {
|
||||
float brake = chassisStates.getBrakeSystemStates().getBrakePedalResponsePosition();
|
||||
if (brake > 0) {
|
||||
isAutopilotAbility = false;
|
||||
unableAutopilotReason = "制动踏板被踩下";
|
||||
}
|
||||
if (chassisStates.hasBrakeSystemStates()) {
|
||||
float brake = chassisStates.getBrakeSystemStates().getBrakePedalResponsePosition();
|
||||
if (brake > 0) {
|
||||
isAutopilotAbility = false;
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.CHASSIS, "制动踏板被踩下");
|
||||
}
|
||||
}
|
||||
if (isAutopilotAbility) {
|
||||
if (chassisStates.hasGearSystemStates()) {
|
||||
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
|
||||
if (!AutopilotAbilityManager.getInstance().isLaunchAutopilot(gear)) {
|
||||
isAutopilotAbility = false;
|
||||
unableAutopilotReason = "档位不正常";
|
||||
}
|
||||
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 (isAutopilotAbility) {
|
||||
|
||||
// //电子驻车制动系统
|
||||
// if (chassisStates.hasEpbSystemStates()) {
|
||||
// ChassisStatesOuterClass.EPBSystemStates epb = chassisStates.getEpbSystemStates();
|
||||
@@ -147,45 +153,45 @@ public class AutopilotAbility250 {
|
||||
// epb.getEpbWorkState();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReasons);
|
||||
}
|
||||
AutopilotAbilityManager.getInstance().onAutopilotAbility(isAutopilotAbility, unableAutopilotReason);
|
||||
}
|
||||
|
||||
public synchronized void start() {
|
||||
protected synchronized void start(OnAutopilotAbilityListener listener) {
|
||||
this.listener = listener;
|
||||
if (timer == null) {
|
||||
timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (AutopilotAbilityManager.getInstance().getOnAutopilotAbilityListener() != null) {
|
||||
AutopilotAbilityManager.getInstance().getOnAutopilotAbilityListener().onStatusQuery();
|
||||
if (listener != null) {
|
||||
listener.onStatusQuery();
|
||||
}
|
||||
AdasManager.getInstance().sendStatusQueryReq();
|
||||
if (AutopilotAbilityManager.getInstance().getHandler() != null) {
|
||||
if (AutopilotAbilityManager.getInstance().getHandler().hasMessages(WHAT_TIMEOUT))
|
||||
AutopilotAbilityManager.getInstance().getHandler().removeMessages(WHAT_TIMEOUT);
|
||||
AutopilotAbilityManager.getInstance().getHandler().sendEmptyMessageDelayed(WHAT_TIMEOUT, DEFAULT_TIMEOUT);
|
||||
if (listener != null) {
|
||||
listener.onSendTimeoutMessages();
|
||||
}
|
||||
}
|
||||
}, 2000L, DEFAULT_DETECTION_TIME);//延迟执行,避免刚连接成功后底盘信息无法及时同步
|
||||
}, 2000L, AutopilotAbilityManager.DEFAULT_DETECTION_TIME);//延迟执行,避免刚连接成功后底盘信息无法及时同步
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void stop() {
|
||||
protected synchronized void stop() {
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
}
|
||||
this.chassisStates = null;
|
||||
this.masterVersion = -1;
|
||||
this.listener = null;
|
||||
}
|
||||
|
||||
|
||||
public void onHandleMessage(Message msg) {
|
||||
if (msg.what == WHAT_TIMEOUT) {
|
||||
onCallback(null);
|
||||
}
|
||||
protected void onCallTimeout() {
|
||||
onCallback(null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.zhidao.support.adas.high.common.autopilot.ability;
|
||||
|
||||
import android.os.Message;
|
||||
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 java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
@@ -22,29 +26,35 @@ import system_master.SystemStatusInfo;
|
||||
*/
|
||||
public class AutopilotAbility330 {
|
||||
private static final String TAG = AutopilotAbility330.class.getSimpleName();
|
||||
private static final int WHAT_TIMEOUT = 0;
|
||||
private static final int DEFAULT_TIMEOUT = 1500;
|
||||
private static final long DEFAULT_DETECTION_TIME = 3 * 1000L;//默认检测时间
|
||||
private static final String[] NODE_INFO_STATE = {"未知状态 ", "依赖未就绪 ", "启动中 ", "运行 ", "停止 ", "无法启动状态 ", "人为启动状态 ", "人为关闭状态 "};
|
||||
private volatile Timer timer;
|
||||
|
||||
private volatile FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond;//自动驾驶状态为OFF的原因
|
||||
private int mapVersion = -1;//MAP版本
|
||||
private int masterVersion = -1;//Master版本
|
||||
private OnAutopilotAbilityListener listener;
|
||||
|
||||
public AutopilotAbility330(int mapVersion) {
|
||||
protected interface OnAutopilotAbilityListener {
|
||||
void onAutopilotAbility(boolean isAutopilotAbility, @Nullable ArrayList<UnableAutopilotReason> unableAutopilotReasons);
|
||||
|
||||
void onStatusQuery();
|
||||
|
||||
void onSendTimeoutMessages();
|
||||
|
||||
void onRemoveTimeoutMessages();
|
||||
}
|
||||
|
||||
protected AutopilotAbility330(int mapVersion) {
|
||||
this.mapVersion = mapVersion;
|
||||
this.masterVersion = -1;
|
||||
}
|
||||
|
||||
public synchronized void setFsmStatusReasonRespond(FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond) {
|
||||
protected synchronized void setFsmStatusReasonRespond(FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond) {
|
||||
this.fsmStatusReasonRespond = fsmStatusReasonRespond;
|
||||
}
|
||||
|
||||
public void setStatusInfo(SystemStatusInfo.StatusInfo statusInfo) {
|
||||
if (AutopilotAbilityManager.getInstance().getHandler() != null) {
|
||||
if (AutopilotAbilityManager.getInstance().getHandler().hasMessages(WHAT_TIMEOUT))
|
||||
AutopilotAbilityManager.getInstance().getHandler().removeMessages(WHAT_TIMEOUT);
|
||||
protected void setStatusInfo(SystemStatusInfo.StatusInfo statusInfo) {
|
||||
if (listener != null) {
|
||||
listener.onRemoveTimeoutMessages();
|
||||
}
|
||||
onCallback(statusInfo);
|
||||
}
|
||||
@@ -52,7 +62,7 @@ public class AutopilotAbility330 {
|
||||
|
||||
private void onCallback(SystemStatusInfo.StatusInfo statusInfo) {
|
||||
boolean isAutopilotAbility = true;//是否能启动自动驾驶
|
||||
String unableAutopilotReason = null;//不能启动自动驾驶原因
|
||||
ArrayList<UnableAutopilotReason> unableAutopilotReasons = null;//不能启动自动驾驶原因
|
||||
//检测节点状态相关
|
||||
if (statusInfo != null) {
|
||||
if (masterVersion == -1 && statusInfo.hasMasterVersion()) {
|
||||
@@ -64,7 +74,7 @@ public class AutopilotAbility330 {
|
||||
if (mapVersion >= 30400 && masterVersion > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) {
|
||||
isAutopilotAbility = statusInfo.getAutoPilotReady();
|
||||
if (!isAutopilotAbility) {
|
||||
unableAutopilotReason = statusInfo.getAutoPilotUnreadyReason();
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, statusInfo.getAutoPilotUnreadyReason());
|
||||
}
|
||||
} else if (mapVersion >= 21000 && masterVersion > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1,还需要判断AutoPilotReady字段是否存在,以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行
|
||||
isAutopilotAbility = statusInfo.getAutoPilotReady();
|
||||
@@ -72,19 +82,17 @@ 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 < NODE_INFO_STATE.length) {
|
||||
builder.append(NODE_INFO_STATE[state]);
|
||||
if (state < AutopilotAbilityManager.NODE_INFO_STATE.length) {
|
||||
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 + "未知异常");
|
||||
}
|
||||
}
|
||||
unableAutopilotReason = builder.toString();
|
||||
} else {
|
||||
unableAutopilotReason = "未知异常节点";
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, "未知异常节点");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -92,6 +100,7 @@ public class AutopilotAbility330 {
|
||||
// 目前已知可以下发启动自驾命令的状态: SystemState.SYS_RUNNING、SystemState.PILOT_READY、SystemState.AUTO_PILOT_STARTING、SystemState.AUTO_PILOT_RUNNING
|
||||
if (systemState != SystemStatusInfo.SystemState.SYS_RUNNING && systemState != SystemStatusInfo.SystemState.PILOT_READY) {
|
||||
isAutopilotAbility = false;
|
||||
String unableAutopilotReason = null;
|
||||
if (systemState == SystemStatusInfo.SystemState.SYS_STARTING) {
|
||||
unableAutopilotReason = "系统正在启动";
|
||||
} else if (systemState == SystemStatusInfo.SystemState.SYS_EXITING) {
|
||||
@@ -113,67 +122,66 @@ public class AutopilotAbility330 {
|
||||
} else {
|
||||
unableAutopilotReason = "未知系统状态";
|
||||
}
|
||||
if (!isAutopilotAbility) {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.SSM, unableAutopilotReason);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isAutopilotAbility = false;//是否能启动自动驾驶
|
||||
unableAutopilotReason = "SSM状态查询超时无响应";//不能启动自动驾驶原因
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "SSM状态查询超时无响应");
|
||||
}
|
||||
if (isAutopilotAbility) {
|
||||
if (fsmStatusReasonRespond != null) {
|
||||
int count = fsmStatusReasonRespond.getFsmStatusReasonRespondCount();
|
||||
StringBuilder builder = null;
|
||||
if (count > 0) {
|
||||
builder = new StringBuilder();
|
||||
for (int i = 0; i < count; i++) {
|
||||
String respond = fsmStatusReasonRespond.getFsmStatusReasonRespond(i);
|
||||
builder.append(respond).append(' ');
|
||||
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 (builder != null) {
|
||||
isAutopilotAbility = false;
|
||||
builder.deleteCharAt(builder.length() - 1);//删除末尾
|
||||
unableAutopilotReason = builder.toString();
|
||||
if (unableAutopilotReasons == null || unableAutopilotReasons.isEmpty()) {
|
||||
unableAutopilotReasons = AutopilotAbilityManager.getInstance().addUnableAutopilotReason(unableAutopilotReasons, UnableAutopilotReason.SourceType.LIB, "FSM数据异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
AutopilotAbilityManager.getInstance().onAutopilotAbility(isAutopilotAbility, unableAutopilotReason);
|
||||
if (listener != null) {
|
||||
listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReasons);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void start() {
|
||||
protected synchronized void start(OnAutopilotAbilityListener listener) {
|
||||
this.listener = listener;
|
||||
if (timer == null) {
|
||||
timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (AutopilotAbilityManager.getInstance().getOnAutopilotAbilityListener() != null) {
|
||||
AutopilotAbilityManager.getInstance().getOnAutopilotAbilityListener().onStatusQuery();
|
||||
if (listener != null) {
|
||||
listener.onStatusQuery();
|
||||
}
|
||||
AdasManager.getInstance().sendStatusQueryReq();
|
||||
if (AutopilotAbilityManager.getInstance().getHandler() != null) {
|
||||
if (AutopilotAbilityManager.getInstance().getHandler().hasMessages(WHAT_TIMEOUT))
|
||||
AutopilotAbilityManager.getInstance().getHandler().removeMessages(WHAT_TIMEOUT);
|
||||
AutopilotAbilityManager.getInstance().getHandler().sendEmptyMessageDelayed(WHAT_TIMEOUT, DEFAULT_TIMEOUT);
|
||||
if (listener != null) {
|
||||
listener.onSendTimeoutMessages();
|
||||
}
|
||||
}
|
||||
}, 2000L, DEFAULT_DETECTION_TIME);//延迟执行,避免刚连接成功后底盘信息无法及时同步
|
||||
}, 2000L, AutopilotAbilityManager.DEFAULT_DETECTION_TIME);//延迟执行,避免刚连接成功后底盘信息无法及时同步
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void stop() {
|
||||
protected synchronized void stop() {
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
}
|
||||
this.masterVersion = -1;
|
||||
this.listener = null;
|
||||
}
|
||||
|
||||
|
||||
public void onHandleMessage(Message msg) {
|
||||
if (msg.what == WHAT_TIMEOUT) {
|
||||
onCallback(null);
|
||||
}
|
||||
protected void onCallTimeout() {
|
||||
onCallback(null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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,12 +2,17 @@ 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;
|
||||
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.Constants;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhjt.mogo.adas.data.bean.UnableAutopilotReason;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
@@ -16,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;
|
||||
|
||||
/**
|
||||
@@ -25,17 +31,26 @@ import system_master.SystemStatusInfo;
|
||||
* <p>
|
||||
* 此定时器不能停止 鹰眼中存在UI更新依赖循环查询系统状态
|
||||
*/
|
||||
public class AutopilotAbilityManager {
|
||||
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_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;
|
||||
/**
|
||||
* 不能启动自动驾驶的档位
|
||||
@@ -79,9 +94,27 @@ public class AutopilotAbilityManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加不能启动自驾的原因
|
||||
*
|
||||
* @param unableAutopilotReasons 原因列表
|
||||
* @param source 来源
|
||||
* @param unableAutopilotReason 云隐
|
||||
* @return 原因列表
|
||||
*/
|
||||
protected ArrayList<UnableAutopilotReason> addUnableAutopilotReason(ArrayList<UnableAutopilotReason> unableAutopilotReasons, UnableAutopilotReason.SourceType source, String unableAutopilotReason) {
|
||||
if (unableAutopilotReasons == null) {
|
||||
unableAutopilotReasons = new ArrayList<>();
|
||||
}
|
||||
unableAutopilotReasons.add(new UnableAutopilotReason(source, unableAutopilotReason));
|
||||
return unableAutopilotReasons;
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -93,9 +126,33 @@ public class AutopilotAbilityManager {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void onAutopilotAbility(boolean isAutopilotAbility, String unableAutopilotReason) {
|
||||
@Override
|
||||
public void onAutopilotAbility(boolean isAutopilotAbility, @Nullable ArrayList<UnableAutopilotReason> unableAutopilotReasons) {
|
||||
if (listener != null) {
|
||||
listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReason);
|
||||
listener.onAutopilotAbility(isAutopilotAbility, unableAutopilotReasons);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusQuery() {
|
||||
if (onAutopilotAbilityListener != null) {
|
||||
onAutopilotAbilityListener.onStatusQuery();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSendTimeoutMessages() {
|
||||
onRemoveTimeoutMessages();
|
||||
if (handler != null) {
|
||||
handler.sendEmptyMessageDelayed(WHAT_TIMEOUT, DEFAULT_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoveTimeoutMessages() {
|
||||
if (handler != null) {
|
||||
if (handler.hasMessages(WHAT_TIMEOUT))
|
||||
handler.removeMessages(WHAT_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,18 +160,11 @@ public class AutopilotAbilityManager {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
public Handler getHandler() {
|
||||
return handler;
|
||||
}
|
||||
|
||||
public void setOnAutopilotAbilityListener(OnAutopilotAbilityListener onAutopilotAbilityListener) {
|
||||
this.onAutopilotAbilityListener = onAutopilotAbilityListener;
|
||||
}
|
||||
|
||||
public OnAutopilotAbilityListener getOnAutopilotAbilityListener() {
|
||||
return onAutopilotAbilityListener;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SSM状态更新
|
||||
@@ -130,6 +180,15 @@ public class AutopilotAbilityManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void setStatusInfo(SsmInfo.SsmStatusInf statusInfo) {
|
||||
if (autopilotAbility350And360 != null) {
|
||||
autopilotAbility350And360.setStatusInfo(statusInfo);
|
||||
}
|
||||
if (autopilotAbility360 != null) {
|
||||
autopilotAbility360.setStatusInfo(statusInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 底盘状态更新
|
||||
*
|
||||
@@ -142,6 +201,9 @@ public class AutopilotAbilityManager {
|
||||
if (autopilotAbility250 != null) {
|
||||
autopilotAbility250.setChassisStates(chassisStates);
|
||||
}
|
||||
if (autopilotAbility350And360 != null) {
|
||||
autopilotAbility350And360.setChassisStates(chassisStates);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,39 +215,74 @@ public class AutopilotAbilityManager {
|
||||
if (autopilotAbility330 != null) {
|
||||
autopilotAbility330.setFsmStatusReasonRespond(fsmStatusReasonRespond);
|
||||
}
|
||||
if (autopilotAbility360 != null) {
|
||||
autopilotAbility360.setFsmStatusReasonRespond(fsmStatusReasonRespond);
|
||||
}
|
||||
}
|
||||
|
||||
public void onHandleMessage(Message msg) {
|
||||
if (autopilotAbility250 != null) {
|
||||
autopilotAbility250.onHandleMessage(msg);
|
||||
if (msg.what == WHAT_TIMEOUT) {
|
||||
if (autopilotAbility250 != null) {
|
||||
autopilotAbility250.onCallTimeout();
|
||||
}
|
||||
if (autopilotAbility330 != null) {
|
||||
autopilotAbility330.onCallTimeout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
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();
|
||||
autopilotAbility250.start(this);
|
||||
}
|
||||
} else {
|
||||
CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用230版本");
|
||||
Log.i(TAG, "能否启动自驾能力检测使用版本:230");
|
||||
stop250();
|
||||
stop330();
|
||||
stop350And360();
|
||||
stop360();
|
||||
if (autopilotAbility230 == null) {
|
||||
autopilotAbility230 = new AutopilotAbility230();
|
||||
autopilotAbility230.start();
|
||||
autopilotAbility230.start(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -212,6 +309,20 @@ public class AutopilotAbilityManager {
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
@@ -234,7 +345,7 @@ public class AutopilotAbilityManager {
|
||||
initAutopilotAbility();
|
||||
}
|
||||
}
|
||||
}, 8000L);//延迟执行,避免刚连接成功后底盘信息无法及时同步
|
||||
}, 8000L);//8秒原因:需要后去CarConfig 对象,两个地方调用initAutopilotAbility(); 初始化 一个在这,另一个在setCarConfig(),如果setCarConfig() 证明获取版本还未成功,获取版本会重试3次每次间隔两秒
|
||||
}
|
||||
|
||||
}
|
||||
@@ -244,9 +355,13 @@ public class AutopilotAbilityManager {
|
||||
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) {
|
||||
|
||||
@@ -7,8 +7,8 @@ import com.zhidao.support.adas.high.AdasChannel;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.AutopilotReview;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhjt.mogo.adas.data.bean.MogoReport;
|
||||
import com.zhidao.support.adas.high.protocol.RawData;
|
||||
import com.zhjt.mogo.adas.data.bean.MogoReport;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -28,20 +28,39 @@ public class ReportMessage extends MyAbstractMessageHandler {
|
||||
}
|
||||
|
||||
private void initStartAutopilotFailCode() {
|
||||
//ssm_master的失败事件
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.ESYS.AUTOPILOT_FAILED);//在尝试启动自动驾驶,但是超过指定时间后底盘未进入,会发送此事件
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.ESYS.ROUTING_REQ_TIMEOUT);//算路请求响应超时或轨迹加载超时
|
||||
/* SSM侧上报的失败事件*/
|
||||
//首先有系统状态不符合,不允许自驾的情况
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.ESSM.AUTOPILOT_UNREADY);//因自动驾驶节点状态未就绪拒绝自动驾驶
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.ESSM.AUTOPILOT_KEY_NODE_BORKEN);//因自驾驾驶关键节点挂掉拒绝自动驾驶
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.ESSM.IGNORED_CMD_DUE_PAD_CONTROL);//pad自驾中,拒绝云控的自驾命令
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.ESSM.IGNORED_CMD_DUE_AICLOUD_CONTROL);//云控自驾中,拒绝pad的自驾命令
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.ESYS.NOT_ALLOW_AUTOPILOT_FOR_REMOTE);//系统处于远程驾驶中,拒绝进入自动驾驶
|
||||
//其次是自驾转发底盘前轨迹与算路的环节错误
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.ESYS.CHECK_TRAJECTORY_FAILURE);//自驾环节轨迹检查不可用,或者触发轨迹下载,检查超时
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.ESYS.ROUTING_REQ_TIMEOUT);//算路请求响应超时,可能原因是hadmap_engine没有返回,轨迹加载失败,轨迹加载超时
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.ESYS.PLANNING_CHANGE_FAILIED);//planning切换失败(仅df hq有此事件)
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.ESYS.CHECK_TRAJECTORY_FAILURE);//轨迹下载检查不可用
|
||||
//controller的失败事件 EMAP_ENTRY_AUTOPILOT_XXX 底盘启动失败
|
||||
//(7.10新增)鉴于存在 大量地图不存在导致或者 engine 节点不存在 导致的 routing反馈,SSM310,MAP350开始增加engine ready的检测
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.ESYS.MAP_ENGINE_NOT_READY);//hadmap_engine启动了但是状态不对,可能原因是hadmap_engine加载地图失败,或者初始化失败
|
||||
//最后是命令给到底盘,超时失败的事件,如果收到了控制侧上报的失败事件,这个事件可忽略
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.ESYS.AUTOPILOT_FAILED);//在尝试启动自动驾驶,但是超过指定时间后底盘未进入,会发送此事件
|
||||
|
||||
/*控制侧上报的失败事件 EMAP_ENTRY_AUTOPILOT_XXX 底盘启动失败*/
|
||||
//相关模块无消息导致的进自驾失败,需要联系相关模块排查
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.EMAP.ENTRY_AUTOPILOT_FOR_CANADAPTER_TIMEOUT);//can_adapter消息超时未进入自驾
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.EMAP.ENTRY_AUTOPILOT_FOR_PLANNING_TIMEOUT);//PLANNING消息超时未进自驾
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.EMAP.ENTRY_AUTOPILOT_FOR_LOCATION_TIMEOUT);//定位消息超时未进自驾
|
||||
//车端干预导致的自驾失败,检查是否有驾驶干预或者仪表盘不正常
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.EMAP.ENTRY_AUTOPILOT_FOR_BRAKE);//制动踏板干预未进自驾
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.EMAP.ENTRY_AUTOPILOT_FOR_ACCEL);//加速踏板干预未进自驾
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.EMAP.ENTRY_AUTOPILOT_FOR_STEER);//方向盘干预未进自驾
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.EMAP.ENTRY_AUTOPILOT_FOR_GEAR_SWITCH);//档位切换干预未进自驾
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.EMAP.ENTRY_AUTOPILOT_FOR_OTHER_CTL);//其他干预未进自驾,请检查仪表盘和开关项(如双闪,制动灯灯等 可在msg中补充原因信息)
|
||||
//控制判断车辆故障,需要联系运维处理的事件
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.EMAP.ENTRY_AUTOPILOT_FOR_VEHICLE_ERROR);//控制判断车辆故障,需要联系运维处理的事件
|
||||
//控制判断底盘异常,需要重启车辆
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.EMAP.ENTRY_AUTOPILOT_FOR_CHASSIS_FAULT);//控制判断底盘异常,需要重启车辆
|
||||
//不知道确切的失败原因,需要联系控制进一步排查
|
||||
startAutopilotFailCode.add(MogoReport.Code.Error.EMAP.ENTRY_AUTOPILOT_FOR_UNKNOWN);//不知道确切的失败原因,需要联系控制进一步排查
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.zhidao.support.adas.high.socket;
|
||||
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_CODE_WEB_SOCKET_MESSAGE_BYTE;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_CODE_WEB_SOCKET_MESSAGE_JSON;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_CODE_WEB_SOCKET_OPEN;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_SOURCE_ADAS;
|
||||
import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_TYPE_INIT_STATUS;
|
||||
import static com.zhidao.support.adas.high.common.Constants.RESOURCE_PATH;
|
||||
import static com.zhidao.support.adas.high.common.Constants.WS_IP_HOST_HEAD;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
@@ -25,6 +24,7 @@ import com.zhidao.support.adas.high.queue.WebSocketQueueManager;
|
||||
import com.zhjt.service.chain.ChainLog;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@@ -33,6 +33,7 @@ import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.WebSocket;
|
||||
import okhttp3.WebSocketListener;
|
||||
import okhttp3.internal.ws.RealWebSocket;
|
||||
import okio.ByteString;
|
||||
|
||||
/**
|
||||
@@ -51,7 +52,7 @@ public class FpgaSocket implements IWebSocket {
|
||||
private static final String TAG = FpgaSocket.class.getSimpleName();
|
||||
private OkHttpClient client;
|
||||
|
||||
private volatile WebSocket mWebSocket;
|
||||
private volatile RealWebSocket mWebSocket;
|
||||
|
||||
private EchoWebSocketListener listener;
|
||||
private IWebSocketConnectListener mWebSocketConnectListener;
|
||||
@@ -79,11 +80,11 @@ public class FpgaSocket implements IWebSocket {
|
||||
*/
|
||||
private volatile String receiveTimeoutReason = null;
|
||||
|
||||
public FpgaSocket() {
|
||||
init();
|
||||
public FpgaSocket(Context context) {
|
||||
init(context);
|
||||
}
|
||||
|
||||
private void init() {
|
||||
private void init(Context context) {
|
||||
listener = new EchoWebSocketListener();
|
||||
OkHttpClient.Builder okBuilder = new OkHttpClient.Builder();
|
||||
okBuilder.writeTimeout(4, TimeUnit.SECONDS)
|
||||
@@ -96,10 +97,10 @@ public class FpgaSocket implements IWebSocket {
|
||||
onPassiveClose(1001, receiveTimeoutReason);
|
||||
}
|
||||
});
|
||||
reconnectManager = new ReconnectManager(new ReconnectManager.OnReconnectListener() {
|
||||
reconnectManager = new ReconnectManager(context, new ReconnectManager.OnReconnectListener() {
|
||||
@Override
|
||||
public void onReconnection() {
|
||||
connect("重连中");
|
||||
public void onReconnection(String tag) {
|
||||
connect("重连中(" + tag + ")");
|
||||
}
|
||||
});
|
||||
client = okBuilder.build();
|
||||
@@ -123,7 +124,9 @@ public class FpgaSocket implements IWebSocket {
|
||||
Request request = new Request.Builder()
|
||||
.url(wsHost)
|
||||
.build();
|
||||
mWebSocket = client.newWebSocket(request, listener);
|
||||
mWebSocket = new RealWebSocket(request, listener, new Random(), 0);
|
||||
mWebSocket.connect(client);
|
||||
// mWebSocket = client.newWebSocket(request, listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,14 @@ public class DispatchHandler {
|
||||
|
||||
public void sendRawMessage(RawData raw) {
|
||||
start();
|
||||
if (messageType == MessagePad.MessageType.MsgTypePointCloud) {
|
||||
boolean isIdle = mBaseHandler.getLooper().getQueue().isIdle();
|
||||
// Log.i("TimeConsuming", mThread.getName() + " 当前消息队列是否处于空闲状态=" + isIdle);
|
||||
if (!isIdle) {
|
||||
mBaseHandler.removeCallbacksAndMessages(null);
|
||||
// Log.i("TimeConsuming", mThread.getName() + " 移除所有消息后,当前消息队列是否处于空闲状态=" + mBaseHandler.getLooper().getQueue().isIdle());
|
||||
}
|
||||
}
|
||||
Message msg = Message.obtain();
|
||||
msg.obj = raw;
|
||||
msg.what = WHAT_DISPATCH;
|
||||
|
||||
Reference in New Issue
Block a user