diff --git a/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/ui/BusPassengerRouteFragment.java b/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/ui/BusPassengerRouteFragment.java index dd5398ace9..5041b7e52f 100644 --- a/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/ui/BusPassengerRouteFragment.java +++ b/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/ui/BusPassengerRouteFragment.java @@ -3,7 +3,6 @@ package com.mogo.och.bus.passenger.ui; import android.annotation.SuppressLint; import android.graphics.drawable.AnimationDrawable; import android.os.Bundle; -import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; @@ -170,6 +169,8 @@ public class BusPassengerRouteFragment extends } public void updateDriverSn(String sn) { + // TODO 这是测试方法,直播源为公司,凤坤旁的F车机 + //if (driverMonitorView.isSOPDriverSn("F803EB2046PZD00164")){ if (driverMonitorView.isSOPDriverSn(sn)){ visibleLiveShadow(); }else { @@ -180,8 +181,10 @@ public class BusPassengerRouteFragment extends @Override protected void openOrCloseLiveVideo() { if (videoSwitch.isSelected()){ + driverMonitorView.stopLive(); videoSwitch.setSelected(false); }else { + driverMonitorView.startLive(); videoSwitch.setSelected(true); mapAndLiveVideoView.changeToSecondView(); } diff --git a/OCH/mogo-och-bus-passenger/src/jinlvvan/res/layout/bus_p_base_fragment.xml b/OCH/mogo-och-bus-passenger/src/jinlvvan/res/layout/bus_p_base_fragment.xml index 9f21d94c8a..46bf3aefed 100644 --- a/OCH/mogo-och-bus-passenger/src/jinlvvan/res/layout/bus_p_base_fragment.xml +++ b/OCH/mogo-och-bus-passenger/src/jinlvvan/res/layout/bus_p_base_fragment.xml @@ -26,11 +26,6 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> - - - - - - - - - - - - - - - - - - - - - - - - () } - private val mHandler = Handler() - private val mRunnable = object : Runnable { - override fun run() { - // Do something here - Logger.d( - "${SceneConstant.M_HMI}$TAG", - "检查司机直播……isLived=$isLived 当前车上的司机端SN=${sopShowDriverMap[CallerTelematicManager.getServerToken()]}" - ) - CallerLogger.d( - "${SceneConstant.M_HMI}$TAG", - "检查司机直播……isLived=$isLived 当前车上的司机端SN=${sopShowDriverMap[CallerTelematicManager.getServerToken()]}" - ) - showLive() + // TODO SOP演示功能代码,乘客端查看当前车辆上的司机位置监控,请求的是分体机提供的直播信息,这里采用的是硬编码,因为云平台的操作就是这样,没有接口供查询对应关系 + private var sopShowDriverMap = HashMap() + private var isLived = false - mHandler.postDelayed(this, 10000) // 1 second delay - } - } + // 调用直播传入的司机屏幕SN + private var currentDriverSN = "" + + // 当前直播源的SN,TODO 如果要测试可以使用下面的SN +// private var currentDriverLiveSN = "F803EB2046PZD00164" + private var currentDriverLiveSN = "" - private val liveStreamManager by lazy { - LiveStreamManagerImpl.getInstance( - context.applicationContext as Application?, - MoGoAiCloudClientConfig.getInstance().sn, - false - ) - } var liveListener: LiveListener? = null @@ -83,10 +64,11 @@ class DriverMonitorView : textureViewDriverMonitor.isOpaque = false - liveStreamManager.setLivePushStatusChangeCallback { } - - // TODO SOP演示需求,只有乘客屏幕才会触发这个逻辑 begin + // TODO SOP演示需求,只有乘客屏幕才会触发这个逻辑 ,车上必须配置了分体机作为直播源 begin + // http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=111386656 // 测试数据 + sopShowDriverMap["F803EB2046PZD00164"] = "F803EB2046PZD00164"//凤坤工位旁的分体机 + sopShowDriverMap["X20202105189C2522114198E7B3"] = "F803EB2046PZD00164"//凤坤工位旁的分体机 sopShowDriverMap["X202022060289M7N8P"] = "F803EB2046PZD00188"//湘A01733D // key=pad司机屏幕SN,value=分体机SN,value用来调用ZeGo直播服务查看直播,@see MoGoAiCloudTrafficLive.viewDesignativeVehicleLive sopShowDriverMap["20220524733SWT1"] = "F803EB2046PZD00190"//湘D01777D @@ -98,61 +80,99 @@ class DriverMonitorView : // TODO SOP演示需求,只有乘客屏幕才会触发这个逻辑 END // 点击重新连接直播 ivNormal.setOnClickListener { - showLive() + startLive() } - - mHandler.postDelayed(mRunnable, 1000) // 1 second delay - } - - fun isSOPDriverSn(sn: String) :Boolean{ - return sopShowDriverMap.containsKey(sn) } override fun onDetachedFromWindow() { super.onDetachedFromWindow() - mHandler.removeCallbacks(mRunnable) - sopShowDriverMap[CallerTelematicManager.getServerToken()]?.let { - MoGoAiCloudTrafficLive.stopCarLive(it) + if (currentDriverLiveSN.isNotEmpty()) { + MoGoAiCloudTrafficLive.stopCarLive(currentDriverLiveSN) } } - fun showLive() { - if (!isLived) { - sopShowDriverMap[CallerTelematicManager.getServerToken()]?.let { - Logger.d( - "${SceneConstant.M_HMI}$TAG", - "检查司机直播……isLived=$isLived 当前车上的司机端SN=${sopShowDriverMap[CallerTelematicManager.getServerToken()]}" - ) - CallerLogger.d( - "${SceneConstant.M_HMI}$TAG", - "检查司机直播……isLived=$isLived 当前车上的司机端SN=${sopShowDriverMap[CallerTelematicManager.getServerToken()]}" - ) + /** + * 检查传入的司机端所在车辆是否配置了,F车机作为直播源。ture-有,false-没有 + */ + fun isSOPDriverSn(snDriver: String): Boolean { + currentDriverSN = snDriver + // 查找传入的司机端所在车是否配置了F车机作为直播源 + sopShowDriverMap[snDriver]?.let { + // 这里应对的是乘客端切换连接的司机端的情况,正常情况这里不会执行,一个车只有一个司机端 + if (isLived && it != currentDriverLiveSN) { + stopLive() + } + currentDriverLiveSN = it + + // 这里知只是了初始化下直播SDK,防止直接调用观看直播时候还未登录问题 + LiveStreamManagerImpl.getInstance( + context.applicationContext as Application?, + MoGoAiCloudClientConfig.getInstance().sn, + false + ) + } ?: let { + // 如果没查到,设置当前车辆为null,并将之前的直播关闭 + stopLive() + currentDriverLiveSN = "" + } + + Logger.d( + "${SceneConstant.M_HMI}$TAG", + "当前车上的司机端SN=${currentDriverSN},直播分体机SN=${currentDriverLiveSN}" + ) + CallerLogger.d( + "${SceneConstant.M_HMI}$TAG", + "当前车上的司机端SN=${currentDriverSN},直播分体机SN=${currentDriverLiveSN}" + ) + return currentDriverLiveSN.isNotEmpty() + } + + + /** + * 打开,司机仓监控直播 + */ + fun startLive() { + if (currentDriverLiveSN.isNotEmpty()) { + Logger.d( + "${SceneConstant.M_HMI}$TAG", + "检查司机直播……isLived=$isLived 当前车上的司机端SN=${currentDriverSN},直播分体机SN=${currentDriverLiveSN}" + ) + CallerLogger.d( + "${SceneConstant.M_HMI}$TAG", + "检查司机直播……isLived=$isLived 当前车上的司机端SN=${currentDriverSN},直播分体机SN=${currentDriverLiveSN}" + ) + if (!isLived) { MoGoAiCloudTrafficLive.viewDesignativeVehicleLive( - it, + currentDriverLiveSN, textureViewDriverMonitor, carLiveCallBack ) - } ?: let { - //为空又怎么撸 - if (CallerTelematicManager.getServerToken().isNotEmpty()) { - Logger.d( - "${SceneConstant.M_HMI}$TAG", - "检查司机直播……isLived=$isLived 当前车辆SN=${CallerTelematicManager.getServerToken()} 不支持直播" - ) - CallerLogger.d( - "${SceneConstant.M_HMI}$TAG", - "检查司机直播……isLived=$isLived 当前车辆SN=${CallerTelematicManager.getServerToken()} 不支持直播" - ) - // 乘客屏幕连接上了司机屏,但是司机屏不在直播范围内,进行隐藏操作。 - liveListener?.onPlayError() - } + } else { + ToastUtils.showShort("正在直播中") } - // TODO 测试用的 -// MoGoAiCloudTrafficLive.viewDesignativeVehicleLive( -// "F803EB2046PZD00164", -// textureViewDriverMonitor, -// carLiveCallBack -// ) + } else { + ToastUtils.showShort("当前车内没有直播源") + //为空又怎么撸 + Logger.d( + "${SceneConstant.M_HMI}$TAG", + "检查司机直播……isLived=$isLived 当前车辆SN=${currentDriverSN} 不支持直播" + ) + CallerLogger.d( + "${SceneConstant.M_HMI}$TAG", + "检查司机直播……isLived=$isLived 当前车辆SN=${currentDriverSN} 不支持直播" + ) + // 乘客屏幕连接上了司机屏,但是司机屏不在直播范围内,进行隐藏操作。 + liveListener?.onPlayError() + } + } + + /** + * 关闭,司机仓监控直播 + */ + fun stopLive() { + isLived = false + if (currentDriverLiveSN.isNotEmpty()) { + MoGoAiCloudTrafficLive.stopCarLive(currentDriverLiveSN) } } @@ -170,20 +190,20 @@ class DriverMonitorView : private val carLiveCallBack = object : ITrafficCarLiveCallBack { override fun onLive(liveSn: String?) { - Logger.d("${SceneConstant.M_HMI}$TAG", "onLive:$liveSn") + Logger.i("${SceneConstant.M_HMI}$TAG", "onLive:$liveSn") CallerLogger.d("${SceneConstant.M_HMI}$TAG", "onLive:$liveSn") } override fun onFirstFrame() { - Logger.d("${SceneConstant.M_HMI}$TAG", "onFirstFrame:isFirstPage") + Logger.i("${SceneConstant.M_HMI}$TAG", "onFirstFrame:isFirstPage") CallerLogger.d("${SceneConstant.M_HMI}$TAG", "onFirstFrame:isFirstPage") isLived = true refreshView(isLived) } override fun onDisConnect() { - Logger.e("${SceneConstant.M_HMI}$TAG", "onDisConnect") - CallerLogger.e("${SceneConstant.M_HMI}$TAG", "onDisConnect") + Logger.w("${SceneConstant.M_HMI}$TAG", "onDisConnect") + CallerLogger.w("${SceneConstant.M_HMI}$TAG", "onDisConnect") isLived = false refreshView(isLived) } @@ -196,14 +216,16 @@ class DriverMonitorView : } override fun onPlaying() { - Logger.e("${SceneConstant.M_HMI}$TAG", "onPlaying……") + Logger.i("${SceneConstant.M_HMI}$TAG", "onPlaying……") + CallerLogger.i("${SceneConstant.M_HMI}$TAG", "onPlaying……") isLived = true refreshView(isLived) } override fun onPlaRequesting() { - Logger.e("${SceneConstant.M_HMI}$TAG", "onPlaRequesting……") - isLived = true + Logger.w("${SceneConstant.M_HMI}$TAG", "onPlaRequesting……") + CallerLogger.w("${SceneConstant.M_HMI}$TAG", "onPlaRequesting……") + isLived = false refreshView(isLived) } } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/V2XFogEventView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/V2XFogEventView.kt deleted file mode 100644 index 5c0cda896e..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/V2XFogEventView.kt +++ /dev/null @@ -1,95 +0,0 @@ -package com.mogo.eagle.core.function.hmi.ui.widget - -import android.animation.Animator -import android.animation.Animator.AnimatorListener -import android.animation.AnimatorSet -import android.animation.ObjectAnimator -import android.content.Context -import android.util.AttributeSet -import android.view.LayoutInflater -import android.view.View -import androidx.constraintlayout.widget.ConstraintLayout -import com.mogo.eagle.core.data.enums.EventTypeEnumNew -import com.mogo.eagle.core.data.enums.WarningDirectionEnum -import com.mogo.eagle.core.function.api.hmi.warning.IV2XEventListener -import com.mogo.eagle.core.function.call.v2x.CallerV2XWarningListenerManager -import com.mogo.eagle.core.function.hmi.R -import com.mogo.eagle.core.utilcode.util.ThreadUtils -import kotlinx.android.synthetic.main.view_v2x_warning_fog.view.* - -class V2XFogEventView(context: Context, attrs: AttributeSet) : - ConstraintLayout(context, attrs), IV2XEventListener { - - companion object { - private const val TAG = "V2XFogEventView" - } - - private val animatorSet = AnimatorSet() - - init { - LayoutInflater.from(context).inflate(R.layout.view_v2x_warning_fog, this, true) - val animator1 = ObjectAnimator.ofFloat(iv_wu1, "alpha", 0f, 1f, 0f) - val animator2 = ObjectAnimator.ofFloat(iv_wu1, "translationX", -500f, 100f, 300f) - val animator3 = ObjectAnimator.ofFloat(iv_wu1, "scaleX", 1f, 1.5f, 2f) - val animator4 = ObjectAnimator.ofFloat(iv_wu1, "scaleY", 1f, 1.5f, 2f) - val animator5 = ObjectAnimator.ofFloat(iv_wu2, "alpha", 0f, 1f, 0f) - val animator6 = ObjectAnimator.ofFloat(iv_wu2, "translationX", 500f, -100f, -300f) - val animator7 = ObjectAnimator.ofFloat(iv_wu2, "scaleX", 1f, 1.5f, 2f) - val animator8 = ObjectAnimator.ofFloat(iv_wu2, "scaleY", 1f, 1.5f, 2f) - animatorSet.playTogether( - animator1, - animator2, - animator3, - animator4, - animator5, - animator6, - animator7, - animator8 - ) - animatorSet.duration = 5000 - animatorSet.addListener(object : AnimatorListener{ - override fun onAnimationStart(animation: Animator?) { - visibility = View.VISIBLE - } - - override fun onAnimationEnd(animation: Animator?) { - visibility = View.GONE - } - - override fun onAnimationCancel(animation: Animator?) { - visibility = View.GONE - } - - override fun onAnimationRepeat(animation: Animator?) { - - } - - }) - } - - override fun onAttachedToWindow() { - super.onAttachedToWindow() - CallerV2XWarningListenerManager.addListener(TAG, this) - } - - override fun show(v2xType: String, direction: WarningDirectionEnum, time: Long) { - ThreadUtils.runOnUiThread { - if(v2xType == EventTypeEnumNew.FOURS_FOG.poiType){ - if (animatorSet.isStarted) { - return@runOnUiThread - } - animatorSet.start() - } - } - } - - override fun dismiss(direction: WarningDirectionEnum) { - - } - - override fun onDetachedFromWindow() { - super.onDetachedFromWindow() - CallerV2XWarningListenerManager.removeListener(TAG) - } - -} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/DisplayEffectsHelper.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/DisplayEffectsHelper.java deleted file mode 100644 index 8c9b4c0f56..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/DisplayEffectsHelper.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.mogo.eagle.core.function.main; - -import android.animation.AnimatorSet; -import android.animation.ObjectAnimator; -import android.content.res.Resources; -import android.util.DisplayMetrics; -import android.view.View; - -import com.mogo.eagle.core.function.hmi.R; - - -/** - * created by wujifei on 2021/3/30 14:05 - * describe: - */ -public class DisplayEffectsHelper { - private volatile static DisplayEffectsHelper instance = null; - private AnimatorSet animatorSet; - - public static DisplayEffectsHelper getInstance() { - if (instance == null) { - synchronized (DisplayEffectsHelper.class) { - if (instance == null) { - instance = new DisplayEffectsHelper(); - } - } - } - return instance; - } - - public void init(View rootView) { - View view1 = rootView.findViewById(R.id.iv_wu1); - View view2 = rootView.findViewById(R.id.iv_wu2); - ObjectAnimator animator1 = ObjectAnimator.ofFloat(view1, "alpha", 0f, 1f, 0f); - ObjectAnimator animator2 = ObjectAnimator.ofFloat(view1, "translationX", -500, 100f, 300f); - ObjectAnimator animator3 = ObjectAnimator.ofFloat(view1, "scaleX", 1f, 1.5f, 2f); - ObjectAnimator animator4 = ObjectAnimator.ofFloat(view1, "scaleY", 1f, 1.5f, 2f); - ObjectAnimator animator5 = ObjectAnimator.ofFloat(view2, "alpha", 0f, 1f, 0f); - ObjectAnimator animator6 = ObjectAnimator.ofFloat(view2, "translationX", 500, -100f, -300f); - ObjectAnimator animator7 = ObjectAnimator.ofFloat(view2, "scaleX", 1f, 1.5f, 2f); - ObjectAnimator animator8 = ObjectAnimator.ofFloat(view2, "scaleY", 1f, 1.5f, 2f); - animatorSet = new AnimatorSet(); - animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5, animator6, animator7, animator8); - animatorSet.setDuration(5000); - } - - public void display() { - animatorSet.start(); - } - - private float dp2px(float dp) { - DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics(); - return dp * metrics.density; - } -} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/wu1.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/wu1.png deleted file mode 100644 index 0ab8e44e21..0000000000 Binary files a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/wu1.png and /dev/null differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/wu2.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/wu2.png deleted file mode 100644 index aff4543048..0000000000 Binary files a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/wu2.png and /dev/null differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_v2x_warning_fog.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_v2x_warning_fog.xml deleted file mode 100644 index 4b49c7665b..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_v2x_warning_fog.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/MarkerDrawerManager.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/MarkerDrawerManager.kt index d1bccb8b3c..ac07806e88 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/MarkerDrawerManager.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/MarkerDrawerManager.kt @@ -86,12 +86,33 @@ object MarkerDrawerManager { } } - fun updateRoutePoints(routePoints: List?, context: Context) { + /** + * 存储全局轨迹用于轮询计算车已走过的轨迹index + */ + fun updateGDRoutePoints(routePoints: List?) { if (routePoints == null || routePoints.isEmpty()) return - val latLngModels = coordinateConverterWgsToGcjListCommon(context, routePoints) - planningPoints.clear() - planningPoints.addAll(latLngModels) -// float remainingSumLength = calculateRemainingSumLength(mRoutePoints); + synchronized(this) { + planningPoints.clear() + planningPoints.addAll(routePoints) + } + } + + fun resetStatus() { + synchronized(this) { + planningPoints.clear() + } + lastArrivedIndex = -1 + } + + /** + * 转为高德定位对象 + */ + fun change2GDPoints(routePoints: List?, context: Context): List { + return if (routePoints == null || routePoints.isEmpty()) { + emptyList() + } else { + coordinateConverterWgsToGcjListCommon(context, routePoints) + } } /** @@ -100,6 +121,7 @@ object MarkerDrawerManager { * @param realLat * @return 返回已经到达点的index */ + @Synchronized private fun getCarLocationIndex( routePoints: List, newPoints: MutableList, @@ -108,14 +130,24 @@ object MarkerDrawerManager { heading: Double ): Int { var currentIndex = 0 //记录疑似点 + // 是否超过200KM + var isLongDistance = false if (routePoints.isNotEmpty()) { //基础点 val baseLatLng = routePoints[0] + newPoints.add(baseLatLng) var baseDiffDis = CoordinateUtils.calculateLineDistance( realLon, realLat, baseLatLng.longitude, baseLatLng.latitude ) // lon,lat, prelon, prelat - for (i in 1 until routePoints.size) { + if (baseDiffDis > 200000) { + isLongDistance = true + } + val size = routePoints.size + for (i in 1 until size) { val latLng = routePoints[i] + // 深拷贝数据用于高德地图上轨迹线的绘制 + newPoints.add(LatLng(latLng.latitude, latLng.longitude)) + if (isLongDistance) continue val diff = CoordinateUtils.calculateLineDistance( realLon, realLat, latLng.longitude, latLng.latitude ) @@ -135,14 +167,20 @@ object MarkerDrawerManager { } } Log.d("MarkerDrawerManager", "当次计算已走过的点的索引为:$currentIndex,存储的上次索引为:$lastArrivedIndex") - if (currentIndex < lastArrivedIndex) { - currentIndex = lastArrivedIndex - } else { - lastArrivedIndex = currentIndex + if (!isLongDistance) { + // 过滤缓存的非当次轨迹的索引,并且出现车已走过索引跳跃过大时视为无效复用上一次计算结果 + if (currentIndex < lastArrivedIndex || (lastArrivedIndex >= 0 && currentIndex - lastArrivedIndex >= 10)) { + if (lastArrivedIndex < size) { + currentIndex = lastArrivedIndex + } + } else { + lastArrivedIndex = currentIndex + } + if (size >= 2) { + newPoints.add(currentIndex + 1, LatLng(realLat, realLon)) + return currentIndex + 1 + } } - newPoints.addAll(routePoints) - newPoints.add(currentIndex + 1, LatLng(realLat, realLon)) - return currentIndex + 1 } return 0 } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/OverMapView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/OverMapView.kt index 13b502df3d..94b9a31f2c 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/OverMapView.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/OverMapView.kt @@ -15,10 +15,7 @@ import android.widget.TextView import androidx.annotation.MainThread import androidx.core.graphics.drawable.toBitmap import ch.hsr.geohash.GeoHash -import com.amap.api.maps.AMap -import com.amap.api.maps.CameraUpdate -import com.amap.api.maps.CameraUpdateFactory -import com.amap.api.maps.TextureMapView +import com.amap.api.maps.* import com.amap.api.maps.model.* import com.mogo.eagle.core.data.map.Infrastructure import com.mogo.eagle.core.data.map.MogoLocation @@ -37,21 +34,18 @@ import com.mogo.eagle.core.function.map.R import com.mogo.eagle.core.function.smp.MakerWithCount import com.mogo.eagle.core.function.smp.MarkerDrawerManager import com.mogo.eagle.core.function.smp.MarkerDrawerManager.callback +import com.mogo.eagle.core.function.smp.MarkerDrawerManager.change2GDPoints import com.mogo.eagle.core.function.smp.MarkerDrawerManager.coordinateConverterWgsToGcj -import com.mogo.eagle.core.function.smp.MarkerDrawerManager.lastArrivedIndex import com.mogo.eagle.core.function.smp.MarkerDrawerManager.lonLatHeading -import com.mogo.eagle.core.function.smp.MarkerDrawerManager.planningPoints import com.mogo.eagle.core.function.smp.MarkerDrawerManager.startLoopCalCarLocation -import com.mogo.eagle.core.function.smp.MarkerDrawerManager.updateRoutePoints +import com.mogo.eagle.core.function.smp.MarkerDrawerManager.updateGDRoutePoints import com.mogo.eagle.core.function.smp.V2XMarkerView import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.UiThreadHandler -import com.zhidaoauto.map.sdk.open.tools.ThreadPoolUtils import me.jessyan.autosize.utils.AutoSizeUtils import mogo.telematics.pad.MessagePad import mogo.v2x.MogoV2X -import java.util.concurrent.ExecutorService import java.util.concurrent.Executors import kotlin.math.pow @@ -127,10 +121,16 @@ class OverMapView @JvmOverloads constructor( @Volatile private var isInit = false + @Volatile + private var isFirst = true + + // 用来绘制轨迹线 private val singlePool by lazy { Executors.newSingleThreadExecutor() } + private var allPoints: List? = null + companion object { const val TAG = "OverMapView" } @@ -334,8 +334,9 @@ class OverMapView @JvmOverloads constructor( mStartMarker?.isVisible = false mEndMarker?.isVisible = false MarkerDrawerManager.stopLoopCalCarLocation() - planningPoints.clear() - lastArrivedIndex = -1 + ThreadUtils.getIoPool().execute { + MarkerDrawerManager.resetStatus() + } isInit = false } @@ -355,10 +356,7 @@ class OverMapView @JvmOverloads constructor( resources.getDrawable(R.drawable.transparent_background, null) .toBitmap(AutoSizeUtils.dp2px(context, 32f), AutoSizeUtils.dp2px(context, 230f)) ) - CallerPlanningRottingListenerManager.addListener(TAG, this) initAMapView(context) - // 注册定位监听 - CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this) //设置全览模式 overLayerView?.setOnClickListener { displayCustomOverView() } overLayerView?.let { @@ -403,6 +401,9 @@ class OverMapView @JvmOverloads constructor( override fun onAttachedToWindow() { super.onAttachedToWindow() + CallerPlanningRottingListenerManager.addListener(TAG, this) + // 注册定位监听 + CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this) CallerFuncBizListenerManager.addListener(TAG, object : IFuncBizProvider { override fun onInfStructures(map: HashMap>?) { geoHashInfMap = map @@ -470,37 +471,50 @@ class OverMapView @JvmOverloads constructor( Log.d(TAG, "全局路径规划轨迹为空") return } + Log.d(TAG, "全局路径规划轨迹下发") + isFirst = true + MarkerDrawerManager.resetStatus() val list: List = locationList - // 转成高德坐标系并存储 - updateRoutePoints(list, mContext!!) - val planningPointList: List = planningPoints - UiThreadHandler.post ({ - displayCustomOverView() - drawStartAndEndMarker(planningPointList) - }, UiThreadHandler.MODE.QUEUE) - if (!isInit) { - callback = object : MarkerDrawerManager.Callback { - override fun onLocationChanged(planningPoints: List, locIndex: Int) { - // 每1s刷新一下轨迹线 - UiThreadHandler.post ({ - if (planningPoints.isNotEmpty()) { - drawPolyline(planningPoints, locIndex) + // 转成高德定位对象并存储 + val planningPointList = change2GDPoints(list, mContext!!) + updateGDRoutePoints(planningPointList) + synchronized(this::class.java) { + if (!isInit) { + var timeStamp = 0L + callback = object : MarkerDrawerManager.Callback { + override fun onLocationChanged(points: List, locIndex: Int) { + if (points.isNotEmpty()) { + // 每1s刷新一下轨迹线 + singlePool.execute { + if (isFirst) { + Log.d(TAG, "第一次!") + isFirst = false + allPoints = points + displayCustomOverView() + drawStartAndEndMarker(points) + } + timeStamp = System.currentTimeMillis() + drawPolyline(points, locIndex) + Log.d(TAG, "绘制轨迹线的时间为:${System.currentTimeMillis() - timeStamp}ms") + } } - }, UiThreadHandler.MODE.QUEUE) + } } + startLoopCalCarLocation() + isInit = true } - startLoopCalCarLocation() - isInit = true } - UiThreadHandler.post({ - if (geoHashInfMap.isNullOrEmpty()) { - UiThreadHandler.postDelayed({ + if (geoHashInfMap.isNullOrEmpty()) { + UiThreadHandler.postDelayed({ + singlePool.execute { drawInfrastructureMarkers(locationList) - }, 1000, UiThreadHandler.MODE.QUEUE) - } else { + } + }, 1000, UiThreadHandler.MODE.QUEUE) + } else { + singlePool.execute { drawInfrastructureMarkers(locationList) } - }, UiThreadHandler.MODE.QUEUE) + } } /** @@ -662,33 +676,39 @@ class OverMapView @JvmOverloads constructor( * 进入自定义全览模式 */ fun displayCustomOverView() { - val linePointsLatLng = planningPoints - if (linePointsLatLng.size > 1 && mLocation != null) { - //圈定地图显示范围 - //存放经纬度 - val boundsBuilder = LatLngBounds.Builder() - for (i in linePointsLatLng.indices) { - boundsBuilder.include(linePointsLatLng[i]) + singlePool.execute { + val linePointsLatLng = allPoints + if (linePointsLatLng != null && linePointsLatLng.size > 1 && mLocation != null) { + //圈定地图显示范围 + //存放经纬度 + val boundsBuilder = LatLngBounds.Builder() + for (i in linePointsLatLng.indices) { + boundsBuilder.include(linePointsLatLng[i]) + } + val currentLatLng = LatLng(mLocation!!.latitude, mLocation!!.longitude) + boundsBuilder.include(currentLatLng) + val cameraPosition = CameraPosition.Builder().tilt(mTilt).build() + //第二个参数为四周留空宽度 + if (mAMap != null) { + mAMap!!.moveCamera( + CameraUpdateFactory.newLatLngBoundsRect( + boundsBuilder.build(), + AutoSizeUtils.dp2px(context, leftPadding.toFloat()), + AutoSizeUtils.dp2px(context, rightPadding.toFloat()), + AutoSizeUtils.dp2px(context, topPadding.toFloat()), + AutoSizeUtils.dp2px(context, bottomPadding.toFloat()) + ) + ) + mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)) + } + } else { + if (mCarMarker != null && mAMap != null) { + //设置希望展示的地图缩放级别 + val cameraPosition = CameraPosition.Builder() + .target(mCarMarker!!.position).tilt(mTilt).zoom(zoomLevel.toFloat()).build() + mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)) + } } - val currentLatLng = LatLng(mLocation!!.latitude, mLocation!!.longitude) - boundsBuilder.include(currentLatLng) - val cameraPosition = CameraPosition.Builder().tilt(mTilt).build() - //第二个参数为四周留空宽度 - mAMap!!.moveCamera( - CameraUpdateFactory.newLatLngBoundsRect( - boundsBuilder.build(), - AutoSizeUtils.dp2px(context, leftPadding.toFloat()), - AutoSizeUtils.dp2px(context, rightPadding.toFloat()), - AutoSizeUtils.dp2px(context, topPadding.toFloat()), - AutoSizeUtils.dp2px(context, bottomPadding.toFloat()) - ) - ) - mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)) - } else { - //设置希望展示的地图缩放级别 - val cameraPosition = CameraPosition.Builder() - .target(mCarMarker!!.position).tilt(mTilt).zoom(zoomLevel.toFloat()).build() - mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)) } } @@ -699,14 +719,16 @@ class OverMapView @JvmOverloads constructor( */ private fun drawCarMarker(location: MogoLocation?) { if (location == null) return - if (mCarMarker != null) { - val currentLatLng = LatLng(location.latitude, location.longitude) - mCarMarker!!.rotateAngle = (360 - location.heading).toFloat() - mCarMarker!!.position = currentLatLng - mCarMarker!!.setToTop() - if (mCompassMarker != null) { - mCompassMarker!!.rotateAngle = (360 - location.heading).toFloat() - mCompassMarker!!.position = currentLatLng + singlePool.execute { + if (mCarMarker != null) { + val currentLatLng = LatLng(location.latitude, location.longitude) + mCarMarker!!.rotateAngle = (360 - location.heading).toFloat() + mCarMarker!!.position = currentLatLng + mCarMarker!!.setToTop() + if (mCompassMarker != null) { + mCompassMarker!!.rotateAngle = (360 - location.heading).toFloat() + mCompassMarker!!.position = currentLatLng + } } } } @@ -718,6 +740,7 @@ class OverMapView @JvmOverloads constructor( mStartMarker?.isVisible = false mEndMarker?.isVisible = false if (coordinates.size > 2) { + Log.d(TAG, "绘制起终点") // 设置开始结束Marker位置 val startLatLng = coordinates[0] val endLatLng = coordinates[coordinates.size - 1] @@ -725,6 +748,8 @@ class OverMapView @JvmOverloads constructor( mEndMarker?.position = endLatLng mStartMarker?.isVisible = true mEndMarker?.isVisible = true + } else { + Log.d(TAG, "不绘制起终点") } } @@ -734,8 +759,7 @@ class OverMapView @JvmOverloads constructor( * @param coordinates * @param locIndex */ - @MainThread - fun drawPolyline(coordinates: List, locIndex: Int) { + private fun drawPolyline(coordinates: List, locIndex: Int) { if (textureList.size > 0) { textureList.clear() } @@ -759,6 +783,7 @@ class OverMapView @JvmOverloads constructor( texIndexList.add(i - 1) } if (mAMap != null && coordinates.size > 2) { +// Log.d(TAG, "绘制时轨迹点数为:${coordinates.size},纹理数为:${textureList.size},车辆index为:$locIndex") //设置线段纹理 val polylineOptions = PolylineOptions() polylineOptions.addAll(coordinates) @@ -819,60 +844,69 @@ class OverMapView @JvmOverloads constructor( * 站点轨迹集合被包含在地图显示范围内 */ fun includeSitePointsAndUpdateCamera(coordinates: List?) { - val linePointsLatLng = planningPoints - val boundsBuilder = LatLngBounds.Builder() - var isOnlyCarLocation = true + singlePool.execute { + val linePointsLatLng = allPoints + val boundsBuilder = LatLngBounds.Builder() + var isOnlyCarLocation = true - if (linePointsLatLng.size > 1) { - // 圈定地图显示范围(自动驾驶轨迹) - for (i in linePointsLatLng.indices) { - boundsBuilder.include(linePointsLatLng[i]) + if (linePointsLatLng != null && linePointsLatLng.size > 1) { + // 圈定地图显示范围(自动驾驶轨迹) + for (i in linePointsLatLng.indices) { + boundsBuilder.include(linePointsLatLng[i]) + } + isOnlyCarLocation = false } - isOnlyCarLocation = false - } - if (mLocation != null) { - // 自车坐标 - boundsBuilder.include(LatLng(mLocation!!.latitude, mLocation!!.longitude)) - } - - coordinates?.let { - // 站点轨迹被包含在地图显示范围内 - for (i in it.indices) { - boundsBuilder.include(it[i]) + if (mLocation != null) { + // 自车坐标 + boundsBuilder.include(LatLng(mLocation!!.latitude, mLocation!!.longitude)) } - isOnlyCarLocation = false - } - if (!isOnlyCarLocation) { - val cameraPosition = CameraPosition.Builder().tilt(mTilt).build() - //第二个参数为四周留空宽度 - mAMap!!.moveCamera( - CameraUpdateFactory.newLatLngBoundsRect( - boundsBuilder.build(), - AutoSizeUtils.dp2px(context, leftPadding.toFloat()), - AutoSizeUtils.dp2px(context, rightPadding.toFloat()), - AutoSizeUtils.dp2px(context, topPadding.toFloat()), - AutoSizeUtils.dp2px(context, bottomPadding.toFloat()) - ) - ) - mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)) - } else { - //设置希望展示的地图缩放级别 - val cameraPosition = CameraPosition.Builder() - .target(mCarMarker!!.position).tilt(mTilt).zoom(zoomLevel.toFloat()).build() - mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)) + coordinates?.let { + // 站点轨迹被包含在地图显示范围内 + for (i in it.indices) { + boundsBuilder.include(it[i]) + } + isOnlyCarLocation = false + } + + if (!isOnlyCarLocation) { + val cameraPosition = CameraPosition.Builder().tilt(mTilt).build() + //第二个参数为四周留空宽度 + if (mAMap != null) { + mAMap!!.moveCamera( + CameraUpdateFactory.newLatLngBoundsRect( + boundsBuilder.build(), + AutoSizeUtils.dp2px(context, leftPadding.toFloat()), + AutoSizeUtils.dp2px(context, rightPadding.toFloat()), + AutoSizeUtils.dp2px(context, topPadding.toFloat()), + AutoSizeUtils.dp2px(context, bottomPadding.toFloat()) + ) + ) + mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)) + } + } else { + //设置希望展示的地图缩放级别 + if (mCarMarker != null && mAMap != null) { + val cameraPosition = CameraPosition.Builder() + .target(mCarMarker!!.position).tilt(mTilt).zoom(zoomLevel.toFloat()).build() + mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)) + } + } } } override fun onChassisLocationGCJ02(gnssInfo: MogoLocation?) { gnssInfo?.let { - mLocation = it - lonLatHeading = Triple(it.longitude, it.latitude, it.heading) - drawCarMarker(it) - if (isFirstLocation) { - displayCustomOverView() - isFirstLocation = false + // 在中国境内 + if (CoordinateConverter.isAMapDataAvailable(it.latitude, it.longitude)) { + mLocation = it + lonLatHeading = Triple(it.longitude, it.latitude, it.heading) + drawCarMarker(it) + if (isFirstLocation) { + displayCustomOverView() + isFirstLocation = false + } } } @@ -885,7 +919,7 @@ class OverMapView @JvmOverloads constructor( */ override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) { globalPathResp?.let { - singlePool.execute { + ThreadUtils.getIoPool().execute { handlePlanningData(it.wayPointsList) } } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt index 8e74f8cf2c..c8813b87df 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt @@ -44,12 +44,6 @@ enum class EventTypeEnumNew( "前方道路积水", "道路积水" ), - //浓雾 - FOURS_FOG( - "10010", "出现浓雾", "浓雾预警", R.drawable.v2x_icon_nongwu_vr, - "前方出现浓雾", "出现浓雾" - ), - //结冰 FOURS_ICE( "10011", "路面结冰", "路面结冰", R.drawable.v2x_icon_jiebing_vr, @@ -532,7 +526,6 @@ enum class EventTypeEnumNew( FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeStr FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeStr FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeStr - FOURS_FOG.poiType -> FOURS_FOG.poiTypeStr FOURS_ICE.poiType -> FOURS_ICE.poiTypeStr FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, @@ -553,7 +546,6 @@ enum class EventTypeEnumNew( FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeStrVr FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeStrVr FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeStrVr - FOURS_FOG.poiType -> FOURS_FOG.poiTypeStrVr FOURS_ICE.poiType -> FOURS_ICE.poiTypeStrVr FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, @@ -574,7 +566,6 @@ enum class EventTypeEnumNew( FOURS_ROAD_WORK.poiType -> "施工" FOURS_BLOCK_UP.poiType -> "道路拥堵" FOURS_PONDING.poiType -> "道路积水" - FOURS_FOG.poiType -> "出现浓雾" FOURS_ICE.poiType -> "路面结冰" FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> "交通事故" @@ -590,7 +581,6 @@ enum class EventTypeEnumNew( FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeSrcVr FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeSrcVr FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeSrcVr - FOURS_FOG.poiType -> FOURS_FOG.poiTypeSrcVr FOURS_ICE.poiType -> FOURS_ICE.poiTypeSrcVr FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, @@ -610,7 +600,7 @@ enum class EventTypeEnumNew( return when (poiType) { FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType-> if (isVrMode) R.drawable.bg_v2x_event_type_orange_vr else R.drawable.bg_v2x_event_type_orange TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType, - FOURS_PONDING.poiType, FOURS_FOG.poiType, FOURS_ICE.poiType, FOURS_ACCIDENT.poiType, + FOURS_PONDING.poiType, FOURS_ICE.poiType, FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> if (isVrMode) R.drawable.bg_v2x_event_type_red_vr else R.drawable.bg_v2x_event_type_read else -> { @@ -626,7 +616,7 @@ enum class EventTypeEnumNew( R.drawable.bg_v2x_event_type_orange TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType, FOURS_PONDING.poiType, - FOURS_FOG.poiType, FOURS_ICE.poiType, + FOURS_ICE.poiType, FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> @@ -643,7 +633,7 @@ enum class EventTypeEnumNew( return when (poiType) { TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType, FOURS_BLOCK_UP.poiType, - FOURS_PONDING.poiType, FOURS_FOG.poiType, + FOURS_PONDING.poiType, FOURS_ICE.poiType, FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, @@ -664,7 +654,6 @@ enum class EventTypeEnumNew( FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.tts FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.tts FOURS_PONDING.poiType -> FOURS_PONDING.tts - FOURS_FOG.poiType -> FOURS_FOG.tts FOURS_ICE.poiType -> FOURS_ICE.tts FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.tts @@ -684,7 +673,6 @@ enum class EventTypeEnumNew( FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.content FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.content FOURS_PONDING.poiType -> FOURS_PONDING.content - FOURS_FOG.poiType -> FOURS_FOG.content FOURS_ICE.poiType -> FOURS_ICE.content FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> @@ -704,7 +692,6 @@ enum class EventTypeEnumNew( FOURS_BLOCK_UP.poiType -> R.raw.v2x_yongdu FOURS_ACCIDENT.poiType,FOURS_ACCIDENT_04.poiType -> R.raw.v2x_shigu FOURS_LIVING.poiType -> R.raw.v2x_shishilukuang - FOURS_FOG.poiType -> R.raw.v2x_nongwu TRAFFIC_CHECK.poiType -> R.raw.v2x_jiaotongjiancha FOURS_ROAD_WORK.poiType -> R.raw.v2x_daolushigong FOURS_ICE.poiType -> R.raw.v2x_daolujiebing @@ -757,10 +744,6 @@ enum class EventTypeEnumNew( FOURS_PONDING.poiType ->{ FOURS_PONDING.poiTypeStr } - //浓雾 - FOURS_FOG.poiType ->{ - FOURS_FOG.poiTypeStr - } //结冰 FOURS_ICE.poiType ->{ FOURS_ICE.poiTypeStr @@ -1060,10 +1043,6 @@ enum class EventTypeEnumNew( FOURS_PONDING.poiType -> { R.drawable.v2x_icon_jishui_vr } - //浓雾 - FOURS_FOG.poiType -> { - R.drawable.v2x_icon_nongwu_vr - } //结冰 FOURS_ICE.poiType -> { R.drawable.v2x_icon_jiebing_vr diff --git a/core/mogo-core-res/src/main/res/drawable-xhdpi/module_common_ic_rc_dark_frog2.png b/core/mogo-core-res/src/main/res/drawable-xhdpi/module_common_ic_rc_dark_frog2.png deleted file mode 100644 index 787101fbb1..0000000000 Binary files a/core/mogo-core-res/src/main/res/drawable-xhdpi/module_common_ic_rc_dark_frog2.png and /dev/null differ diff --git a/core/mogo-core-res/src/main/res/drawable-xhdpi/module_common_ic_rc_dark_frog2_white.png b/core/mogo-core-res/src/main/res/drawable-xhdpi/module_common_ic_rc_dark_frog2_white.png deleted file mode 100644 index b6164bcfdd..0000000000 Binary files a/core/mogo-core-res/src/main/res/drawable-xhdpi/module_common_ic_rc_dark_frog2_white.png and /dev/null differ diff --git a/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_nongwu_vr.png b/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_nongwu_vr.png deleted file mode 100644 index f6e145dbea..0000000000 Binary files a/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_nongwu_vr.png and /dev/null differ diff --git a/libraries/mogo-adas-data/src/main/proto/message_pad.proto b/libraries/mogo-adas-data/src/main/proto/message_pad.proto index c72d33a01e..6916e70154 100644 --- a/libraries/mogo-adas-data/src/main/proto/message_pad.proto +++ b/libraries/mogo-adas-data/src/main/proto/message_pad.proto @@ -366,7 +366,8 @@ message GlobalPathReq // message definition for MsgTypeGlobalPathResp message GlobalPathResp { - repeated Location wayPoints = 1; + repeated Location wayPoints = 1; + uint64 lineId = 2; //路线id } // message definition for MsgTypeTrafficLightData diff --git a/libraries/mogo-adas-data/src/main/proto/system_status_info.proto b/libraries/mogo-adas-data/src/main/proto/system_status_info.proto index 0a4953f7f8..0469739ba8 100644 --- a/libraries/mogo-adas-data/src/main/proto/system_status_info.proto +++ b/libraries/mogo-adas-data/src/main/proto/system_status_info.proto @@ -54,11 +54,14 @@ message StatusInfo { optional DropTopic topic_drop_info=3; // topic 掉频信息, 如有掉频添加没有不添加 optional string reserved = 4; // 用于表示idle模式,'idle' 表示idle模式 'work' 表示正常工作 // add by liyl 20220907 - optional int32 pilot_mode = 5; // 0: manaul 1: autopilot 2: RemotePilot + optional int32 pilot_mode = 5; // 0: manaul 1: autopilot 6: RemotePilot optional string map_version = 6; // MAP 版本信息 optional string master_version = 7; // system_master 版本信息 optional bool auto_pilot_ready = 8; // 自动驾驶状态就绪, 20221111增加 optional bool remote_pilot_ready = 9; // 平行驾驶状态就绪 - optional NodeFaultList auto_pilot_unready_list = 10; //20221128 增加 - optional NodeFaultList remote_pilot_unready_list = 11; //20221128 增加 + optional NodeFaultList auto_pilot_unready_list = 10; //自驾未就绪节点列表, 20221128 增加 + optional NodeFaultList remote_pilot_unready_list = 11; //平行驾驶未就绪列表, 20221128 增加 + optional string auto_pilot_unready_reason = 12; //自动驾驶状态未就绪原因描述 + optional string remote_pilot_unready_reason = 13; //平行驾驶状态未就绪原因描述 } + diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java index 5bccb67907..499fff2033 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbility250.java @@ -13,7 +13,7 @@ import chassis.ChassisStatesOuterClass; import system_master.SystemStatusInfo; /** - * 是否可以启动自动驾驶能力检测 工控机版本>=250使用此类 + * 是否可以启动自动驾驶能力检测 非清扫车MAP版本>=250使用此类 清扫车MAP版本>=250&& <330使用此类 * 目前监控了底盘的一些状态和查询节点状态应答的数据 * 没有使用监控事件报告的原因是因为,部分异常没进行正常恢复通知,例如收到了异常监控数据,但是异常恢复之后没有恢复的通知 *

@@ -27,8 +27,10 @@ public class AutopilotAbility250 { private static final String[] NODE_INFO_STATE = {"未知状态 ", "依赖未就绪 ", "启动中 ", "运行 ", "停止 ", "无法启动状态 ", "人为启动状态 ", "人为关闭状态 "}; private volatile Timer timer; private ChassisStatesOuterClass.ChassisStates chassisStates; + private int mapVersion = -1;//工控机版本 - public AutopilotAbility250() { + public AutopilotAbility250(int mapVersion) { + this.mapVersion = mapVersion; } @@ -55,8 +57,13 @@ public class AutopilotAbility250 { String masterVersion = statusInfo.getMasterVersion(); version = AdasManager.getInstance().parseVersion(false, masterVersion); } - //如果 maser version 大于1,还需要判断AutoPilotReady字段是否存在,以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行 - if (version > 1 && statusInfo.hasAutoPilotReady()) { + //SSM 3版本兼容 + if (mapVersion >= 30400 && version > 2 && statusInfo.hasAutoPilotReady() && statusInfo.hasAutoPilotUnreadyReason()) { + isAutopilotAbility = statusInfo.getAutoPilotReady(); + if (!isAutopilotAbility) { + unableAutopilotReason = statusInfo.getAutoPilotUnreadyReason(); + } + } else if (mapVersion >= 21000 && version > 1 && statusInfo.hasAutoPilotReady()) {//如果 maser version 大于1,还需要判断AutoPilotReady字段是否存在,以确保MAP版本和SSM Maser版本不陪配情况逻辑能正常执行 isAutopilotAbility = statusInfo.getAutoPilotReady(); if (!isAutopilotAbility) { SystemStatusInfo.NodeFaultList nodeFaultList = statusInfo.getAutoPilotUnreadyList(); diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java index f44c666eba..5185bd6321 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/autopilot/ability/AutopilotAbilityManager.java @@ -30,7 +30,8 @@ public class AutopilotAbilityManager { private OnAdasListener listener; private Handler handler; private OnAutopilotAbilityListener onAutopilotAbilityListener; - private int dockerVersion = -1;//工控机版本 + private int mapVersion = -1;//工控机版本 + private boolean isFutianSweeper = false;//是否是福田清扫车 private AutopilotAbility230 autopilotAbility230; private AutopilotAbility250 autopilotAbility250; private Timer startTimer; @@ -77,15 +78,12 @@ public class AutopilotAbilityManager { } public void setCarConfig(MessagePad.CarConfigResp carConfig) { - if (dockerVersion == -1) { - String v = carConfig.getDockVersion(); - int version = AdasManager.getInstance().parseVersion(v); - if (version != -1) { - stopTimer(); - dockerVersion = version; - CupidLogUtils.i(TAG, "工控机版本=" + dockerVersion); - initAutopilotAbility(); - } + mapVersion = carConfig.getMapVersion(); + isFutianSweeper = carConfig.getIsFutianSweeper(); + if (mapVersion != -1) { + stopTimer(); + CupidLogUtils.i(TAG, "工控机版本=" + mapVersion); + initAutopilotAbility(); } } @@ -138,13 +136,15 @@ public class AutopilotAbilityManager { } private void initAutopilotAbility() { - if (dockerVersion >= 20500) { + if (mapVersion >= 20500) { + CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用250版本"); stop230(); if (autopilotAbility250 == null) { - autopilotAbility250 = new AutopilotAbility250(); + autopilotAbility250 = new AutopilotAbility250(mapVersion); autopilotAbility250.start(); } } else { + CupidLogUtils.i(TAG, "是否可以启动自动驾驶能力检测使用230版本"); stop250(); if (autopilotAbility230 == null) { autopilotAbility230 = new AutopilotAbility230(); @@ -185,8 +185,8 @@ public class AutopilotAbilityManager { startTimer.schedule(new TimerTask() { @Override public void run() { - if (dockerVersion == -1 && AdasManager.getInstance().getIpcConnectionStatus() == Constants.IPC_CONNECTION_STATUS.CONNECTED) { - dockerVersion = 20300; + if (mapVersion == -1 && AdasManager.getInstance().getIpcConnectionStatus() == Constants.IPC_CONNECTION_STATUS.CONNECTED) { + mapVersion = 20300; initAutopilotAbility(); } } @@ -200,7 +200,8 @@ public class AutopilotAbilityManager { stop230(); stop250(); handler = null; - dockerVersion = -1; + mapVersion = -1; + isFutianSweeper = false; } } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java index b67c9ef9d7..cfb08dc2a0 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/AMapViewWrapper.java @@ -120,10 +120,6 @@ public class AMapViewWrapper implements IMogoMapView, private EnumMapUI mCurrentUI = EnumMapUI.MAP_STYLE_NIGHT_VR; private VisualAngleMode mVisualAngleMode = MODE_MEDIUM_SIGHT; - private boolean mMapLoaded = false; - private boolean mIsFirstLocated = true; - private boolean mIsDelayed = false; - private IHdCacheListener hdCacheListener; public AMapViewWrapper(MapAutoView mMapView) { @@ -173,6 +169,7 @@ public class AMapViewWrapper implements IMogoMapView, //设置手势是否可以缩放 isCanZoom true 可缩放 false 不可缩放 options.setZoomGesturesEnabled(true); options.setScaleVRMode(true); + options.setWeatherEnable(false); // options.setAllGesturesEnabled(false); //禁止全部手势 if (options.getMyLocationStyle() != null) { options.getMyLocationStyle().setDisplayAnimEnable(true); @@ -750,7 +747,6 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void onMapLoaded() { CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--onMapLoaded: "); - mMapLoaded = true; if (checkAMapView()) { CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition(); MogoMapListenerHandler.Companion.getMogoMapListenerHandler().onMapChanged(ObjectUtils.fromAMap(cameraPosition.getTarget()),