Merge branch 'dev_robotaxi-d-app-module_265_220329_2.6.5' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_robotaxi-d-app-module_265_220329_2.6.5

 Conflicts:
	OCH/mogo-och-bus-passenger/src/main/res/layout/bus_p_base_fragment.xml
This commit is contained in:
wangmingjun
2022-04-08 20:28:37 +08:00
71 changed files with 1420 additions and 219 deletions

View File

@@ -60,6 +60,7 @@ dependencies {
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.mogo_core_function_v2x
implementation rootProject.ext.dependencies.mogo_core_function_hmi
}else {
implementation project(":core:mogo-core-utils")
implementation project(":foudations:mogo-commons")
@@ -67,6 +68,7 @@ dependencies {
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
implementation project(':core:function-impl:mogo-core-function-v2x')
implementation project(':core:function-impl:mogo-core-function-hmi')
}
}

View File

@@ -4,6 +4,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mogo.eagle.core.function.hmi.ui.widget.SteeringWheelView
android:id="@+id/steering_wheel"
android:layout_width="@dimen/dp_300"
android:layout_height="@dimen/dp_300"
android:layout_marginLeft="@dimen/dp_90"
android:layout_marginTop="@dimen/dp_90"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/bus_p_autopilot_iv"
android:layout_width="wrap_content"

View File

@@ -170,7 +170,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/switch_line_btn"
android:id="@+id/switch_line_btn"fragment_och_bus.xml
android:layout_width="@dimen/module_mogo_och_autopilot_order_bg_width"
android:layout_height="@dimen/bus_switch_line_btn"
android:text="@string/bus_switch_line_btn"

View File

