Merge branch 'dev_robotaxi-d-app-module_2130_221116_2.13.0' into mutidev_robotaxi-d-app-module_2130_221116_2.13.0_multi_display

# Conflicts:
#	gradle.properties
This commit is contained in:
donghongyu
2022-12-13 10:52:37 +08:00
5 changed files with 39 additions and 49 deletions

View File

@@ -47,6 +47,7 @@ import com.mogo.och.bus.passenger.constant.BusPassengerConst;
import com.mogo.och.bus.passenger.network.BusPassengerModelLoopManager;
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager;
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
import com.mogo.och.common.module.manager.AbnormalFactorsLoopManager;
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
import com.mogo.och.common.module.utils.ToastUtilsOch;
import org.jetbrains.annotations.NotNull;
@@ -188,14 +189,7 @@ public class BusPassengerModel {
@Override
public void onError() {
if (ToastUtilsOch.isCustomFastClick(5000)){
if (!NetworkUtils.isConnected(mContext)) {
ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
} else {
ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
}
queryDriverSiteByCoordinate();
}
}
@Override
@@ -206,11 +200,7 @@ public class BusPassengerModel {
queryDriverOperationDelay();
return;
}
if (ToastUtilsOch.isCustomFastClick(10000)){
//code = 1003; message = bus车辆已收车或未出车;bus driver shadow,not exists
ToastUtils.showShort(msg);
queryDriverSiteByCoordinate();
}
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg );
}
});
}
@@ -286,6 +276,8 @@ public class BusPassengerModel {
//2021.11.1 自动驾驶路线规划接口
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener);
AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext);
}
private void releaseListeners() {
@@ -299,6 +291,8 @@ public class BusPassengerModel {
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(mGoAutopilotStatusListener);
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
AbnormalFactorsLoopManager.INSTANCE.stopLoopAbnormalFactors();
}
//监听网络变化,避免启动机器时无网导致无法更新订单信息

View File

@@ -2,6 +2,7 @@ package com.mogo.och.common.module.manager
import android.Manifest
import android.content.Context
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
@@ -66,7 +67,8 @@ object AbnormalFactorsLoopManager : IMogoStatusChangedListener {
var toastStr = ""
if (!locationStatusPermsStatus) toastStr += "定位服务异常 "
if (!networkStatus) toastStr += " 网络异常 "
if (!socketStatus) toastStr += " 长链接异常 "
if (!socketStatus && !DebugConfig.getProductFlavor().contains("Passenger")) toastStr += " 长链接异常 "
i(TAG, "abnormal_factors_Str = $toastStr")

View File

@@ -38,6 +38,7 @@ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.common.module.manager.AbnormalFactorsLoopManager;
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
import com.mogo.och.common.module.map.AmapNaviToDestinationModel;
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
@@ -241,6 +242,8 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
//增加限速监听
CallLimitingVelocityListenerManager.INSTANCE.addListener(TAG,limitingVelocityListener);
AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext);
}
private void releaseListeners() {
@@ -255,6 +258,8 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(mGoAutopilotStatusListener);
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
CallLimitingVelocityListenerManager.INSTANCE.removeListener(limitingVelocityListener);
AbnormalFactorsLoopManager.INSTANCE.stopLoopAbnormalFactors();
}
/**
@@ -324,9 +329,14 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
}
@Override
public void onFail(int code, String msg) {
public void onError() {
}
@Override
public void onFail(int code, String msg) {
CallerLogger.INSTANCE.e(M_TAXI_P + TAG,"queryInAndWaitOrders"+code+msg);
}
});
}

View File

@@ -20,21 +20,17 @@ import mogo.telematics.pad.MessagePad;
public class TrackObj {
private final CircleQueue circleQueue = new CircleQueue(6);
// private final KalmanFilter kalmanFilter; //卡尔曼结果
private S2CellId s2CellId; //s2 id权重
private S2LatLng s2LatLng; //s2 经纬度
private double recentlyTime; //用于缓存帧数判断暂定缓存1秒数据中间如果有物体未出现1秒后删除
private double roadAngle; //道路航向
// private double headingDelta; //航向角德尔塔
private int[] typeArray = new int[3];
private int typeWeight; //类型权重
private double lat;
private double lon;
private double speedAverage;
// private CenterLine centerLineInfo = null;
public TrackObj(MessagePad.TrackedObject data) {
// kalmanFilter = new KalmanFilter(data.getLongitude(), data.getLatitude(), 0.0000005);
circleQueue.addQueue(new ObjQueue(data.getHeading(), data.getSpeed(), data.getLatitude(), data.getLongitude(), data.getType()));
recentlyTime = data.getSatelliteTime();
lat = data.getLatitude();
@@ -61,15 +57,13 @@ public class TrackObj {
private void correct() {
calAverageSpeedAndType();
calLoc();
calHeading();
// calHeading();
}
@SuppressLint("NewApi")
private void calAverageSpeedAndType() {
if (circleQueue.size() >= 3) {
List<ObjQueue> objQueueList = circleQueue.getLastThreeFrame();
// 计算平均速度
// speedAverage = (objQueueList.get(0).getSpeed() + objQueueList.get(1).getSpeed() + objQueueList.get(2).getSpeed()) / 3;
// 使用中值滤波
objQueueList.sort(Comparator.comparing(ObjQueue::getSpeed));
speedAverage = objQueueList.get(1).getSpeed();
@@ -101,38 +95,13 @@ public class TrackObj {
private void calLoc() {
//距离计算,位置修正
if (relativeStatic()) {
// double angle = roadAngle != 0 ? roadAngle : cacheData.getHeading();
// if (centerLineInfo == null && isFourWheelType()) {
// try {
// centerLineInfo = CallerHDMapManager.INSTANCE.getCenterLineInfo(lon, lat, (float) angle);
// } catch (Exception e) {
// Log.d("hy uuid : " + cacheData.getUuid(), "道路获取异常");
// }
// if (centerLineInfo != null && centerLineInfo.getPoints() != null && !centerLineInfo.getPoints().isEmpty()) {
// double[] matchedPoint = PointInterpolatorUtil.mergeToRoad(cacheData.getLongitude(), cacheData.getLatitude(), centerLineInfo.getPoints());
// if (matchedPoint[0] > 0 || matchedPoint[1] > 0) {
// lon = matchedPoint[0];
// lat = matchedPoint[1];
// s2LatLng = S2LatLng.fromDegrees(cacheData.getLatitude(), cacheData.getLongitude());
// s2CellId = S2CellId.fromLatLng(s2LatLng).parent(22);
// } else {
// centerLineInfo = null;
// }
// } else {
// centerLineInfo = null;
// }
// }
cacheData = cacheData.toBuilder().setLongitude(lon).setLatitude(lat).build();
} else {
// centerLineInfo = null;
//不在阈值内则更新,代表物体移动,使用卡尔曼滤波经纬度数据
//double[] lonLat = kalmanFilter.filter(cacheData.getLongitude(), cacheData.getLatitude());
lat = cacheData.getLatitude();
lon = cacheData.getLongitude();
s2LatLng = S2LatLng.fromDegrees(cacheData.getLatitude(), cacheData.getLongitude());
s2CellId = S2CellId.fromLatLng(s2LatLng).parent(22);
// Log.d("hy uuid : " + cacheData.getUuid(), " 开始移动 lon : " + lon + " , lat : " + lat);
// cacheData = cacheData.toBuilder().setLongitude(lonLat[0]).setLatitude(lonLat[1]).build();
}
}
@@ -175,7 +144,6 @@ public class TrackObj {
public boolean relativeStatic() {
if (speedAverage < LIMIT_SPEED) {
// Log.d("emArrow-Track", "relativeStatic return" + " , uuid : " + cacheData.getUuid());
return true;
} else {
return isInRange();
@@ -192,7 +160,6 @@ public class TrackObj {
return false;
}
double dis = CoordinateUtils.calculateLineDistance(center[0], center[1], cacheData.getLongitude(), cacheData.getLatitude());
// Log.d("emArrow-Track", "uuid : " + cacheData.getUuid() + " , type : " + cacheData.getType() + " , list size : " + objQueueList.size() + " , dis : " + dis);
if (cacheData.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS.getType() || cacheData.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK.getType()) {
return dis <= 0.6;
} else {

View File

@@ -9,6 +9,7 @@ import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.map.*
import com.mogo.eagle.core.data.map.MapRoadInfo.StopLine
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager.OnRoadListener
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.*
@@ -24,6 +25,8 @@ import kotlinx.coroutines.internal.synchronized
import java.util.*
import java.util.concurrent.TimeUnit
import java.util.concurrent.TimeUnit.SECONDS
import java.util.concurrent.atomic.*
import kotlin.math.*
/**
* 高精地图视角管理类
@@ -59,6 +62,9 @@ object CallerVisualAngleManager {
val displayThreshold: Long //最大展示时长 > 0; 表示最长展示多长时间, -1 表示,一直展示,直到触发默认视角, 0: 默认视角专用值,
}
private val beginLocation = AtomicReference<MogoLocation>()
private val listener = object : OnRoadListener {
private var roadId = ""
override fun onRoadIdInfo(roadId: String) {
@@ -68,13 +74,24 @@ object CallerVisualAngleManager {
hasCrossRoad = false
changeVisualAngle(CrossRoad(false))
}
} else {
if (hasCrossRoad) {
val beginLoc = beginLocation.get()
val endLoc = CallerMapLocationListenerManager.getCurrentLocation()
if (beginLoc != null && endLoc != null && abs(beginLoc.bearing - endLoc.bearing) >= 170) {
hasCrossRoad = false
changeVisualAngle(CrossRoad(false))
}
}
}
this.roadId = roadId
}
override fun onStopLineInfo(info: StopLine) {
if (!hasCrossRoad && info.distanceOfCarToStopLine <= 30.0) {
hasCrossRoad = true
beginLocation.set(CallerMapLocationListenerManager.getCurrentLocation())
changeVisualAngle(CrossRoad(true))
}
}