[2.13.2] 修改限速展示来源和优先级,暂时废弃开关

This commit is contained in:
lixiaopeng
2023-01-13 00:06:57 +08:00
parent 15235dce86
commit 3e3cbb4459
18 changed files with 220 additions and 29 deletions

View File

@@ -8,6 +8,7 @@ import com.mogo.eagle.core.function.api.v2x.IV2XEventProvider
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightManager
import com.mogo.eagle.core.function.v2x.events.V2XEventManager
import com.mogo.eagle.core.function.v2x.speedlimit.SpeedLimitDataManager
import com.mogo.eagle.core.function.v2x.speedlimit.SpeedLimitDispatcher
import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightDispatcher
import com.mogo.eagle.core.function.v2x.vip.VipCarManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
@@ -23,6 +24,7 @@ class V2XProvider : IV2XEventProvider {
VipCarManager.INSTANCE.initServer(context)
SpeedLimitDataManager.getInstance().start()
TrafficLightDispatcher.INSTANCE.initServer(context)
SpeedLimitDispatcher.INSTANCE.initLimit(context)
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
//不处理

View File

@@ -54,17 +54,16 @@ public class SpeedLimitDataManager implements IMogoCarLocationChangedListener2 {
@BizConfig(biz = V2I,dependentBizNode = "",bizNode = BIZ_SLW)
private void getSpeedLimit() {
if (!isShowObuLimitSpeedView) {
// if (!isShowObuLimitSpeedView) {
int speedLimit = MogoMapUIController.getInstance().getLimitSpeed(mLocation.getLongitude(), mLocation.getLatitude(), mLocation.getBearing());
UiThreadHandler.post(() -> {
if (speedLimit > 0) {
Log.d("liyz", "SpeedLimitDataManager map getSpeedLimit speedLimit = " + speedLimit);
CallerHmiManager.INSTANCE.showLimitingVelocity(speedLimit);
// CallerHmiManager.INSTANCE.showLimitingVelocity(speedLimit);
CallLimitingVelocityListenerManager.INSTANCE.invokeOnLimitingVelocityChange(speedLimit);
}
});
}
}
// }
}
public void start() {

View File

@@ -0,0 +1,80 @@
package com.mogo.eagle.core.function.v2x.speedlimit
import android.content.Context
import android.os.Handler
import android.util.Log
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuTrafficLightListener
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.api.v2x.LimitingVelocityListener
import com.mogo.eagle.core.function.api.v2x.ObuLimitingSpeedListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.obu.CallerObuTrafficLightListenerManager
import com.mogo.eagle.core.function.call.trafficlight.CallerTrafficLightListenerManager
import com.mogo.eagle.core.function.call.v2x.CallLimitingVelocityListenerManager
import com.mogo.eagle.core.function.call.v2x.CallObuLimitingSpeedListenerManager
import com.mogo.eagle.core.function.v2x.trafficlight.TrafficLightHMIManager
import perception.TrafficLightOuterClass
import perception.TrafficLightOuterClass.TrafficLight
/**
* @author lixiaopeng
* @description 对多个限速进行调度maprsu ...
* @since: 2023/1/12
*/
class SpeedLimitDispatcher : LimitingVelocityListener, ObuLimitingSpeedListener {
companion object {
const val TAG = "SpeedLimitDispatcher"
val INSTANCE: SpeedLimitDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
SpeedLimitDispatcher()
}
}
private var mContext: Context? = null
//是否有AI获取红绿灯灯态
private var hasObuStatus: Boolean = false
fun initLimit(context: Context) {
mContext = context
//注册监听MAP的限速
CallLimitingVelocityListenerManager.addListener(TAG, this)
//注册监听OBU的限速
CallObuLimitingSpeedListenerManager.addListener(TAG, this)
}
/**
* 地图限速数据
*/
override fun onLimitingVelocityChange(limitingVelocity: Int) {
// CallerHmiManager.disableLimitingVelocity()
if (!hasObuStatus) {
CallerHmiManager.showLimitingVelocity(limitingVelocity, 1)
}
}
/**
* obu限速
*/
override fun onObuLimitingSpeedChange(limitingSpeed: Int) {
// CallerHmiManager.disableLimitingVelocity()
if (limitingSpeed > 0) {
hasObuStatus = true
CallerHmiManager.showLimitingVelocity(limitingSpeed, 2)
} else {
hasObuStatus = false
CallerHmiManager.disableLimitingVelocity()
}
}
fun destroy() {
//取消注册监听AI云获取红绿灯状态
CallerTrafficLightListenerManager.unRegisterTrafficLightListener(TAG)
//取消注册监听工控机感知红绿灯
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
}
}