opt road match

This commit is contained in:
tongchenfei
2021-03-16 16:54:10 +08:00
parent c942144189
commit a6a2c2a39b
5 changed files with 116 additions and 68 deletions

View File

@@ -171,7 +171,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
mAdasRecognizedMarkersCaches = newAdasRecognizedMarkersCaches;
}
// private final Map< String, Boolean > mIsMatchStatusCache = new ArrayMap<>();
private final Map< String, Boolean > mIsMatchStatusCache = new ArrayMap<>();
private String markerRes;
private String markerRes2;
@@ -204,14 +204,25 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
);
ADASRecognizedResult lastPosition = mLastPositions.remove( uniqueKey );
boolean match = false;
if ( matchedPoint != null ) {
Logger.d( TAG, "matchPoint %s distance = %s",lineCounter, matchedPoint[2] );
boolean match = matchedPoint[2] < 0.45 && matchedPoint[2] > 0;
match = matchedPoint[2] < 1 && matchedPoint[2] > 0;
if ( lastPosition != null ) {
double clearAngle;
if (recognizedListResult.heading > 0 && recognizedListResult.heading <= 90) {
clearAngle = recognizedListResult.heading;
} else if (recognizedListResult.heading > 90 && recognizedListResult.heading <= 180) {
clearAngle = 180 - recognizedListResult.heading ;
} else if (recognizedListResult.heading > 180 && recognizedListResult.heading <= 270) {
clearAngle = recognizedListResult.heading - 180;
}else{
clearAngle = 360 - recognizedListResult.heading;
}
double _angle = Math.atan2(Math.abs(matchedPoint[0] - lastPosition.lon), Math.abs(matchedPoint[1] - lastPosition.lat)) * (180 / PI);
Logger.d( TAG, "matchPoint %s angel = %s", lineCounter,_angle );
_angle = Math.abs(clearAngle - _angle);
Logger.d(TAG, "matchPoint %s angel = %s", lineCounter, _angle);
if ( _angle > 22.5 ) {
match = false;
}
@@ -222,12 +233,12 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
recognizedListResult.lat = matchedPoint[1];
}
}
mLastPositions.put( uniqueKey, recognizedListResult );
// Boolean isMatch = mIsMatchStatusCache.get( uniqueKey );
// if ( matchedPoint != null ) {
// if ( ( isMatch == null || !isMatch ) ) {
// if ( matchedPoint[2] < 0.5 ) {
// if ( matchedPoint[2] < 0.5 && matchedPoint[2] > 0 ) {
// isMatch = true;
// }
// } else {
@@ -238,6 +249,13 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
// if ( isMatch == null ) {
// isMatch = false;
// }
// if (lastPosition != null) {
// double _angle = Math.atan2(Math.abs(matchedPoint[0] - lastPosition.lon), Math.abs(matchedPoint[1] - lastPosition.lat)) * (180 / PI);
// Logger.d(TAG, "matchPoint %s angel = %s", lineCounter, _angle);
// if (_angle > 22.5) {
// isMatch = false;
// }
// }
// mIsMatchStatusCache.put( uniqueKey, isMatch );
//
// if ( isMatch ) {
@@ -245,8 +263,8 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
// recognizedListResult.lat = matchedPoint[1];
// }
// }
mLastPositions.put( uniqueKey, recognizedListResult );
Logger.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
IMogoMarker marker = mAdasRecognizedMarkersCaches.remove( uniqueKey );
if ( marker == null || marker.isDestroyed() ) {
@@ -331,6 +349,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
SpeedData obj = new SpeedData();
obj.context = mContext;
obj.marker = marker;
// obj.speed = match ? 1.0 : 0.0;
obj.speed = recognizedListResult.speed;//;lineCounter++
msg.obj = obj;
msg.what = MSG_DISPLAY_SPEED;