[3.3.0][M1] 360环视需求代码提交

This commit is contained in:
renwj
2023-06-13 16:39:27 +08:00
parent 59dd44a14b
commit dd9a4667df
37 changed files with 1388 additions and 231 deletions

View File

@@ -0,0 +1,172 @@
package com.zhjt.mogo.adas.data.bean;
import android.text.TextUtils;
import android.util.Log;
import com.zhjt.mogo.adas.data.AdasConstants;
import mogo.telematics.pad.MessagePad;
/**
* 工控机配置参数
* -1表示未知说明没有这个param或者get失败
*/
public class AdasParam {
/**
* 绕障类功能开关
* -1未知 0关闭 1开启
*/
public final int detouringCmd;
/**
* 变道绕障的目标障碍物速度阈值
* -1未知
*/
public final double detouringSpeed;
/**
* AEB开关
* -1未知 0关闭自动紧急制动功能 1启用自动紧急制动功能
*/
public final int aebCmd;
/**
* 限制绕障开关
* -1未知 0默认正常绕障 1限制绕障
*/
public final int laneChangeRestrainValid;
/**
* 停车让行线前避让等待开关
* -1未知 0默认停车让行线前无需等待 1停车让行线前需要等待
*/
public final int stopYieldValid;
/**
* 地图限速功能开关
* -1未知 0默认不使用地图限速功能 1使用地图限速功能
*/
public final int hadmapSpeedLimitValid;
/**
* 环岛模式开关
* -1未知 0默认普通模式 1环岛模式
*/
public final int rampThetaValid;
/**
* 弱网减速停车策略开关
* -1未知 0关闭弱网减速停车策略 1默认使用弱网减速停车策略
*/
public final int weakNetSlowDown;
/**
* m1拼接视频自车位置参数(string),格式:x,y,width,height
* MAP发出的原始数据
*/
public final String m1StitchedVideoSelfVehicleParam;
/**
* m1拼接视频自车位置参数
* 解析后的数据
* 为空的原因:未查询此数据、工控机不存在此数据、解析失败
*/
public final M1StitchedVideoSelfVehicleParam m1StitchedVideoSelfVehicleParamParse;
public AdasParam(MessagePad.SetParamReq param) {
int detouringCmd = -1;
double detouringSpeed = -1.0;
int aebCmd = -1;
int laneChangeRestrainValid = -1;
int stopYieldValid = -1;
int hadmapSpeedLimitValid = -1;
int rampThetaValid = -1;
int weakNetSlowDown = -1;
String m1StitchedVideoSelfVehicleParam = null;
M1StitchedVideoSelfVehicleParam m1StitchedVideoSelfVehicleParamParse = null;
if (param != null) {
int size = param.getReqsCount();
if (size > 0) {
for (int i = 0; i < size; i++) {
MessagePad.SetOneParam oneParam = param.getReqs(i);
int type = oneParam.getType();
String value = oneParam.getValue();
if (type == AdasConstants.MapSystemParamType.DETOURING_VALUE) {
if (!TextUtils.isEmpty(value)) {
detouringCmd = Integer.parseInt(value);
}
} else if (type == AdasConstants.MapSystemParamType.DETOURING_SPEED_VALUE) {
if (!TextUtils.isEmpty(value)) {
detouringSpeed = Double.parseDouble(value);
}
} else if (type == AdasConstants.MapSystemParamType.AEB_VALUE) {
if (!TextUtils.isEmpty(value)) {
aebCmd = Integer.parseInt(value);
}
} else if (type == AdasConstants.MapSystemParamType.LANE_CHANGE_RESTRAIN_VALID_VALUE) {
if (!TextUtils.isEmpty(value)) {
laneChangeRestrainValid = Integer.parseInt(value);
}
} else if (type == AdasConstants.MapSystemParamType.STOP_YIELD_VALID_VALUE) {
if (!TextUtils.isEmpty(value)) {
stopYieldValid = Integer.parseInt(value);
}
} else if (type == AdasConstants.MapSystemParamType.HADMAP_SPEED_LIMIT_VALID_VALUE) {
if (!TextUtils.isEmpty(value)) {
hadmapSpeedLimitValid = Integer.parseInt(value);
}
} else if (type == AdasConstants.MapSystemParamType.RAMP_THETA_VALID_VALUE) {
if (!TextUtils.isEmpty(value)) {
rampThetaValid = Integer.parseInt(value);
}
} else if (type == AdasConstants.MapSystemParamType.WEAK_NET_SLOW_DOWN_VALUE) {
if (!TextUtils.isEmpty(value)) {
weakNetSlowDown = Integer.parseInt(value);
}
} else if (type == AdasConstants.MapSystemParamType.M1_STITCHED_VIDEO_SELF_VEHICLE_PARAM_VALUE) {
if (!TextUtils.isEmpty(value)) {
m1StitchedVideoSelfVehicleParam = value;
try {
String[] s = value.split(",");
m1StitchedVideoSelfVehicleParamParse = new M1StitchedVideoSelfVehicleParam(Integer.parseInt(s[0]), Integer.parseInt(s[1]), Integer.parseInt(s[2]), Integer.parseInt(s[3]));
} catch (Exception e) {
Log.e("AdasParam", "M1拼接视频自车位置参数解析失败", e);
e.printStackTrace();
}
}
}
}
}
}
this.detouringCmd = detouringCmd;
this.detouringSpeed = detouringSpeed;
this.aebCmd = aebCmd;
this.laneChangeRestrainValid = laneChangeRestrainValid;
this.stopYieldValid = stopYieldValid;
this.hadmapSpeedLimitValid = hadmapSpeedLimitValid;
this.rampThetaValid = rampThetaValid;
this.weakNetSlowDown = weakNetSlowDown;
this.m1StitchedVideoSelfVehicleParam = m1StitchedVideoSelfVehicleParam;
this.m1StitchedVideoSelfVehicleParamParse = m1StitchedVideoSelfVehicleParamParse;
}
@Override
public String toString() {
return "绕障类功能开关=" + (detouringCmd == -1 ? "未知" : detouringCmd == 0 ? "" : "") +
"\n变道绕障的目标障碍物速度阈值=" + (detouringSpeed == -1 ? "未知" : detouringSpeed + "m/s") +
"\nAEB开关=" + (aebCmd == -1 ? "未知" : aebCmd == 0 ? "" : "") +
"\n限制绕障开关=" + (laneChangeRestrainValid == -1 ? "未知" : laneChangeRestrainValid == 0 ? "正常绕障" : "限制绕障") +
"\n停车让行线前避让等待开关=" + (stopYieldValid == -1 ? "未知" : stopYieldValid == 0 ? "无需等待" : "等待") +
"\n地图限速功能开关=" + (hadmapSpeedLimitValid == -1 ? "未知" : hadmapSpeedLimitValid == 0 ? "不使用" : "使用") +
"\n环岛模式开关=" + (rampThetaValid == -1 ? "未知" : rampThetaValid == 0 ? "普通模式" : "环岛模式") +
"\n弱网减速停车策略开关=" + (weakNetSlowDown == -1 ? "未知" : weakNetSlowDown == 0 ? "关闭" : "使用") +
"\nm1拼接视频自车位置参数=" + (m1StitchedVideoSelfVehicleParam == null ? "未知" : m1StitchedVideoSelfVehicleParam);
}
public static class M1StitchedVideoSelfVehicleParam {
public final int x;
public final int y;
public final int width;
public final int height;
public M1StitchedVideoSelfVehicleParam(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
}
}