Merge remote-tracking branch 'origin/dev2_aiSdk' into dev2_aiSdk

This commit is contained in:
董宏宇
2021-04-19 20:06:05 +08:00
14 changed files with 95 additions and 32 deletions

View File

@@ -131,10 +131,10 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
.longitude(location.getLon())
.set3DMode(true)
.controlAngle(true)
.rotate(rotate);
options.icon3DRes(getModelRes(type));
options.flat(true);
options.anchorColor("#FB3C3CFF");
.rotate(rotate)
.icon3DRes(getModelRes(type))
.anchorColor("#FB3C3CFF")
.flat(true);
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerType, options);
marker.setToTop();
}

View File

@@ -1 +0,0 @@
{"systemTime":1615529718585,"satelliteTime":1615529718585,"lon":116.411411222501,"lat":39.9753341630918,"alt":34.4018669128417,"heading":0.342695406938048,"speed":0.003303937,"type":3,"uuid":"2_1"}

View File

@@ -1 +0,0 @@
{"systemTime":1615529718585,"satelliteTime":1615529718585,"lon":116.411411222501,"lat":39.9753341630918,"alt":34.4018669128417,"heading":0.342695406938048,"speed":0.003303937,"type":3,"uuid":"2_1"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -625,6 +625,9 @@ public class MockIntentHandler implements IntentHandler {
boolean isUseAdasRecognize = intent.getBooleanExtra( "status", false );
DebugConfig.setUseAdasRecognize( isUseAdasRecognize );
break;
case 54:
mTimeTickCarHandler.sendEmptyMessageDelayed( 1, 0L );
break;
}
}
@@ -679,6 +682,7 @@ public class MockIntentHandler implements IntentHandler {
}
}
private Handler mLocationMockHandler = new Handler( WorkThreadHandler.newInstance( "loc-mock-thread" ).getLooper() ) {
@Override
public void handleMessage( Message msg ) {
@@ -740,9 +744,28 @@ public class MockIntentHandler implements IntentHandler {
}
roadSizeBr = null;
}
} else if (msg.what == 8) {
try {
handleMockAdasCarIntent();
} catch ( Exception e ) {
try {
if ( readers2 != null ) {
for ( BufferedReader reader : readers2 ) {
if (reader != null) {
reader.close();
}
}
}
} catch ( IOException ex ) {
ex.printStackTrace();
}
readers2 = null;
}
}
}
};
private Handler mLocationMockHandler1 = new Handler( WorkThreadHandler.newInstance( "loc-mock-thread1" ).getLooper() ) {
@Override
public void handleMessage( Message msg ) {
@@ -780,6 +803,19 @@ public class MockIntentHandler implements IntentHandler {
}
};
private Handler mTimeTickCarHandler = new Handler( WorkThreadHandler.newInstance( "loc-time-mock-thread" ).getLooper() ) {
@Override
public void handleMessage( Message msg ) {
super.handleMessage( msg );
mLocDelay += 50;
if ( mLocDelay > 4_000L ) {
mLocationMockHandler1.sendEmptyMessageDelayed( 1, 0L );
}
mLocationMockHandler.sendEmptyMessageDelayed( 8, 0L );
mTimeTickCarHandler.sendEmptyMessageDelayed( 0, 50L );
}
};
private BufferedReader br;
private boolean handleMockLocationIntent() throws Exception {
@@ -792,6 +828,7 @@ public class MockIntentHandler implements IntentHandler {
throw new Exception( "end of file." );
}
JSONObject jo = new JSONObject( line );
//改变rtk定位数据触发自车移动
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( jo );
Log.i( "mock-timer-loc-map", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
SnapshotLocationController.getInstance().syncAdasLocationInfo( jo );
@@ -830,6 +867,7 @@ public class MockIntentHandler implements IntentHandler {
}
private BufferedReader[] readers = null;
private BufferedReader[] readers2 = null;
private boolean handleMockAdasIntent() throws Exception {
final long start = System.currentTimeMillis();
@@ -858,6 +896,33 @@ public class MockIntentHandler implements IntentHandler {
return true;
}
private boolean handleMockAdasCarIntent() throws Exception {
final long start = System.currentTimeMillis();
if ( readers2 == null ) {
readers2 = new BufferedReader[3];
for ( int i = 0; i < 3; i++ ) {
readers2[i] = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adascar" + i + ".txt" ) ) );
}
}
List< ADASRecognizedResult > allList = new ArrayList<>();
for ( BufferedReader reader : readers2 ) {
String line = reader.readLine();
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
if ( adasRecognizedResult != null ) {
allList.add( adasRecognizedResult );
}
}
AdasRec adasRec = new AdasRec();
adasRec.models = allList;
MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockAdasRecognized( GsonUtil.jsonFromObject( adasRec ) );
Log.i( "mock-timer-adas", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
return true;
}
public static class AdasRec{
public String action = "view";
public List<ADASRecognizedResult> models;

View File

@@ -111,7 +111,7 @@ public class V2XWaringManager {
if (v2XWarnMessageListener != null) {
V2XServiceManager
.getMoGoSocketManager()
.unregisterOnMessageListener(10116, v2XWarnMessageListener);
.unregisterOnMessageListener(401018, v2XWarnMessageListener);
}
}
@@ -123,7 +123,7 @@ public class V2XWaringManager {
V2XServiceManager
.getMoGoSocketManager()
.registerOnMessageListener(
10116,
401018,
v2XWarnMessageListener );
}

View File

@@ -10,6 +10,7 @@ import com.mogo.service.connection.IMogoOnMessageListener;
/**
* desc: 下发的云端预警数据
*
*/
public class V2XWarnMessageListener implements IMogoOnMessageListener<V2XWarningEntity> {

View File

@@ -12,14 +12,10 @@ import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.drawer.MarkerDrawer;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.drawer.V2XWarnDataDrawer;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.common.utils.Trigonometric;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.v2x.MoGoV2XServicePaths;
import com.mogo.module.v2x.V2XConst;
@@ -52,6 +48,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()
);
/*
* 自车前方的点,在停止线上--通过自车位置与距离停止线之间的距离计算
* */
@@ -71,7 +68,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
@Override
public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) {
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> ");
mCloundWarningInfo = cloundWarningInfo;
showTime = mCloundWarningInfo.getShowTime();
pointsBetween();
@@ -274,33 +270,31 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
* 自车为起点绘制(根据设计,前方行人/弱势交通参与者预警 getDirection() == 1 自车与停止线之间为蓝色预警;其他侧方预警自车与预碰撞点之间显示红色预警)
*/
private void drawSlefCarLine(double lon, double lat, float bearing) {
// Log.d("liyz", "-------1-------- isSelfLineClear = " + isSelfLineClear + "--lon =" + lon + "---lat = " + lat);
if (!isSelfLineClear) {
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
if (mCloundWarningInfo != null) {
MogoLatLng startLatlng = null;
MogoLatLng endLatlng = null;
MogoLatLng addMiddleLoc = null;
if (!isFirstLocation) {
//自车位置
startLatlng = new MogoLatLng(lat, lon);
carLocation = getMogoLat(new MogoLatLng(lat, lon));
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(),
mCloundWarningInfo.getDirection() == 1 ? middleLocationInStopLine.lon : mCloundWarningInfo.getCollisionLon());
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));
Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lat + "," + startLatlng.lon +
"中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat);
if (!isFirstLocation) {
carLocation = getMogoLat(new MogoLatLng(lat, lon));
isFirstLocation = true;
}
//自车位置
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(),
mCloundWarningInfo.getDirection() == 1 ? middleLocationInStopLine.lon : mCloundWarningInfo.getCollisionLon());
startLatlng = new MogoLatLng(lat, lon);
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));
Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lat + "," + startLatlng.lon +
"中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat);
if (mogoPolyline != null) {
// Log.d("liyz", "-------2-------- lon =" + lon + "---lat = " + lat);
mogoPolyline.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
mogoPolyline.setTransparency(0.5f);
} else {
// Log.d("liyz", "-------3-------- lon =" + lon + "---lat = " + lat);
DrawLineInfo info = new DrawLineInfo(); // 对象
Log.d(TAG, "安全区域的画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng);
List locations = new ArrayList();

View File

@@ -56,7 +56,6 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
// 线条粗细,渐变,渐变色值
// 当前车辆位置
options.width(info.getWidth() == 0.0 ? 60 : info.getWidth()).useGradient(true).colorValues(colors);
// options.width(60).useGradient(true).colorValues(colors);
List<MogoLatLng> locations = info.getLocations();
for (int i = 0; i < locations.size(); i++) {
options.add(locations.get(i));

View File

@@ -95,7 +95,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
.getMogoTopViewManager()
.addView(getV2XWindow().getView(), layoutParams, this);
getV2XWindow().show(mMarkerEntity);
getV2XMarker().drawPOI(mMarkerEntity);
// getV2XMarker().drawPOI(mMarkerEntity);
}
}
@@ -116,8 +116,10 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
@Override
public void drawPOI() {
getV2XMarker().drawPOI(mMarkerEntity);
Log.d(TAG, "drawPOI");
if (getV2XMarker() != null) {
getV2XMarker().drawPOI(mMarkerEntity);
Log.d(TAG, "drawPOI");
}
}
@Override

View File

@@ -1,7 +1,7 @@
{
"type": 10013,
"lat": 39.977148,
"lon": 116.417478,
"lon": 116.417886,
"distance": 2,
"collisionLat": 39.977094,
"collisionLon": 116.417634,
@@ -17,7 +17,7 @@
],
"from": 1,
"angle": 0,
"direction": 2,
"direction": 3,
"speed": 11.108121,
"targetColor": "#FF4040",
"stopLineDistance": 60,

View File

@@ -330,6 +330,7 @@ public class MogoADASController implements IMogoADASController {
Logger.w( TAG, "--->action is null" );
return;
}
//识别的他车移动操作
mAdasMessageFactory.createMessage( action ).handlerMsg( GsonUtil.getGson(), mOnAdasListener, detectResult );
} catch ( JSONException e ) {
e.printStackTrace();