合并2.13.2的obu验收相关功能
This commit is contained in:
@@ -11,6 +11,7 @@ import com.mogo.eagle.function.biz.monitoring.CronTaskManager.Companion.cronTask
|
||||
import com.mogo.eagle.function.biz.notice.NoticeSocketManager.Companion.noticeSocketManager
|
||||
import com.mogo.eagle.function.biz.notice.network.NoticeNetWorkManager
|
||||
import com.mogo.eagle.function.biz.v2x.speedlimit.SpeedLimitDataManager
|
||||
import com.mogo.eagle.function.biz.v2x.speedlimit.SpeedLimitDispatcher
|
||||
import com.mogo.eagle.function.biz.v2x.trafficlight.core.MogoTrafficLightManager
|
||||
import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightDispatcher
|
||||
import com.mogo.eagle.function.biz.v2x.vip.VipCarManager
|
||||
@@ -30,6 +31,7 @@ class FuncBizProvider : IMoGoFuncBizProvider {
|
||||
TrafficLightDispatcher.INSTANCE.initServer(context) //todo 红绿灯中心模块放入dataCenter
|
||||
VipCarManager.INSTANCE.initServer(context)
|
||||
SpeedLimitDataManager.getInstance().start()
|
||||
SpeedLimitDispatcher.INSTANCE.initLimit(context)
|
||||
// RedLightWarningManager.INSTANCE.listenTrafficLight()
|
||||
}
|
||||
|
||||
|
||||
@@ -61,15 +61,16 @@ public class SpeedLimitDataManager implements IMoGoChassisLocationGCJ02Listener
|
||||
|
||||
@BizConfig(biz = V2I, dependentBizNode = "", bizNode = BIZ_SLW)
|
||||
private void getSpeedLimit() {
|
||||
if (!isShowObuLimitSpeedView) {
|
||||
// if (!isShowObuLimitSpeedView) {
|
||||
int speedLimit = CallerMapUIServiceManager.INSTANCE.getMapUIController().getLimitSpeed(mLocation.getLongitude(), mLocation.getLatitude(), (float) mLocation.getHeading());
|
||||
UiThreadHandler.post(() -> {
|
||||
if (speedLimit > 0) {
|
||||
CallerHmiManager.INSTANCE.showLimitingVelocity(speedLimit);
|
||||
// CallerHmiManager.INSTANCE.showLimitingVelocity(speedLimit, 1);
|
||||
CallLimitingVelocityListenerManager.INSTANCE.invokeOnLimitingVelocityChange(speedLimit);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.mogo.eagle.function.biz.v2x.speedlimit
|
||||
|
||||
import android.content.Context
|
||||
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.trafficlight.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallLimitingVelocityListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallObuLimitingSpeedListenerManager
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 对多个限速进行调度(map,rsu ...)
|
||||
* @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.removeListener(TAG)
|
||||
//取消注册监听工控机感知红绿灯
|
||||
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,9 +4,11 @@ import android.content.Context
|
||||
import android.os.Handler
|
||||
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.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.function.biz.v2x.trafficlight.TrafficLightHMIManager
|
||||
import perception.TrafficLightOuterClass
|
||||
@@ -17,26 +19,36 @@ import perception.TrafficLightOuterClass.TrafficLight
|
||||
* @description 对多个红绿灯信号来源进行统一调度(AI云、工控机)
|
||||
* @since: 2022/4/28
|
||||
*/
|
||||
class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLightListener {
|
||||
class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLightListener,
|
||||
IMoGoObuTrafficLightListener {
|
||||
|
||||
companion object{
|
||||
companion object {
|
||||
const val TAG = "TrafficLightDispatcher"
|
||||
val INSTANCE: TrafficLightDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED){
|
||||
val INSTANCE: TrafficLightDispatcher by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
TrafficLightDispatcher()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
//是否有AI获取红绿灯灯态
|
||||
private var hasAiLightStatus: Boolean = false
|
||||
//obu数据
|
||||
private var hasObuLightStatus: Boolean = false
|
||||
|
||||
fun initServer(context: Context){
|
||||
fun initServer(context: Context) {
|
||||
mContext = context
|
||||
//注册监听AI云获取红绿灯状态,注册监听AI云进入路口,注册监听红绿灯请求失败
|
||||
//注册监听AI云获取红绿灯状态
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
//注册监听AI云进入路口
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
//注册监听红绿灯请求失败
|
||||
CallerTrafficLightListenerManager.addListener(TAG, this)
|
||||
//注册监听工控机感知红绿灯
|
||||
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
|
||||
//obu红绿灯数据
|
||||
CallerObuTrafficLightListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,46 +56,48 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLigh
|
||||
* @param trafficLights 感知红绿灯
|
||||
*/
|
||||
override fun onAutopilotPerceptionTrafficLight(trafficLights: TrafficLightOuterClass.TrafficLights?) {
|
||||
if(!hasAiLightStatus){
|
||||
trafficLights?.let { it ->
|
||||
var light :TrafficLight?= null
|
||||
if(it.hasStraight()){
|
||||
light = it.straight
|
||||
}else if(it.hasLeft()){
|
||||
light = it.left
|
||||
}else if(it.hasRight()){
|
||||
light = it.right
|
||||
}else if(it.hasUTurn()){
|
||||
light = it.uTurn
|
||||
}
|
||||
if(light == null){
|
||||
//隐藏红绿灯显示
|
||||
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
|
||||
}else{
|
||||
when (light.state) {
|
||||
TrafficLightOuterClass.LightState.STATE_RED -> {
|
||||
//红灯
|
||||
CallerHmiManager.showWarningTrafficLight(1,2)
|
||||
CallerHmiManager.changeCountdownGreen(0)
|
||||
}
|
||||
TrafficLightOuterClass.LightState.STATE_YELLOW -> {
|
||||
//黄灯
|
||||
CallerHmiManager.showWarningTrafficLight(2,2)
|
||||
CallerHmiManager.changeCountdownGreen(0)
|
||||
}
|
||||
TrafficLightOuterClass.LightState.STATE_GREEN -> {
|
||||
//绿灯
|
||||
CallerHmiManager.showWarningTrafficLight(3,2)
|
||||
CallerHmiManager.changeCountdownGreen(0)
|
||||
}
|
||||
TrafficLightOuterClass.LightState.STATE_OFF -> {
|
||||
//黑灯,隐藏红绿灯显示
|
||||
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
|
||||
}
|
||||
else -> {}
|
||||
if (!hasObuLightStatus) {
|
||||
if (!hasAiLightStatus) {
|
||||
trafficLights?.let { it ->
|
||||
var light: TrafficLight? = null
|
||||
if (it.hasStraight()) {
|
||||
light = it.straight
|
||||
} else if (it.hasLeft()) {
|
||||
light = it.left
|
||||
} else if (it.hasRight()) {
|
||||
light = it.right
|
||||
} else if (it.hasUTurn()) {
|
||||
light = it.uTurn
|
||||
}
|
||||
if (light == null) {
|
||||
//隐藏红绿灯显示
|
||||
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
|
||||
} else {
|
||||
when (light.state) {
|
||||
TrafficLightOuterClass.LightState.STATE_RED -> {
|
||||
//红灯
|
||||
CallerHmiManager.showWarningTrafficLight(1, 2)
|
||||
CallerHmiManager.changeCountdownGreen(0)
|
||||
}
|
||||
TrafficLightOuterClass.LightState.STATE_YELLOW -> {
|
||||
//黄灯
|
||||
CallerHmiManager.showWarningTrafficLight(2, 2)
|
||||
CallerHmiManager.changeCountdownGreen(0)
|
||||
}
|
||||
TrafficLightOuterClass.LightState.STATE_GREEN -> {
|
||||
//绿灯
|
||||
CallerHmiManager.showWarningTrafficLight(3, 2)
|
||||
CallerHmiManager.changeCountdownGreen(0)
|
||||
}
|
||||
TrafficLightOuterClass.LightState.STATE_OFF -> {
|
||||
//黑灯,隐藏红绿灯显示
|
||||
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,21 +106,28 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLigh
|
||||
* AI云获取红绿灯状态
|
||||
*/
|
||||
override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
|
||||
TrafficLightHMIManager.INSTANCE.updateTrafficLight(trafficLightResult)
|
||||
hasAiLightStatus = true
|
||||
if (!hasObuLightStatus) {
|
||||
TrafficLightHMIManager.INSTANCE.updateTrafficLight(trafficLightResult)
|
||||
hasAiLightStatus = true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆进入路口
|
||||
* 车辆进入路口回调
|
||||
* @param enter true:进入路口;false:离开路口
|
||||
*/
|
||||
override fun onEnterCrossRoad(enter: Boolean) {
|
||||
if(!enter){
|
||||
if (!enter) {
|
||||
Handler().postDelayed({
|
||||
hasAiLightStatus = false
|
||||
hasObuLightStatus = false
|
||||
}, 5000)
|
||||
CallerTrafficLightListenerManager.resetTrafficLightData()
|
||||
//如果没有OBU灯态则进行隐藏,如果有OBU灯态,则交由OBU管理
|
||||
if(!hasObuLightStatus){
|
||||
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,14 +135,32 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener , IMoGoTrafficLigh
|
||||
*/
|
||||
override fun onTrafficRequestError() {
|
||||
hasAiLightStatus = false
|
||||
CallerTrafficLightListenerManager.resetTrafficLightData()
|
||||
if(!hasObuLightStatus){
|
||||
if (TrafficLightHMIManager.INSTANCE.isWarningTrafficLightShow()) {
|
||||
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* obu 红绿灯数据
|
||||
*/
|
||||
override fun onObuTrafficLight(light: Int) {
|
||||
super.onObuTrafficLight(light)
|
||||
hasObuLightStatus = true
|
||||
CallerHmiManager.showWarningTrafficLight(light, 3)
|
||||
}
|
||||
|
||||
fun destroy(){
|
||||
//取消注册监听AI云获取红绿灯状态,取消注册监听红绿灯请求失败,取消注册监听AI云进入路口
|
||||
fun destroy() {
|
||||
//取消注册监听AI云获取红绿灯状态
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
//取消注册监听工控机感知红绿灯
|
||||
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
|
||||
//取消注册监听红绿灯请求失败
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
//取消注册监听AI云进入路口
|
||||
CallerTrafficLightListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user