@@ -24,7 +24,7 @@ if (!isAndroidTestBuild()) {
}
//if (!isAndroidTestBuild()) {
// apply plugin: 'apm-plugin'
apply plugin: 'apm-plugin'
//}
//if (!isAndroidTestBuild()) {
@@ -263,29 +263,29 @@ dependencies {
}
//if (!isAndroidTestBuild()) {
// ApmPlugin {
// // 是否进行插桩
// enable true
// // 是否在Debug包插桩默认不插桩
// enableInDebug true
// // DEBUG("DEBUG"), INFO("INFO"), WARN("WARN"), ERROR("ERROR");
// // INFO 级别Log会汇总所有被插桩处理的类供查看路径 app/build/ByteX/ApmPlugin
// logLevel "DEBUG"
// // 启动分析开关监控App启动耗时需要同时开启pageLoadSwitch
// startSwitch = true
// // 页面响应开关监控Activity的生命周期耗时
// pageLoadSwitch = true
// // 网络监控开关监控okhttp3的网络请求
// okHttp3Switch = true
// // 白名单下的包进行插桩,需要填写要插装类所在的包名,支持前缀配置
// whiteList = [
// "com.mogo"
// ]
// // 黑名单包下类不进行插桩,可以配置包名和类名,没有可以填空
// blackList = [
//
// ]
// }
ApmPlugin {
// 是否进行插桩
enable true
// 是否在Debug包插桩默认不插桩
enableInDebug true
// DEBUG("DEBUG"), INFO("INFO"), WARN("WARN"), ERROR("ERROR");
// INFO 级别Log会汇总所有被插桩处理的类供查看路径 app/build/ByteX/ApmPlugin
logLevel "DEBUG"
// 启动分析开关监控App启动耗时需要同时开启pageLoadSwitch
startSwitch = true
// 页面响应开关监控Activity的生命周期耗时
pageLoadSwitch = true
// 网络监控开关监控okhttp3的网络请求
okHttp3Switch = false
// 白名单下的包进行插桩,需要填写要插装类所在的包名,支持前缀配置
whiteList = [
"com.mogo"
]
// 黑名单包下类不进行插桩,可以配置包名和类名,没有可以填空
blackList = [
]
}
//}
android.applicationVariants.all { variant ->

View File

@@ -36,6 +36,14 @@
android:name="MAP_SDK_VERSION"
android:value="${MAP_SDK_VERSION}" />
<!-- 自动驾驶业务埋点上报URL -->
<meta-data
android:name="com.elegant.analytics.AnalyticsConfig.EventsEndpoint"
android:value="https://bdlog.zhidaozhixing.com/autocar" />
<meta-data
android:name="com.elegant.analytics.AnalyticsConfig.EventsFallbackEndpoint"
android:value="https://bdlog.zhidaozhixing.com/autocar" />
</application>

View File

@@ -0,0 +1,154 @@
package com.zhidao.adas.client;
import com.zhidao.adas.client.bean.ArrivalNotification;
import com.zhidao.adas.client.bean.AutopilotState;
import com.zhidao.adas.client.bean.BasicInfoReq;
import com.zhidao.adas.client.bean.CarConfigResp;
import com.zhidao.adas.client.bean.GlobalPathResp;
import com.zhidao.adas.client.bean.GnssInfo;
import com.zhidao.adas.client.bean.MogoReportMessage;
import com.zhidao.adas.client.bean.PerceptionTrafficLight;
import com.zhidao.adas.client.bean.RecordPanel;
import com.zhidao.adas.client.bean.TrackedObjects;
import com.zhidao.adas.client.bean.Trajectory;
import com.zhidao.adas.client.bean.VehicleState;
import com.zhidao.adas.client.bean.Warn;
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo;
import com.zhidao.support.adas.high.bean.SSHResult;
import com.zhidao.support.adas.high.common.ProtocolStatus;
public abstract class OnAdasClientListener {
/**
* 自动驾驶局部轨迹 车前引导线
*
* @param trajectory 数据
*/
public void onTrajectory(Trajectory trajectory) {
}
/**
* 障碍物 他车数据
*
* @param trackedObjects 数据
*/
public void onTrackedObjects(TrackedObjects trackedObjects) {
}
/**
* 惯导信息
*
* @param gnssInfo 数据
*/
public void onGnssInfo(GnssInfo gnssInfo) {
}
/**
* 底盘信息, 透传底盘状态pb参考底盘
*
* @param vehicleState 数据
*/
public void onVehicleState(VehicleState vehicleState) {
}
/**
* 自动驾驶状态
*
* @param autopilotState 数据
*/
public void onAutopilotState(AutopilotState autopilotState) {
}
/**
* 监控事件报告
*
* @param mogoReportMessage 数据
*/
public void onReportMessage(MogoReportMessage mogoReportMessage) {
}
/**
* 感知红绿灯
*
* @param trafficLights 感知红绿灯
*/
public void onPerceptionTrafficLight(PerceptionTrafficLight trafficLights) {
}
/**
* 自动驾驶设备基础信息请求
*
* @param basicInfoReq 数据 目前没有任何参数
*/
public void onBasicInfoReq(BasicInfoReq basicInfoReq) {
}
/**
* 车机基础信息应答
*
* @param carConfigResp 数据
*/
public void onCarConfigResp(CarConfigResp carConfigResp) {
}
/**
* 数据采集结果
*
* @param recordPanel 数据
*/
public void onRecordResult(RecordPanel recordPanel) {
}
/**
* 自动驾驶路径应答
*
* @param globalPathResp 数据
*/
public void onGlobalPathResp(GlobalPathResp globalPathResp) {
}
/**
* 报警信息
* 暂时保留,目前没有使用
*
* @param warn 数据
*/
@Deprecated
public void onWarn(Warn warn) {
}
/**
* 到站提醒 自动驾驶站点
*
* @param arrivalNotification 数据
*/
public void onArrivalNotification(ArrivalNotification arrivalNotification) {
}
/**
* 升级状态
*
* @param info
*/
@Deprecated
public void onUpgradeStateInfo(IPCUpgradeStateInfo info) {
}
/**
* 向IPC发送命令返回结果
*
* @param info
*/
public void onSSHResult(SSHResult info) {
}
/**
* 数据错误
*
* @param status 错误原因
* @param bytes 原始数据
*/
public void onError(ProtocolStatus status, byte[] bytes) {
}
}

View File

@@ -4,11 +4,11 @@ import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
public class ArrivalNotification extends Base {
public class ArrivalNotification extends BaseInfo {
public final MessagePad.ArrivalNotification bean;
public ArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification bean) {
super(bean.getSerializedSize(), header);
super("接收", bean.getSerializedSize(), header);
this.bean = bean;
}

View File

@@ -4,11 +4,11 @@ import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
public class AutopilotState extends Base {
public class AutopilotState extends BaseInfo {
public final MessagePad.AutopilotState bean;
public AutopilotState(MessagePad.Header header, MessagePad.AutopilotState bean) {
super(bean.getSerializedSize(), header);
super("接收", bean.getSerializedSize(), header);
this.bean = bean;
}

View File

@@ -1,21 +0,0 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
public abstract class Base {
public final MessagePad.Header header;
public final int len;
public Base(int len, MessagePad.Header header) {
this.len = 8 + header.getSerializedSize() + len;
this.header = header;
}
@Override
public String toString() {
return len + "##Header:[" + TextFormat.printer().escapingNonAscii(false).shortDebugString(header)+"]\n";
}
}

View File

@@ -0,0 +1,32 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
public abstract class BaseInfo {
public final String action;
public final long nowTime;
public final MessagePad.Header header;
public final int len;
public BaseInfo(String action, int len, MessagePad.Header header) {
this.action = action;
nowTime = System.currentTimeMillis();
this.len = 8 + header.getSerializedSize() + len;
this.header = header;
}
public BaseInfo(String action, int len) {
this.action = action;
nowTime = System.currentTimeMillis();
this.len = len;
this.header = null;
}
@Override
public String toString() {
return len + "##Header:[" + TextFormat.printer().escapingNonAscii(false).shortDebugString(header) + "]\n";
}
}

View File

@@ -4,11 +4,11 @@ import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
public class BasicInfoReq extends Base {
public class BasicInfoReq extends BaseInfo {
public final MessagePad.BasicInfoReq bean;
public BasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq bean) {
super(bean.getSerializedSize(), header);
super("接收", bean.getSerializedSize(), header);
this.bean = bean;
}

View File

@@ -4,11 +4,11 @@ import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
public class CarConfigResp extends Base {
public class CarConfigResp extends BaseInfo {
public final MessagePad.CarConfigResp bean;
public CarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp bean) {
super(bean.getSerializedSize(), header);
super("接收", bean.getSerializedSize(), header);
this.bean = bean;
}

View File

@@ -3,11 +3,12 @@ package com.zhidao.adas.client.bean;
import com.zhidao.support.adas.high.common.DigitalTrans;
import com.zhidao.support.adas.high.common.ProtocolStatus;
public class ErrorData {
public class ErrorData extends BaseInfo {
private final ProtocolStatus status;
private final byte[] bytes;
public ErrorData(ProtocolStatus status, byte[] bytes) {
super("接收", bytes.length);
this.status = status;
this.bytes = bytes;
}

View File

@@ -4,11 +4,11 @@ import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
public class GlobalPathResp extends Base {
public class GlobalPathResp extends BaseInfo {
public final MessagePad.GlobalPathResp bean;
public GlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp bean) {
super(bean.getSerializedSize(), header);
super("接收", bean.getSerializedSize(), header);
this.bean = bean;
}

View File

@@ -4,11 +4,11 @@ import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
public class GnssInfo extends Base {
public class GnssInfo extends BaseInfo {
public final MessagePad.GnssInfo bean;
public GnssInfo(MessagePad.Header header, MessagePad.GnssInfo bean) {
super(bean.getSerializedSize(), header);
super("接收", bean.getSerializedSize(), header);
this.bean = bean;
}

View File

@@ -5,11 +5,11 @@ import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
public class MogoReportMessage extends Base {
public class MogoReportMessage extends BaseInfo {
public final MogoReportMsg.MogoReportMessage bean;
public MogoReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage bean) {
super(bean.getSerializedSize(), header);
super("接收", bean.getSerializedSize(), header);
this.bean = bean;
}

View File

@@ -0,0 +1,10 @@
package com.zhidao.adas.client.bean;
public class MySSHResult extends BaseInfo {
public final String info;
public MySSHResult(String info, int len) {
super("接收", len);
this.info = info;
}
}

View File

@@ -5,11 +5,11 @@ import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
import perception.TrafficLightOuterClass;
public class PerceptionTrafficLight extends Base {
public class PerceptionTrafficLight extends BaseInfo {
public final TrafficLightOuterClass.TrafficLights bean;
public PerceptionTrafficLight(MessagePad.Header header, TrafficLightOuterClass.TrafficLights bean) {
super(bean.getSerializedSize(), header);
super("接收", bean.getSerializedSize(), header);
this.bean = bean;
}

View File

@@ -5,11 +5,11 @@ import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
import record_cache.RecordPanelOuterClass;
public class RecordPanel extends Base {
public class RecordPanel extends BaseInfo {
public final RecordPanelOuterClass.RecordPanel bean;
public RecordPanel(MessagePad.Header header, RecordPanelOuterClass.RecordPanel bean) {
super(bean.getSerializedSize(), header);
super("接收", bean.getSerializedSize(), header);
this.bean = bean;
}

View File

@@ -4,11 +4,11 @@ import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
public class TrackedObjects extends Base {
public class TrackedObjects extends BaseInfo {
private MessagePad.TrackedObjects bean;
public TrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects bean) {
super(bean.getSerializedSize(), header);
super("接收", bean.getSerializedSize(), header);
this.bean = bean;
}

View File

@@ -4,11 +4,11 @@ import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
public class Trajectory extends Base {
public class Trajectory extends BaseInfo {
public final MessagePad.Trajectory bean;
public Trajectory(MessagePad.Header header, MessagePad.Trajectory bean) {
super(bean.getSerializedSize(), header);
super("接收", bean.getSerializedSize(), header);
this.bean = bean;
}
@Override

View File

@@ -5,11 +5,11 @@ import com.google.protobuf.TextFormat;
import chassis.VehicleStateOuterClass;
import mogo.telematics.pad.MessagePad;
public class VehicleState extends Base {
public class VehicleState extends BaseInfo {
public final VehicleStateOuterClass.VehicleState bean;
public VehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState bean) {
super(bean.getSerializedSize(), header);
super("接收", bean.getSerializedSize(), header);
this.bean = bean;
}

View File

@@ -4,11 +4,11 @@ import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
public class Warn extends Base {
public class Warn extends BaseInfo {
public final MessagePad.Warn bean;
public Warn(MessagePad.Header header, MessagePad.Warn bean) {
super(bean.getSerializedSize(), header);
super("接收", bean.getSerializedSize(), header);
this.bean = bean;
}

View File

@@ -4,6 +4,21 @@ import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import com.zhidao.adas.client.OnAdasClientListener;
import com.zhidao.adas.client.bean.ArrivalNotification;
import com.zhidao.adas.client.bean.AutopilotState;
import com.zhidao.adas.client.bean.BaseInfo;
import com.zhidao.adas.client.bean.BasicInfoReq;
import com.zhidao.adas.client.bean.CarConfigResp;
import com.zhidao.adas.client.bean.GlobalPathResp;
import com.zhidao.adas.client.bean.GnssInfo;
import com.zhidao.adas.client.bean.MogoReportMessage;
import com.zhidao.adas.client.bean.PerceptionTrafficLight;
import com.zhidao.adas.client.bean.RecordPanel;
import com.zhidao.adas.client.bean.TrackedObjects;
import com.zhidao.adas.client.bean.Trajectory;
import com.zhidao.adas.client.bean.VehicleState;
import com.zhidao.adas.client.bean.Warn;
import com.zhidao.support.adas.high.common.ThreadPoolManager;
import java.io.BufferedWriter;
@@ -11,7 +26,9 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
@@ -25,12 +42,13 @@ public class LogSave {
private static final String LOG_FILE_NAME = "%s.log";//文件名称
private volatile static LogSave INSTANCE;
private static final long MAX_CAPACITY = 20 * 1024 * 1024L;//单文件最大存储容量 kb
private final LinkedBlockingQueue<String> queue;
private final LinkedBlockingQueue<BaseInfo> queue;
private BufferedWriter buff = null;
private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault());
private File file;
private volatile long capacity = MAX_CAPACITY;
private Future future;
private List<OnAdasClientListener> listeners = new ArrayList<>();
private LogSave() {
queue = new LinkedBlockingQueue<>();
@@ -47,6 +65,15 @@ public class LogSave {
return INSTANCE;
}
public void registerOnAdasClientListener(OnAdasClientListener listener) {
if (!listeners.contains(listener)) {
listeners.add(listener);
}
}
public void unregisterOnAdasClientListener(OnAdasClientListener listener) {
listeners.remove(listener);
}
public boolean isSdcardUse() {
boolean bl = false;
@@ -74,13 +101,12 @@ public class LogSave {
}
public void saveLog(String action, String data) {
long nowTime = System.currentTimeMillis();
String time = sdf.format(new Date(nowTime));
String builder = time + " [action]:" + action + " [data]:" + data;
queue.add(builder);
}
public void saveLog(BaseInfo info) {
if (isStart()) {
queue.add(info);
}
}
public boolean isStart() {
return future != null;
}
@@ -128,9 +154,43 @@ public class LogSave {
closeBufferedWriter();
getFile();
}
String data = queue.take();
if (!TextUtils.isEmpty(data)) {
buff.write(data);
BaseInfo data = queue.take();
if (!listeners.isEmpty()) {
for (OnAdasClientListener listener : listeners) {
if (data instanceof Trajectory) {
listener.onTrajectory((Trajectory) data);
} else if (data instanceof TrackedObjects) {
listener.onTrackedObjects((TrackedObjects) data);
}else if (data instanceof GnssInfo) {
listener.onGnssInfo((GnssInfo) data);
}else if (data instanceof VehicleState) {
listener.onVehicleState((VehicleState) data);
}else if (data instanceof AutopilotState) {
listener.onAutopilotState((AutopilotState) data);
}else if (data instanceof MogoReportMessage) {
listener.onReportMessage((MogoReportMessage) data);
}else if (data instanceof PerceptionTrafficLight) {
listener.onPerceptionTrafficLight((PerceptionTrafficLight) data);
}else if (data instanceof BasicInfoReq) {
listener.onBasicInfoReq((BasicInfoReq) data);
}else if (data instanceof CarConfigResp) {
listener.onCarConfigResp((CarConfigResp) data);
}else if (data instanceof RecordPanel) {
listener.onRecordResult((RecordPanel) data);
}else if (data instanceof GlobalPathResp) {
listener.onGlobalPathResp((GlobalPathResp) data);
}else if (data instanceof Warn) {
listener.onWarn((Warn) data);
}else if (data instanceof ArrivalNotification) {
listener.onArrivalNotification((ArrivalNotification) data);
}
}
}
String time = sdf.format(new Date(data.nowTime));
String builder = time + " [action]:" + data.action + " [data]:" + data.toString();
if (!TextUtils.isEmpty(builder)) {
buff.write(builder);
buff.newLine();
buff.flush();
}

View File

@@ -54,6 +54,7 @@ import com.zhidao.adas.client.bean.GlobalPathResp;
import com.zhidao.adas.client.bean.GnssInfo;
import com.zhidao.adas.client.bean.IPCConnectState;
import com.zhidao.adas.client.bean.MogoReportMessage;
import com.zhidao.adas.client.bean.MySSHResult;
import com.zhidao.adas.client.bean.PerceptionTrafficLight;
import com.zhidao.adas.client.bean.RecordPanel;
import com.zhidao.adas.client.bean.TrackedObjects;
@@ -632,7 +633,8 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onSSHResult(final SSHResult info) {
LogSave.getInstance().saveLog("接收", info.toString());
MySSHResult result = new MySSHResult(info.toString(), 0);
LogSave.getInstance().saveLog(result);
showToastCenter("IPC命令下发结果" + info.code + " 命令:" + info.cmd + " 信息:" + info.msg);
CupidLogUtils.w(TAG, "IPC命令下发结果" + info.code + " 命令:" + info.cmd + " 信息:" + info.msg);
}
@@ -640,63 +642,63 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onError(ProtocolStatus status, byte[] bytes) {
ErrorData base = new ErrorData(status, bytes);
LogSave.getInstance().saveLog("接收", base.toString());
LogSave.getInstance().saveLog(base);
EventBus.getDefault().post(base);
}
@Override
public void onTrajectory(MessagePad.Header header, MessagePad.Trajectory trajectory) {
Trajectory base = new Trajectory(header, trajectory);
LogSave.getInstance().saveLog("接收", base.toString());
LogSave.getInstance().saveLog(base);
EventBus.getDefault().post(base);
}
@Override
public void onTrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects trackedObjects) {
TrackedObjects base = new TrackedObjects(header, trackedObjects);
LogSave.getInstance().saveLog("接收", base.toString());
LogSave.getInstance().saveLog(base);
EventBus.getDefault().post(base);
}
@Override
public void onGnssInfo(MessagePad.Header header, MessagePad.GnssInfo gnssInfo) {
GnssInfo base = new GnssInfo(header, gnssInfo);
LogSave.getInstance().saveLog("接收", base.toString());
LogSave.getInstance().saveLog(base);
EventBus.getDefault().post(base);
}
@Override
public void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState) {
VehicleState base = new VehicleState(header, vehicleState);
LogSave.getInstance().saveLog("接收", base.toString());
LogSave.getInstance().saveLog(base);
EventBus.getDefault().post(base);
}
@Override
public void onAutopilotState(MessagePad.Header header, MessagePad.AutopilotState autopilotState) {
AutopilotState base = new AutopilotState(header, autopilotState);
LogSave.getInstance().saveLog("接收", base.toString());
LogSave.getInstance().saveLog(base);
EventBus.getDefault().post(base);
}
@Override
public void onReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage mogoReportMessage) {
MogoReportMessage base = new MogoReportMessage(header, mogoReportMessage);
LogSave.getInstance().saveLog("接收", base.toString());
LogSave.getInstance().saveLog(base);
EventBus.getDefault().post(base);
}
@Override
public void onPerceptionTrafficLight(MessagePad.Header header, TrafficLightOuterClass.TrafficLights trafficLights) {
PerceptionTrafficLight base = new PerceptionTrafficLight(header, trafficLights);
LogSave.getInstance().saveLog("接收", base.toString());
LogSave.getInstance().saveLog(base);
EventBus.getDefault().post(base);
}
@Override
public void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq) {
BasicInfoReq info = new BasicInfoReq(header, basicInfoReq);
LogSave.getInstance().saveLog("接收", info.toString());
LogSave.getInstance().saveLog(info);
AdasManager.getInstance().sendBasicInfoResp("X202021111192N41VY", 1);
showToastCenter("收到车机基础信息请求:" + info.toString());
// EventBus.getDefault().post(new BasicInfoReq(header, basicInfoReq));
@@ -705,14 +707,14 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onCarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp carConfigResp) {
CarConfigResp base = new CarConfigResp(header, carConfigResp);
LogSave.getInstance().saveLog("接收", base.toString());
LogSave.getInstance().saveLog(base);
EventBus.getDefault().postSticky(base);
}
@Override
public void onRecordResult(MessagePad.Header header, RecordPanelOuterClass.RecordPanel recordPanel) {
RecordPanel base = new RecordPanel(header, recordPanel);
LogSave.getInstance().saveLog("接收", base.toString());
LogSave.getInstance().saveLog(base);
recordKey = recordPanel.getKey();
recordFileName = recordPanel.getFilename();
EventBus.getDefault().post(base);
@@ -721,27 +723,27 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
@Override
public void onGlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp globalPathResp) {
GlobalPathResp base = new GlobalPathResp(header, globalPathResp);
LogSave.getInstance().saveLog("接收", base.toString());
LogSave.getInstance().saveLog(base);
EventBus.getDefault().post(base);
}
@Override
public void onWarn(MessagePad.Header header, MessagePad.Warn warn) {
Warn base = new Warn(header, warn);
LogSave.getInstance().saveLog("接收", base.toString());
LogSave.getInstance().saveLog(base);
EventBus.getDefault().post(base);
}
@Override
public void onArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification arrivalNotification) {
ArrivalNotification base = new ArrivalNotification(header, arrivalNotification);
LogSave.getInstance().saveLog("接收", base.toString());
LogSave.getInstance().saveLog(base);
EventBus.getDefault().post(base);
}
@Override
public void onUpgradeStateInfo(final IPCUpgradeStateInfo info) {
LogSave.getInstance().saveLog("接收", info.toString());
// LogSave.getInstance().saveLog("接收", info.toString());
EventBus.getDefault().post(info);
}
@@ -898,7 +900,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
}
getHandler().sendEmptyMessage(WHAT_IPC_IP);
}
LogSave.getInstance().saveLog("连接状态", status);
// LogSave.getInstance().saveLog("连接状态", status);
CupidLogUtils.i(TAG, "connectStatus=" + status);
}

View File

@@ -166,7 +166,7 @@ ext {
crashreportapmbyte : "com.mogo.test:crashreport-apmbyte:${CRASHREPORT_APMBYTE_VERSION}",
crashreportnoop : "com.mogo.test:crashreport-noop:${CRASHREPORT_NOOP_VERSION}",
crashreportupgrade : "com.mogo.test:crashreport-upgrade:${CRASHREPORT_UPGRADE_VERSION}",
apm_insight : 'com.volcengine:apm_insight:1.4.4.cn',
apm_insight : 'com.volcengine:apm_insight:1.4.5.cn',
apm_insight_crash : 'com.volcengine:apm_insight_crash:1.4.2',
//========================= TTS语音 Maven 版本管理 =========================

View File

@@ -10,6 +10,7 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.function.api.bindingcar.BindingcarCallBack;
import com.mogo.eagle.core.function.api.bindingcar.IMoGoBindingcarProvider;
import com.mogo.eagle.core.function.bindingcar.network.BindingcarNetWorkManager;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import org.jetbrains.annotations.NotNull;
@@ -66,11 +67,13 @@ public class BindingcarProvider implements IMoGoBindingcarProvider {
private int getScreenType() {
int screenType = -1;
if (FunctionBuildConfig.appIdentityMode == 0 || FunctionBuildConfig.appIdentityMode == 0xA0) {
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
screenType = 1; //司机屏
} else if (FunctionBuildConfig.appIdentityMode == 1 || FunctionBuildConfig.appIdentityMode == 0xA1) {
screenType = 2; //乘客屏
}
// if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
// screenType = 2; //乘客屏
// }
return screenType;
}

View File

@@ -6,8 +6,8 @@ import com.mogo.commons.mvp.Presenter
* @author xiaoyuzhou
* @date 2021/8/3 3:55 下午
*/
class WaringPresenter(view: MoGoWarningContract.View?) :
Presenter<MoGoWarningContract.View?>(view) {
class HmiPresenter(view: MoGoHmiContract.View?) :
Presenter<MoGoHmiContract.View?>(view) {
}

View File

@@ -11,7 +11,7 @@ import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
*@author xiaoyuzhou
*@date 2021/8/4 3:38 下午
*/
interface MoGoWarningContract {
interface MoGoHmiContract {
interface View : IView {

View File

@@ -60,10 +60,10 @@ import java.util.*
* 预警图层
*/
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_HMI)
class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>(),
class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
IMoGoWaringProvider,
IMoGoHmiViewProxy,
MoGoWarningContract.View,
MoGoHmiContract.View,
IMoGoAutopilotRecordListener {
private val TAG = "MoGoHmiFragment"
@@ -347,8 +347,8 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
return TAG
}
override fun createPresenter(): WaringPresenter {
return WaringPresenter(this)
override fun createPresenter(): HmiPresenter {
return HmiPresenter(this)
}
override fun setSpeedChartViewVisibility(visibility: Int) {

View File

@@ -10,7 +10,9 @@ import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import android.view.animation.DecelerateInterpolator
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import kotlinx.android.synthetic.main.view_brake_light_status.view.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
@@ -28,7 +30,12 @@ class BrakeViewStatus @JvmOverloads constructor(
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
init {
LayoutInflater.from(context).inflate(R.layout.view_brake_light_status, this, true)
//bus乘客端
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
LayoutInflater.from(context).inflate(R.layout.view_brake_light_status_daytime, this, true)
} else {
LayoutInflater.from(context).inflate(R.layout.view_brake_light_status, this, true)
}
}
private var isBrake: Boolean = false
@@ -55,12 +62,12 @@ class BrakeViewStatus @JvmOverloads constructor(
if (isBrake) {
isBrake = false
GlobalScope.launch(Dispatchers.Main) {
scaleImageAndTv()
// scaleImageAndTv()
var disappearAnimation = AlphaAnimation(1f, 0f)
disappearAnimation.duration = 1200
disappearAnimation.duration = 400
layout_brake.startAnimation(disappearAnimation)
image_brake.startAnimation(disappearAnimation)
tv_brake.startAnimation(disappearAnimation)
// image_brake.startAnimation(disappearAnimation)
// tv_brake.startAnimation(disappearAnimation)
disappearAnimation.setAnimationListener(object : Animation.AnimationListener {
override fun onAnimationRepeat(p0: Animation?) {

View File

@@ -107,9 +107,9 @@ class TurnLightViewStatus @JvmOverloads constructor(
//显示背景
private fun showNormalAnimation() {
val appearAnimation = AlphaAnimation(0f, 1.0f)
appearAnimation.duration = 600
appearAnimation.duration = 300
val appearAnimationImage = AlphaAnimation(0f, 1.0f)
appearAnimation.duration = 1000
appearAnimation.duration = 500
turn_light_layout.startAnimation(appearAnimation)
left_nor_image.startAnimation(appearAnimationImage)
right_nor_image.startAnimation(appearAnimationImage)
@@ -134,7 +134,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
disappearAnimationLeft.duration = 300
val disappearAnimationBg = AlphaAnimation(1.0f, 0f)
disappearAnimationBg.duration = 1200
disappearAnimationBg.duration = 500
left_nor_image.startAnimation(disappearAnimationLeft)
right_nor_image.startAnimation(disappearAnimationLeft)
@@ -170,7 +170,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
//实现图片闪烁效果
private fun setAnimation(imageView: ImageView) {
val animation = AlphaAnimation(1.0f, 0f)
animation.duration = 600
animation.duration = 500
animation.interpolator = LinearInterpolator()
animation.repeatCount = Animation.INFINITE
animation.repeatMode = Animation.REVERSE

View File

@@ -5,6 +5,7 @@ import android.content.Context
import android.content.res.TypedArray
import android.graphics.*
import android.util.AttributeSet
import android.util.Log
import android.view.View
import android.view.animation.OvershootInterpolator
import androidx.core.content.ContextCompat
@@ -16,23 +17,28 @@ import com.mogo.eagle.core.function.hmi.R
* @since: 2022/1/14
*/
class CircularProgressView @JvmOverloads constructor(
context: Context, attrs: AttributeSet?, defStyleAttr : Int)
: View(context, attrs, defStyleAttr){
context: Context, attrs: AttributeSet?, defStyleAttr: Int)
: View(context, attrs, defStyleAttr) {
val typedArray: TypedArray = context.obtainStyledAttributes(attrs, R.styleable.CircularProgressView)
val TAG: String = "CircularProgressView"
val typedArray : TypedArray = context.obtainStyledAttributes(attrs, R.styleable.CircularProgressView)
// 绘制画笔
private val mBackPaint : Paint = Paint()
private val mProgPaint : Paint = Paint()
private val mBackPaint: Paint = Paint()
private val mProgPaint: Paint = Paint()
// 绘制区域
private var mRectF : RectF? = null
private var mRectF: RectF? = null
// 圆环渐变色
private var mColorArray : IntArray?=null
private var mColorArray: IntArray? = null
// 圆环进度(0-100) 初始化进度
private var mProgress : Int = typedArray.getInteger(R.styleable.CircularProgressView_progress, 0)
private var mProgress: Int = typedArray.getInteger(R.styleable.CircularProgressView_progress, 0)
constructor(context : Context) : this(context,null)
constructor(context: Context) : this(context, null)
constructor(context : Context,attrs : AttributeSet?) :this(context, attrs, 0)
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
init {
// 初始化背景圆环画笔
@@ -52,9 +58,9 @@ class CircularProgressView @JvmOverloads constructor(
// 初始化进度圆环渐变色
val startColor = typedArray.getColor(R.styleable.CircularProgressView_progStartColor, -1)
val firstColor = typedArray.getColor(R.styleable.CircularProgressView_progFirstColor, -1)
if(startColor != -1 && firstColor != -1){
mColorArray = intArrayOf(startColor,firstColor)
}else{
if (startColor != -1 && firstColor != -1) {
mColorArray = intArrayOf(startColor, firstColor)
} else {
mColorArray = null
}
@@ -67,16 +73,17 @@ class CircularProgressView @JvmOverloads constructor(
val viewWide = getMeasuredWidth() - getPaddingLeft() - getPaddingRight();
val viewHigh = getMeasuredHeight() - getPaddingTop() - getPaddingBottom();
val mRectLength =
((if (viewWide > viewHigh) viewHigh else viewWide) - if (mBackPaint.strokeWidth > mProgPaint.strokeWidth) mBackPaint.strokeWidth else mProgPaint.strokeWidth).toInt()
((if (viewWide > viewHigh) viewHigh else viewWide) - if (mBackPaint.strokeWidth > mProgPaint.strokeWidth) mBackPaint.strokeWidth else mProgPaint.strokeWidth).toInt()
val mRectL = getPaddingLeft() + (viewWide - mRectLength) / 2
val mRectT = getPaddingTop() + (viewHigh - mRectLength) / 2
mRectF = RectF(mRectL.toFloat(), mRectT.toFloat(), (mRectL + mRectLength).toFloat(),
(mRectT + mRectLength).toFloat())
(mRectT + mRectLength).toFloat())
Log.d(TAG, "渐变色:" + mColorArray?.size.toString())
// 设置进度圆环渐变色
mColorArray?.let {
mProgPaint.shader = LinearGradient(
0.0f, 0.0f, 0.0f,
measuredWidth.toFloat(), it, null, Shader.TileMode.MIRROR)
0.0f, 0.0f, 0.0f,
measuredWidth.toFloat(), it, null, Shader.TileMode.MIRROR)
}
}
@@ -84,9 +91,11 @@ class CircularProgressView @JvmOverloads constructor(
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
canvas?.let {
mRectF?.let { it1 -> it.drawArc(it1, 0.0f, 360.0f, false, mBackPaint) }
mRectF?.let { it1 -> it.drawArc(it1, 275.0f,
(360 * mProgress / 100).toFloat(), false, mProgPaint) }
mRectF?.let { it1 -> it.drawArc(it1, 0.0f, 360.0f, false, mBackPaint) }
mRectF?.let { it1 ->
it.drawArc(it1, 275.0f,
(360 * mProgress / 100).toFloat(), false, mProgPaint)
}
}
}
@@ -95,7 +104,7 @@ class CircularProgressView @JvmOverloads constructor(
* 获取当前进度
* @return 当前进度0-100
*/
fun getProgress() : Int{
fun getProgress(): Int {
return mProgress
}
@@ -103,7 +112,7 @@ class CircularProgressView @JvmOverloads constructor(
* 设置当前进度
* @param progress 当前进度0-100
*/
fun setProgress(progress : Int){
fun setProgress(progress: Int) {
mProgress = progress
invalidate()
}
@@ -113,12 +122,12 @@ class CircularProgressView @JvmOverloads constructor(
* @param progress 当前进度0-100
* @param animTime 动画时间(毫秒)
*/
fun setProgress(progress : Int, animTime : Long){
if (animTime<=0){
fun setProgress(progress: Int, animTime: Long) {
if (animTime <= 0) {
setProgress(progress)
} else{
} else {
val animator = ValueAnimator.ofInt(mProgress, progress)
animator.addUpdateListener{
animator.addUpdateListener {
mProgress = it.animatedValue as Int
invalidate()
}
@@ -132,7 +141,7 @@ class CircularProgressView @JvmOverloads constructor(
* 设置背景圆环宽度
* @param width 背景圆环宽度
*/
fun setBackWidth(width : Int){
fun setBackWidth(width: Int) {
mBackPaint.strokeWidth = width.toFloat()
invalidate()
}
@@ -141,8 +150,8 @@ class CircularProgressView @JvmOverloads constructor(
* 设置背景圆环颜色
* @param color 背景圆环颜色
*/
fun setBackColor(color : Int){
mBackPaint.color = ContextCompat.getColor(context,color)
fun setBackColor(color: Int) {
mBackPaint.color = ContextCompat.getColor(context, color)
invalidate()
}
@@ -150,39 +159,50 @@ class CircularProgressView @JvmOverloads constructor(
* 设置进度圆环宽度
* @param width 进度圆环宽度
*/
fun setProgWidth(width : Int){
fun setProgWidth(width: Int) {
mProgPaint.strokeWidth = width.toFloat()
invalidate()
}
/**
* 设置进度圆环
* 设置进度圆环渐变色起始
* @param color 景圆环颜色
*/
fun setProgColor(color : Int){
mProgPaint.color = ContextCompat.getColor(context,color)
fun setProgColor(color: Int) {
mProgPaint.color = ContextCompat.getColor(context, color)
mProgPaint.shader = null
invalidate()
}
fun setProgColor(startColor : Int,endColor: Int){
mColorArray = intArrayOf(ContextCompat.getColor(context,startColor),ContextCompat.getColor(context,endColor))
/**
* 渐变色结束色
*/
fun setProgFirstColor(color: Int) {
mProgPaint.color = ContextCompat.getColor(context, color)
mProgPaint.shader = null
invalidate()
}
fun setProgColor(startColor: Int, endColor: Int) {
mColorArray = intArrayOf(ContextCompat.getColor(context, startColor), ContextCompat.getColor(context, endColor))
mColorArray?.let {
mProgPaint.shader = LinearGradient(0f, 0f, 0f,
getMeasuredWidth().toFloat(), it, null, Shader.TileMode.MIRROR)
getMeasuredWidth().toFloat(), it, null, Shader.TileMode.MIRROR)
}
}
fun setProgColor(colorArray : IntArray){
fun setProgColor(colorArray: IntArray) {
colorArray.let {
if(it.size<2){
if (it.size < 2) {
return
}
mColorArray = it.copyOf()
mColorArray?.let{
mColorArray?.let {
mProgPaint.shader = LinearGradient(0f, 0f, 0f,
getMeasuredWidth().toFloat(), it, null, Shader.TileMode.MIRROR)
getMeasuredWidth().toFloat(), it, null, Shader.TileMode.MIRROR)
}
}

View File

@@ -0,0 +1,190 @@
package com.mogo.eagle.core.function.hmi.ui.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import org.jetbrains.annotations.NotNull;
import chassis.Chassis;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
/**
* @author Jing
* @description 方向盘
* 方向盘跟随CAN数据做旋转
* 档位随CAN数据做切换和高亮显示
* @since: 4/7/22
*/
public class SteeringWheelView extends ConstraintLayout {
private static final String TAG = "SteeringWheelView";
private ImageView autopilotIV;
private TextView steeringTV;
private TapPositionView tapPositionView;
private CircularProgressView steeringCircularV;
private RotateAnimation rotateAnimation;
private float fromDegrees = 0;//方向盘旋转起始位置
public SteeringWheelView(@NonNull Context context) {
super(context);
Log.d(TAG, "1");
}
public SteeringWheelView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Log.d(TAG, "2");
LayoutInflater.from(context).inflate(R.layout.hmi_steering_wheel, this);
initView();
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, mIMoGoAutopilotVehicleStateListener);
}
private void initView() {
autopilotIV = (ImageView) findViewById(R.id.autopilot_iv);
steeringTV = findViewById(R.id.steering_tv);
tapPositionView = findViewById(R.id.tap_position);
steeringCircularV = findViewById(R.id.steering_circular);
steeringCircularV.setBackWidth(8);
steeringCircularV.setBackColor(R.color.hmi_light_blue_00);
steeringCircularV.setProgColor(R.color.hmi_light_blue, R.color.hmi_dark_blue);
steeringCircularV.setProgress(10, 1000);
}
public SteeringWheelView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
Log.d(TAG, "3");
}
public SteeringWheelView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
Log.d(TAG, "4");
}
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
@Override
public void onAutopilotArriveAtStation(@org.jetbrains.annotations.Nullable MessagePad.ArrivalNotification arrivalNotification) {
}
@Override
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
}
@Override
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
if (autopilotStatusInfo == null) return;
int state = autopilotStatusInfo.getState();
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "state = %s", state);
if (autopilotIV != null) {
Log.d(TAG, "autopilotIV != null");
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
autopilotIV.setImageResource(R.drawable.bg_auto);
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
autopilotIV.setImageResource(R.drawable.bg_auto_nor);
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
autopilotIV.setImageResource(R.drawable.bg_auto_nor);
}
} else {
Log.d(TAG, "autopilotIV=null");
}
}
@Override
public void onAutopilotSNRequest() {
}
};
private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() {
/**
* 车辆转向灯
* @param lightSwitch
*/
@Override
public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) {
Log.d(TAG, "车辆转向灯:" + lightSwitch.toString());
}
/**
* 刹车灯
* @param brakeLight
*/
@Override
public void onAutopilotBrakeLightData(boolean brakeLight) {
Log.d(TAG, "刹车灯:" + String.valueOf(brakeLight));
}
@Override
public void onAutopilotSteeringData(float steering) {
if (steeringTV != null && String.valueOf(steering) != null) {
steeringTV.setText(String.valueOf(steering) + "°");
steeringCircularV.setProgress((int) steering, 1000);
animationWithSteeringData(steering);
} else {
Log.d(TAG, "steering未呈现");
}
}
/**
* 档位
* @param gear
*/
@Override
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
Log.d(TAG, "档位" + gear.toString());
if (tapPositionView != null) {
tapPositionView.updateWithGear(gear);
}
}
};
/**
* 方向盘随CAN数据做方向和角度旋转
* 参数1从哪一个旋转角度开始
* 参数2转到什么角度
* 后4个参数用于设置围绕着旋转的圆的圆心在哪里
* 参数3肯定x轴坐标的类型有ABSOLUT绝对坐标、RELATIVE_TO_SELF相对于自身坐标、RELATIVE_TO_PARENT相对于父控件的坐标
* 参数4x轴的值0.5f代表是以自身这个控件的一半长度为x轴
* 参数5肯定y轴坐标的类型
* 参数6y轴的值0.5f代表是以自身这个控件的一半长度为x轴
*
* @param steering
*/
private void animationWithSteeringData(float steering) {
Log.d(TAG, "方向盘转动" + String.valueOf(steering));
rotateAnimation = new RotateAnimation(fromDegrees, steering,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setDuration(1000);//旋转时长
rotateAnimation.setFillAfter(true);//旋转后保持原状
autopilotIV.clearAnimation();
autopilotIV.startAnimation(rotateAnimation);
fromDegrees = steering;
}
}

View File

@@ -0,0 +1,80 @@
package com.mogo.eagle.core.function.hmi.ui.widget;
import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.eagle.core.function.hmi.R;
import org.jetbrains.annotations.NotNull;
import chassis.Chassis;
/**
* @author Jing
* @description 方向盘下方的档位
* @since: 4/7/22
*/
public class TapPositionView extends ConstraintLayout {
private static final String TAG = "TapPositionView";
private TextView tabP;
private TextView tabR;
private TextView tabN;
private TextView tabD;
public TapPositionView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Log.d(TAG, "2");
LayoutInflater.from(context).inflate(R.layout.hmi_tap_position, this);
tabP = findViewById(R.id.tap_p);
tabR = findViewById(R.id.tap_r);
tabN = findViewById(R.id.tap_n);
tabD = findViewById(R.id.tap_d);
}
public void updateWithGear(@NotNull Chassis.GearPosition gear) {
if (tabP != null && tabR != null && tabN != null && tabD != null) {
switch (gear) {
case GEAR_NONE:
tabP.setTextColor(Color.parseColor("#6E8EC9"));
tabR.setTextColor(Color.parseColor("#6E8EC9"));
tabN.setTextColor(Color.parseColor("#6E8EC9"));
tabD.setTextColor(Color.parseColor("#6E8EC9"));
break;
case GEAR_P:
tabP.setTextColor(Color.parseColor("#0043FF"));
tabR.setTextColor(Color.parseColor("#6E8EC9"));
tabN.setTextColor(Color.parseColor("#6E8EC9"));
tabD.setTextColor(Color.parseColor("#6E8EC9"));
break;
case GEAR_R:
tabR.setTextColor(Color.parseColor("#0043FF"));
tabP.setTextColor(Color.parseColor("#6E8EC9"));
tabN.setTextColor(Color.parseColor("#6E8EC9"));
tabD.setTextColor(Color.parseColor("#6E8EC9"));
break;
case GEAR_N:
tabN.setTextColor(Color.parseColor("#0043FF"));
tabR.setTextColor(Color.parseColor("#6E8EC9"));
tabP.setTextColor(Color.parseColor("#6E8EC9"));
tabD.setTextColor(Color.parseColor("#6E8EC9"));
break;
case GEAR_D:
tabD.setTextColor(Color.parseColor("#0043FF"));
tabN.setTextColor(Color.parseColor("#6E8EC9"));
tabR.setTextColor(Color.parseColor("#6E8EC9"));
tabP.setTextColor(Color.parseColor("#6E8EC9"));
break;
default:
break;
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/background">
<shape
android:innerRadius="@dimen/dp_85"
android:shape="ring"
android:thickness="4px"
android:useLevel="false">
<solid android:color="#BBCFF6" />
</shape>
</item>
</layer-list>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="@dimen/dp_36"/>
<gradient android:angle="315" android:endColor="#E6E9EFFC" android:startColor="#E6E9EFFC" />
</shape>
</item>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="8"
android:useLevel="false">
<gradient
android:centerColor="#FF7121"
android:centerY="0.50"
android:endColor="#FFFF00"
android:startColor="#6BD3FF"
android:type="sweep"
android:useLevel="false" />
</shape>
</item>
</layer-list>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/brakelight_bg_color_daytime" />
<corners android:radius="@dimen/turnlight_bg_corner" />
</shape>

View File

@@ -137,8 +137,8 @@
<!--限速牌子-->
<com.mogo.eagle.core.function.hmi.ui.widget.LimitingVelocityView
android:id="@+id/viewLimitingVelocity"
android:layout_width="130px"
android:layout_height="130px"
android:layout_width="120px"
android:layout_height="120px"
android:layout_marginTop="30px"
android:layout_marginEnd="40px"
android:background="@drawable/bg_waring_limiting_velocity"

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_steering_wheel">
<ProgressBar
android:id="@+id/blue_circle"
android:layout_width="@dimen/dp_180"
android:layout_height="@dimen/dp_180"
android:layout_centerHorizontal="true"
android:layout_marginLeft="@dimen/dp_60"
android:layout_marginTop="@dimen/dp_38"
android:layout_marginRight="@dimen/dp_60"
android:indeterminateDrawable="@drawable/bg_steering_outer"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/steering_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_50"
android:gravity="right"
android:text="18°"
android:textColor="#415479"
android:textSize="@dimen/dp_26"
app:layout_constraintRight_toLeftOf="@+id/blue_circle"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.eagle.core.function.hmi.ui.widget.CircularProgressView
android:id="@+id/steering_circular"
android:layout_width="@dimen/dp_180"
android:layout_height="@dimen/dp_180"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_36"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:progWidth="8px"
app:progress="0" />
<ImageView
android:id="@+id/autopilot_iv"
android:layout_width="@dimen/dp_144"
android:layout_height="@dimen/dp_144"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_54"
android:src="@drawable/bg_auto"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="@dimen/dp_40"
android:layout_height="@dimen/dp_40"
android:src="@drawable/icon_in_steering"
app:layout_constraintBottom_toBottomOf="@+id/autopilot_iv"
app:layout_constraintLeft_toLeftOf="@+id/autopilot_iv"
app:layout_constraintRight_toRightOf="@+id/autopilot_iv"
app:layout_constraintTop_toTopOf="@+id/autopilot_iv" />
<com.mogo.eagle.core.function.hmi.ui.widget.TapPositionView
android:id="@+id/tap_position"
android:layout_width="@dimen/dp_240"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_30"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/blue_circle" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tap_p"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="P"
android:textAlignment="center"
android:textColor="#738FC4"
android:textSize="@dimen/dp_32"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tap_r"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tap_r"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="R"
android:textAlignment="center"
android:textColor="#738FC4"
android:textSize="@dimen/dp_32"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/tap_p"
app:layout_constraintRight_toLeftOf="@+id/tap_n"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tap_n"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="N"
android:textAlignment="center"
android:textColor="#738FC4"
android:textSize="@dimen/dp_32"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/tap_r"
app:layout_constraintRight_toLeftOf="@+id/tap_d"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tap_d"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="D"
android:textAlignment="center"
android:textColor="#738FC4"
android:textSize="@dimen/dp_32"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/tap_n"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -37,7 +37,7 @@
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!--预警视图 OBU、云端下发、自车感知、自车策略-->
<!--HMI 预警视图 OBU、云端下发、自车感知、自车策略-->
<FrameLayout
android:id="@+id/module_main_id_waring_fragment"
android:layout_width="match_parent"

View File

@@ -25,7 +25,7 @@
android:id="@+id/image_brake"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="110px"
android:layout_marginLeft="115px"
android:layout_gravity="center_vertical"
android:src="@drawable/module_light_nor"
android:visibility="gone"
@@ -37,10 +37,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="20px"
android:text="刹车中"
android:textColor="#ffffff"
android:textSize="45px"
android:textSize="40px"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@+id/image_brake" />

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/brakelight_width_daytime"
android:layout_height="@dimen/brakelight_height_daytime"
android:visibility="visible">
<LinearLayout
android:id="@+id/layout_brake"
android:layout_width="@dimen/brakelight_width_daytime"
android:layout_height="@dimen/brakelight_height_daytime"
android:background="@drawable/brakelight_background_daytime"
android:layout_gravity="top|center_horizontal"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:visibility="gone">
<ImageView
android:id="@+id/image_brake"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@drawable/bus_shache_nor_daytime"
android:layout_marginLeft="15px"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/tv_brake"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="刹车中"
android:textColor="#2D3E5F"
android:textSize="34px"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@+id/image_brake" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -38,8 +38,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:layout_marginLeft="10px"
android:layout_marginTop="5px"
android:layout_marginLeft="13px"
android:layout_marginTop="3px"
android:src="@drawable/module_arrow_left_select_nor"
android:visibility="gone" />
@@ -48,8 +48,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:layout_marginTop="5px"
android:layout_marginRight="10px"
android:layout_marginTop="3px"
android:layout_marginRight="13px"
android:src="@drawable/module_arrow_right_select_nor"
android:visibility="gone" />
</FrameLayout>

View File

@@ -46,6 +46,7 @@
<color name="dialog_bg_color">#3B4577</color>
<color name="turnlight_bg_color">#000000</color>
<color name="brakelight_bg_color_daytime">#E6FFFFFF</color>
<color name="hmi_traffic_light_red_color_up">#FFFFA28B</color>
<color name="hmi_traffic_light_red_color_down">#FFDA1100</color>
@@ -53,4 +54,7 @@
<color name="hmi_traffic_light_green_color_down">#FF006D43</color>
<color name="hmi_traffic_light_yellow_color_up">#FFFFE198</color>
<color name="hmi_traffic_light_yellow_color_down">#FFFF9B00</color>
<color name="hmi_light_blue">#45D3FF</color>
<color name="hmi_dark_blue">#1B5BFF</color>
<color name="hmi_light_blue_00">#0045D3FF</color>
</resources>

View File

@@ -37,10 +37,12 @@
<dimen name="dp_1066">1066px</dimen>
<dimen name="turnlight_bg_corner">60px</dimen>
<dimen name="turnlight_width">270px</dimen>
<dimen name="turnlight_width">275px</dimen>
<dimen name="turnlight_height">120px</dimen>
<dimen name="brakelight_width">460px</dimen>
<dimen name="brakelight_height">120px</dimen>
<dimen name="brakelight_width_daytime">220px</dimen>
<dimen name="brakelight_height_daytime">120px</dimen>
<dimen name="hmi_traffic_light_layout_width">225px</dimen>
<dimen name="hmi_traffic_light_layout_height">154px</dimen>

View File

@@ -1,15 +1,18 @@
package com.mogo.eagle.core.function.map;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
import android.annotation.SuppressLint;
import android.content.Context;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.MogoMarkerManager;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.utils.DrivingDirectionUtils;
import java.util.ArrayList;
import java.util.List;
@@ -31,12 +34,12 @@ public class IdentifyDataDrawer {
/**
* 上一帧数据的缓存
*/
private static final ConcurrentHashMap<String, TrafficData> mMarkersCaches = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<String, MessagePad.TrackedObject> mMarkersCaches = new ConcurrentHashMap<>();
/**
* 已经感知不到的脏数据
*/
private final ConcurrentHashMap<String, TrafficData> mDirtyPositions = new ConcurrentHashMap<>();
private final ConcurrentHashMap<String, MessagePad.TrackedObject> firstData = new ConcurrentHashMap<>();
/**
* 记录每次实际绘制的交通元素UUID
*/
@@ -71,6 +74,7 @@ public class IdentifyDataDrawer {
*
* @param resultList adas感知融合数据
*/
@SuppressLint("NewApi")
public void renderAdasRecognizedResult(List<MessagePad.TrackedObject> resultList) {
if (resultList == null || resultList.isEmpty()) {
clearOldMarker();
@@ -84,35 +88,32 @@ public class IdentifyDataDrawer {
return;
}
// 循环将集合中的数据提取记录
for (MessagePad.TrackedObject trafficData : resultList) {
// 过滤掉未知感知数据
if (!FunctionBuildConfig.isDrawUnknownIdentifyData &&
trafficData.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.getType()) {
//CallerLogger.INSTANCE.w(TAG, "未知感知类型数据,丢弃,不渲染");
continue;
long start = System.currentTimeMillis();
//清除缓存
for (MessagePad.TrackedObject data : resultList) {
if (trafficDataUuidList.size() > 0 && trafficDataUuidList.contains("" + data.getUuid())) {
trafficDataUuidList.remove("" + data.getUuid());
}
trafficDataUuidList.add("" + trafficData.getUuid());
}
// // 找出上一针数据中已经不在本次数据中存在的数据
// for (String uuid : mMarkersCaches.keySet()) {
// if (!trafficDataUuidList.contains(uuid)) {
// mDirtyPositions.put(uuid, mMarkersCaches.get(uuid));
// }
// }
// // 移除脏数据
// for (String uuid : mDirtyPositions.keySet()) {
// MogoApisHandler.getInstance().getApis()
// .getMapServiceApi()
// .getMarkerManager(mContext)
// .removeMarker(uuid);
// }
trafficDataUuidList.forEach(uuid -> {
mMarkersCaches.remove(uuid);
});
// 绘制新数据
MogoMarkerManager.getInstance(mContext)
.updateBatchMarkerPosition(filterTrafficData(resultList));
CallerLogger.INSTANCE.d(M_HMI + "arrow47", "origin data size : " + resultList.size());
ArrayList<MessagePad.TrackedObject> filterList = filterTrafficData(resultList);
long cost = System.currentTimeMillis() - start;
CallerLogger.INSTANCE.d(M_HMI + "arrow47", "cost : " + cost);
if (filterList.size() > 0) {
// 绘制新数据
MogoMarkerManager.getInstance(mContext)
.updateBatchMarkerPosition(filterList);
}
CallerLogger.INSTANCE.d(M_HMI + "arrow47", "first data size : " + firstData.size() + " , mMarkersCaches : " + mMarkersCaches.size());
// 首次未添加的感知物在调用完绘制方法后再塞入cache map
mMarkersCaches.putAll(firstData);
}
/**
@@ -121,14 +122,46 @@ public class IdentifyDataDrawer {
* @return 过滤后的数据集合
*/
private ArrayList<MessagePad.TrackedObject> filterTrafficData(List<MessagePad.TrackedObject> trafficData) {
firstData.clear();
mFilterTrafficData.clear();
trafficDataUuidList.clear();
for (MessagePad.TrackedObject data : trafficData) {
// 过滤掉未知感知数据
if (data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.getType()) {
if (!FunctionBuildConfig.isDrawUnknownIdentifyData && data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.getType()) {
//CallerLogger.INSTANCE.w(TAG, "未知感知类型数据,丢弃,不渲染");
continue;
}
mFilterTrafficData.add(data);
//首次过来的数据不添加,首次未添加的感知物在调用完绘制方法后再塞入cache map
MessagePad.TrackedObject cacheData = mMarkersCaches.get("" + data.getUuid());
if (cacheData != null) {
MessagePad.TrackedObject correctData = null;
//todo 进行修正
if (Math.abs(cacheData.getHeading() - data.getHeading()) > 40 && Math.abs(cacheData.getHeading() - data.getHeading()) < 90) {
CallerLogger.INSTANCE.d(M_HMI + "arrow47", "uuid: " + data.getUuid() + " , 40~90差值范围 , 上一帧 : " + cacheData.getHeading() + " , 当前帧 : " + data.getHeading());
}
if (Math.abs(cacheData.getHeading() - data.getHeading()) > 90) {
int degree = DrivingDirectionUtils.getDegreeOfCar2Poi(cacheData.getLongitude(), cacheData.getLatitude(), data.getLongitude(), data.getLatitude(), Double.valueOf(cacheData.getHeading()).intValue());
if (degree > 90) {
CallerLogger.INSTANCE.d(M_HMI + "arrow47", "uuid: " + data.getUuid() + " , 夹角 : " + degree + " , 修正 上一帧 : " + cacheData.getHeading() + " , 当前帧 : " + data.getHeading());
correctData = data.toBuilder().setHeading(cacheData.getHeading()).build();
} else {
CallerLogger.INSTANCE.d(M_HMI + "arrow47", "uuid: " + data.getUuid() + " , 夹角 : " + degree + " , 未修正 上一帧 : " + cacheData.getHeading() + " , 当前帧 : " + data.getHeading());
}
}
if (correctData != null) {
mFilterTrafficData.add(correctData);
//更新已存在的感知物体数据
mMarkersCaches.put("" + data.getUuid(), correctData);
} else {
mFilterTrafficData.add(data);
//更新已存在的感知物体数据
mMarkersCaches.put("" + data.getUuid(), data);
}
} else {
firstData.put("" + data.getUuid(), data);
}
trafficDataUuidList.add("" + data.getUuid());
}
return mFilterTrafficData;
}

View File

@@ -0,0 +1,212 @@
package com.mogo.eagle.core.function.map;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
import android.annotation.SuppressLint;
import android.content.Context;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.MogoMap;
import com.mogo.map.MogoMarkerManager;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.AdasRecognizedType;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import mogo.telematics.pad.MessagePad;
/**
* @author xiaoyuzhou
* @date 2021/10/19 10:45 上午
* 域控制器识别信息绘制
*/
public class IdentifyDataDrawerTest {
private static final String TAG = "IdentifyDataDrawer";
protected final Context mContext;
private static volatile IdentifyDataDrawerTest sInstance;
/**
* 上一帧数据的缓存
*/
private static final ConcurrentHashMap<String, MessagePad.TrackedObject> mMarkersCaches = new ConcurrentHashMap<>();
private static final ConcurrentHashMap<String, KalmanFilter> algoCache = new ConcurrentHashMap<>();
/**
* 记录每次实际绘制的交通元素UUID
*/
private final ArrayList<String> trafficDataUuidList = new ArrayList<>();
/**
* 过滤后的数据集合
*/
private final ArrayList<MessagePad.TrackedObject> mFilterTrafficData = new ArrayList<>();
private IdentifyDataDrawerTest() {
mContext = AbsMogoApplication.getApp();
addPreVehicleModel();
}
public static IdentifyDataDrawerTest getInstance() {
if (sInstance == null) {
synchronized (IdentifyDataDrawerTest.class) {
if (sInstance == null) {
sInstance = new IdentifyDataDrawerTest();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
/**
* 渲染 adas 识别的数据
*
* @param resultList adas感知融合数据
*/
@SuppressLint("NewApi")
public void renderAdasRecognizedResult(List<MessagePad.TrackedObject> resultList) {
if (resultList == null || resultList.isEmpty()) {
clearOldMarker();
CallerLogger.INSTANCE.w(TAG, "感知数据为空无需渲染……");
return;
}
if (!MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
clearOldMarker();
CallerLogger.INSTANCE.w(TAG, "渲染 adas 识别的数据 当前不是VR模式");
return;
}
//清除缓存
for (MessagePad.TrackedObject data : resultList) {
if (trafficDataUuidList.size() > 0 && trafficDataUuidList.contains("" + data.getUuid())) {
trafficDataUuidList.remove("" + data.getUuid());
}
}
trafficDataUuidList.forEach(uuid -> {
mMarkersCaches.remove(uuid);
algoCache.remove(uuid);
});
ArrayList<MessagePad.TrackedObject> filterList = filterTrafficData(resultList);
if (filterList.size() > 0) {
// 绘制新数据
MogoMarkerManager.getInstance(mContext)
.updateBatchMarkerPosition(filterList);
}
}
/**
* 数据过滤器
*
* @return 过滤后的数据集合
*/
private ArrayList<MessagePad.TrackedObject> filterTrafficData(List<MessagePad.TrackedObject> trafficData) {
mFilterTrafficData.clear();
trafficDataUuidList.clear();
for (MessagePad.TrackedObject data : trafficData) {
// 过滤掉未知感知数据
if (!FunctionBuildConfig.isDrawUnknownIdentifyData && data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.getType()) {
//CallerLogger.INSTANCE.w(TAG, "未知感知类型数据,丢弃,不渲染");
continue;
}
MessagePad.TrackedObject cacheData = mMarkersCaches.get("" + data.getUuid());
double heading = MogoMap.getInstance().getMogoMap().getUIController().getAngle(cacheData.getLongitude(), cacheData.getLatitude(), data.getLongitude(), data.getLatitude());
CallerLogger.INSTANCE.d(M_HMI + "arrow47", " uuid : " + data.getUuid() + " , origin heading : " + data.getHeading() + " , correct heading : " + heading + " ---- " + (data.getHeading() - heading));
// double heading = kalmanFilter(data);
MessagePad.TrackedObject correctData = data.toBuilder().setHeading(heading).build();
mFilterTrafficData.add(correctData);
//更新已存在的感知物体数据
mMarkersCaches.put("" + correctData.getUuid(), correctData);
trafficDataUuidList.add("" + correctData.getUuid());
}
return mFilterTrafficData;
}
private double kalmanFilter(MessagePad.TrackedObject data) {
String uuid = "" + data.getUuid();
if (algoCache.containsKey(uuid)) {
Object o = algoCache.get(uuid);
KalmanFilter kf = (KalmanFilter) o;
assert kf != null;
double[] lonLat = kf.filter(data.getLongitude(), data.getLatitude());
algoCache.put(uuid, kf);
MessagePad.TrackedObject cacheTrackObj = mMarkersCaches.get(uuid);
assert cacheTrackObj != null;
double heading = MogoMap.getInstance().getMogoMap().getUIController().getAngle(cacheTrackObj.getLongitude(), cacheTrackObj.getLatitude(), lonLat[0], lonLat[1]);
CallerLogger.INSTANCE.d(M_HMI + "arrow47", " uuid : " + uuid + " , origin heading : " + data.getHeading() + " , correct heading : " + heading + " ---- " + (data.getHeading() - heading));
return heading;
} else {
double r = 0.00005;
if (AdasRecognizedType.valueFrom(data.getType()) == AdasRecognizedType.classIdTrafficBus || AdasRecognizedType.valueFrom(data.getType()) == AdasRecognizedType.classIdTrafficTruck) {
r = 0.0001;
}
algoCache.put(uuid, new KalmanFilter(data.getLongitude(), data.getLatitude(), r));
return data.getHeading();
}
}
/**
* 清除旧的 marker 数据
*/
public void clearOldMarker() {
for (String uuid : trafficDataUuidList) {
MogoMarkerManager.getInstance(mContext)
.removeMarker(uuid);
}
trafficDataUuidList.clear();
}
private void addPreVehicleModel() {
CallerLogger.INSTANCE.d(TAG, "添加感知模型到地图中……");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI, "添加感知模型到地图中……preVehicleStrWeiZhi=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE, "添加感知模型到地图中……preVehicleStrPeople=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_BICYCLE, "添加感知模型到地图中……preVehicleStrBicycle=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE, "添加感知模型到地图中……preVehicleStrTaChe=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO, "添加感知模型到地图中……preVehicleStrMoto=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS, "添加感知模型到地图中……preVehicleStrBus=");
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK, "添加感知模型到地图中……preVehicleStrTruck=");
}
/**
* 添加模型到地图中
*
* @param typeTrafficIdWeiZhi
* @param s
*/
private void addPreVehicleModelWeiZhi(TrafficTypeEnum typeTrafficIdWeiZhi, String s) {
String preVehicleStrWeiZhi = MogoMarkerManager.getInstance(mContext)
.addPreVehicleModel(typeTrafficIdWeiZhi.getType(),
typeTrafficIdWeiZhi.getTraffic3DIconId());
CallerLogger.INSTANCE.d(TAG, s + preVehicleStrWeiZhi);
if (preVehicleStrWeiZhi == null) {
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
CallerLogger.INSTANCE.w(TAG, "添加感知模型到地图中失败,尝试重复添加……");
addPreVehicleModelWeiZhi(typeTrafficIdWeiZhi, s);
}
}, 1000L);
}
}
}

View File

@@ -0,0 +1,34 @@
package com.mogo.eagle.core.function.map;
public class KalmanFilter {
private final double q = 1.0E-6D;
double r = 5.0E-5D;
double[][] xhat = new double[][]{{0.0D, 0.0D}, {0.0D, 0.0D}};
double[][] p = new double[][]{{1.0D, 1.0D}, {0.0D, 0.0D}};
double[][] xhatminus = new double[][]{{0.0D, 0.0D}, {0.0D, 0.0D}};
double[][] pMinus = new double[][]{{0.0D, 0.0D}, {0.0D, 0.0D}};
double[][] k = new double[][]{{0.0D, 0.0D}, {0.0D, 0.0D}};
int idx = 1;
public KalmanFilter(double lon, double lat, double r) {
this.xhat[0][0] = lon;
this.xhat[0][1] = lat;
this.r = r;
}
public double[] filter(double lon, double lat) {
for(int i = 0; i < 2; ++i) {
this.xhatminus[this.idx][i] = this.xhat[1 - this.idx][i];
this.pMinus[this.idx][i] = this.p[1 - this.idx][i] + 1.0E-6D;
this.k[this.idx][i] = this.pMinus[this.idx][i] / (this.pMinus[this.idx][i] + this.r);
double value = i == 0 ? lon : lat;
this.xhat[this.idx][i] = this.xhatminus[this.idx][i] + this.k[this.idx][i] * (value - this.xhatminus[this.idx][i]);
this.p[this.idx][i] = (1.0D - this.k[this.idx][i]) * this.pMinus[this.idx][i];
}
double lon1 = this.xhat[this.idx][0];
double lat1 = this.xhat[this.idx][1];
this.idx = 1 - this.idx;
return new double[]{lon1, lat1};
}
}

View File

@@ -262,7 +262,7 @@ public class SmallMapDirectionView
new PolylineOptions()
.addAll(mCoordinatesLatLng)
.color(Color.argb(255, 31, 127, 255))
.width(5));
.width(6));
}
// else {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 604 B

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -40,20 +40,20 @@ class TrafficLightHMIManager {
trafficLightStatus.isGreen() || trafficLightStatus.isFlashGreen() -> {
CallerHmiManager.showWarningTrafficLight(3)
CallerHmiManager.changeCountdownGreen(remain)
CallerHmiManager.changeCountdownRed(-1)
CallerHmiManager.changeCountdownYellow(-1)
// CallerHmiManager.changeCountdownRed(-1)
// CallerHmiManager.changeCountdownYellow(-1)
}
trafficLightStatus.isYellow() -> {
CallerHmiManager.showWarningTrafficLight(2)
CallerHmiManager.changeCountdownYellow(remain)
CallerHmiManager.changeCountdownGreen(-1)
CallerHmiManager.changeCountdownRed(-1)
// CallerHmiManager.changeCountdownGreen(-1)
// CallerHmiManager.changeCountdownRed(-1)
}
trafficLightStatus.isRed() -> {
CallerHmiManager.showWarningTrafficLight(1)
CallerHmiManager.changeCountdownRed(remain)
CallerHmiManager.changeCountdownGreen(-1)
CallerHmiManager.changeCountdownYellow(-1)
// CallerHmiManager.changeCountdownGreen(-1)
// CallerHmiManager.changeCountdownYellow(-1)
}
}
}

View File

@@ -0,0 +1,93 @@
package com.mogo.eagle.core.utilcode.util;
import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
/**
* 遮罩层工具类
*
* @author mogoauto
*/
public class OverlayViewUtils {
private static final String TAG = "OverlayViewUtils";
private static WindowManager windowManager;
private static Context applicationContext;
private static volatile boolean isShowing = false;
/**
* 记录上一次的View
*/
private static View lastOverlayView;
/**
* 添加覆盖View在Activity上面
*/
public static void showOverlayView(Activity context, View overlayView) {
if (applicationContext == null) {
applicationContext = context.getApplicationContext();
}
if (windowManager == null) {
windowManager = context.getWindowManager();
}
// 设置View显示模式沉浸式的侵入到状态栏导航栏
overlayView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
LayoutParams params = new LayoutParams();
params.width = LayoutParams.MATCH_PARENT;
params.height = LayoutParams.MATCH_PARENT;
params.alpha = 1.0f;
// 设置窗口类型为应用子窗口和PopupWindow同类型
params.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
// 没有边界限制,允许窗口扩展到屏幕外
params.flags = WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
// 如果正在展示中并且lastOverlayView不为null先做移除操作保证覆盖在最上面的View只有一个防止叠加导致无法移除
if (lastOverlayView != null) {
dismissOverlayView(lastOverlayView);
}
try {
// 后门逻辑,长时间触摸消失
overlayView.setOnLongClickListener(v -> {
dismissOverlayView(lastOverlayView);
return true;
});
lastOverlayView = overlayView;
windowManager.addView(overlayView, params);
isShowing = true;
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 移除覆盖View在Activity上面
*/
public static void dismissOverlayView(View overlayView) {
if (!isShowing) {
return;
}
try {
if (windowManager != null && overlayView != null) {
windowManager.removeView(overlayView);
}
isShowing = false;
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -124,7 +124,7 @@ public class IPCFixationIPHelper {
public void run() {
start(ips);
}
}, 5 * 1000L);//延时
}, 4 * 1000L);//延时
}
}
}
@@ -135,7 +135,7 @@ public class IPCFixationIPHelper {
Process p;
try {
//ping -c 3 -w 100 中 -c 是指ping的次数 3是指ping 3次 -w 100 以秒为单位指定超时间隔是指超时时间为100秒
p = Runtime.getRuntime().exec("ping -c 2 -w 5 " + str);
p = Runtime.getRuntime().exec("ping -c 2 -w 2 " + str);
int status = p.waitFor();
InputStream input = p.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(input));

View File

@@ -77,9 +77,9 @@ public class FpgaSocket implements IWebSocket {
}
if (okBuilder == null) {
okBuilder = new OkHttpClient.Builder();
okBuilder.writeTimeout(5, TimeUnit.SECONDS)
.readTimeout(5, TimeUnit.SECONDS)
.connectTimeout(5, TimeUnit.SECONDS);
okBuilder.writeTimeout(4, TimeUnit.SECONDS)
.readTimeout(4, TimeUnit.SECONDS)
.connectTimeout(1, TimeUnit.SECONDS);
}
if (client == null) {
client = okBuilder.build();
@@ -117,7 +117,7 @@ public class FpgaSocket implements IWebSocket {
if (isReconnect) {
if (!isUserCloseWebSocket) {
try {
Thread.sleep(5000L);
Thread.sleep(2000L);
} catch (InterruptedException e) {
e.printStackTrace();
}

View File

@@ -1,6 +1,5 @@
package com.mogo.map;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.overlay.IMogoPolyline;

View File

@@ -352,4 +352,10 @@ public interface IMogoMapUIController {
* 设置地图视线角度
*/
void setMapDAngle(float angle);
/**
* 获取行车方向
* @return
*/
float getAngle(double startLon, double startLat, double endLon, double endLat);
}

View File

@@ -1079,4 +1079,9 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.getMapAutoViewHelper().setMapDAngle(angle);
}
@Override
public float getAngle(double startLon, double startLat, double endLon, double endLat) {
return MapAutoApi.INSTANCE.getAngle(startLon,startLat,endLon,endLat);
}
}

View File

@@ -454,4 +454,13 @@ public class MogoMapUIController implements IMogoMapUIController {
mDelegate.setMapDAngle(angle);
}
}
@Override
public float getAngle(double startLon, double startLat, double endLon, double endLat) {
initDelegate();
if (mDelegate != null) {
return mDelegate.getAngle(startLon, startLat, endLon, endLat);
}
return 0.0f;
}
}

View File

@@ -374,4 +374,12 @@ public class AMapUIController implements IMogoMapUIController {
mClient.setMapDAngle(angle);
}
}
@Override
public float getAngle(double startLon, double startLat, double endLon, double endLat) {
if (mClient != null) {
return mClient.getAngle(startLon,startLat,endLon,endLat);
}
return 0;
}
}

View File

@@ -81,6 +81,7 @@ dependencies {
} else {
api project(":libraries:mogo-map")
api project(":libraries:mogo-map-api")
implementation project(':libraries:mogo-adas-data')
api project(":foudations:mogo-commons")
api project(':services:mogo-service-api')
api project(':core:mogo-core-utils')

View File

@@ -11,5 +11,6 @@
<dimen name="module_v2x_brake_image_width">120px</dimen>
<dimen name="module_v2x_brake_image_margin_left">37px</dimen>
<dimen name="module_v2x_brake_image_margin_right">27px</dimen>
<dimen name="dp_144">144px</dimen>
<dimen name="dp_300">300px</dimen>
</resources>

View File

@@ -180,6 +180,8 @@ public class MogoRouteOverlayManager implements
}
// CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG , "onLocationChanged: size = "+ mTrajectoryList.size()+" ----- "+mLocation.getLongitude()+"-"+mLocation.getLatitude());
ArrayList list = new ArrayList();
MogoLatLng carlatLng = new MogoLatLng(CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat(),CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon());
list.add(carlatLng);
for (MogoLatLng latLng : temp) {
// if(!isPointOnCarFront(mLocation,latLng)){
list.add(latLng);
@@ -191,6 +193,7 @@ public class MogoRouteOverlayManager implements
}
}
public boolean isPointOnCarFront(MogoLocation carLocal, MogoLatLng pointLocal) {
double carLon = carLocal.getLongitude();
double carLat = carLocal.getLatitude();

View File

@@ -53,10 +53,10 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
return map;
}
});
crash.config().setChannel("eagle");
String mapSDKVersion = AppUtils.getCustomMapSDKVersion(context);
crash.config().setChannel("MAP_SDK_VERSION:"+mapSDKVersion);
//可选可以设置自定义did,不设置会使用内部默认的
crash.config().setDeviceId(MoGoAiCloudClientConfig.getInstance().getSn());
String mapSDKVersion = AppUtils.getCustomMapSDKVersion(context);
crash.addTags(MAP_SDK_VERSION, mapSDKVersion);
// crash.setReportUrl("www.xxx.com"); // 私有化部署:私有化部署才配置上报地址
// crash.addTags("key", "value"); // 自定义筛选tag, 按需添加、可多次覆盖
@@ -66,6 +66,7 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
dimension.put("Devices_SN_DeviceId", MoGoAiCloudClientConfig.getInstance().getSn() + "__" + DeviceIdUtils.getDeviceId(context));
dimension.put("Devices_SN_WidevineID_MD5", MoGoAiCloudClientConfig.getInstance().getSn() + "__" + DeviceIdUtils.getWidevineIDWithMd5(context));
dimension.put("Devices_SN_WidevineID", MoGoAiCloudClientConfig.getInstance().getSn() + "__" + DeviceIdUtils.getWidevineID(context));
dimension.put(MAP_SDK_VERSION, mapSDKVersion);
HashMap<String, Double> metric = new HashMap<>();
//指标值
//metric.put("Devices_ID_metric", (double) 100);
@@ -95,7 +96,7 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
//是否打印日志线上release版本要配置为false
builder.debugMode(true);
//支持用户自定义user_id把平台数据和自己用户关联起来可以不配置
builder.userId(MoGoAiCloudClientConfig.getInstance().getSn());
// builder.userId(MoGoAiCloudClientConfig.getInstance().getSn());
//私有化部署:配置数据上报的域名 私有化部署才需要配置内部有默认域名测试支持设置http://www.xxx.com 默认是https协议
// builder.defaultReportDomain("www.xxx.com");
//设置渠道。1.3.16版本增加接口