Merge branch 'dev2_aiSdk' into qa_och_bus2

This commit is contained in:
董宏宇
2021-04-29 16:07:31 +08:00
5 changed files with 81 additions and 82 deletions

View File

@@ -9,7 +9,7 @@ import com.mogo.module.v2x.listener.V2XMessageListener_401009;
import com.mogo.module.v2x.listener.V2XMessageListener_401010;
import com.mogo.module.v2x.listener.V2XMessageListener_401011;
import com.mogo.module.v2x.listener.V2XMessageListener_401012;
import com.mogo.module.v2x.listener.V2XMessageListener_401020;
import com.mogo.module.v2x.listener.V2XMessageListener_402000;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -33,7 +33,7 @@ public class V2XSocketManager {
private V2XMessageListener_401007 v2XMessageListener_401007;
private V2XMessageListener_401009 v2XMessageListener_401009;
private V2XMessageListener_401010 v2XMessageListener_401010;
private V2XMessageListener_401020 mV2XMessageListener_401020;
private V2XMessageListener_402000 mV2XMessageListener_402000;
private V2XSocketManager() {
@@ -112,10 +112,10 @@ public class V2XSocketManager {
.getMoGoSocketManager()
.unregisterOnMessageListener(401009, v2XMessageListener_401009);
}
if (mV2XMessageListener_401020 != null) {
if (mV2XMessageListener_402000 != null) {
V2XServiceManager
.getMoGoSocketManager()
.unregisterOnMessageListener(401019, mV2XMessageListener_401020);
.unregisterOnMessageListener(401019, mV2XMessageListener_402000);
}
}
@@ -231,13 +231,13 @@ public class V2XSocketManager {
* * 最优路线推荐
*/
public void register401020() {
mV2XMessageListener_401020 = new V2XMessageListener_401020();
mV2XMessageListener_402000 = new V2XMessageListener_402000();
// 道路事件,在线车辆绘制
V2XServiceManager
.getMoGoSocketManager()
.registerOnMessageListener(
401020,
mV2XMessageListener_401020
402000,
mV2XMessageListener_402000
);
}

View File

@@ -21,7 +21,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* @description 车路云场景预警-云下发数据监听 最优路线推荐
* @since: 2021/4/13
*/
public class V2XMessageListener_401020 implements IMogoOnMessageListener<V2XOptimalRouteDataRes> {
public class V2XMessageListener_402000 implements IMogoOnMessageListener<V2XOptimalRouteDataRes> {
@Override
public Class target() {
return V2XOptimalRouteDataRes.class;
@@ -29,7 +29,7 @@ public class V2XMessageListener_401020 implements IMogoOnMessageListener<V2XOpti
@Override
public void onMsgReceived(V2XOptimalRouteDataRes message) {
Logger.i(MODULE_NAME, "V2XMessageListener_401020" + message);
Logger.i(MODULE_NAME, "V2XMessageListener_402000" + message);
// 将接收到的数据转换成最优车道推荐的场景数据
if (message != null

View File

@@ -71,66 +71,66 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
@Override
public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) {
// if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
mCloundWarningInfo = cloundWarningInfo;
showTime = mCloundWarningInfo.getShowTime();
pointsBetween();
bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing();
mCloundWarningInfo = cloundWarningInfo;
showTime = mCloundWarningInfo.getShowTime();
pointsBetween();
bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing();
//顶部弹框
if (mV2XScenario == null) {
mV2XScenario = new V2XFrontWarningScenario();
}
mV2XScenario.setWarningEntity(cloundWarningInfo);
mV2XScenario.init(null);
//预警蒙层
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getDirection(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
isSelfLineClear = false;
isFirstLocation = false;
V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS);
if (cloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP) { //前方 TODO
middleLocationInStopLine = getMiddleLocationInStopLine();
MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine, 50, cloundWarningInfo.getAngle());
//停止线前方画线
WorkThreadHandler.getInstance().postDelayed(() -> {
//二轮车和行人的渲染和移动
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
//绘制识别物与交汇点连线,并且更新连线数据
drawRedWarningLineFrontOfStopLine(cloundWarningInfo, middleLocationInStopLine, warningLocation);
//添加停止线marker
handleStopLine();
//自车画线
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
}, 500);
UiThreadHandler.postDelayed(() -> {
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
V2XServiceManager.getMoGoStopPolylineManager().clearLine();
isSelfLineClear = true;
}, showTime);
} else { //左侧或者右侧
WorkThreadHandler.getInstance().postDelayed(() -> {
//绘制识别物与交汇点连线,并且更新连线数据
drawOtherObjectLine(cloundWarningInfo);
//二轮车和行人的渲染和移动
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
//车辆静止的时候
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
}, 500);
//延迟3秒清理线
UiThreadHandler.postDelayed(() -> {
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
isSelfLineClear = true;
}, showTime);
}
//顶部弹框
if (mV2XScenario == null) {
mV2XScenario = new V2XFrontWarningScenario();
}
mV2XScenario.setWarningEntity(cloundWarningInfo);
mV2XScenario.init(null);
//预警蒙层
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getDirection(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
isSelfLineClear = false;
isFirstLocation = false;
V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS);
if (cloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP) { //前方 TODO
middleLocationInStopLine = getMiddleLocationInStopLine();
MogoLatLng warningLocation = new MogoLatLng(cloundWarningInfo.getLat(),cloundWarningInfo.getLon());
//停止线前方画线
WorkThreadHandler.getInstance().postDelayed(() -> {
//二轮车和行人的渲染和移动
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
//绘制识别物与交汇点连线,并且更新连线数据
drawRedWarningLineFrontOfStopLine(cloundWarningInfo, middleLocationInStopLine, warningLocation);
//添加停止线marker
handleStopLine();
//自车画线
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
}, 500);
UiThreadHandler.postDelayed(() -> {
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
V2XServiceManager.getMoGoStopPolylineManager().clearLine();
isSelfLineClear = true;
}, showTime);
} else { //左侧或者右侧
WorkThreadHandler.getInstance().postDelayed(() -> {
//绘制识别物与交汇点连线,并且更新连线数据
drawOtherObjectLine(cloundWarningInfo);
//二轮车和行人的渲染和移动
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
//车辆静止的时候
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
}, 500);
//延迟3秒清理线
UiThreadHandler.postDelayed(() -> {
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
isSelfLineClear = true;
}, showTime);
}
}
// }
@@ -149,12 +149,13 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
carLocation = getMogoLat(new MogoLatLng(lat, lon));
isFirstLocation = true;
}
//绘制线的终点(在停止线上或者预碰撞点上)
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP ? middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(),
mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP ? 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);
@@ -193,8 +194,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
MogoLatLng latLng = (MogoLatLng) fillPoints.get(i);
entity.setLat(latLng.lat);
entity.setLon(latLng.lon);
entity.setCollisionLat(mCloundWarningInfo.getCollisionLat());
entity.setCollisionLon(mCloundWarningInfo.getCollisionLon());
entity.heading = mCloundWarningInfo.heading;
V2XWarnDataDrawer.getInstance().renderStopLineData(entity);
}

View File

@@ -1,10 +1,10 @@
{
"type": 1,
"lat": 26.879390180525974,
"lon": 112.56927332599024,
"lat": 26.8826301,
"lon": 112.5634948,
"distance": 2,
"collisionLat": 26.879413602631494,
"collisionLon": 112.56942224899758,
"collisionLat": 26.88271105,
"collisionLon": 112.5636347,
"stopLines": [
{
"lat": 26.88008312,

View File

@@ -1,18 +1,18 @@
{
"type": 2,
"lat": 26.879413602631494,
"lon": 112.56942224899758,
"lat": 26.88241239,
"lon": 112.5631241,
"distance": 2,
"collisionLat": 26.879393211872856,
"collisionLon": 112.56917110603266,
"collisionLat": 26.88241239,
"collisionLon": 112.5631241,
"stopLines": [
{
"lat": 26.88008312,
"lon": 112.57147295
"lat": 26.88241239,
"lon": 112.5631241
},
{
"lat": 26.88008302,
"lon": 112.57147295
"lat": 26.88241239,
"lon": 112.5631241
}
],
"from": 1,