Merge branch 'dev_minibus-d_230425_3.2.0' into code_opt_3.3.0
This commit is contained in:
@@ -281,6 +281,7 @@ class MoGoAutopilotControlProvider :
|
||||
SharedPrefsMgr.getInstance(it).putString(MoGoConfig.AUTOPILOT_IP, autoPilotIp)
|
||||
}
|
||||
// 设置IP地址
|
||||
AdasManager.getInstance().adasOptions.isClient = false
|
||||
AdasManager.getInstance().adasOptions.ipcConnectionMode =
|
||||
AdasOptions.IPC_CONNECTION_MODE.ASSIGN
|
||||
AdasManager.getInstance().adasOptions.ipcAssignIP = autoPilotIp
|
||||
|
||||
@@ -288,9 +288,6 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
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.version = AdasManager.getInstance().adasVersion
|
||||
if (autopilotStatusInfo.connectIP == null) {
|
||||
autopilotStatusInfo.connectIP = AdasManager.getInstance().ipcConnectedIp
|
||||
|
||||
@@ -1,10 +1,24 @@
|
||||
package com.mogo.eagle.core.function.datacenter.autopilot.server
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.biz.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.zhidao.support.adas.high.AdasManager
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
@@ -14,7 +28,8 @@ import com.zhidao.support.adas.high.AdasManager
|
||||
* 异步同步数据给 Autopilot 控制器
|
||||
* 数据源(不限于):OBU、网络等
|
||||
*/
|
||||
class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListener {
|
||||
class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListener,
|
||||
IMoGoAutopilotStatusListener {
|
||||
companion object {
|
||||
const val TAG = "AsyncDataToAutopilotServer"
|
||||
val INSTANCE: AsyncDataToAutopilotServer by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
@@ -22,10 +37,41 @@ class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListen
|
||||
}
|
||||
}
|
||||
|
||||
private var mPreAutoStatus = AtomicInteger(-1)
|
||||
private var createSubscribe: Disposable? = null
|
||||
|
||||
fun initServer() {
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
super.onAutopilotStatusResponse(autoPilotStatusInfo)
|
||||
val state = autoPilotStatusInfo.state
|
||||
if (mPreAutoStatus.get() != state) {
|
||||
mPreAutoStatus.set(state)
|
||||
createSubscribe?.let {
|
||||
if (!it.isDisposed) {
|
||||
bizLog(SceneConstant.M_ADAS_IMPL + TAG, "自动驾驶状态变化,取消前置轨迹请求,间隔2s重新请求底盘轨迹")
|
||||
createSubscribe?.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
when (state) {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
createSubscribe = Observable.timer(2000L, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
bizLog(SceneConstant.M_ADAS_IMPL + TAG, "请求底盘轨迹")
|
||||
CallerAutoPilotControlManager.getGlobalPath()
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
|
||||
var version = -1
|
||||
if (AdasManager.getInstance().carConfig != null) {
|
||||
@@ -34,4 +80,16 @@ class AsyncDataToAutopilotServer private constructor() : IMoGoTrafficLightListen
|
||||
if (version > -1 && version < 290)
|
||||
CallerAutoPilotControlManager.sendTrafficLightData(trafficLightResult)
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT,
|
||||
linkCode = ChainConstant.CHAIN_LINK_ADAS,
|
||||
endpoint = PAD,
|
||||
nodeAliasCode = ChainConstant.CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_BIZ,
|
||||
paramIndexes = [0, 1],
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
private fun bizLog(tag: String, msg: String) {
|
||||
CallerLogger.d(tag, msg)
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.eagle.core.function.datacenter.v2x
|
||||
|
||||
import android.content.Context
|
||||
import android.os.CountDownTimer
|
||||
import android.os.Handler
|
||||
import com.mogo.eagle.core.data.biz.trafficlight.*
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
@@ -63,6 +64,9 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
@Volatile
|
||||
private var hasObuLightStatus: Boolean = false
|
||||
|
||||
private var lightCountDownTimer: CountDownTimer?= null
|
||||
private var lastLightTime: Long = System.currentTimeMillis()
|
||||
|
||||
fun initServer(context: Context) {
|
||||
mContext = context
|
||||
//注册监听AI云.OBU,路侧获取红绿灯状态
|
||||
@@ -79,6 +83,28 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onAutopilotPerceptionTrafficLight ---- hasObuLightStatus = $hasObuLightStatus ----hasAiLightStatus = $hasAiLightStatus ")
|
||||
if (!hasObuLightStatus) {
|
||||
if (!hasAiLightStatus) {
|
||||
|
||||
lastLightTime = System.currentTimeMillis()
|
||||
if(lightCountDownTimer==null){
|
||||
lightCountDownTimer = object: CountDownTimer(300000,1000){
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
if((System.currentTimeMillis() - lastLightTime)>1000){
|
||||
//隐藏红绿灯显示
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
lightCountDownTimer?.cancel()
|
||||
lightCountDownTimer = null
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
lightCountDownTimer?.cancel()
|
||||
lightCountDownTimer = null
|
||||
}
|
||||
|
||||
}
|
||||
lightCountDownTimer?.start()
|
||||
}
|
||||
|
||||
trafficLights?.let { it ->
|
||||
var light: TrafficLight? = null
|
||||
if (it.hasStraight()) {
|
||||
@@ -205,7 +231,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
|
||||
CallerTrafficLightListenerManager.changeCountdownYellow(remain)
|
||||
}
|
||||
TrafficLightEnum.BLACK -> {
|
||||
CallerTrafficLightListenerManager.disableTrafficLightCountDown()
|
||||
CallerTrafficLightListenerManager.disableTrafficLight()
|
||||
}
|
||||
else -> {
|
||||
hide()
|
||||
|
||||
Reference in New Issue
Block a user