Merge branch 'jj' into dev2_aiSdk
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -91,7 +91,6 @@
|
|||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
<option name="resolveModulePerSourceSet" value="false" />
|
<option name="resolveModulePerSourceSet" value="false" />
|
||||||
<option name="useQualifiedModuleNames" value="true" />
|
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -23,7 +23,11 @@ enum AdasRecognizedType {
|
|||||||
//bus
|
//bus
|
||||||
classIdTrafficBus( "traffic_bus", 6 ),
|
classIdTrafficBus( "traffic_bus", 6 ),
|
||||||
//truck
|
//truck
|
||||||
classIdTrafficTruck( "traffic_truck", 8 );
|
classIdTrafficTruck( "traffic_truck", 8 ),
|
||||||
|
//stopLine
|
||||||
|
classIdStopLine("warning_stop_line",9),
|
||||||
|
//预警箭头
|
||||||
|
classIdWarningArrows("warning_arrows",10);
|
||||||
|
|
||||||
AdasRecognizedType( int code ) {
|
AdasRecognizedType( int code ) {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
@@ -45,8 +49,10 @@ enum AdasRecognizedType {
|
|||||||
classIdMoto,
|
classIdMoto,
|
||||||
classIdTrafficSign,
|
classIdTrafficSign,
|
||||||
classIdTrafficBus,
|
classIdTrafficBus,
|
||||||
null,
|
|
||||||
classIdTrafficTruck,
|
classIdTrafficTruck,
|
||||||
|
classIdStopLine,
|
||||||
|
classIdWarningArrows,
|
||||||
|
null,
|
||||||
};
|
};
|
||||||
|
|
||||||
public String getRes() {
|
public String getRes() {
|
||||||
|
|||||||
@@ -125,17 +125,13 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
|||||||
return marker;
|
return marker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawerMarkerWithLocation(MarkerShowEntity markerShowEntity, MogoLatLng location) {
|
public void drawerArrowsMarkerWithLocation(MogoLatLng location, String markerType, int type) {
|
||||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||||
.object(markerShowEntity)
|
|
||||||
.latitude(location.getLat())
|
.latitude(location.getLat())
|
||||||
.longitude(location.getLon());
|
.longitude(location.getLon());
|
||||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
options.icon3DRes(getModelRes(type)); //TODO
|
||||||
options.icon3DRes(getModelRes(2)); //TODO
|
|
||||||
|
|
||||||
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
|
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
|
||||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerType, options);
|
||||||
iMarkerView.setMarker(marker);
|
|
||||||
marker.setToTop();
|
marker.setToTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ import com.mogo.map.MogoLatLng;
|
|||||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||||
import com.mogo.map.overlay.IMogoPolyline;
|
import com.mogo.map.overlay.IMogoPolyline;
|
||||||
import com.mogo.module.common.MogoApisHandler;
|
import com.mogo.module.common.MogoApisHandler;
|
||||||
|
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||||
import com.mogo.module.common.drawer.V2XWarnDataDrawer;
|
import com.mogo.module.common.drawer.V2XWarnDataDrawer;
|
||||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||||
import com.mogo.module.common.utils.Trigonometric;
|
import com.mogo.module.common.utils.Trigonometric;
|
||||||
import com.mogo.module.service.MarkerServiceHandler;
|
import com.mogo.module.service.MarkerServiceHandler;
|
||||||
|
import com.mogo.module.service.ServiceConst;
|
||||||
import com.mogo.module.service.receiver.MogoReceiver;
|
import com.mogo.module.service.receiver.MogoReceiver;
|
||||||
import com.mogo.module.v2x.MoGoV2XServicePaths;
|
import com.mogo.module.v2x.MoGoV2XServicePaths;
|
||||||
import com.mogo.module.v2x.V2XConst;
|
import com.mogo.module.v2x.V2XConst;
|
||||||
@@ -35,6 +37,7 @@ import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
|||||||
*/
|
*/
|
||||||
@Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER)
|
@Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER)
|
||||||
public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMogoCarLocationChangedListener2 {
|
public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMogoCarLocationChangedListener2 {
|
||||||
|
private static String WARNING_ARROWS = "WARNING_ARROWS";
|
||||||
private V2XWarningEntity mCloundWarningInfo;
|
private V2XWarningEntity mCloundWarningInfo;
|
||||||
private static String TAG = "MoGoV2XCloundDataManager";
|
private static String TAG = "MoGoV2XCloundDataManager";
|
||||||
private boolean isSelfLineClear;
|
private boolean isSelfLineClear;
|
||||||
@@ -44,6 +47,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
|||||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
|
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
|
||||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()
|
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()
|
||||||
);
|
);
|
||||||
|
private MogoLatLng middleLocationInStopLine;
|
||||||
|
|
||||||
private static long showTime = 0;
|
private static long showTime = 0;
|
||||||
|
|
||||||
@@ -67,14 +71,14 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
|||||||
isFirstLocation = false;
|
isFirstLocation = false;
|
||||||
|
|
||||||
if (cloundWarningInfo.getDirection() == 1) { //前方
|
if (cloundWarningInfo.getDirection() == 1) { //前方
|
||||||
MogoLatLng startLatLng = getMiddleLocationInStopLine();
|
middleLocationInStopLine = getMiddleLocationInStopLine();
|
||||||
MogoLatLng warningLocation = Trigonometric.getNewLocation(startLatLng, 80, cloundWarningInfo.getAngle());
|
MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine, 30, cloundWarningInfo.getAngle());
|
||||||
//停止线前方画线
|
//停止线前方画线
|
||||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||||
//二轮车和行人的渲染和移动
|
//二轮车和行人的渲染和移动
|
||||||
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
|
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
|
||||||
//绘制识别物与交汇点连线,并且更新连线数据
|
//绘制识别物与交汇点连线,并且更新连线数据
|
||||||
drawStopLine(cloundWarningInfo, startLatLng, warningLocation);
|
drawStopLine(cloundWarningInfo, middleLocationInStopLine, warningLocation);
|
||||||
//添加停止线marker
|
//添加停止线marker
|
||||||
handleStopLine();
|
handleStopLine();
|
||||||
}, 500);
|
}, 500);
|
||||||
@@ -160,10 +164,10 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
|||||||
private void drawOtherObjectLine(V2XWarningEntity info) {
|
private void drawOtherObjectLine(V2XWarningEntity info) {
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline();
|
IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline();
|
||||||
MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());
|
MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());//识别物坐标
|
||||||
MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());
|
MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());//预碰撞点坐标
|
||||||
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
|
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);//识别物到碰撞点之间的距离
|
||||||
MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());
|
MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());//补点
|
||||||
if (polyLine != null) {
|
if (polyLine != null) {
|
||||||
Log.d(V2XConst.LOG_NAME_WARN, "polyLine != null");
|
Log.d(V2XConst.LOG_NAME_WARN, "polyLine != null");
|
||||||
polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
|
polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
|
||||||
@@ -180,6 +184,8 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
|||||||
Log.d(V2XConst.LOG_NAME_WARN, "drawOtherObjectLine width = " + info.getRoadwidth());
|
Log.d(V2XConst.LOG_NAME_WARN, "drawOtherObjectLine width = " + info.getRoadwidth());
|
||||||
lineInfo.setWidth(info.getRoadwidth() * 10 + 5);
|
lineInfo.setWidth(info.getRoadwidth() * 10 + 5);
|
||||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo);
|
V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo);
|
||||||
|
//识别物到预碰撞点之间的箭头
|
||||||
|
addArrows(startLatlng, endLatlng);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.e(V2XConst.LOG_NAME_WARN, "info == null");
|
Log.e(V2XConst.LOG_NAME_WARN, "info == null");
|
||||||
@@ -189,17 +195,22 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
|||||||
|
|
||||||
//侧面目标物与碰撞点之间添加多个小箭头
|
//侧面目标物与碰撞点之间添加多个小箭头
|
||||||
private void addArrows(MogoLatLng startLatLng, MogoLatLng endLatLng) {
|
private void addArrows(MogoLatLng startLatLng, MogoLatLng endLatLng) {
|
||||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
|
||||||
float distance = CoordinateUtils.calculateLineDistance(
|
float distance = CoordinateUtils.calculateLineDistance(
|
||||||
startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat);
|
startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat);
|
||||||
|
Log.d(TAG, "添加小箭头--目标物与预碰撞点之间的距离是" + String.valueOf(distance));
|
||||||
if (distance > 5) {
|
if (distance > 5) {
|
||||||
int count = (int) (distance / 5);
|
int count = (int) (distance / 5);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count - 1; i++) {
|
||||||
MogoLatLng newLo = Trigonometric.getNewLocation(
|
MogoLatLng newLo = Trigonometric.getNewLocation(
|
||||||
startLatLng, 5 * i, mCloundWarningInfo.getAngle());
|
startLatLng, 5 * (i + 1), 120);
|
||||||
V2XWarnDataDrawer.getInstance().drawerMarkerWithLocation(markerShowEntity, newLo);
|
V2XWarnDataDrawer.getInstance().drawerArrowsMarkerWithLocation(newLo, WARNING_ARROWS, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//延迟3秒清理线
|
||||||
|
UiThreadHandler.postDelayed(() -> {
|
||||||
|
V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS);
|
||||||
|
}, showTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -240,6 +251,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
|||||||
MogoLatLng endLatlng = null;
|
MogoLatLng endLatlng = null;
|
||||||
MogoLatLng addMiddleLoc = null;
|
MogoLatLng addMiddleLoc = null;
|
||||||
if (!isFirstLocation) {
|
if (!isFirstLocation) {
|
||||||
|
//自车位置
|
||||||
startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
|
startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
|
||||||
carLocation = getMogoLat(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
|
carLocation = getMogoLat(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
|
||||||
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? carLocation.lat : mCloundWarningInfo.getCollisionLat(),
|
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? carLocation.lat : mCloundWarningInfo.getCollisionLat(),
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
],
|
],
|
||||||
"from": 1,
|
"from": 1,
|
||||||
"angle": 0,
|
"angle": 0,
|
||||||
"direction": 1,
|
"direction": 2,
|
||||||
"speed": 11.108121,
|
"speed": 11.108121,
|
||||||
"targetColor": "#FF4040",
|
"targetColor": "#FF4040",
|
||||||
"stopLineDistance": 60,
|
"stopLineDistance": 60,
|
||||||
|
|||||||
Reference in New Issue
Block a user