Merge branch 'dev_robotaxi-d-app-module_2130_221116_2.13.0' into 'test_robotaxi-d-app-module_2130_221116_2.13.0.1'
Dev robotaxi d app module 2130 221116 2.13.0 See merge request zhjt/AndroidApp/MoGoEagleEye!464
This commit is contained in:
@@ -441,10 +441,10 @@ public class BusPassengerModel {
|
||||
int nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew(currentRouteIndex
|
||||
,mRoutePoints
|
||||
,stationNext.getGcjLon(),stationNext.getGcjLat());
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "currentRouteIndex = " + currentRouteIndex
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "轨迹排查==currentRouteIndex = " + currentRouteIndex
|
||||
+ ", nextRouteIndex = " + nextRouteIndex);
|
||||
if (currentRouteIndex < nextRouteIndex){ //如果找到的next在起点的轨迹前面,直接舍弃这个轨迹,不显示
|
||||
mTwoStationsRouts.addAll(mRoutePoints.subList(currentRouteIndex,nextRouteIndex));
|
||||
mTwoStationsRouts.addAll(mRoutePoints.subList(currentRouteIndex,nextRouteIndex + 1));
|
||||
}
|
||||
}
|
||||
}else { //只有两个站点的时候整个路线就是两个站点之间的轨迹
|
||||
@@ -476,16 +476,25 @@ public class BusPassengerModel {
|
||||
}
|
||||
|
||||
for (List<MogoLocation> lastPoints: lastPointsMap.values()){
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "轨迹排查==lastPoints.size() = " + lastPoints.size());
|
||||
float lastSumLength = 0;
|
||||
if (lastPoints.size() == 1){ //只是最后一个点,计算当前位置和最后一个点的距离
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
lastPoints.get(0).getLongitude(), lastPoints.get(0).getLatitude(),
|
||||
mLocation.getLongitude(), mLocation.getLatitude());
|
||||
if (mNextStationIndex <= mStations.size()-1 && mNextStationIndex >= 0){
|
||||
BusPassengerStation stationNext = mStations.get(mNextStationIndex);
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
stationNext.getGcjLon(), stationNext.getGcjLat(),
|
||||
mLocation.getLongitude(), mLocation.getLatitude());
|
||||
}else {
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
lastPoints.get(0).getLongitude(), lastPoints.get(0).getLatitude(),
|
||||
mLocation.getLongitude(), mLocation.getLatitude());
|
||||
}
|
||||
|
||||
}else {
|
||||
lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints);
|
||||
}
|
||||
double lastTime = lastSumLength / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 ; //秒
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "lastSumLength = " + lastSumLength);
|
||||
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "轨迹排查==lastSumLength = " + lastSumLength);
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
mAutopilotPlanningCallback.routePlanningToNextStationChanged((long)lastSumLength,(long) lastTime);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class CoordinateCalculateRouteUtil {
|
||||
if (currentIndex == mRoutePoints.size()-1){
|
||||
latePoints.add(mRoutePoints.get(currentIndex));
|
||||
}else if(currentIndex < mRoutePoints.size()-1){
|
||||
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
|
||||
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()));
|
||||
}
|
||||
return latePoints;
|
||||
}
|
||||
@@ -263,7 +263,7 @@ public class CoordinateCalculateRouteUtil {
|
||||
// LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||
latePoints.add(location);
|
||||
}else {
|
||||
List<MogoLocation> locations = mRoutePoints.subList(currentIndex,mRoutePoints.size()-1);
|
||||
List<MogoLocation> locations = mRoutePoints.subList(currentIndex,mRoutePoints.size());
|
||||
for (MogoLocation location: locations) {
|
||||
// LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||
latePoints.add(location);
|
||||
|
||||
@@ -96,7 +96,7 @@ public class MoGoHandAdasMsgManager implements
|
||||
@Override
|
||||
public void onAutopilotLightSwitchData(Chassis.LightSwitch lightSwitch) {
|
||||
//can数据转发 转向灯状态 0是正常 1是左转 2是右转
|
||||
if (!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //小巴不展示
|
||||
// if (!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //小巴不展示
|
||||
if (lightSwitch != null) {
|
||||
int state = setTurnLightState(lightSwitch.getNumber());
|
||||
if (state == 1 || state == 2) {
|
||||
@@ -107,7 +107,7 @@ public class MoGoHandAdasMsgManager implements
|
||||
}
|
||||
CallerHmiManager.INSTANCE.showTurnLight(state);
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class MoGoHandAdasMsgManager implements
|
||||
@Override
|
||||
public void onAutopilotCarStateData(@Nullable MessagePad.GnssInfo gnssInfo) {
|
||||
//根据加速度判断 是否刹车
|
||||
if (!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //小巴不展示
|
||||
// if (!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) { //小巴不展示
|
||||
if (gnssInfo != null) {
|
||||
//设置刹车信息
|
||||
if (gnssInfo.getAcceleration() < SharedPrefsMgr.getInstance(mContext).getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5F)) {
|
||||
@@ -137,7 +137,7 @@ public class MoGoHandAdasMsgManager implements
|
||||
if (!isShowTurnLight) {
|
||||
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ dependencies {
|
||||
// MoGo 数据埋点工具
|
||||
implementation rootProject.ext.dependencies.analytics
|
||||
|
||||
compileOnly rootProject.ext.dependencies.mogocustommap
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.mogo.eagle.core.utilcode.kotlin.safeCancel
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.mogo.map.uicontroller.VisualAngleMode
|
||||
import com.zhidaoauto.map.sdk.open.tools.MapTools
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.android.asCoroutineDispatcher
|
||||
import kotlinx.coroutines.internal.synchronized
|
||||
@@ -63,42 +64,43 @@ object CallerVisualAngleManager {
|
||||
val displayThreshold: Long //最大展示时长 > 0; 表示最长展示多长时间, -1 表示,一直展示,直到触发默认视角, 0: 默认视角专用值,
|
||||
}
|
||||
|
||||
private val beginLocation = AtomicReference<MogoLocation>()
|
||||
private val triggerLocation = AtomicReference<MogoLocation>()
|
||||
|
||||
private val distanceOfCarToStopLine = AtomicReference<Double>()
|
||||
private val distanceOfCarToStopLine = AtomicReference(0.0)
|
||||
|
||||
private val travelled by lazy { AtomicReference(0.0) }
|
||||
|
||||
private val listener = object : OnRoadListener {
|
||||
private var roadId = ""
|
||||
private val roadId = AtomicReference<String>()
|
||||
private val triggerRoadId = AtomicReference<String>()
|
||||
|
||||
override fun onRoadIdInfo(roadId: String) {
|
||||
val oldRoadId = this.roadId
|
||||
Log.d(TAG, "-- onRoadIdInfo --: prev: ${this.roadId} -> curr: $roadId")
|
||||
val startLoc = beginLocation.get()
|
||||
val currLoc = CallerMapLocationListenerManager.getCurrentLocation()
|
||||
this.roadId.set(roadId)
|
||||
Log.d(TAG, "-- onRoadIdInfo --: prev: ${this.triggerRoadId.get()} -> curr: $roadId")
|
||||
val loc = CallerMapLocationListenerManager.getCurrentLocation()
|
||||
var triggerClose = false
|
||||
val distance = distanceOfCarToStopLine.get()
|
||||
if (hasCrossRoad && distance > 0 && oldRoadId != roadId && startLoc != null && currLoc != null && CoordinateUtils.calculateLineDistance(startLoc.longitude, startLoc.latitude, currLoc.longitude, currLoc.latitude).also {
|
||||
Log.d(TAG, "d1: $it, d2: $distance")
|
||||
} >= distance) {
|
||||
distanceOfCarToStopLine.set(0.0)
|
||||
hasCrossRoad = false
|
||||
Log.d(TAG, "-- onRoadIdInfo --: trigger close --")
|
||||
triggerClose = true
|
||||
}
|
||||
if (!triggerClose && hasCrossRoad && oldRoadId == roadId) {
|
||||
val beginLoc = beginLocation.get()
|
||||
val endLoc = CallerMapLocationListenerManager.getCurrentLocation()
|
||||
if (beginLoc != null && endLoc != null && abs(beginLoc.bearing - endLoc.bearing) >= 170) {
|
||||
Log.d(TAG, "-- onRoadIdInfo --: trigger close 2 --")
|
||||
triggerClose = true
|
||||
val distance = distanceOfCarToStopLine.get() + 5
|
||||
if (hasCrossRoad && distance > 0) {
|
||||
val prev = triggerLocation.get()
|
||||
if (prev != null && loc != null) {
|
||||
travelled.set(MapTools.distance(loc.longitude, loc.latitude, prev.longitude, prev.latitude) + travelled.get())
|
||||
triggerLocation.set(loc)
|
||||
}
|
||||
val oldRoadId = triggerRoadId.get()
|
||||
Log.d(TAG, "-- onRoadIdInfo --: travelled --: ${travelled.get()}")
|
||||
if ((travelled.get() > distance) && oldRoadId != null && oldRoadId != roadId) {
|
||||
distanceOfCarToStopLine.set(0.0)
|
||||
hasCrossRoad = false
|
||||
beginLocation.set(null)
|
||||
triggerRoadId.set(null)
|
||||
travelled.set(0.0)
|
||||
triggerLocation.set(null)
|
||||
Log.d(TAG, "-- onRoadIdInfo --: trigger close --")
|
||||
triggerClose = true
|
||||
}
|
||||
}
|
||||
if (triggerClose) {
|
||||
changeVisualAngle(CrossRoad(false))
|
||||
}
|
||||
this.roadId = roadId
|
||||
}
|
||||
|
||||
|
||||
@@ -106,8 +108,9 @@ object CallerVisualAngleManager {
|
||||
Log.d(TAG, "-- onStopLineInfo --: ${info.distanceOfCarToStopLine}")
|
||||
if (!hasCrossRoad && info.distanceOfCarToStopLine <= 30.0) {
|
||||
hasCrossRoad = true
|
||||
triggerRoadId.set(this.roadId.get())
|
||||
distanceOfCarToStopLine.set(info.distanceOfCarToStopLine)
|
||||
beginLocation.set(CallerMapLocationListenerManager.getCurrentLocation())
|
||||
triggerLocation.set(CallerMapLocationListenerManager.getCurrentLocation())
|
||||
changeVisualAngle(CrossRoad(true))
|
||||
}
|
||||
}
|
||||
@@ -236,12 +239,11 @@ object CallerVisualAngleManager {
|
||||
}
|
||||
}
|
||||
|
||||
private val heap by lazy {
|
||||
private val queue by lazy {
|
||||
PriorityQueue<Record>()
|
||||
}
|
||||
|
||||
@OptIn(InternalCoroutinesApi::class)
|
||||
fun changeVisualAngle(scene: Scene) {
|
||||
fun changeVisualAngle(current: Scene) {
|
||||
val appIdentityMode = FunctionBuildConfig.appIdentityMode
|
||||
if (AppIdentityModeUtils.isBus(appIdentityMode) && AppIdentityModeUtils.isPassenger(appIdentityMode)) {
|
||||
return
|
||||
@@ -252,85 +254,68 @@ object CallerVisualAngleManager {
|
||||
val displayed = getDisplayed()
|
||||
if (displayed == null) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 2 ---")
|
||||
val top = getTop() //堆顶
|
||||
if (top != null) {
|
||||
if (top.target.priority >= scene.priority) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 3 ---")
|
||||
top.triggerTime = triggerTime
|
||||
doChangeAngle(top)
|
||||
synchronized(heap){
|
||||
heap += Record(scene, triggerTime = -1)
|
||||
}
|
||||
} else {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 4 ---")
|
||||
doChangeAngle(Record(scene, triggerTime = triggerTime))
|
||||
}
|
||||
} else {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 5 ---")
|
||||
doChangeAngle(Record(scene, triggerTime = triggerTime))
|
||||
}
|
||||
doChangeAngle(Record(current, triggerTime = triggerTime))
|
||||
} else {
|
||||
val prev = displayed.target
|
||||
Log.d("${M_DEVA}${TAG}", "--- 6 --- old: $prev -> cur: $scene")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 3 --- old: $prev -> cur: $current")
|
||||
val prevTriggerTime = displayed.triggerTime
|
||||
if (scene !is Default && prev.priority >= scene.priority && (prev is RoadEvent || prev is TooClose)) {
|
||||
|
||||
if (current !is Default && prev.priority > current.priority && (prev is RoadEvent || prev is TooClose)) {
|
||||
val displayDuration = triggerTime - prevTriggerTime
|
||||
Log.d("${M_DEVA}${TAG}", "--- 7 ---:duration: $displayDuration")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 4 ---:场景[$prev], 已展示时长: duration: $displayDuration")
|
||||
if (displayDuration < prev.displayThreshold) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 8 --- old: $prev -> cur: $scene")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 5 --- 场景[$prev]:仍在保护展示时长内,直接return")
|
||||
return@launch
|
||||
}
|
||||
}
|
||||
if (prev.priority > scene.priority) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 9 --- old: $prev -> cur: $scene")
|
||||
if (prev.displayThreshold < 0) {
|
||||
return@launch
|
||||
}
|
||||
}
|
||||
if (scene is Turning) {
|
||||
val isOpen = scene.open
|
||||
if (prev is Turning && current is Turning) {
|
||||
val isOpen = current.open
|
||||
if (!isOpen) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 10 --- old: $prev -> cur: $scene")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 7 --- 场景[$current], 收到关闭通知")
|
||||
queue -= displayed
|
||||
changeVisualAngle(Default())
|
||||
heap -= displayed
|
||||
return@launch
|
||||
}
|
||||
}
|
||||
if (scene is CrossRoad) {
|
||||
val isOpen = scene.open
|
||||
if (prev is CrossRoad && current is CrossRoad) {
|
||||
val isOpen = current.open
|
||||
if (!isOpen) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 11 --- old: $prev -> cur: $scene")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 8 --- old: $prev -> cur: $current")
|
||||
queue -= displayed
|
||||
changeVisualAngle(Default())
|
||||
heap -= displayed
|
||||
return@launch
|
||||
}
|
||||
}
|
||||
|
||||
if (scene is Default) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 12 ---")
|
||||
if (prev.priority > current.priority && prev.displayThreshold < 0) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 6 --- 场景[$prev]正在展示,尚未收到关闭,场景,依然展示当前场景,直接return")
|
||||
return@launch
|
||||
}
|
||||
|
||||
if (current is Default) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 9 ---")
|
||||
defaultDelayJob?.safeCancel()
|
||||
launch {
|
||||
val delay = scene.unit.toMillis(scene.delay)
|
||||
Log.d("${M_DEVA}${TAG}", "--- 13 ---")
|
||||
val delay = current.unit.toMillis(current.delay)
|
||||
Log.d("${M_DEVA}${TAG}", "--- 10 ---")
|
||||
delay(delay)
|
||||
Log.d("${M_DEVA}${TAG}", "--- 14 ---")
|
||||
doChangeAngle(Record(scene, triggerTime = triggerTime))
|
||||
heap -= displayed
|
||||
queue -= displayed
|
||||
Log.d("${M_DEVA}${TAG}", "--- 11 ---")
|
||||
doChangeAngle(Record(current, triggerTime = triggerTime))
|
||||
}.also { itx ->
|
||||
itx.invokeOnCompletion {
|
||||
if (it is CancellationException) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 15 ---")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 12 ---")
|
||||
}
|
||||
}
|
||||
defaultDelayJob = itx
|
||||
}
|
||||
} else {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 16 ---")
|
||||
Log.d("${M_DEVA}${TAG}", "--- 13 ---")
|
||||
defaultDelayJob?.safeCancel()
|
||||
if (displayed.target.priority < scene.priority) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 17 ---")
|
||||
doChangeAngle(Record(scene, triggerTime = triggerTime))
|
||||
if (displayed.target.priority < current.priority) {
|
||||
Log.d("${M_DEVA}${TAG}", "--- 14 ---")
|
||||
queue -= displayed
|
||||
doChangeAngle(Record(current, triggerTime = triggerTime))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -344,8 +329,8 @@ object CallerVisualAngleManager {
|
||||
Log.d("${M_DEVA}${TAG}", "--- doChangeAngle ---: ${record.target}")
|
||||
if (record.target !is Default) {
|
||||
record.isDisplay = true
|
||||
synchronized(heap) {
|
||||
heap += record
|
||||
synchronized(queue) {
|
||||
queue += record
|
||||
}
|
||||
}
|
||||
it.changeMapVisualAngle(angle, null)
|
||||
@@ -356,8 +341,6 @@ object CallerVisualAngleManager {
|
||||
* 是否有正在展示的
|
||||
*/
|
||||
@Synchronized
|
||||
private fun getDisplayed() = heap.find { it.isDisplay }
|
||||
private fun getDisplayed() = queue.firstOrNull()
|
||||
|
||||
@Synchronized
|
||||
private fun getTop() = heap.firstOrNull()
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user