[2.15.0][V2N] 添加本地日志; 放宽v2n事件触发条件[diffAngle:20->30, eventAngle: 20 -> 25]

This commit is contained in:
renwj
2023-04-19 15:50:59 +08:00
parent f4cffe569a
commit bde82664f4
3 changed files with 22 additions and 11 deletions

View File

@@ -37,7 +37,7 @@ public class V2XAlarmServer {
CopyOnWriteArrayList<V2XRoadEventEntity> v2XRoadEventEntityList,
MogoLocation currentLocation) {
try {
//Logger.d(TAG, "getDriveFrontAlarmEvent --- 1 ---" + currentLocation );
Logger.d(TAG, "getDriveFrontAlarmEvent --- 1 ---" + currentLocation );
if (!showedEvents.isEmpty()) {
Iterator<V2XRoadEventEntity> iterator = showedEvents.iterator();
while (iterator.hasNext()) {
@@ -54,7 +54,7 @@ public class V2XAlarmServer {
}
}
}
//Logger.d(TAG, "getDriveFrontAlarmEvent --- 2 ---" + currentLocation);
Logger.d(TAG, "getDriveFrontAlarmEvent --- 2 ---" + currentLocation);
if (currentLocation != null && v2XRoadEventEntityList != null) {
// 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告
for (V2XRoadEventEntity v2XRoadEventEntity : v2XRoadEventEntityList) {
@@ -65,7 +65,7 @@ public class V2XAlarmServer {
MarkerLocation eventLocation = v2XRoadEventEntity.getLocation();
// 1、判断是否到达了触发距离,20 ~ 500,
double distance = v2XRoadEventEntity.getDistance();
//Logger.d(TAG, "distance:" + distance);
Logger.d(TAG, "distance:" + distance + ",poiType:" + v2XRoadEventEntity.getPoiType());
if (distance <= 500) {
if (EventTypeEnumNew.GHOST_PROBE.getPoiType().equals(v2XRoadEventEntity.getPoiType())) {
if (distance > 25) {
@@ -76,8 +76,8 @@ public class V2XAlarmServer {
double carBearing = currentLocation.getHeading();
double eventBearing = eventLocation.getAngle();
double diffAngle = DrivingDirectionUtils.getAngleDiff(carBearing, eventBearing);
//Logger.d(TAG, "car_bearing:" + carBearing + ",eventBearing:" + eventBearing + ",diffAngle:" + diffAngle);
if (diffAngle <= 20) {
Logger.d(TAG, "car_bearing:" + carBearing + ",eventBearing:" + eventBearing + ",diffAngle:" + diffAngle);
if (diffAngle <= 30) {
// 3、计算当前车辆行驶方向与事件位置之间夹角《20度保证道路事件在车辆前方
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
currentLocation.getLongitude(),
@@ -87,12 +87,12 @@ public class V2XAlarmServer {
(int) currentLocation.getHeading()
);
//Logger.d(TAG, "eventAngle:" + eventAngle);
if (0 <= eventAngle && eventAngle <= 20) {
Logger.d(TAG, "eventAngle:" + eventAngle);
if (0 <= eventAngle && eventAngle <= 25) {
if (showedEvents.contains(v2XRoadEventEntity)) {
return null;
}
//Logger.d(TAG, "showed---");
Logger.d(TAG, "showed---");
showedEvents.add(v2XRoadEventEntity);
return v2XRoadEventEntity;
}

View File

@@ -207,9 +207,8 @@ internal object V2NIdentifyDrawer {
} catch (t: Throwable) {
t.printStackTrace()
}
val shiGong = trafficData?.filter { it.type == 501 || it.type == 502 }
Logger.d(TAG, "--- onAutopilotIdentifyDataUpdate -- : trafficData: ${ trafficData?.joinToString(",") }")
val shiGong = trafficData?.filter { it.type == 501 || it.type == 502 }
if (shiGong != null && shiGong.isNotEmpty()) {
drawShiGong(shiGong)
}
@@ -221,7 +220,7 @@ internal object V2NIdentifyDrawer {
override fun onAutopilotV2nCongestionEvent(header: Header, rsi: RSI_PB) {
super.onAutopilotV2nCongestionEvent(header, rsi)
Logger.d(TAG, "--- onAutopilotV2nCongestionEvent -- : rsi: ${ GsonUtils.toJson(rsi) }")
try {
V2XBizTrace.onAck("onAutopilotV2nCongestionEvent", rsi)
} catch (t: Throwable) {

View File

@@ -4,6 +4,7 @@ import android.animation.ArgbEvaluator
import android.graphics.Color
import android.os.Handler
import android.os.Looper
import android.util.Log
import android.view.animation.DecelerateInterpolator
import androidx.core.util.Pair
import com.mogo.eagle.core.data.map.MogoLatLng
@@ -88,6 +89,7 @@ class AiRoadMarker {
300f
)
//施工中心点后方的自车行驶方向上300米距离
Log.d(TAG, "--- marker --- 3 --- l1:$l1")
V2XBizTrace.onAck("$TAG --- marker --- 3 --- l1:", l1)
val l2 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(
marker.poi_lon,
@@ -96,9 +98,11 @@ class AiRoadMarker {
-300f
)
if (l1.points.isEmpty() || l2.points.isEmpty()) {
Log.d(TAG, " --- marker --- 3 --- return ----")
V2XBizTrace.onAck("$TAG --- marker --- 3 --- return ----", "")
return
}
Log.d(TAG, " --- marker --- 4 --- l2: $l2")
V2XBizTrace.onAck("$TAG --- marker --- 4 --- l2:", l2)
val points = LinkedList<MogoLatLng>()
if (l2 != null && l2.points.isNotEmpty()) {
@@ -108,6 +112,7 @@ class AiRoadMarker {
}
val centerX = marker.poi_lon
val centerY = marker.poi_lat
Log.d(TAG, "--- marker --- 5 --- marker: $marker")
V2XBizTrace.onAck("$TAG --- marker --- 5 --- marker:", marker)
val farthestPoint = marker.polygon?.let {
var find: Pair<Double, Double> = Pair(centerX, centerY)
@@ -128,6 +133,7 @@ class AiRoadMarker {
MogoLatLng(find.second, find.first)
} ?: MogoLatLng(centerY, centerX)
marker.farthestPoint = Pair(farthestPoint.lon, farthestPoint.lat)
Log.d(TAG, "--- marker --- 6 --- marker:$marker")
V2XBizTrace.onAck("$TAG --- marker --- 6 --- marker:", marker)
if (l1 != null && l1.points.isNotEmpty()) {
for (l in l1.points) {
@@ -160,6 +166,7 @@ class AiRoadMarker {
var line = line.get()
options.points(points)
options.colorValues(colors)
Log.d(TAG, "--- marker --- 7 --- points:${points.size}")
V2XBizTrace.onAck("$TAG --- marker --- 7 --- points:", "${points.size}")
if (line == null || line.isDestroyed) {
val l = overlayManager?.addPolyline(options)
@@ -183,8 +190,10 @@ class AiRoadMarker {
private fun removeLine() {
val old = line.get()
Log.d(TAG, " --- removeRedLine --- 1")
V2XBizTrace.onAck("$TAG --- removeRedLine --- 1", "")
if (old != null) {
Log.d(TAG,"--- removeRedLine --- 2")
V2XBizTrace.onAck("$TAG --- removeRedLine --- 2", "")
line.set(null)
old.isVisible = false
@@ -193,6 +202,7 @@ class AiRoadMarker {
}
private fun unMarker(marker: Marker) {
Log.d(TAG,"$TAG --- unMarker ---")
V2XBizTrace.onAck("$TAG --- unMarker ---", "")
this.marker.set(null)
removeLine()
@@ -202,11 +212,13 @@ class AiRoadMarker {
}
fun receive() {
Log.d(TAG, " --- receive --- 1 ---")
V2XBizTrace.onAck("$TAG --- receive --- 1 ---", "")
val poi = this.marker.get()
val car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
if (poi != null) {
val distance = CoordinateUtils.calculateLineDistance(car.longitude, car.latitude, poi.poi_lon, poi.poi_lat)
Log.d(TAG ," --- receive --- 2 ---car:[${car.longitude}, ${car.latitude}] -> poi:[${poi.poi_lon}, ${poi.poi_lat}] --> distance:$distance")
V2XBizTrace.onAck(
"$TAG --- receive --- 2 ---",
"car:[${car.longitude}, ${car.latitude}] -> poi:[${poi.poi_lon}, ${poi.poi_lat}] --> distance:$distance"