merge
This commit is contained in:
@@ -5,22 +5,24 @@ import android.content.Context
|
||||
import androidx.annotation.RequiresPermission
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlCmdParameter
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.toRouteInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.data.trafficlight.toTrafficLightDetail
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider
|
||||
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoAdasListenerImpl
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoAdasMsgConnectStatusListenerImpl
|
||||
import com.mogo.eagle.core.function.autopilot.adapter.MoGoHandAdasMsgManager
|
||||
import com.mogo.eagle.core.function.autopilot.server.AsyncDataToAutopilotServer
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.telematic.MogoProtocolMsg
|
||||
@@ -35,7 +37,6 @@ import com.zhidao.support.adas.high.bean.IPCUpgradeInfo
|
||||
import com.zhidao.support.adas.high.common.Constants
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils
|
||||
import io.netty.channel.Channel
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
@@ -54,47 +55,44 @@ class MoGoAutopilotProvider :
|
||||
get() = TAG
|
||||
|
||||
override fun init(context: Context) {
|
||||
MoGoHandAdasMsgManager.getInstance();
|
||||
Logger.d(TAG, "初始化工控机连接……")
|
||||
MoGoHandAdasMsgManager.getInstance()
|
||||
CallerLogger.i("$M_ADAS_IMPL$TAG", "初始化工控机连接……")
|
||||
mContext = context
|
||||
// 初始化ADAS 域控制器
|
||||
CupidLogUtils.setEnableLog(false)
|
||||
CupidLogUtils.setIsWriteLog(false)
|
||||
// TODO 临时方案,根据不同的身份标识,连接不同的工控机IP
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {// 司机
|
||||
// 注册地图采集功能
|
||||
CallerMapDataCollectorManager.registerOnMapCollectTaskListener(this)
|
||||
// "192.168.1.102"
|
||||
val options = AdasOptions.Builder()
|
||||
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
|
||||
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
|
||||
.setClient(false)
|
||||
.build()
|
||||
.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.FIXATION)
|
||||
.setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(mContext))
|
||||
.setClient(false)
|
||||
.build()
|
||||
|
||||
AdasManager.getInstance().create(context, options)
|
||||
AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl())
|
||||
NSDNettyManager.getInstance().startNSDNettyServerWithSN(context, object :
|
||||
NettyServerListener<MogoProtocolMsg> {
|
||||
override fun onMessageResponseServer(msg: MogoProtocolMsg?, channel: Channel?) {
|
||||
Logger.d(TAG, "Receive client data is:${msg?.toString()}")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "Receive client data is:${msg?.toString()}")
|
||||
}
|
||||
|
||||
override fun onStartServer() {
|
||||
ToastUtils.showShort("司机端服务启动成功!")
|
||||
Logger.d(TAG, "onStartServer")
|
||||
}
|
||||
|
||||
override fun onStopServer() {
|
||||
ToastUtils.showLong("司机端服务停止!")
|
||||
Logger.d(TAG, "onStopServer")
|
||||
}
|
||||
|
||||
override fun onChannelConnect(channel: Channel?) {
|
||||
val socketAddress = channel?.remoteAddress().toString()
|
||||
Logger.d(TAG, "Client ip is:${socketAddress}")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "Client ip is:${socketAddress}")
|
||||
}
|
||||
|
||||
override fun onChannelDisConnect(channel: Channel?) {
|
||||
Logger.d(TAG, "onChannelDisConnect")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "onChannelDisConnect")
|
||||
}
|
||||
}, MoGoAiCloudClientConfig.getInstance().sn)
|
||||
} else {
|
||||
@@ -103,39 +101,38 @@ class MoGoAutopilotProvider :
|
||||
//FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
// "192.168.1.103"
|
||||
val options = AdasOptions
|
||||
.Builder()
|
||||
.setClient(true)
|
||||
.build()
|
||||
AdasManager.getInstance().create(context, options)
|
||||
.Builder()
|
||||
.setClient(true)
|
||||
.build()
|
||||
AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl())
|
||||
NSDNettyManager.getInstance()
|
||||
.searchAndConnectServer(context, MoGoAiCloudClientConfig.getInstance().sn, object :
|
||||
NettyClientListener<MogoProtocolMsg> {
|
||||
override fun onMessageResponseClient(msg: MogoProtocolMsg?, sign: String?) {
|
||||
Logger.d(TAG, "收到司机端的数据!")
|
||||
// 乘客端收到adas数据直接解析,后续分发解析后的数据流程同司机端
|
||||
msg?.let {
|
||||
AdasManager.getInstance().parseIPCData(it.body)
|
||||
Logger.d(TAG, "解析司机端数据完毕!")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClientStatusConnectChanged(statusCode: Int, sign: String?) {
|
||||
when (statusCode) {
|
||||
ConnectState.STATUS_CONNECT_SUCCESS -> {
|
||||
Logger.d(TAG, "乘客端连接司机端服务成功! sign is:${sign}")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "乘客端连接司机端服务成功! sign is:${sign}")
|
||||
}
|
||||
else -> {
|
||||
ToastUtils.showLong("和司机端连接异常!")
|
||||
Logger.d(TAG, "client statusCode is:${statusCode}")
|
||||
CallerLogger.d(
|
||||
"$M_ADAS_IMPL$TAG",
|
||||
"client statusCode is:${statusCode}"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
//////////////////////////////////注意先后顺序,AdasManager.getInstance().create后才可以设置监听/////////////////////////////////////////////
|
||||
// 监听 adas 连接状态
|
||||
AdasManager.getInstance()
|
||||
.setOnAdasConnectStatusListener(MoGoAdasMsgConnectStatusListenerImpl())
|
||||
|
||||
// 监听ADAS-SDK获取到的工控机数据(乘客也需注册)
|
||||
AdasManager.getInstance().setOnAdasListener(MoGoAdasListenerImpl())
|
||||
// 司机端监听
|
||||
@@ -143,17 +140,15 @@ class MoGoAutopilotProvider :
|
||||
AdasManager.getInstance().setOnMultiDeviceListener { bytes ->
|
||||
// 发送数据给乘客端
|
||||
if (NSDNettyManager.getInstance().isServerStart) {
|
||||
Logger.d(
|
||||
TAG,
|
||||
"司机端透传数据给乘客端!"
|
||||
)
|
||||
NSDNettyManager.getInstance()
|
||||
.sendMsgToAllClients(MogoProtocolMsg(NORMAL_DATA, bytes.size, bytes))
|
||||
} else {
|
||||
Logger.d(TAG, "司机端Server未启动!")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "司机端Server未启动!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CallerLogger.i("$M_ADAS_IMPL$TAG", "initServer……")
|
||||
// 同步数据给工控机的服务
|
||||
AsyncDataToAutopilotServer.INSTANCE.initServer()
|
||||
// 同步是否开启美化模式
|
||||
@@ -177,8 +172,9 @@ class MoGoAutopilotProvider :
|
||||
SharedPrefsMgr.getInstance(it).putString(MoGoConfig.AUTOPILOT_IP, autoPilotIp)
|
||||
}
|
||||
// 设置IP地址
|
||||
AdasManager.getInstance().adasOptions.setIpcConnectionMode(AdasOptions.IPC_CONNECTION_MODE.ASSIGN)
|
||||
AdasManager.getInstance().adasOptions.setIpcAssignIP(autoPilotIp)
|
||||
AdasManager.getInstance().adasOptions.ipcConnectionMode =
|
||||
AdasOptions.IPC_CONNECTION_MODE.ASSIGN
|
||||
AdasManager.getInstance().adasOptions.ipcAssignIP = autoPilotIp
|
||||
// 打开通讯连接
|
||||
AdasManager.getInstance().connect()
|
||||
return ""
|
||||
@@ -192,66 +188,75 @@ class MoGoAutopilotProvider :
|
||||
|
||||
override fun onMapCollectStart(cmdId: Int, cmdTime: Long) {
|
||||
val result = recordPackage(2, cmdId)
|
||||
Logger.d(TAG, "开始记录包: [$cmdId, $result]")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "开始记录包: [$cmdId, $result]")
|
||||
}
|
||||
|
||||
override fun onMapCollectEnd(cmdId: Int, cmdTime: Long) {
|
||||
val result = stopRecord(2, cmdId)
|
||||
Logger.d(TAG, "结束记录包: [$cmdId, $result]")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "结束记录包: [$cmdId, $result]")
|
||||
}
|
||||
|
||||
override fun startAutoPilot(result: AutopilotControlParameters) {
|
||||
override fun startAutoPilot(controlParameters: AutopilotControlParameters) {
|
||||
if (AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
val parameter = AutopilotControlCmdParameter("aiCloudToStartAutopilot", result)
|
||||
AdasManager.getInstance().aiCloudToAdasData(GsonUtils.toJson(parameter))
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 1, controlParameters.toRouteInfo())
|
||||
} else {
|
||||
Logger.e(TAG, "车机与工控机链接失败,无法开启自动驾驶")
|
||||
CallerLogger.e("$M_ADAS_IMPL$TAG", "车机与工控机链接失败,无法开启自动驾驶")
|
||||
}
|
||||
}
|
||||
|
||||
override fun sendTrafficLightData(trafficLightResult: TrafficLightResult) {
|
||||
AdasManager.getInstance().sendTrafficLightData(
|
||||
trafficLightResult.crossId,
|
||||
trafficLightResult.lat,
|
||||
trafficLightResult.lon,
|
||||
trafficLightResult.heading,
|
||||
trafficLightResult.direction,
|
||||
trafficLightResult.lightId,
|
||||
trafficLightResult.laneNo,
|
||||
trafficLightResult.arrowNo,
|
||||
trafficLightResult.flashYellow,
|
||||
trafficLightResult.toTrafficLightDetail()
|
||||
)
|
||||
}
|
||||
|
||||
override fun sendMessageToAutopilot(jsonString: String) {
|
||||
AdasManager.getInstance().sendMessage(jsonString)
|
||||
}
|
||||
|
||||
override fun cancelAutoPilot() {
|
||||
if (AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
AdasManager.getInstance().controlAutopilotCarHead()
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(0, 1, null)
|
||||
} else {
|
||||
Logger.e(TAG, "车机与工控机链接失败,无法断开自动驾驶")
|
||||
CallerLogger.e("$M_ADAS_IMPL$TAG", "车机与工控机链接失败,无法断开自动驾驶")
|
||||
}
|
||||
}
|
||||
|
||||
override fun recordPackage(): Boolean {
|
||||
return AdasManager.getInstance()
|
||||
.recordPackage(1, (System.currentTimeMillis() / 1000).toInt())
|
||||
.startRecordPackage((System.currentTimeMillis() / 1000).toInt(), 1)
|
||||
}
|
||||
|
||||
override fun recordPackage(type: Int, id: Int): Boolean {
|
||||
return AdasManager.getInstance().recordPackage(type, id)
|
||||
return AdasManager.getInstance().startRecordPackage(id, type)
|
||||
}
|
||||
|
||||
override fun recordPackage(type: Int, id: Int, duration: Int): Boolean {
|
||||
return AdasManager.getInstance().recordPackage(type, id, duration)
|
||||
return AdasManager.getInstance().startRecordPackage(id, duration, type)
|
||||
}
|
||||
|
||||
override fun stopRecord(type: Int, id: Int): Boolean {
|
||||
return AdasManager.getInstance().stopRecord(type, id)
|
||||
return AdasManager.getInstance().stopRecordPackage(id, type)
|
||||
}
|
||||
|
||||
override fun setEnableLog(isEnableLog: Boolean) {
|
||||
CupidLogUtils.setEnableLog(isEnableLog)
|
||||
}
|
||||
|
||||
override fun setIsWriteLog(isWriteLog: Boolean) {
|
||||
CupidLogUtils.setIsWriteLog(isWriteLog)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
CallerMapDataCollectorManager.unRegisterOnMapCollectTaskListener(this)
|
||||
}
|
||||
|
||||
override fun setAutoPilotSpeed(speed: Int): Boolean {
|
||||
return AdasManager.getInstance().setSpeed(speed)
|
||||
return AdasManager.getInstance().sendAutopilotSpeedReq(speed.toDouble())
|
||||
}
|
||||
|
||||
override fun setIPCShutDown() {
|
||||
@@ -263,21 +268,24 @@ class MoGoAutopilotProvider :
|
||||
}
|
||||
|
||||
override fun recordCause(key: String?, name: String?, id: String?, reason: String?) {
|
||||
AdasManager.getInstance().recordCause(key, name, id, reason)
|
||||
key?.let {
|
||||
AdasManager.getInstance()
|
||||
.sendRecordCause(it.toLong(), name ?: "", id ?: "", reason ?: "")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机升级确认
|
||||
*/
|
||||
override fun setIPCUpgradeAffirm() {
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.affirm());
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.affirm())
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机升级取消
|
||||
*/
|
||||
override fun setIPCUpgradeCancel() {
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.cancel());
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.cancel())
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,22 +295,36 @@ class MoGoAutopilotProvider :
|
||||
*/
|
||||
override fun setDemoMode(isEnable: Boolean) {
|
||||
if (isEnable) {
|
||||
AdasManager.getInstance().enableDemoMode()
|
||||
AdasManager.getInstance().sendDemoModeReq(1)
|
||||
} else {
|
||||
AdasManager.getInstance().disableDemoMode()
|
||||
AdasManager.getInstance().sendDemoModeReq(0)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 办公室调试使用,强制开启自动驾驶,将 status,pilotmode,control_pilotmode,强追设置为 1
|
||||
* 办公室调试使用,强制开启自动驾驶,将 status,pilotMode,control_pilotMode,强追设置为 1
|
||||
* isEnable = true 开启
|
||||
* isEnable = false 关闭
|
||||
*/
|
||||
override fun setControlAutopilotCarAuto(isEnable: Boolean) {
|
||||
if (isEnable) {
|
||||
AdasManager.getInstance().controlAutopilotCarAuto()
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 0, null)
|
||||
} else {
|
||||
AdasManager.getInstance().controlAutopilotCarHead()
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(0, 0, null)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求工控机基础配置信息
|
||||
*/
|
||||
override fun getCarConfig() {
|
||||
AdasManager.getInstance().sendCarConfigReq()
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全局路径
|
||||
*/
|
||||
override fun getGlobalPath() {
|
||||
AdasManager.getInstance().sendGlobalPathReq()
|
||||
}
|
||||
}
|
||||
@@ -1,365 +0,0 @@
|
||||
package com.mogo.eagle.core.function.autopilot.adapter;
|
||||
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_ADAS;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_DATA;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.function.autopilot.utils.AdasObjectConvertUtils;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotWayArrive;
|
||||
import com.zhidao.support.adas.high.bean.CarLaneInfo;
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.LightStatueInfo;
|
||||
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.SSHResult;
|
||||
import com.zhidao.support.adas.high.bean.TrajectoryInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo;
|
||||
import com.zhidao.support.adas.high.bean.record.AutopilotRecordResult;
|
||||
import com.zhjt.service.chain.ChainLog;
|
||||
import com.zhjt.service.chain.TracingConstants;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/22
|
||||
* <p>
|
||||
* 适配ADAS 回调监听分发,这里不做业务,只做数据包装及分发处理
|
||||
*/
|
||||
public class MoGoAdasListenerImpl implements OnAdasListener {
|
||||
private final String TAG = "OnAdasListenerAdapter";
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onRectData(RectInfo rectInfo) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
ArrayList<TrafficData> recognizedListResults = AdasObjectConvertUtils.INSTANCE.regroupTrafficDataData(rectInfo.getModels());
|
||||
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotIdentifyDataUpdate(recognizedListResults);
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onCarStateData(CarStateInfo carStateInfo) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// Logger.d(TAG, "--------carStateInfo.toString() = " + carStateInfo.toString());
|
||||
AutopilotCarStateInfo autopilotCarStateInfo = AdasObjectConvertUtils.INSTANCE.fromAdasCarStateInfoObject(carStateInfo);
|
||||
// 将数据通过数据中心分发出去
|
||||
CallerAutopilotCarStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo);
|
||||
// 同步给MAP地图
|
||||
adasCarDataCallback(autopilotCarStateInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void adasCarDataCallback(@Nullable AutopilotCarStateInfo stateInfo) {
|
||||
|
||||
if (stateInfo != null && stateInfo.getValues() != null) {
|
||||
//Logger.d(TAG,"同步自车数据给地图……");
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setLastLat(stateInfo.getValues().getLat());
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setLastLon(stateInfo.getValues().getLon());
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setSatelliteTime(stateInfo.getValues().getSatelliteTime());
|
||||
JSONObject data = new JSONObject();
|
||||
try {
|
||||
data.putOpt("lon", stateInfo.getValues().getLon());
|
||||
data.putOpt("lat", stateInfo.getValues().getLat());
|
||||
data.putOpt("alt", stateInfo.getValues().getAlt());
|
||||
data.putOpt("speed", stateInfo.getValues().getGnss_speed());
|
||||
data.putOpt("heading", stateInfo.getValues().getHeading());
|
||||
data.putOpt("acceleration", stateInfo.getValues().getAcceleration());
|
||||
data.putOpt("yawRate", stateInfo.getValues().getYaw_rate());
|
||||
data.putOpt("gpsProvider", 1);
|
||||
try {
|
||||
data.putOpt("systemTime", Long.parseLong(stateInfo.getValues().getSystemTime()));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt("satelliteTime", Long.parseLong(stateInfo.getValues().getSatelliteTime()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt("receiverDataTime", Long.parseLong(stateInfo.getValues().getReceiverDataTime()));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
data.putOpt("adasSatelliteTime", Long.parseLong(stateInfo.getValues().getAdasSatelliteTime()));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
}
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map(data);
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(data);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void autopilotStatus(AutopilotStatus autopilotStatus) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues();
|
||||
|
||||
if (autopilotStatusValues != null) {
|
||||
// 初始化自动驾驶状态信息
|
||||
AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
|
||||
autopilotStatusInfo.setState(autopilotStatusValues.getState());
|
||||
autopilotStatusInfo.setPilotmode(autopilotStatusValues.getPilotmode());
|
||||
autopilotStatusInfo.setControl_pilotmode(autopilotStatusValues.getControl_pilotmode());
|
||||
autopilotStatusInfo.setReason(autopilotStatusValues.getReason());
|
||||
autopilotStatusInfo.setCamera(autopilotStatusValues.getCamera());
|
||||
autopilotStatusInfo.setRtk(autopilotStatusValues.getRtk());
|
||||
autopilotStatusInfo.setRadar(autopilotStatusValues.getRadar());
|
||||
autopilotStatusInfo.setSpeed(autopilotStatusValues.getSpeed());
|
||||
// 初始化自动驾驶状态信息
|
||||
if (autopilotStatusInfo.getVersion() == null) {
|
||||
autopilotStatusInfo.setVersion(AdasManager.getInstance().getAdasConfig().getVersion());
|
||||
}
|
||||
if (autopilotStatusInfo.getConnectIP() == null) {
|
||||
autopilotStatusInfo.setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
|
||||
}
|
||||
if (autopilotStatusInfo.getDockVersion() == null) {
|
||||
autopilotStatusInfo.setDockVersion(AdasManager.getInstance().getAdasConfig().getDockVersion());
|
||||
}
|
||||
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void autopilotArrive(AutopilotWayArrive autopilotWayArrive) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// Logger.d(TAG, "autopilotArrive : " + autopilotWayArrive);
|
||||
if (autopilotWayArrive != null) {
|
||||
AutopilotWayArrive.ResultBean result = autopilotWayArrive.getResult();
|
||||
if (result != null) {
|
||||
AutopilotWayArrive.ResultBean.EndLatLonBean endLatLon = result.getEndLatLon();
|
||||
if (endLatLon != null) {
|
||||
AutopilotStationInfo stationInfo = new AutopilotStationInfo(result.getCarType(), endLatLon.getLon(), endLatLon.getLat());
|
||||
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeArriveAtStation(stationInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onAutopilotRoute(AutopilotRoute route) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// Logger.d(TAG, "onAutopilotRoute : " + route.toString());
|
||||
AutopilotRouteInfo autopilotRoute = AdasObjectConvertUtils.INSTANCE.fromAdasAutopilotRoute(route);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotRotting(autopilotRoute);
|
||||
}
|
||||
}
|
||||
|
||||
// @ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
// endpoint = TracingConstants.Endpoint.PAD,
|
||||
// nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY,
|
||||
// paramIndexes = {0},
|
||||
// clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onAutopilotTrajectory(List<TrajectoryInfo> trajectoryList) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// Logger.d(TAG, "onAutopilotTrajectory : " + trajectoryList);
|
||||
ArrayList<ADASTrajectoryInfo> trajectoryInfoArrayList = new ArrayList<>();
|
||||
if (trajectoryList != null && trajectoryList.size() > 0) {
|
||||
for (TrajectoryInfo trajectory : trajectoryList) {
|
||||
ADASTrajectoryInfo adasTrajectoryInfo = new ADASTrajectoryInfo();
|
||||
adasTrajectoryInfo.setLat(trajectory.getLat());
|
||||
adasTrajectoryInfo.setLon(trajectory.getLon());
|
||||
adasTrajectoryInfo.setAcceleration(trajectory.getAcceleration());
|
||||
adasTrajectoryInfo.setAccumulatedDis(trajectory.getAccumulatedDis());
|
||||
adasTrajectoryInfo.setTime(trajectory.getTime());
|
||||
adasTrajectoryInfo.setVelocity(trajectory.getVelocity());
|
||||
adasTrajectoryInfo.setAlt(trajectory.getAlt());
|
||||
adasTrajectoryInfo.setKappa(trajectory.getKappa());
|
||||
adasTrajectoryInfo.setTheta(trajectory.getTheta());
|
||||
trajectoryInfoArrayList.add(adasTrajectoryInfo);
|
||||
}
|
||||
// Log.e(TAG, "time:" + System.currentTimeMillis() + "trajectoryInfoArrayList:" + trajectoryInfoArrayList);
|
||||
}
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotTrajectory(trajectoryInfoArrayList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotSNRequest();
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onAutopilotGuardian(AutopilotGuardianInfo guardianInfo) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
AutopilotGuardianStatusInfo autopilotRoute = AdasObjectConvertUtils.INSTANCE.fromAutopilotGuardianInfo(guardianInfo);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotGuardian(autopilotRoute);
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onAutopilotRecord(AutopilotRecordResult result) {
|
||||
if (result != null) {
|
||||
AutoPilotRecordResult real = new AutoPilotRecordResult();
|
||||
real.setDiskFree(result.getDiskFree());
|
||||
real.setId(result.getId());
|
||||
real.setDuration(result.getDuration());
|
||||
real.setNote(result.getNote());
|
||||
real.setTotal(result.getTotalSize());
|
||||
real.setType(result.getType());
|
||||
real.setFileName(result.getFilename());
|
||||
real.setKey(result.getKey());
|
||||
real.setStat(result.getStat());
|
||||
real.setTimestamp(result.getTimestamp());
|
||||
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotRecordResult(real);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLightStateData(LightStatueInfo lightStatueInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onObstaclesInfo(ObstaclesInfo obstaclesInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLaneInfo(CarLaneInfo carLaneInfo) {
|
||||
|
||||
}
|
||||
|
||||
@ChainLog(linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
@Override
|
||||
public void onWarnMessage(WarnMessageInfo warnMessageInfo) {
|
||||
final AutopilotWarnMessage warnMessage = AdasObjectConvertUtils.INSTANCE.fromAdasObject(warnMessageInfo);
|
||||
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotWarnMessage(warnMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSize(int width, int height) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 工控机升级状态
|
||||
*
|
||||
* @param info 工控机升级状态
|
||||
*/
|
||||
@Override
|
||||
public void onUpgradeStateInfo(IPCUpgradeStateInfo info) {
|
||||
if (info != null) {
|
||||
Logger.d(TAG, "onUpgradeStateInfo " +
|
||||
" upgrade mode=" + info.getUpgradeMode() +
|
||||
" download status=" + info.getDownloadStatus() +
|
||||
" download progress current=" + info.getProgress().getCurrent() +
|
||||
" download progress total=" + info.getProgress().getTotal() +
|
||||
" download version=" + info.getImages() +
|
||||
" upgrade status=" + info.getUpgradeStatus());
|
||||
CallerHmiManager.INSTANCE.showAdUpgradeStatus(info.getUpgradeMode(), info.getDownloadStatus(), info.getProgress().getCurrent(),
|
||||
info.getProgress().getTotal(), info.getImages(), info.getUpgradeStatus());
|
||||
} else {
|
||||
Logger.d(TAG, "onUpgradeStateInfo : upgrade state info is null");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 命令返回结果
|
||||
* @param info 结果返回实体
|
||||
*/
|
||||
@Override
|
||||
public void onSSHResult(SSHResult info) {
|
||||
if(info!=null && "docker restart autocar_default_1".equals(info.cmd)){
|
||||
CallerHmiManager.INSTANCE.showDockerRebootResult(info.code, info.msg);
|
||||
}else{
|
||||
Logger.d(TAG,"onSSHResult : result info is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
package com.mogo.eagle.core.function.autopilot.adapter
|
||||
|
||||
import chassis.VehicleStateOuterClass
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_LINK_ADAS
|
||||
import com.mogo.eagle.core.data.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_DATA
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeArriveAtStation
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotSNRequest
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager.invokeAutopilotCarConfigData
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager.invokeAutopilotCarStateData
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotRecordResult
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotWarnMessage
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotRotting
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager.invokeAutopilotTrajectory
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showAdUpgradeStatus
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showDockerRebootResult
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter
|
||||
import com.mogo.module.service.MarkerServiceHandler
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import com.zhidao.support.adas.high.OnAdasListener
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo
|
||||
import com.zhidao.support.adas.high.bean.SSHResult
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo_msg.MogoReportMsg
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @author emArrow
|
||||
* @since 2022/3/11
|
||||
*
|
||||
*
|
||||
* 适配ADAS 回调监听分发,这里不做业务,只做数据包装及分发处理
|
||||
*/
|
||||
class MoGoAdasListenerImpl : OnAdasListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "OnAdasListenerAdapter"
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_TRAJECTORY,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onTrajectory(header: MessagePad.Header, trajectory: MessagePad.Trajectory?) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
val trajectoryInfoArrayList = ArrayList<ADASTrajectoryInfo>()
|
||||
if (trajectory != null && trajectory.pointsList.size > 0) {
|
||||
for (trajectory in trajectory.pointsList) {
|
||||
val adasTrajectoryInfo = ADASTrajectoryInfo()
|
||||
adasTrajectoryInfo.lat = trajectory.latitude
|
||||
adasTrajectoryInfo.lon = trajectory.longitude
|
||||
adasTrajectoryInfo.acceleration = trajectory.acceleration
|
||||
adasTrajectoryInfo.accumulatedDis = trajectory.accumulatedDis
|
||||
adasTrajectoryInfo.time = trajectory.time
|
||||
adasTrajectoryInfo.velocity = trajectory.velocity
|
||||
adasTrajectoryInfo.alt = trajectory.altitude
|
||||
adasTrajectoryInfo.kappa = trajectory.kappa
|
||||
adasTrajectoryInfo.theta = trajectory.theta
|
||||
trajectoryInfoArrayList.add(adasTrajectoryInfo)
|
||||
}
|
||||
}
|
||||
invokeAutopilotTrajectory(trajectoryInfoArrayList)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_RECT_DATA,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onTrackedObjects(
|
||||
header: MessagePad.Header,
|
||||
trackedObjects: MessagePad.TrackedObjects
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
invokeAutopilotIdentifyDataUpdate(trackedObjects.objsList as List<TrackedObject>?)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_CAR_STATE,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onGnssInfo(header: MessagePad.Header, gnssInfo: MessagePad.GnssInfo?) {
|
||||
invokeAutopilotCarStateData(gnssInfo)
|
||||
// 同步给MAP地图
|
||||
if (gnssInfo != null) {
|
||||
MogoApisHandler.getInstance().apis.adasControllerApi.lastLat = gnssInfo.latitude
|
||||
MogoApisHandler.getInstance().apis.adasControllerApi.lastLon = gnssInfo.longitude
|
||||
MogoApisHandler.getInstance().apis.adasControllerApi.satelliteTime =
|
||||
java.lang.Double.valueOf(gnssInfo.satelliteTime).toLong()
|
||||
if (1 == FunctionBuildConfig.gpsProvider) {
|
||||
MarkerServiceHandler.getApis().mapServiceApi.mapUIController.syncLocation2Map(
|
||||
gnssInfo
|
||||
)
|
||||
SnapshotLocationDataCenter.getInstance().syncAdasLocationInfo(gnssInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onVehicleState(
|
||||
header: MessagePad.Header,
|
||||
vehicleState: VehicleStateOuterClass.VehicleState?
|
||||
) {
|
||||
if (vehicleState != null) {
|
||||
//转向灯数据
|
||||
CallerAutopilotVehicleStateListenerManager.invokeAutopilotLightSwitchData(vehicleState.light)
|
||||
//刹车灯数据
|
||||
CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_STATUS,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onAutopilotState(
|
||||
header: MessagePad.Header,
|
||||
autopilotState: MessagePad.AutopilotState?
|
||||
) {
|
||||
if (autopilotState != null) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
// 初始化自动驾驶状态信息
|
||||
val autopilotStatusInfo = getAutoPilotStatusInfo()
|
||||
autopilotStatusInfo.state = autopilotState.state
|
||||
autopilotStatusInfo.pilotmode = autopilotState.autopilotMode
|
||||
autopilotStatusInfo.reason = autopilotState.reason
|
||||
autopilotStatusInfo.camera = autopilotState.camera
|
||||
autopilotStatusInfo.rtk = autopilotState.rtk
|
||||
autopilotStatusInfo.radar = autopilotState.radar
|
||||
autopilotStatusInfo.speed = autopilotState.speed.toFloat()
|
||||
autopilotStatusInfo.version = AdasManager.getInstance().adasVersion
|
||||
if (autopilotStatusInfo.connectIP == null) {
|
||||
autopilotStatusInfo.connectIP = AdasManager.getInstance().ipcConnectedIp
|
||||
}
|
||||
if (autopilotStatusInfo.dockVersion == null) {
|
||||
AdasManager.getInstance().carConfig?.let {
|
||||
autopilotStatusInfo.dockVersion = it.dockVersion
|
||||
}
|
||||
}
|
||||
invokeAutoPilotStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_GUARDIAN,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onReportMessage(
|
||||
header: MessagePad.Header,
|
||||
mogoReportMessage: MogoReportMsg.MogoReportMessage?
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
invokeAutopilotGuardian(mogoReportMessage)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBasicInfoReq(
|
||||
header: MessagePad.Header,
|
||||
basicInfoReq: MessagePad.BasicInfoReq?
|
||||
) {
|
||||
invokeAutopilotSNRequest()
|
||||
}
|
||||
|
||||
override fun onCarConfigResp(
|
||||
header: MessagePad.Header,
|
||||
carConfigResp: MessagePad.CarConfigResp?
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded && carConfigResp != null) {
|
||||
invokeAutopilotCarConfigData(carConfigResp)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_RECORD,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onRecordResult(
|
||||
header: MessagePad.Header,
|
||||
recordPanel: RecordPanelOuterClass.RecordPanel?
|
||||
) {
|
||||
if (recordPanel != null) {
|
||||
invokeAutopilotRecordResult(recordPanel)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ROUTE,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onGlobalPathResp(
|
||||
header: MessagePad.Header,
|
||||
globalPathResp: MessagePad.GlobalPathResp?
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
invokeAutopilotRotting(globalPathResp)
|
||||
}
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_WARN,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onWarn(header: MessagePad.Header, warn: MessagePad.Warn?) {
|
||||
invokeAutopilotWarnMessage(warn)
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_DATA,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_ARRIVE,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
override fun onArrivalNotification(
|
||||
header: MessagePad.Header,
|
||||
arrivalNotification: MessagePad.ArrivalNotification?
|
||||
) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
invokeArriveAtStation(arrivalNotification)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onUpgradeStateInfo(info: IPCUpgradeStateInfo) {
|
||||
if (info != null) {
|
||||
CallerLogger.d(
|
||||
"$M_ADAS_IMPL$TAG", "onUpgradeStateInfo " +
|
||||
" upgrade mode=" + info.upgradeMode +
|
||||
" download status=" + info.downloadStatus +
|
||||
" download progress current=" + info.progress.current +
|
||||
" download progress total=" + info.progress.total +
|
||||
" download version=" + info.images +
|
||||
" upgrade status=" + info.upgradeStatus
|
||||
)
|
||||
showAdUpgradeStatus(
|
||||
info.upgradeMode, info.downloadStatus, info.progress.current,
|
||||
info.progress.total, info.images, info.upgradeStatus
|
||||
)
|
||||
} else {
|
||||
CallerLogger.w("$M_ADAS_IMPL$TAG", "onUpgradeStateInfo : upgrade state info is null")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSSHResult(info: SSHResult?) {
|
||||
if (info != null && "docker restart autocar_default_1" == info.cmd) {
|
||||
showDockerRebootResult(info.code, info.msg)
|
||||
} else {
|
||||
CallerLogger.w("$M_ADAS_IMPL$TAG", "onSSHResult : result info is null")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(status: ProtocolStatus, bytes: ByteArray) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,29 +2,27 @@ package com.mogo.eagle.core.function.autopilot.adapter
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.autopilot.network.AdasServiceModel
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import com.zhidao.support.adas.high.OnAdasConnectStatusListener
|
||||
import com.zhidao.support.adas.high.bean.BasicInfo
|
||||
import com.zhidao.support.adas.high.common.Constants
|
||||
import io.reactivex.Flowable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* ADAS-SDK与工控机连接状态回调
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
IMoGoAutopilotStatusListener {
|
||||
private val TAG = "MoGoAdasMsgConnectStatusListenerImpl"
|
||||
private val TAG = "ConnectStatus"
|
||||
|
||||
//自动驾驶状态
|
||||
private var mCurrentAutopilotStatus = -1
|
||||
@@ -35,10 +33,10 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
|
||||
override fun onConnectionIPCStatus(ipcConnectionStatus: Int, reason: String?) {
|
||||
if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
Logger.d(TAG, "webSocket 连接成功")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 连接成功")
|
||||
// 初始化自动驾驶状态信息
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectIP =
|
||||
AdasManager.getInstance().adasConfig.address
|
||||
AdasManager.getInstance().ipcConnectedIp
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = true
|
||||
CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus()
|
||||
|
||||
@@ -48,17 +46,17 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
// 开启轮训上传自动驾驶状态
|
||||
updateDriveStatusTask()
|
||||
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
|
||||
Logger.d(TAG, "webSocket 连接失败 reason:$reason")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 连接失败 reason:$reason")
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectIP =
|
||||
AdasManager.getInstance().adasConfig.address
|
||||
AdasManager.getInstance().ipcConnectedIp
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().connectStatus = false
|
||||
CallerAutoPilotStatusListenerManager.invokeAutoPilotStatus()
|
||||
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTING) {
|
||||
Logger.d(TAG, "webSocket 正在连接")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 正在连接")
|
||||
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.SEARCH_ADDRESS) {
|
||||
Logger.d(TAG, "webSocket 正在搜索工控机IP")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 正在搜索工控机IP")
|
||||
} else if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS) {
|
||||
Logger.d(TAG, "webSocket 找不到可用IP 传入的IP不可用或固定IP列表中所有IP不可用")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "webSocket 找不到可用IP 传入的IP不可用或固定IP列表中所有IP不可用")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,10 +68,10 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
syncBasicInfoToAutopilot()
|
||||
}
|
||||
|
||||
override fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) {
|
||||
if (autopilotWayArrive != null) {
|
||||
val lon = autopilotWayArrive.lon
|
||||
val lat = autopilotWayArrive.lat
|
||||
override fun onAutopilotArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) {
|
||||
if (arrivalNotification != null && arrivalNotification.endLocation != null) {
|
||||
val lon = arrivalNotification.endLocation.longitude
|
||||
val lat = arrivalNotification.endLocation.latitude
|
||||
AdasServiceModel.getInstance().reportSite(lon, lat)
|
||||
}
|
||||
}
|
||||
@@ -89,20 +87,17 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
|
||||
* 同步SN信息给工控机
|
||||
*/
|
||||
private fun syncBasicInfoToAutopilot() {
|
||||
Logger.d(TAG, "同步PAD的SN给工控机……")
|
||||
val info = BasicInfo()
|
||||
// 设置PAD-SN给工控
|
||||
info.setSn(MoGoAiCloudClientConfig.getInstance().sn)
|
||||
// 设置网络环境
|
||||
info.setNetEnvironment(DebugConfig.getNetMode())
|
||||
AdasManager.getInstance().setBasicInfo(info)
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "同步PAD的SN给工控机……")
|
||||
// 设置PAD-SN给工控,网络环境
|
||||
AdasManager.getInstance()
|
||||
.sendBasicInfoResp(MoGoAiCloudClientConfig.getInstance().sn, DebugConfig.getNetMode())
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传自动驾驶状态任务
|
||||
*/
|
||||
private fun updateDriveStatusTask() {
|
||||
Logger.d(TAG, "updateDriveStatusTask")
|
||||
CallerLogger.d("$M_ADAS_IMPL$TAG", "updateDriveStatusTask")
|
||||
Flowable.interval(0, 5, TimeUnit.SECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.unsubscribeOn(Schedulers.io())
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
package com.mogo.eagle.core.function.autopilot.adapter;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.module.common.drawer.IdentifyDataDrawer;
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo;
|
||||
import com.zhidao.support.obu.ami.AmiClientManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import chassis.Chassis;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
public class MoGoHandAdasMsgManager implements
|
||||
IMoGoAutopilotIdentifyListener,
|
||||
IMoGoAutopilotCarStateListener {
|
||||
IMoGoAutopilotVehicleStateListener {
|
||||
|
||||
private final String TAG = "AdasEventManager";
|
||||
|
||||
@@ -30,7 +26,7 @@ public class MoGoHandAdasMsgManager implements
|
||||
|
||||
private MoGoHandAdasMsgManager() {
|
||||
CallerAutopilotIdentifyListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
}
|
||||
|
||||
public static MoGoHandAdasMsgManager getInstance() {
|
||||
@@ -44,40 +40,25 @@ public class MoGoHandAdasMsgManager implements
|
||||
return moGoHandAdasMsgManager;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotCarStateData(@Nullable AutopilotCarStateInfo autoPilotCarStateInfo) {
|
||||
// 获取的自动驾驶车辆信息不是空的时候
|
||||
if (autoPilotCarStateInfo != null) {
|
||||
//can数据转发
|
||||
AutopilotCarStateInfo.ValuesBean bean = autoPilotCarStateInfo.getValues();
|
||||
|
||||
if (bean != null) {
|
||||
//转向灯状态 0是正常 1是左转 2是右转
|
||||
//turnLightOften 是sdk适配的字段,后期建议CarStateInfo和AutopilotCarStateInfo统一成一个
|
||||
int turnLight = bean.getTurnLightOften();
|
||||
AmiClientManager.getInstance().setTurnLightState(turnLight);
|
||||
int brakeLight = bean.getBrake_light(); //1刹车灯亮 其他为松开
|
||||
// Logger.d(TAG, "onCarStateData ---- turnLight = " + turnLight + "---brakeLight = " + brakeLight);
|
||||
//设置转向灯
|
||||
if (turnLight == 1 || turnLight == 2) {
|
||||
CallerHmiManager.INSTANCE.showBrakeLight(0);
|
||||
CallerHmiManager.INSTANCE.showTurnLight(turnLight);
|
||||
}
|
||||
|
||||
//设置刹车信息
|
||||
if (turnLight == 0){
|
||||
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight);
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "bean == null ");
|
||||
}
|
||||
public void onAutopilotLightSwitchData(Chassis.LightSwitch lightSwitch) {
|
||||
//can数据转发 转向灯状态 0是正常 1是左转 2是右转
|
||||
if (lightSwitch != null) {
|
||||
int turnLightNum = lightSwitch.getNumber();
|
||||
AmiClientManager.getInstance().setTurnLightState(turnLightNum);
|
||||
//设置转向灯
|
||||
CallerHmiManager.INSTANCE.showTurnLight(turnLightNum);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotBrakeLightData(boolean brakeLight) {
|
||||
//设置刹车信息
|
||||
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight ? 1 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotIdentifyDataUpdate(@Nullable ArrayList<TrafficData> trafficData) {
|
||||
public void onAutopilotIdentifyDataUpdate(List<MessagePad.TrackedObject> trafficData) {
|
||||
try {
|
||||
if (FunctionBuildConfig.isDrawIdentifyData) {
|
||||
ThreadUtils.getSinglePool().execute(() ->
|
||||
@@ -92,13 +73,13 @@ public class MoGoHandAdasMsgManager implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotWarnMessage(@Nullable AutopilotWarnMessage autopilotWarnMessage) {
|
||||
public void onAutopilotWarnMessage(MessagePad.Warn warn) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotRecordResult(AutoPilotRecordResult result) {
|
||||
public void onAutopilotRecordResult(RecordPanelOuterClass.RecordPanel recordPanel) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.eagle.core.function.autopilot.entity;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/28 16:12
|
||||
* Created by SuYong on 2021/5/28 16:12
|
||||
*/
|
||||
public class AutonomousDriveStatusBean {
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.eagle.core.function.autopilot.entity;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/31 16:24
|
||||
* Created by SuYong on 2021/5/31 16:24
|
||||
*/
|
||||
public class ReportSiteBean {
|
||||
private String sn;
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.mogo.eagle.core.function.autopilot.entity.ReportSiteBean;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
|
||||
@@ -89,7 +88,6 @@ public class AdasServiceModel {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "autopilotArrive success");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.mogo.eagle.core.function.autopilot.server
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlCmdParameter
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
|
||||
import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -25,12 +22,10 @@ class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListen
|
||||
}
|
||||
|
||||
fun initServer() {
|
||||
Logger.d(TAG, "initServer……")
|
||||
CallTrafficLightListenerManager.registerTrafficLightListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
|
||||
val autopilotControlCmdParameter = AutopilotControlCmdParameter("light", trafficLightResult)
|
||||
CallerAutoPilotManager.sendDataToAutopilot(GsonUtils.toJson(autopilotControlCmdParameter))
|
||||
CallerAutoPilotManager.sendTrafficLightData(trafficLightResult)
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
package com.mogo.eagle.core.function.autopilot.utils
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo
|
||||
import com.zhidao.support.adas.high.bean.RectInfo
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo
|
||||
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo
|
||||
import com.zhidao.utils.common.GsonUtil
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/10/18 1:32 下午
|
||||
*/
|
||||
object AdasObjectConvertUtils {
|
||||
val TAG = "AdasObjectConvertUtils"
|
||||
|
||||
fun fromAutopilotGuardianInfo(autopilotGuardianInfo: AutopilotGuardianInfo): AutopilotGuardianStatusInfo? {
|
||||
return GsonUtil.objectFromJson(
|
||||
GsonUtil.jsonFromObject(autopilotGuardianInfo),
|
||||
AutopilotGuardianStatusInfo::class.java
|
||||
)
|
||||
}
|
||||
|
||||
fun fromAdasAutopilotRoute(carStateInfo: AutopilotRoute): AutopilotRouteInfo? {
|
||||
return GsonUtil.objectFromJson(
|
||||
GsonUtil.jsonFromObject(carStateInfo),
|
||||
AutopilotRouteInfo::class.java
|
||||
)
|
||||
}
|
||||
|
||||
fun fromAdasCarStateInfoObject(carStateInfo: CarStateInfo): AutopilotCarStateInfo? {
|
||||
return GsonUtil.objectFromJson(
|
||||
GsonUtil.jsonFromObject(carStateInfo),
|
||||
AutopilotCarStateInfo::class.java
|
||||
)
|
||||
}
|
||||
|
||||
fun fromAdasObject(info: WarnMessageInfo?): AutopilotWarnMessage? {
|
||||
if (info == null) {
|
||||
return null
|
||||
}
|
||||
val warnMessage = AutopilotWarnMessage()
|
||||
warnMessage.content = info.content
|
||||
warnMessage.level = info.level
|
||||
try {
|
||||
warnMessage.type = info.type.toInt()
|
||||
} catch (e: NumberFormatException) {
|
||||
return null
|
||||
}
|
||||
warnMessage.value = info.value
|
||||
return warnMessage
|
||||
}
|
||||
|
||||
fun regroupTrafficDataData(datums: List<RectInfo.RectBean?>?): ArrayList<TrafficData>? {
|
||||
if (datums == null || datums.isEmpty()) {
|
||||
return null
|
||||
}
|
||||
val recognizedListResults: ArrayList<TrafficData> = ArrayList()
|
||||
for (model in datums) {
|
||||
if (model == null) {
|
||||
continue
|
||||
}
|
||||
val recognizedListResult = fromAdasTrafficDataObject(model)
|
||||
if (recognizedListResult != null) {
|
||||
recognizedListResults.add(recognizedListResult)
|
||||
}
|
||||
}
|
||||
return recognizedListResults
|
||||
}
|
||||
|
||||
fun fromAdasTrafficDataObject(model: RectInfo.RectBean?): TrafficData? {
|
||||
if (model == null) {
|
||||
return null
|
||||
}
|
||||
val result = TrafficData()
|
||||
result.uuid = model.uuid
|
||||
result.lat = model.lat
|
||||
result.lon = model.lon
|
||||
result.type = TrafficTypeEnum.getType(model.type.toInt())
|
||||
result.heading = model.heading
|
||||
result.systemTime = model.systemTime.toLong()
|
||||
result.satelliteTime = model.satelliteTime.toLong()
|
||||
result.alt = model.alt
|
||||
result.speed = model.speed
|
||||
result.carId = model.carId
|
||||
result.dataAccuracy = model.dataAccuracy
|
||||
result.distance = model.distance
|
||||
result.threatLevel = model.drawlevel
|
||||
|
||||
//Log.d(TAG, "TrafficData = $result")
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user