[8.0.0][opt]调整预测的数据和绘制逻辑
This commit is contained in:
@@ -7,6 +7,7 @@ import com.mogo.map.overlay.proxy.point.IMapPointOverlay
|
||||
import com.mogo.map.overlay.proxy.line.IMapPolylineOverlay
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo.yycp.api.proto.SocketDownData
|
||||
import prediction2025.Prediction2025
|
||||
import java.util.HashMap
|
||||
|
||||
/**
|
||||
@@ -51,6 +52,8 @@ interface IMogoMap {
|
||||
*/
|
||||
fun updateBatchAiMarkerPosition(optionsArrayList: HashMap<String, SocketDownData.CloudRoadDataProto>?)
|
||||
|
||||
fun updatePreMarkerPosition(optionsArrayList: HashMap<String, Prediction2025.mPredictionObjectApp>?)
|
||||
|
||||
/**
|
||||
* 添加感知使用到的3d模型
|
||||
*
|
||||
@@ -65,4 +68,6 @@ interface IMogoMap {
|
||||
* @param uuidString
|
||||
*/
|
||||
fun removeMarker(uuidString: String?)
|
||||
|
||||
fun switchData(x: Double, y: Double, isWgs84: Boolean): DoubleArray?
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.mogo.map.identity
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.map.MogoMap
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo.yycp.api.proto.SocketDownData
|
||||
import prediction2025.Prediction2025
|
||||
import java.util.HashMap
|
||||
|
||||
/**
|
||||
@@ -29,4 +31,15 @@ interface IMogoIdentifyManager {
|
||||
* @param optionsArrayList 锚点集合
|
||||
*/
|
||||
fun updateBatchAiMarkerPosition(optionsArrayList: HashMap<String, SocketDownData.CloudRoadDataProto>, mapInstance:String = MogoMap.DEFAULT)
|
||||
|
||||
/**
|
||||
* 批量更新预测数据对应的锚点位置
|
||||
*
|
||||
* @param optionsArrayList 锚点集合
|
||||
*/
|
||||
fun updatePreMarkerPosition(optionsArrayList: HashMap<String, Prediction2025.mPredictionObjectApp>, mapInstance:String)
|
||||
|
||||
fun updateGps(gnssInfo: MogoLocation, mapInstance: String)
|
||||
|
||||
fun updateUTM(carX: Double, carY: Double, preX: Double, preY: Double, mapInstance: String)
|
||||
}
|
||||
@@ -219,6 +219,7 @@ data class Polyline(val id: String, val owner: String, val level: Level, val opt
|
||||
}
|
||||
|
||||
private fun str2Int(tag: String): Int {
|
||||
if (tag.isEmpty()) return 0
|
||||
var sum = 0
|
||||
for (c in tag) {
|
||||
sum += c.code
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.zhidaoauto.map.sdk.open.view.MapAutoView
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo.yycp.api.proto.SocketDownData
|
||||
import prediction2025.Prediction2025
|
||||
import java.util.function.BiConsumer
|
||||
|
||||
/**
|
||||
@@ -176,6 +177,40 @@ class AMapWrapper(map: MapAutoViewHelper?, mapView: MapAutoView, controller: IMo
|
||||
}
|
||||
}
|
||||
|
||||
var preMarkerOptions = BatchMarkerOptions()
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
override fun updatePreMarkerPosition(optionsArrayList: java.util.HashMap<String, Prediction2025.mPredictionObjectApp>?) {
|
||||
if (!checkAMap()) {
|
||||
return
|
||||
}
|
||||
if (optionsArrayList == null || optionsArrayList.size == 0) {
|
||||
return
|
||||
}
|
||||
val markerOptionsArrayList = ArrayList<MarkerSimpleData>()
|
||||
optionsArrayList.forEach(BiConsumer { s: String?, preObject: Prediction2025.mPredictionObjectApp? ->
|
||||
val markerOptions = ObjectUtils.fromPreData(preObject)
|
||||
if (markerOptions != null) {
|
||||
markerOptionsArrayList.add(markerOptions)
|
||||
}
|
||||
})
|
||||
if (markerOptionsArrayList.size == 0) {
|
||||
return
|
||||
}
|
||||
// val time = markerOptionsArrayList[0].time
|
||||
// 最后一个参数,是否管理锚点的删除
|
||||
preMarkerOptions.list = markerOptionsArrayList
|
||||
preMarkerOptions.delayStrategy = false
|
||||
preMarkerOptions.ruleAngle = 8.0f
|
||||
preMarkerOptions.controlIcon = 1
|
||||
// // marker做动画时需用到(要么一直不传,要么一直都传)
|
||||
// preMarkerOptions.satelliteTime = time
|
||||
preMarkerOptions.deleteRule = 0
|
||||
if (mMapView.getMarkerController() != null) {
|
||||
mMapView.getMarkerController()!!.updateBatchMarkerPositon(preMarkerOptions)
|
||||
}
|
||||
}
|
||||
|
||||
override fun addPreVehicleModel(type: Int, modelRes: Int): String? {
|
||||
try {
|
||||
if (mMapView.getMarkerController() != null) {
|
||||
@@ -205,4 +240,8 @@ class AMapWrapper(map: MapAutoViewHelper?, mapView: MapAutoView, controller: IMo
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun switchData(x: Double, y: Double, isWgs84: Boolean): DoubleArray? {
|
||||
return mAMap?.switchData(x, y, isWgs84)
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,18 @@
|
||||
package com.mogo.map.identify;
|
||||
|
||||
import static com.mogo.map.MogoMap.DEFAULT;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.MogoMap;
|
||||
import com.mogo.map.identity.IMogoIdentifyManager;
|
||||
import java.util.HashMap;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo.yycp.api.proto.SocketDownData;
|
||||
import prediction2025.Prediction2025;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -69,4 +76,40 @@ public class MogoIdentifyManager implements IMogoIdentifyManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePreMarkerPosition(@NonNull HashMap<String, Prediction2025.mPredictionObjectApp> optionsArrayList, @NonNull String mapInstance) {
|
||||
try {
|
||||
IMogoMap iMogoMap = MogoMap.Companion.getMapInstance().getMogoMap(mapInstance);
|
||||
if(iMogoMap != null){
|
||||
iMogoMap.updatePreMarkerPosition(optionsArrayList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateGps(MogoLocation gnssInfo, @NonNull String mapInstance) {
|
||||
IMogoMap iMogoMap = MogoMap.Companion.getMapInstance().getMogoMap(mapInstance);
|
||||
if(iMogoMap != null){
|
||||
iMogoMap.getUiController().setExtraGPSData(gnssInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUTM(double carX, double carY, double preX, double preY, @NonNull String mapInstance) {
|
||||
IMogoMap iMogoMap = MogoMap.Companion.getMapInstance().getMogoMap(DEFAULT);// 同一个地图实例保存根据定位计算度带后的值
|
||||
IMogoMap mogoMap2 = MogoMap.Companion.getMapInstance().getMogoMap(mapInstance);
|
||||
if(iMogoMap != null && mogoMap2 != null){
|
||||
double[] arr = iMogoMap.switchData(carX, carY, false);
|
||||
double[] preArr = iMogoMap.switchData(preX, preY, false);
|
||||
if (arr != null && arr.length == 2 && preArr != null && preArr.length == 2) {
|
||||
double angle = DrivingDirectionUtils.getLineAngle(arr[0], arr[1], preArr[0], preArr[1]);
|
||||
MogoLocation location = new MogoLocation();
|
||||
location.setHeading(angle);
|
||||
location.setLongitude(arr[0]);
|
||||
location.setLatitude(arr[1]);
|
||||
mogoMap2.getUiController().setExtraGPSData(location);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.view.View;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils;
|
||||
import com.mogo.map.overlay.line.Polyline;
|
||||
import com.mogo.map.overlay.point.Point;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
@@ -19,12 +20,15 @@ import com.zhidaoauto.map.sdk.open.renders.marker.MarkerOptions;
|
||||
import com.zhidaoauto.map.sdk.open.renders.marker.MarkerSimpleData;
|
||||
import com.zhidaoauto.map.sdk.open.renders.poyline.PolylineOptions;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
import com.zhjt.mogo.adas.data.Adas;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo.yycp.api.proto.SocketDownData;
|
||||
import prediction2025.Prediction2025;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -34,6 +38,19 @@ import mogo.yycp.api.proto.SocketDownData;
|
||||
*/
|
||||
public class ObjectUtils {
|
||||
|
||||
private static Map<Adas.TrackedObjectType, Adas.TrackedObjectClassID> sTypeMap = Map.of(
|
||||
Adas.TrackedObjectType.TYPE_PEDESTRIAN, Adas.TrackedObjectClassID.Person,
|
||||
Adas.TrackedObjectType.TYPE_MOTOR, Adas.TrackedObjectClassID.MotorCycle,
|
||||
Adas.TrackedObjectType.TYPE_BICYCLE, Adas.TrackedObjectClassID.Bicycle,
|
||||
Adas.TrackedObjectType.TYPE_CAR, Adas.TrackedObjectClassID.Car,
|
||||
Adas.TrackedObjectType.TYPE_TRUCK, Adas.TrackedObjectClassID.Truck,
|
||||
Adas.TrackedObjectType.TYPE_BUS, Adas.TrackedObjectClassID.Bus,
|
||||
Adas.TrackedObjectType.TYPE_WARNINGTRIANGLE, Adas.TrackedObjectClassID.WarningTriangle,
|
||||
Adas.TrackedObjectType.TYPE_ROADWORK_OCCUPY_0501, Adas.TrackedObjectClassID.RoadWork_occupy_0501,
|
||||
Adas.TrackedObjectType.TYPE_ROADWORK_BREAK_0502, Adas.TrackedObjectClassID.RoadWork_break_0502,
|
||||
Adas.TrackedObjectType.TYPE_ROAD_CONGESTION, Adas.TrackedObjectClassID.ROAD_CONGESTION
|
||||
);
|
||||
|
||||
public static MarkerOptions fromMogo(Point.Options opt, MapAutoView mapAutoView) {
|
||||
|
||||
if (opt == null) {
|
||||
@@ -174,6 +191,55 @@ public class ObjectUtils {
|
||||
return markerOptions;
|
||||
}
|
||||
|
||||
public static MarkerSimpleData fromPreData(Prediction2025.mPredictionObjectApp preData) {
|
||||
if (preData == null || preData.getMNid() == 800000) {// 过滤掉自车
|
||||
return null;
|
||||
}
|
||||
MarkerSimpleData markerOptions = null;
|
||||
try {
|
||||
markerOptions = new MarkerSimpleData();
|
||||
markerOptions.setId(preData.getMNid());
|
||||
markerOptions.setMarkerType(trackedObjectTypeTransform(preData.getClasstype()));
|
||||
markerOptions.setRotateAngle(getPredictionHeading(preData));
|
||||
// 自车2条轨迹,它车1条轨迹;每条轨迹的第一个点为位置,其它点为预测轨迹点
|
||||
markerOptions.setLat(preData.getPredictionTrajectoryList().get(0).getTrajectoryPointsList().get(0).getX());
|
||||
markerOptions.setLon(preData.getPredictionTrajectoryList().get(0).getTrajectoryPointsList().get(0).getY());
|
||||
// marker做动画时需用到(要么一直不传,要么一直都传)
|
||||
// markerOptions.setTime(Double.valueOf(preData.getSatelliteTime() * 1000).longValue());
|
||||
markerOptions.setColor("#90ABCAFF");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return markerOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* 域控障碍物类型转换成鹰眼使用的类型
|
||||
*
|
||||
* @param classType 域控障碍物类型(目前只有Prediction2025.mPredictionObjects.objs_app.classtype 是域控的障碍物类型)
|
||||
* @return 障碍物类型 与 message_pad中的TrackedObjects 的 objs.type 类型一致
|
||||
*/
|
||||
private static int trackedObjectTypeTransform(int classType) {
|
||||
Adas.TrackedObjectType type = Adas.TrackedObjectType.forNumber(classType);
|
||||
if (type == null) {
|
||||
type = Adas.TrackedObjectType.TYPE_UNKNOWN;
|
||||
}
|
||||
Adas.TrackedObjectClassID classID = sTypeMap.get(type);
|
||||
if (classID == null) {
|
||||
classID = Adas.TrackedObjectClassID.Unknown;
|
||||
}
|
||||
return classID.getNumber();
|
||||
}
|
||||
|
||||
private static float getPredictionHeading(Prediction2025.mPredictionObjectApp preData) {
|
||||
List<geometry.Geometry.Point> pointList = preData.getPredictionTrajectoryList().get(0).getTrajectoryPointsList();
|
||||
if (pointList.size() >= 2) {
|
||||
return (float) DrivingDirectionUtils.getLineAngle(pointList.get(0).getX(), pointList.get(0).getY(), pointList.get(1).getX(), pointList.get(1).getY());
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static BitmapDescriptor getBitmapDescriptorFromMogo(Bitmap icon, View view) {
|
||||
if (icon != null) {
|
||||
return BitmapDescriptorFactory.INSTANCE.fromBitmap(icon);
|
||||
|
||||
Reference in New Issue
Block a user