[V2X]V2X新增道路事件

This commit is contained in:
renwj
2022-06-10 19:16:51 +08:00
parent 2f8300c592
commit ca69a6ead7
3 changed files with 34 additions and 17 deletions

View File

@@ -64,10 +64,7 @@ import com.mogo.service.statusmanager.StatusDescriptor.SEEK_HELPING
import com.mogo.v2x.V2XManager import com.mogo.v2x.V2XManager
import com.mogo.v2x.callback.IV2XCallback import com.mogo.v2x.callback.IV2XCallback
import com.mogo.v2x.config.V2XConfig import com.mogo.v2x.config.V2XConfig
import com.mogo.v2x.data.V2XAdvanceWarning import com.mogo.v2x.data.*
import com.mogo.v2x.data.V2XMarkerCardResult
import com.mogo.v2x.data.V2XOptimalRoute
import com.mogo.v2x.data.V2XWarningTarget
import com.mogo.v2x.event.V2XEvent import com.mogo.v2x.event.V2XEvent
import com.shuyu.gsyvideoplayer.GSYVideoManager import com.shuyu.gsyvideoplayer.GSYVideoManager
import com.shuyu.gsyvideoplayer.cache.CacheFactory import com.shuyu.gsyvideoplayer.cache.CacheFactory
@@ -78,6 +75,7 @@ import com.shuyu.gsyvideoplayer.player.PlayerFactory
import com.shuyu.gsyvideoplayer.utils.GSYVideoType import com.shuyu.gsyvideoplayer.utils.GSYVideoType
import kotlinx.coroutines.* import kotlinx.coroutines.*
import kotlinx.coroutines.android.asCoroutineDispatcher import kotlinx.coroutines.android.asCoroutineDispatcher
import roadwork.Road.RW_PB
import tv.danmaku.ijk.media.player.IjkMediaPlayer import tv.danmaku.ijk.media.player.IjkMediaPlayer
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicBoolean import java.util.concurrent.atomic.AtomicBoolean
@@ -452,9 +450,27 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
is V2XEvent.Warning -> { is V2XEvent.Warning -> {
handleWarningTargetEvent(event.data) handleWarningTargetEvent(event.data)
} }
is V2XEvent.RoadAI -> {
handleRoadMarkerEvent(event.data.toRoadMarker)
}
} }
} }
private val RW_PB.toRoadMarker: V2XMarkerCardResult
get() = V2XMarkerCardResult().also { l1 ->
l1.exploreWay = ArrayList<V2XMarkerExploreWay>().also { l2 ->
l2.add(V2XMarkerExploreWay().also { l3 ->
l3.poiType = this.roadwork?.poiType?.toString()
l3.generateTime = this.roadwork?.detectTime ?: 0L
l3.location = V2XMarkerLocation().also { l4 ->
l4.lat = this.roadwork?.center?.point?.lat ?: 0.0
l4.lon = this.roadwork?.center?.point?.lon ?: 0.0
l4.angle = -1.0
}
})
}
}
private fun handleWarningTargetEvent(data: V2XWarningTarget) { private fun handleWarningTargetEvent(data: V2XWarningTarget) {
val v2xMessageEntity = V2XMessageEntity<V2XWarningTarget>() val v2xMessageEntity = V2XMessageEntity<V2XWarningTarget>()
v2xMessageEntity.type = V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS v2xMessageEntity.type = V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS

View File

@@ -48,7 +48,8 @@ public class V2XAlarmServer {
// 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告 // 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告
for (V2XRoadEventEntity v2XRoadEventEntity : v2XRoadEventEntityList) { for (V2XRoadEventEntity v2XRoadEventEntity : v2XRoadEventEntityList) {
// 0、道路事件必须有朝向角度>=0; // 0、道路事件必须有朝向角度>=0;
if (v2XRoadEventEntity.getLocation().getAngle() >= 0) { boolean ignoreAngle = v2XRoadEventEntity.getLocation().getAngle() < 0;
if (v2XRoadEventEntity.getLocation().getAngle() >= 0 || ignoreAngle) {
// 计算车辆距离指定气泡的距离 // 计算车辆距离指定气泡的距离
MarkerLocation eventLocation = v2XRoadEventEntity.getLocation(); MarkerLocation eventLocation = v2XRoadEventEntity.getLocation();
// 1、判断是否到达了触发距离,20 ~ 500, // 1、判断是否到达了触发距离,20 ~ 500,
@@ -63,7 +64,7 @@ public class V2XAlarmServer {
double carBearing = currentLocation.getBearing(); double carBearing = currentLocation.getBearing();
double eventBearing = eventLocation.getAngle(); double eventBearing = eventLocation.getAngle();
double diffAngle = DrivingDirectionUtils.getAngleDiff(carBearing, eventBearing); double diffAngle = DrivingDirectionUtils.getAngleDiff(carBearing, eventBearing);
if (diffAngle < 20) { if (ignoreAngle || diffAngle < 20) {
// 3、计算当前车辆行驶方向与事件位置之间夹角《20度保证道路事件在车辆前方 // 3、计算当前车辆行驶方向与事件位置之间夹角《20度保证道路事件在车辆前方
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi( double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
currentLocation.getLongitude(), currentLocation.getLongitude(),
@@ -72,7 +73,7 @@ public class V2XAlarmServer {
eventLocation.getLat(), eventLocation.getLat(),
(int) currentLocation.getBearing() (int) currentLocation.getBearing()
); );
if (0 <= eventAngle && eventAngle <= 20) { if (ignoreAngle || 0 <= eventAngle && eventAngle <= 20) {
// 判断是否已经提示过道路事件 // 判断是否已经提示过道路事件
boolean isAlreadyAlert = false; boolean isAlreadyAlert = false;
String lastTime = mAlertRoadEventList.get(v2XRoadEventEntity); String lastTime = mAlertRoadEventList.get(v2XRoadEventEntity);

View File

@@ -63,23 +63,23 @@ SERVICE_CHAIN_VERSION=1.1.0
LOGLIB_VERSION=1.3.0 LOGLIB_VERSION=1.3.0
######## MogoAiCloudSDK Version ######## ######## MogoAiCloudSDK Version ########
# 网络请求LOGLIB_VERSION # 网络请求LOGLIB_VERSION
MOGO_NETWORK_VERSION=1.3.59 MOGO_NETWORK_VERSION=1.4.1
# 鉴权 # 鉴权
MOGO_PASSPORT_VERSION=1.3.59 MOGO_PASSPORT_VERSION=1.4.1
# 常链接 # 常链接
MOGO_SOCKET_VERSION=1.3.59 MOGO_SOCKET_VERSION=1.4.1
# 数据采集 # 数据采集
MOGO_REALTIME_VERSION=1.3.59 MOGO_REALTIME_VERSION=1.4.1
# 探路,道路事件发布,获取 # 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.3.59 MOGO_TANLU_VERSION=1.4.1
# 直播推流 # 直播推流
MOGO_LIVE_VERSION=1.3.59 MOGO_LIVE_VERSION=1.4.1
# 直播拉流 # 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.3.59 MOGO_TRAFFICLIVE_VERSION=1.4.1
# 定位服务 # 定位服务
MOGO_LOCATION_VERSION=1.3.59 MOGO_LOCATION_VERSION=1.4.1
# 远程通讯模块 # 远程通讯模块
MOGO_TELEMATIC_VERSION=1.3.59 MOGO_TELEMATIC_VERSION=1.4.1
######## MogoAiCloudSDK Version ######## ######## MogoAiCloudSDK Version ########
# 自研地图 # 自研地图
MAP_SDK_VERSION=2.2.0.7 MAP_SDK_VERSION=2.2.0.7
@@ -155,7 +155,7 @@ MOGO_OCH_TAXI_VERSION=2.0.66
# mogoAiCloud sdk services # mogoAiCloud sdk services
MOGO_AICLOUD_SERVICES_SDK_VERSION=2.1.16.10 MOGO_AICLOUD_SERVICES_SDK_VERSION=2.1.16.10
# v2x-sdk # v2x-sdk
MOGO_V2X_SDK_VERSION=1.3.59 MOGO_V2X_SDK_VERSION=1.4.1
################# 旧版本架构模块版本 ################# ################# 旧版本架构模块版本 #################