Merge branch 'dev_robotaxi-d-app-module_270_220510_2.7.0' into dev_robobus-d_220427_local

This commit is contained in:
wangmingjun
2022-05-10 11:34:16 +08:00
18 changed files with 175 additions and 39 deletions

View File

@@ -25,9 +25,9 @@ if (!isAndroidTestBuild()) {
}
}
//if (!isAndroidTestBuild()) {
if (!isAndroidTestBuild()) {
apply plugin: 'apm-plugin'
//}
}
//if (!isAndroidTestBuild()) {
// apply plugin: 'bytex.threadOpt'
@@ -265,7 +265,7 @@ dependencies {
androidTestImplementation rootProject.ext.dependencies.androidx_espresso_core
}
//if (!isAndroidTestBuild()) {
if (!isAndroidTestBuild()) {
ApmPlugin {
// 是否进行插桩
enable true
@@ -289,7 +289,7 @@ dependencies {
]
}
//}
}
android.applicationVariants.all { variant ->
def buildTime = new Date().format("yyyyMMdd", TimeZone.getTimeZone("GMT+08:00"))

View File

@@ -33,6 +33,7 @@ class AutoPilotBadCaseTest {
@Test
fun showBadCaseEntrance1(): Unit = runBlocking(Dispatchers.Main) {
ensureMoGoHmiFragmentShow()
delay(TimeUnit.MILLISECONDS.toSeconds(30))
var index = 0
(1 until 50)
.map { it }

View File

@@ -9,6 +9,7 @@ import com.zhidao.adas.client.bean.ErrorData;
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.MyPointCloud;
import com.zhidao.adas.client.bean.PerceptionObstacles;
import com.zhidao.adas.client.bean.PerceptionTrafficLight;
import com.zhidao.adas.client.bean.PredictionObstacleTrajectory;
@@ -110,6 +111,7 @@ public class DataDistribution {
public final List<String> listArrivalNotification = new ArrayList<>();
public final List<String> listErrorData = new ArrayList<>();
public final List<String> listUpdate = new ArrayList<>();
public final List<String> listPointCloud = new ArrayList<>();
public String cutDown(String str) {
if (isCutDown && str.length() > 650) {
@@ -146,6 +148,19 @@ public class DataDistribution {
// for (OnAdasClientListener listener : listeners) {
// listener.onRefresh();
// }
// }
} else if (data instanceof MyPointCloud) {
listPointCloud.add(0, time + str);
if (listPointCloud.size() > LIST_SIZE) {
listPointCloud.remove(listPointCloud.size() - 1);
}
if (listener != null) {
listener.onRefresh();
}
// if (!listeners.isEmpty()) {
// for (OnAdasClientListener listener : listeners) {
// listener.onRefresh();
// }
// }
} else if (data instanceof GnssInfo) {
listGnssInfo.add(0, time + str);

View File

@@ -0,0 +1,21 @@
package com.zhidao.adas.client.bean;
import com.google.protobuf.TextFormat;
import mogo.telematics.pad.MessagePad;
public class MyPointCloud extends BaseInfo {
public final rule_segement.PointCloud.LidarPointCloud bean;
public MyPointCloud(MessagePad.Header header, rule_segement.PointCloud.LidarPointCloud bean) {
super("接收", bean.getSerializedSize(), header);
this.bean = bean;
}
@Override
public String toString() {
return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean);
}
}

View File

@@ -152,6 +152,10 @@ public class InfoFragment extends BaseFragment {
case Constants.TITLE.RECEIVE_PERCEPTION_OBSTACLES:
adapter.setData(DataDistribution.getInstance().listPerceptionObstacles);
break;
case Constants.TITLE.RECEIVE_POINT_CLOUD:
adapter.setData(DataDistribution.getInstance().listPointCloud);
break;
case Constants.TITLE.RECEIVE_ERROR:
adapter.setData(DataDistribution.getInstance().listErrorData);
break;

View File

@@ -42,6 +42,7 @@ import com.mogo.telematic.client.listener.NettyClientListener;
import com.mogo.telematic.client.status.ConnectState;
import com.mogo.telematic.server.netty.NettyServerListener;
import com.zhidao.adas.client.BuildConfig;
import com.zhidao.adas.client.DataDistribution;
import com.zhidao.adas.client.R;
import com.zhidao.adas.client.adapter.InfoTitleAdapter;
import com.zhidao.adas.client.base.BaseActivity;
@@ -55,7 +56,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.MyPointCloud;
import com.zhidao.adas.client.bean.PerceptionObstacles;
import com.zhidao.adas.client.bean.PerceptionTrafficLight;
import com.zhidao.adas.client.bean.PredictionObstacleTrajectory;
@@ -64,7 +65,6 @@ 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.adas.client.DataDistribution;
import com.zhidao.adas.client.log.LogSave;
import com.zhidao.adas.client.utils.Constants;
import com.zhidao.support.adas.high.AdasManager;
@@ -73,7 +73,6 @@ import com.zhidao.support.adas.high.OnAdasConnectStatusListener;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.OnMultiDeviceListener;
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo;
import com.zhidao.adas.client.ssh.SSHResult;
import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.common.ProtocolStatus;
@@ -96,6 +95,7 @@ import perception.ObjectOuterClass;
import perception.TrafficLightOuterClass;
import prediction.Prediction;
import record_cache.RecordPanelOuterClass;
import rule_segement.PointCloud;
public class MainActivity extends BaseActivity implements OnAdasListener, OnAdasConnectStatusListener, BaseAdapter.OnItemClickListener<String> {
private final static String TAG = MainActivity.class.getSimpleName();
@@ -146,6 +146,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
private InfoFragment perceptionTrafficLightFragment;
private InfoFragment predictionObstacleTrajectoryFragment;
private InfoFragment perceptionObstaclesFragment;
private InfoFragment pointCloudFragment;
private VersionFragment versionFragment;
private FragmentManager manager;
private FragmentTransaction transaction;
@@ -453,6 +454,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
titleFragmentData.add(Constants.TITLE.RECEIVE_TRAJECTORY);
titleFragmentData.add(Constants.TITLE.RECEIVE_TRACKED_OBJECTS);
titleFragmentData.add(Constants.TITLE.RECEIVE_PERCEPTION_OBSTACLES);
titleFragmentData.add(Constants.TITLE.RECEIVE_POINT_CLOUD);
titleFragmentData.add(Constants.TITLE.RECEIVE_VEHICLE_STATE);
titleFragmentData.add(Constants.TITLE.RECEIVE_AUTOPILOT_STATE);
titleFragmentData.add(Constants.TITLE.RECEIVE_REPORT_MESSAGE);
@@ -646,6 +648,14 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
transaction.commit();
}
break;
case Constants.TITLE.RECEIVE_POINT_CLOUD:
if (pointCloudFragment == null)
pointCloudFragment = new InfoFragment(data);
if (!pointCloudFragment.isVisible()) {
transaction.replace(R.id.fl_info, pointCloudFragment);
transaction.commit();
}
break;
case Constants.TITLE.RECEIVE_CAR_CONFIG_RESP:
AdasManager.getInstance().sendCarConfigReq();
if (versionFragment == null)
@@ -799,6 +809,12 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
DataDistribution.getInstance().addData(base);
}
@Override
public void onPointCloud(MessagePad.Header header, PointCloud.LidarPointCloud pointCloud) {
MyPointCloud base = new MyPointCloud(header, pointCloud);
DataDistribution.getInstance().addData(base);
}
@Override
public void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq) {
BasicInfoReq info = new BasicInfoReq(header, basicInfoReq);

View File

@@ -152,6 +152,7 @@ public class Constants {
String RECEIVE_PERCEPTION_TRAFFIC_LIGHT = "感知红绿灯";
String RECEIVE_PREDICTION_OBSTACLE_TRAJECTORY = "他车轨迹预测";
String RECEIVE_PERCEPTION_OBSTACLES = "透传障碍物";
String RECEIVE_POINT_CLOUD = "点云透传";
// String RECEIVE_BASIC_INFO_REQ = "自动驾驶设备基础信息请求";
String RECEIVE_CAR_CONFIG_RESP = "信息与配置";

View File

@@ -49,6 +49,7 @@ import perception.ObjectOuterClass
import perception.TrafficLightOuterClass
import prediction.Prediction
import record_cache.RecordPanelOuterClass
import rule_segement.PointCloud
/**
* @author emArrow
@@ -175,6 +176,8 @@ class MoGoAdasListenerImpl : OnAdasListener {
autopilotState: MessagePad.AutopilotState?
) {
if (autopilotState != null) {
//工控机模拟时间
CallerAutopilotVehicleStateListenerManager.invokeAutopilotTime(header.timestamp.toLong())
if (HdMapBuildConfig.isMapLoaded) {
// 初始化自动驾驶状态信息
val autopilotStatusInfo = getAutoPilotStatusInfo()
@@ -235,6 +238,10 @@ class MoGoAdasListenerImpl : OnAdasListener {
//他车轨迹预测
}
override fun onPointCloud(header: MessagePad.Header?, pointCloud: PointCloud.LidarPointCloud?) {
//点云数据透传
}
override fun onBasicInfoReq(
header: MessagePad.Header,
basicInfoReq: MessagePad.BasicInfoReq?

View File

@@ -14,6 +14,7 @@ import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
import com.mogo.eagle.core.utilcode.kotlin.PX
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -193,7 +194,7 @@ internal object BadCaseManager : LifecycleEventObserver {
private fun CoroutineScope.showBadCaseInternal(record: AutoPilotRecord) = launch {
viewHolder?.get()?.also { itx ->
presenter.updateLastModified(record.toLongTime())
presenter.updateLastModified(CallerAutopilotVehicleStateListenerManager.getAutopilotTimeStamp())
showEntry()
itx.onClick {
showBadCaseFloat(

View File

@@ -30,5 +30,4 @@ interface IMoGoAutopilotVehicleStateListener {
* @param gear 档位
*/
fun onAutopilotGearData(gear: Chassis.GearPosition)
}

View File

@@ -15,6 +15,9 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() {
private val M_AUTOPILOT_VEHICLE_LISTENERS: ConcurrentHashMap<String, IMoGoAutopilotVehicleStateListener> =
ConcurrentHashMap()
@Volatile
private var timeStamp: Long = 0L
/**
* 添加 ADAS车辆状态&定位 监听
* @param tag 标记,用来注销监听使用
@@ -57,7 +60,6 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() {
* 车辆转向灯数据回调
* @param lightSwitch
*/
@Synchronized
fun invokeAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
M_AUTOPILOT_VEHICLE_LISTENERS.forEach {
val listener = it.value
@@ -69,7 +71,6 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() {
* 车辆刹车灯数据回调
* @param brakeLight
*/
@Synchronized
fun invokeAutopilotBrakeLightData(brakeLight: Boolean) {
M_AUTOPILOT_VEHICLE_LISTENERS.forEach {
val listener = it.value
@@ -81,7 +82,6 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() {
* 车辆方向盘转向角回调
* @param steering 方向盘转向角
*/
@Synchronized
fun invokeAutopilotSteeringData(steering: Float){
M_AUTOPILOT_VEHICLE_LISTENERS.forEach{
val listener = it.value
@@ -93,7 +93,6 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() {
* 车辆挂挡档位
* @param gear 档位
*/
@Synchronized
fun invokeAutopilotGearData(gear: Chassis.GearPosition){
M_AUTOPILOT_VEHICLE_LISTENERS.forEach{
val listener = it.value
@@ -101,5 +100,17 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() {
}
}
/**
* 工控机时间回调
*/
fun invokeAutopilotTime(time: Long) {
this.timeStamp = time
}
/**
* 获取工控机的时间, 单位是秒
*/
fun getAutopilotTimeStamp(): Long {
return this.timeStamp
}
}

View File

@@ -3,7 +3,7 @@ package mogo.telematics.pad;
enum ProtocolVersion{
Defaultver = 0;
CurrentVersion = 3; //每次修改proto文件增加1
CurrentVersion = 4; //每次修改proto文件增加1
}
enum MessageType
@@ -19,6 +19,7 @@ enum MessageType
MsgTypePerceptionTrafficLight = 0x10006; //感知红绿灯
MsgTypePredictionObstacleTrajectory = 0x10007; //他车轨迹预测
MsgTypePerceptionObstacles = 0x10008; //透传的融合障碍物
MsgTypePointCloud = 0x10009; //点云透传
MsgTypeBasicInfoReq = 0x10100; //自动驾驶设备基础信息请求
MsgTypeBasicInfoResp = 0x10101; //自动驾驶设备基础信息应答
@@ -133,6 +134,9 @@ message AutopilotState
// message definition for MessageType: MsgTypePerceptionObstacles
// refer to TrackedObjects in object.proto
// message definition for MessageType: MsgTypePointCloud
// refer to point_cloud.proto
// message definition for MessageType: MsgTypeBasicInfoReq
message BasicInfoReq
{

View File

@@ -0,0 +1,14 @@
syntax="proto2";
package rule_segement;
import "header.proto";
message LidarPointCloud
{
optional common.Header header = 1;
optional double self_longitude = 2;
optional double self_latitude = 3;
optional double self_yaw = 4;
repeated float del_data = 7 [packed=true];
repeated float add_data = 8 [packed=true];
}

View File

@@ -9,12 +9,14 @@ import static com.zhidao.support.adas.high.chain.AdasChain.CHAIN_LINK_LOG_CONNEC
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.gson.Gson;
import com.google.protobuf.InvalidProtocolBufferException;
import com.zhidao.support.adas.high.bean.BaseInfo;
import com.zhidao.support.adas.high.common.Constants;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.common.Define;
import com.zhidao.support.adas.high.common.DigitalTrans;
import com.zhidao.support.adas.high.common.IPCFixationIPHelper;
import com.zhidao.support.adas.high.common.MessageType;
@@ -104,18 +106,12 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
@Override
public void onStartFindIP() {
if (adasConnectStatusListener != null) {
ipcConnectionStatus.set(Constants.IPC_CONNECTION_STATUS.SEARCH_ADDRESS);
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus.get(), "正在搜索IP");
}
updateConnectStatus(Constants.IPC_CONNECTION_STATUS.SEARCH_ADDRESS, "正在搜索IP");
}
@Override
public void onStopFindIP() {
if (adasConnectStatusListener != null) {
ipcConnectionStatus.set(Constants.IPC_CONNECTION_STATUS.DISCONNECTED);
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus.get(), "停止搜索IP");
}
updateConnectStatus(Constants.IPC_CONNECTION_STATUS.DISCONNECTED, "停止搜索IP");
}
/**
@@ -346,36 +342,26 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
@Override
public void onConnecting(String msg) {
ipcConnectionStatus.set(Constants.IPC_CONNECTION_STATUS.CONNECTING);
if (adasConnectStatusListener != null) {
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus.get(), msg);
}
updateConnectStatus(Constants.IPC_CONNECTION_STATUS.CONNECTING, msg);
}
@Override
public void onWebSocketConnectSuccess(String ipAddress, int port) {
ipcConnectionStatus.set(Constants.IPC_CONNECTION_STATUS.CONNECTED);
ipcConnectedIp = ipAddress;
ipcConnectedPort = port;
if (adasConnectStatusListener != null) {
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus.get(), "已连接");
}
updateConnectStatus(Constants.IPC_CONNECTION_STATUS.CONNECTED, "已连接");
sendCarConfigReq();
}
@Override
public void onWebSocketConnectFailed(String t) {
ipcConnectionStatus.set(Constants.IPC_CONNECTION_STATUS.DISCONNECTED);
ipcConnectedIp = null;
ipcConnectedPort = Constants.DEFAULT_PORT;
if (adasConnectStatusListener != null) {
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus.get(), t);
}
updateConnectStatus(Constants.IPC_CONNECTION_STATUS.DISCONNECTED, t);
}
@Override
public void onMessage(String message) {
handlerWSMsg(message);
}
@Override
@@ -384,10 +370,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
}
private void notFoundAddress() {
ipcConnectionStatus.set(Constants.IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS);
if (adasConnectStatusListener != null) {
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus.get(), "地址不可用或不合法");
}
updateConnectStatus(Constants.IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS, "地址不可用或不合法");
}
/**
@@ -438,6 +421,20 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
//连接状态listener
private final OnAdasConnectStatusListener adasConnectStatusListener;
/**
* 更新连接状态
*
* @param status 状态
* @param reason 状态描述
* 如果ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.DISCONNECTED && reason==null 表示主动断开连接
*/
private void updateConnectStatus(@Define.IPCConnectionStatus int status, @Nullable String reason) {
ipcConnectionStatus.set(status);
if (adasConnectStatusListener != null) {
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus.get(), reason);
}
}
void setOnAdasListener(OnAdasListener adasListener) {
mAdasListener = adasListener;
}

View File

@@ -10,6 +10,7 @@ import perception.ObjectOuterClass;
import perception.TrafficLightOuterClass;
import prediction.Prediction;
import record_cache.RecordPanelOuterClass;
import rule_segement.PointCloud;
/**
* @ProjectName: lib-adas-fpga
@@ -98,6 +99,14 @@ public interface OnAdasListener {
*/
void onTrackedObjects(MessagePad.Header header, ObjectOuterClass.TrackedObjects trackedObjects);
/**
* 透传的点云数据
*
* @param header 头
* @param pointCloud 数据
*/
void onPointCloud(MessagePad.Header header, PointCloud.LidarPointCloud pointCloud);
/**
* 自动驾驶设备基础信息请求
*

View File

@@ -21,6 +21,7 @@ public enum MessageType {
TYPE_RECEIVE_PERCEPTION_TRAFFIC_LIGHT(MessagePad.MessageType.MsgTypePerceptionTrafficLight, "感知红绿灯"),
TYPE_RECEIVE_PREDICTION_OBSTACLE_TRAJECTORY(MessagePad.MessageType.MsgTypePredictionObstacleTrajectory, "他车轨迹预测"),
TYPE_RECEIVE_PERCEPTION_OBSTACLES(MessagePad.MessageType.MsgTypePerceptionObstacles, "透传的融合障碍物"),
TYPE_RECEIVE_POINT_CLOUD(MessagePad.MessageType.MsgTypePointCloud, "点云透传"),
TYPE_RECEIVE_BASIC_INFO_REQ(MessagePad.MessageType.MsgTypeBasicInfoReq, "自动驾驶设备基础信息请求"),
TYPE_SEND_BASIC_INFO_RESP(MessagePad.MessageType.MsgTypeBasicInfoResp, "自动驾驶设备基础信息应答"),

View File

@@ -20,6 +20,7 @@ public class MyMessageFactory implements IMyMessageFactory {
private IMsg perceptionTrafficLightMessage;//感知红绿灯
private IMsg predictionObstacleTrajectoryMessage;//他车轨迹预测
private IMsg perceptionObstaclesMessage;//透传的融合障碍物
private IMsg pointCloudMessage;//透传点云数据
private IMsg basicInfoReqMessage;//自动驾驶设备基础信息请求
private IMsg carConfigRespMessage;//车机基础信息应答
@@ -105,6 +106,12 @@ public class MyMessageFactory implements IMyMessageFactory {
perceptionObstaclesMessage = new PerceptionObstaclesMessage();
}
return perceptionObstaclesMessage;
} else if (messageType == MessageType.TYPE_RECEIVE_POINT_CLOUD.typeCode) {
//他车轨迹预测
if (pointCloudMessage == null) {
pointCloudMessage = new PointCloudMessage();
}
return pointCloudMessage;
} else if (messageType == MessageType.TYPE_RECEIVE_BASIC_INFO_REQ.typeCode) {
//自动驾驶设备基础信息请求
if (basicInfoReqMessage == null) {

View File

@@ -0,0 +1,28 @@
package com.zhidao.support.adas.high.msg;
import com.google.gson.Gson;
import com.google.protobuf.InvalidProtocolBufferException;
import com.zhidao.support.adas.high.OnAdasListener;
import mogo.telematics.pad.MessagePad;
import rule_segement.PointCloud;
/**
* 透传点云数据
*/
public class PointCloudMessage extends MyAbstractMessageHandler {
@Override
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
}
@Override
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
PointCloud.LidarPointCloud pointCloud = PointCloud.LidarPointCloud.parseFrom(msg);
if (adasListener != null) {
adasListener.onPointCloud(header, pointCloud);
}
}
}