[2.13.2]优化V2X事件触发逻辑
This commit is contained in:
@@ -75,24 +75,32 @@ public class V2XAlarmServer {
|
||||
double eventBearing = eventLocation.getAngle();
|
||||
double diffAngle = DrivingDirectionUtils.getAngleDiff(carBearing, eventBearing);
|
||||
Log.d("RWJ", "car_bearing:" + carBearing + ",eventBearing:" + eventBearing + ",diffAngle:" + diffAngle);
|
||||
if (diffAngle < 20) {
|
||||
if (diffAngle >= 0 && diffAngle <= 20) {
|
||||
// 3、计算当前车辆行驶方向与事件位置之间夹角《20度,保证道路事件在车辆前方
|
||||
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
currentLocation.getLongitude(),
|
||||
currentLocation.getLatitude(),
|
||||
eventLocation.getLon(),
|
||||
eventLocation.getLat(),
|
||||
(int) currentLocation.getBearing()
|
||||
);
|
||||
// double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
// currentLocation.getLongitude(),
|
||||
// currentLocation.getLatitude(),
|
||||
// eventLocation.getLon(),
|
||||
// eventLocation.getLat(),
|
||||
// (int) currentLocation.getBearing()
|
||||
// );
|
||||
//
|
||||
// Log.d("RWJ", "eventAngle:" + eventAngle);
|
||||
// if (0 <= eventAngle && eventAngle <= 20) {
|
||||
// if (showedEvents.contains(v2XRoadEventEntity)) {
|
||||
// return null;
|
||||
// }
|
||||
// Log.d("RWJ", "showed---");
|
||||
// showedEvents.add(v2XRoadEventEntity);
|
||||
// return v2XRoadEventEntity;
|
||||
// }
|
||||
|
||||
Log.d("RWJ", "eventAngle:" + eventAngle);
|
||||
if (0 <= eventAngle && eventAngle <= 20) {
|
||||
if (showedEvents.contains(v2XRoadEventEntity)) {
|
||||
return null;
|
||||
}
|
||||
showedEvents.add(v2XRoadEventEntity);
|
||||
return v2XRoadEventEntity;
|
||||
if (showedEvents.contains(v2XRoadEventEntity)) {
|
||||
return null;
|
||||
}
|
||||
Log.d("RWJ", "showed---");
|
||||
showedEvents.add(v2XRoadEventEntity);
|
||||
return v2XRoadEventEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,9 +41,6 @@ import java.util.concurrent.TimeUnit;
|
||||
public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> implements IMoGoWarningStatusListener {
|
||||
private static final String TAG = "V2XRoadEventScenario";
|
||||
|
||||
public V2XRoadEventScenario() {
|
||||
setV2XMarker(new V2XRoadEventMarker());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity) {
|
||||
@@ -120,8 +117,8 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
MarkerLocation eventLocation = noveltyInfo.getLocation();
|
||||
if (eventLocation != null) {
|
||||
double distance = CoordinateUtils.calculateLineDistance(carLocation.getLongitude(), carLocation.getLatitude(), eventLocation.getLon(), eventLocation.getLat());
|
||||
alarmText = String.format(alarmText, distance + "");
|
||||
ttsText = String.format(ttsText, distance + "");
|
||||
alarmText = String.format(alarmText, Math.round(distance) + "");
|
||||
ttsText = String.format(ttsText, Math.round(distance) + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user