diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/line/LineManager.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/line/LineManager.kt index fa8becee66..80e94d6caf 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/line/LineManager.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/line/LineManager.kt @@ -133,12 +133,13 @@ object LineManager : CallerBase() { }else { setAutopilotControlParameters() } - OchChainLogManager.writeChainLogAutopilot("自驾参数", "${startStation}---${endStation}") + OchChainLogManager.writeChainLogAutopilot("自驾参数", "站点信息:${startStation}---${endStation}") } fun setContraiInfo(contraiInfo: ContraiInfo?){ this._contraiInfo = contraiInfo setAutopilotControlParameters() + OchChainLogManager.writeChainLogAutopilot("自驾参数", "轨迹信息:${contraiInfo}") } @JvmStatic @@ -159,6 +160,7 @@ object LineManager : CallerBase() { CallerEagleBaseFunctionCall4OchManager.updateOrderLine(sb.toString()) } } + OchChainLogManager.writeChainLogAutopilot("自驾参数", "线路信息:${contraiInfo}") } fun getStations(): Pair { diff --git a/OCH/common/data/src/main/java/com/mogo/och/data/bean/ContraiInfo.kt b/OCH/common/data/src/main/java/com/mogo/och/data/bean/ContraiInfo.kt index e876374a68..5ae6b1ca1c 100644 --- a/OCH/common/data/src/main/java/com/mogo/och/data/bean/ContraiInfo.kt +++ b/OCH/common/data/src/main/java/com/mogo/och/data/bean/ContraiInfo.kt @@ -33,4 +33,5 @@ data class ContraiInfo( var passPoints: MutableList?=null, // 用于算路的经停点 var blackPoints: MutableList?=null, // 用于算路的黑名單點 + val source:Int = 1, //轨迹来源:1 录制;2 自主计算 ) diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/LineModel.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/LineModel.kt index ad1efeea92..848cd531f3 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/LineModel.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/LineModel.kt @@ -249,10 +249,6 @@ object LineModel { } } - // 到站 - fun arrivedStation() { - - } fun arrivedStationSuccess(){ mBusLinesCallbackMap.forEach {callback-> callback.value.onArriveStationSuccess() diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/OrderModel.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/OrderModel.kt index 91d02508ef..429d4d6b2e 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/OrderModel.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/OrderModel.kt @@ -267,11 +267,15 @@ object OrderModel { * 渲染站点信息 * 服务端返回的OchBusRoutesResult逻辑, 离开站为当前站, 到达下一站后才会将下一站置为当前站, * 车机端展示 三站: 中间为即将到到达或者刚到达的站 + * queryBusRoutes + * queryBusRoutes + * queryBusRoutes + * driveToNextStation + * onArriveAt */ private fun updateBusStatus() { val (startStation, endStation) = LineManager.getStations() if(startStation!=null&&endStation!=null){ - MapMakerManager.removeAllMapMarkerByOwner(TAG) if(startStation.isLeaving){// 出发需要移除 MapMakerManager.removeMapMaker(BusConst.BUS_START_MAP_MAKER,startStation.lat,startStation.lon) }else{// 为出发展示 @@ -378,19 +382,6 @@ object OrderModel { //MAP 280 每隔100ms左右返回一次到站, 导致在到达中间站后再次滑动出发后会有时间差,收到一次到站,出现问题 //此处比对 自驾告诉的到站站点坐标和本地应到站站点坐标, 一致时才能到站 LineManager.getStations { start, end -> - if (data != null && data.endLocation != null) { - val latitude = NumberFormatUtil.cutOutNumber(data.endLocation.latitude, 5) //wgs - val longitude = NumberFormatUtil.cutOutNumber(data.endLocation.longitude, 5) - - val arriveLat = NumberFormatUtil.cutOutNumber(end.lat, 5) - val arriveLon = NumberFormatUtil.cutOutNumber(end.lon, 5) - - if (latitude != arriveLat || longitude != arriveLon) { - e(M_BUS + TAG, "行程日志-到站拦截,到站坐标不一致") - OchChainLogManager.writeChainLog("shuttle弱网","$type 行程日志-到站拦截,到站坐标不一致") - return@getStations - } - } if (isArrivedStation) return@getStations diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwitchTaskView.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwitchTaskView.kt index f8a05a838d..b4e01f4b66 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwitchTaskView.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwitchTaskView.kt @@ -154,6 +154,10 @@ class SwitchTaskView: WindowRelativeLayout, SwtichTaskModel.SwtichLineViewCallba viewbizModel?.showSwitchTaskInfo() } + override fun resetRecycleView() { + mAdapter.setDataList(mutableListOf()) + } + private fun showEmptyView(){ actv_submit_task.setTextColor(ResourcesUtils.getColor(R.color.bus_color_66666)) actv_submit_task.isEnabled = false diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwtichTaskModel.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwtichTaskModel.kt index ed4c3005ef..287799a79d 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwtichTaskModel.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwtichTaskModel.kt @@ -77,6 +77,7 @@ class SwtichTaskModel : ViewModel(), IBusLinesCallback { fun hideLoading() fun startTaskSuccess() fun showErrorInfo() + fun resetRecycleView() } fun onBusLineTasks(o: MutableList?) { @@ -96,6 +97,7 @@ class SwtichTaskModel : ViewModel(), IBusLinesCallback { BizLoopManager.runInMainThread{ viewCallback?.hideLoading() viewCallback?.startTaskSuccess() + viewCallback?.resetRecycleView() } } // 选择线路失败 diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/util/BusTrajectoryManager.java b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/util/BusTrajectoryManager.java index 8c0515d42b..c0ebf6c186 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/util/BusTrajectoryManager.java +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/util/BusTrajectoryManager.java @@ -53,6 +53,7 @@ public class BusTrajectoryManager { * 同步Bus路线信息 */ public void syncTrajectoryInfo() { + OchChainLogManager.writeChainLog("轨迹监控","开始或者结束下发轨迹 轨迹id"+mAutoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY); if (LoginStatusManager.isLogin() && LineModel.INSTANCE.getCurrentTask() != null && LineModel.getStartStationIndex() == 0 && !OrderModel.isGoingToNextStation()) { @@ -159,6 +160,7 @@ public class BusTrajectoryManager { } private void startTrajReqLoop() { + OchChainLogManager.writeChainLog("轨迹监控","开始下发轨迹 轨迹id"+mAutoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY); if (mSendReqDisposable != null && !mSendReqDisposable.isDisposed()) { return; } @@ -180,6 +182,7 @@ public class BusTrajectoryManager { } public void stopTrajReqLoop() { + OchChainLogManager.writeChainLog("轨迹监控","结束下发轨迹 轨迹id"+mAutoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY); if (mSendReqDisposable != null) { CallerLogger.d(M_BUS + TAG, "stopTrajReqLoop()"); mSendReqDisposable.dispose(); diff --git a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_line.xml b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_line.xml index 80180f639b..2aa5f7ad18 100644 --- a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_line.xml +++ b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_line.xml @@ -47,16 +47,16 @@ app:layout_constraintTop_toBottomOf="@+id/actv_last_refresh_date" app:layout_constraintBottom_toBottomOf="parent" android:layout_marginTop="@dimen/dp_22" /> - - + app:layout_constraintTop_toTopOf="parent" + android:layout_width="wrap_content" + android:layout_height="wrap_content"/> \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_task.xml b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_task.xml index 6724fa0837..328b10aae9 100644 --- a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_task.xml +++ b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_task.xml @@ -101,16 +101,16 @@ app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" /> - + app:layout_constraintTop_toTopOf="parent" + android:layout_width="wrap_content" + android:layout_height="wrap_content"/> ?) : BaseData() { var txtFileUrlDPQP: String, var txtFileMd5DPQP: String, var contrailSaveTimeDPQP: Long - ) + ){ + fun toCommonContraiInfo(): ContraiInfo { + val result = ContraiInfo(lineId,csvFileUrl,csvFileMd5,txtFileUrl,txtFileMd5,contrailSaveTime,source = source) + return result + } + } } diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/callback/ITaxiADASStatusCallback.java b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/callback/ITaxiADASStatusCallback.java index ce946a51d0..16da2773ee 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/callback/ITaxiADASStatusCallback.java +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/callback/ITaxiADASStatusCallback.java @@ -6,23 +6,5 @@ package com.mogo.och.unmanned.taxi.callback; * Model->Presenter回调:ADAS相关(自动驾驶状态回调,到达终点等等) */ public interface ITaxiADASStatusCallback { - // 自动驾驶触发的已到达目的地:暂未用到 - void onAutopilotArriveEnd(); - // 自动驾驶可用状态 - void onAutopilotEnable(boolean canStartAuto); - - // 自动驾驶不可用状态 - void onAutopilotDisable(boolean canStartAuto); - - // 自动驾驶运行中 - void onAutopilotRunning(boolean canStartAuto); - - //人机共驾 - void onParallelDrivingStatus(boolean canStartAuto); - - //自驾返回失败 - void onStartAdasFailure(); - - void updateAutopilotStatus(boolean canStartAuto); } diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/callback/ITaxiControllerStatusCallback.java b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/callback/ITaxiControllerStatusCallback.java index e6a180ba28..600fa04bc8 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/callback/ITaxiControllerStatusCallback.java +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/callback/ITaxiControllerStatusCallback.java @@ -9,9 +9,6 @@ import com.mogo.eagle.core.data.map.MogoLocation; */ public interface ITaxiControllerStatusCallback { - //开始开启自动驾驶 - void startOpenAutopilot(); - //自动开启自动驾驶 void startOpenAutopilotNonManual(); diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/base/TaxiFragment.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/base/TaxiFragment.kt index 833f324793..fb1af09e0c 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/base/TaxiFragment.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/base/TaxiFragment.kt @@ -39,6 +39,7 @@ import com.mogo.och.unmanned.taxi.ui.navi.auto.TaxiRoutingNaviFragment import com.mogo.och.unmanned.taxi.ui.operational.TaxiOperationalDialogFragment import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskTabFragment +import com.mogo.och.unmanned.taxi.ui.task.itinerarycurrent.ItineraryCurrentView import com.mogo.och.unmanned.taxi.utils.TPRouteDataTestUtils import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.unmannedMapCL import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.module_mogo_och_navi_panel_container @@ -86,11 +87,6 @@ class TaxiFragment :MvpFragment(), @SuppressLint("UseCompatLoadingForDrawables") override fun initViews() { - onAutopilotStatusChanged( - getState(), - CallerAutoPilotControlManager.isCanStartAutopilot(false) - ) - CallerHmiViewControlListenerManager.invokeMainPageViewVisible(View.VISIBLE) taxi_close_navi_icon.setOnClickListener { @@ -200,92 +196,8 @@ class TaxiFragment :MvpFragment(), super.onDestroyView() } - /** - * 改变自动驾驶状态 - * - * @param status 2 - running 1 - enable 2 - disable - */ - fun onAutopilotStatusChanged(status: Int, canStartAuto: Boolean) { - activity?.runOnUiThread(Runnable runOnUiThread@{ - if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != status) { - // 1. 主动开启自动驾驶中,不为2(为0、1)则继续loading - return@runOnUiThread - } - if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status - ) { - // 2. 主动开启自动驾驶中,为2则停止loading,并isStarting = false - startAutopilotDone(true) - return@runOnUiThread - } - // 3. 其他过程直接更新 - startOrStopLoadingAnim(false) - }) - } - - /** - * 停止【开启自动驾驶按钮】动画,并更新按钮状态 - */ - fun stopAnimAndUpdateBtnStatus() { - startOrStopLoadingAnim(false) - startAutopilotDone(false) - } - - var isStarting = false - @SuppressLint("ObjectAnimatorBinding") - fun startOrStopLoadingAnim(start: Boolean) { - if (start) { - isStarting = true - startingAutopilotCountDown() - } else { - isStarting = false - } - } - - private fun startAutopilotDone(success: Boolean) { - UiThreadHandler.postDelayed({ - startOrStopLoadingAnim(false) - onAutopilotStatusChanged( - getState(), - CallerAutoPilotControlManager.isCanStartAutopilot(false) - ) - }, 1000L) - } - - private fun startingAutopilotCountDown() { - UiThreadHandler.postDelayed({ - //未启动成功10s后做处理 - if (isStarting) { //判断动画是否在进行 - //并且根据状态来设置自动驾驶启动成功还是失败 - if (getState() - == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING - ) { - startAutopilotDone(true) - } else { - startAutopilotDone(false) - } - } - }, TaxiUnmannedConst.TIMER_START_AUTOPILOT_INTERVAL) - } - - - /** - * 重新开启自动驾驶 - */ - - fun startAutopilot() { - // 在自动驾驶中,或者自己确认车辆环境可开启自动驾驶 则可点击 - if (!isStarting) { - d(SceneConstant.M_TAXI + TAG, "startAutopilot") - mPresenter?.startAutoPilot() - } - } - - fun changeOperationViewVisible(visible: Int) { - - } - override fun onMapVisualAngleChanged(visualAngleMode: VisualAngleMode?) { } @@ -401,9 +313,6 @@ class TaxiFragment :MvpFragment(), fun setGuidHide() { } - fun updateAutopilotStatus(status: Int, canStartAuto: Boolean) { - onAutopilotStatusChanged(status, canStartAuto) - } /** * 状态变更 * @param inOperation true 可以接单 false 暂停接单 @@ -423,9 +332,8 @@ class TaxiFragment :MvpFragment(), if (MogoStatusManager.getInstance().isTaxiUnmanedDriverLineRoutingVerifyMode) { showAmapNaviToStationFragment(isShow) } else { - // TODO: 需要复原 -// if (null == taskTabFragment || taskTabFragment!!.get() == null) return -// taskTabFragment!!.get()!!.onNaviToEndStationByAMap(isShow) + val currentItinerary = findViewById(R.id.currentItinerary) + currentItinerary?.onNaviToEndStationByAMap(isShow) } } else if (isShow) { //使用routing数据 showRoutingToStationFragment(true) diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/base/TaxiPresenter.java b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/base/TaxiPresenter.java index 9ca319f52b..e2ff3cb07f 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/base/TaxiPresenter.java +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/base/TaxiPresenter.java @@ -79,7 +79,7 @@ public class TaxiPresenter extends Presenter implements ITaxiADASS TaxiTaskModel.INSTANCE.startAutopilotByClick(); } - private OchTransformDispatch ochTransform = new OchTransformDispatch(){ + private final OchTransformDispatch ochTransform = new OchTransformDispatch(){ @Override public void logout() { TaxiTaskModel.INSTANCE.logout(); @@ -92,82 +92,6 @@ public class TaxiPresenter extends Presenter implements ITaxiADASS } - @Override - public void onAutopilotArriveEnd() { - } - - @Override - public void onAutopilotEnable(boolean canStartAuto) { - UiThreadHandler.post(new Runnable() { - @Override - public void run() { - if(mView!=null) { - mView.updateAutopilotStatus( - IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE,canStartAuto); - } - } - }, UiThreadHandler.MODE.QUEUE); - - } - - @Override - public void onAutopilotDisable(boolean canStartAuto) { - UiThreadHandler.post(new Runnable() { - @Override - public void run() { - if(mView!=null) { - mView.updateAutopilotStatus( - IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE,canStartAuto); - } - } - }, UiThreadHandler.MODE.QUEUE); - - } - - @Override - public void onAutopilotRunning(boolean canStartAuto) { - UiThreadHandler.post(new Runnable() { - @Override - public void run() { - if(mView!=null) { - mView.updateAutopilotStatus( - IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING,canStartAuto); - } - } - }, UiThreadHandler.MODE.QUEUE); - - } - - @Override - public void onParallelDrivingStatus(boolean canStartAuto) { - UiThreadHandler.post(new Runnable() { - @Override - public void run() { - - } - }, UiThreadHandler.MODE.QUEUE); - - } - - @Override - public void onStartAdasFailure() { - UiThreadHandler.post(new Runnable() { - @Override - public void run() { - if(mView!=null) { - mView.stopAnimAndUpdateBtnStatus(); - } - } - }, UiThreadHandler.MODE.QUEUE); - - } - - @Override - public void updateAutopilotStatus(boolean canStartAuto) { - if(mView!=null) { - mView.updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState(), canStartAuto); - } - } @Override public void onNaviToEnd(boolean isAmap, boolean isShow) { @@ -182,18 +106,6 @@ public class TaxiPresenter extends Presenter implements ITaxiADASS } - @Override - public void startOpenAutopilot() { - UiThreadHandler.post(new Runnable() { - @Override - public void run() { - if(mView!=null) { - mView.startOrStopLoadingAnim(true); - } - } - }, UiThreadHandler.MODE.QUEUE); - - } @Override public void startOpenAutopilotNonManual() { @@ -201,7 +113,6 @@ public class TaxiPresenter extends Presenter implements ITaxiADASS @Override public void run() { if(mView!=null) { - mView.startOrStopLoadingAnim(true); mView.showStartAutopilotBlinkAnimation(); } } @@ -215,8 +126,6 @@ public class TaxiPresenter extends Presenter implements ITaxiADASS @Override public void run() { if(mView!=null) { - mView.startOrStopLoadingAnim(false); - mView.updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState(),canStartAuto); mView.stopAutopilotBlinkAnimation(); } } @@ -230,8 +139,6 @@ public class TaxiPresenter extends Presenter implements ITaxiADASS @Override public void run() { if(mView!=null) { - mView.startOrStopLoadingAnim(false); - mView.updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState(),canStartAuto); mView.pauseAutopilotBlinkAnimation(); } } @@ -245,7 +152,6 @@ public class TaxiPresenter extends Presenter implements ITaxiADASS @Override public void run() { if(mView!=null) { - mView.startOrStopLoadingAnim(true); mView.resumeAutopilotBlinkAnimation(); } } diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiTaskModel.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiTaskModel.kt index 83f27f04c6..fc0bc0cee0 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiTaskModel.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiTaskModel.kt @@ -45,6 +45,7 @@ import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatu import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutopilotAnalytics +import com.mogo.och.common.module.manager.autopilot.line.ILineCallback import com.mogo.och.common.module.manager.autopilot.line.LineManager import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager import com.mogo.och.common.module.manager.distance.IDistanceListener @@ -214,6 +215,7 @@ object TaxiTaskModel { OchAutoPilotStatusListenerManager.addListener(TAG, mMogoAutopilotStatusListener) //定位监听, 传false是高德坐标系 10 -> 100ms一次 OchLocationManager.addGCJ02Listener(TAG, 5, mMapLocationListener) + LineManager.addListener(TAG,iLineCallback) //2021.11.1 自动驾驶路线规划接口 CallerPlanningRottingListenerManager.addListener(TAG, mMogoAutopilotPlanningListener) //开启自驾后 异常信息返回 @@ -235,6 +237,7 @@ object TaxiTaskModel { // 注销地图监听 OchLocationManager.removeGCJ02Listener(TAG) + LineManager.removeListener(TAG) OCHSocketMessageManager.releaseSocketMessageListener(OCHSocketMessageManager.msgMonitorType) OchAutoPilotStatusListenerManager.removeListener(mMogoAutopilotStatusListener) CallerPlanningRottingListenerManager.removeListener(mMogoAutopilotPlanningListener) @@ -276,14 +279,6 @@ object TaxiTaskModel { private val mMogoAutopilotStatusListener: IOchAutopilotStatusListener = object : IOchAutopilotStatusListener { override fun onAutopilotIpcConnectStatusChanged(status: AdasConstants.IpcConnectionStatus, reason: String?) { -// DebugView.printInfoMsg( -// "[域控连接状态变化] status=$status, reason=${ -// if (TextUtils.isEmpty( -// reason -// ) -// ) "" else reason -// }" -// ) } override fun onAutopilotGuardian(guardianInfo: MogoReportMessage?, lineId: Long) { @@ -311,7 +306,6 @@ object TaxiTaskModel { i(TAG, "onAutopilotStatusResponse autopilotsState= $state") if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) { DebugView.printInfoMsg("[自驾状态变化] afterValue=STATUS_AUTOPILOT_RUNNING,meaning=自动驾驶中") - mADASStatusCallback?.onAutopilotRunning(CallerAutoPilotControlManager.isCanStartAutopilot(false)) if ((QueryCurrentTaskRespBean.isTaskStartTaskType(mCurrentTaskWithOrder))) { OchAutopilotAnalytics.triggerStartAutopilotEvent( isRestartAutopilot, @@ -334,7 +328,6 @@ object TaxiTaskModel { // 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态 return } - mADASStatusCallback?.onAutopilotEnable(CallerAutoPilotControlManager.isCanStartAutopilot(false)) } else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) { DebugView.printInfoMsg("[自驾状态变化] afterValue=STATUS_AUTOPILOT_DISABLE,meaning=不可自动驾驶") if ((FunctionBuildConfig.isDemoMode @@ -345,7 +338,6 @@ object TaxiTaskModel { // 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态 return } - mADASStatusCallback?.onAutopilotDisable(CallerAutoPilotControlManager.isCanStartAutopilot(false)) } else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) { DebugView.printInfoMsg("[自驾状态变化] afterValue=STATUS_PARALLEL_DRIVING,meaning=平行驾驶中") if (FunctionBuildConfig.isDemoMode) { @@ -357,11 +349,9 @@ object TaxiTaskModel { ) { //订单中 // 当美化模式(演示模式)开启时:且有订单、且为去往目的地状态,维持自动驾驶icon开启状态 } else { //美化模式下没订单,显示人工驾驶 - mADASStatusCallback?.onAutopilotDisable(CallerAutoPilotControlManager.isCanStartAutopilot(false)) } return } - mADASStatusCallback?.onParallelDrivingStatus(CallerAutoPilotControlManager.isCanStartAutopilot(false)) } } @@ -395,10 +385,10 @@ object TaxiTaskModel { ).toDouble() if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE){// 两坐标小于15米 DebugView.printInfoMsg("[MAP到站通知] 到站坐标和任务终点15米内, 请求到站") - autopilotArriveAtStation() }else{ DebugView.printInfoMsg("[MAP到站通知] 到站坐标和任务终点不一致, 不请求到站") } + autopilotArriveAtStation() }else{ DebugView.printInfoMsg("[MAP到站通知] endSiteLat = $endSiteLat, endSiteLon = $endSiteLon, " + "mapEndSiteLat = $mapEndSiteLatWgs, mapEndSiteLon = $mapEndSiteLonWgs") @@ -415,11 +405,17 @@ object TaxiTaskModel { } } - override fun canStartAutopilot(canStart: Boolean) { - super.canStartAutopilot(canStart) - mADASStatusCallback?.updateAutopilotStatus(CallerAutoPilotControlManager.isCanStartAutopilot(false)) + } + private val iLineCallback: ILineCallback = + object : ILineCallback { + override fun arrivedStationSuccessBySearch() { + super.arrivedStationSuccessBySearch() + if (checkCurrentTaskCondition() + && QueryCurrentTaskRespBean.isTaskStartTaskType(mCurrentTaskWithOrder) + ) { + judgeTaskEndSiteStation() + } } - } // 自车定位 @@ -428,18 +424,12 @@ object TaxiTaskModel { override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) { //位置变化时,通过围栏判断是否到达x点 if (null == mogoLocation) return - - OCHThreadPoolManager.getsInstance().locationExecute { - if (mDriveToNearestStationTask != null) { - judgeDriveToNearestStationTaskStation(mDriveToNearestStationTask, mogoLocation) + if (mDriveToNearestStationTask != null) { + OCHThreadPoolManager.getsInstance().locationExecute { + if (mDriveToNearestStationTask != null) { + judgeDriveToNearestStationTaskStation(mDriveToNearestStationTask, mogoLocation) + } } - - if (checkCurrentTaskCondition() - && QueryCurrentTaskRespBean.isTaskStartTaskType(mCurrentTaskWithOrder) - ) { - judgeTaskEndSiteStation(mogoLocation) - } - } } } @@ -487,7 +477,6 @@ object TaxiTaskModel { TAG, "onStartAutopilotFailure: startFailedMessage=$startFailedMessage" ) - mADASStatusCallback?.onStartAdasFailure() } } } @@ -778,6 +767,7 @@ object TaxiTaskModel { } clearCurrentOCHOrder() clearLocalCalculateStation() + LineManager.setStartAndEndStation(null,null) return } @@ -789,13 +779,16 @@ object TaxiTaskModel { listener.onTaskStarted(result) } } + if (result.startSite!=null && result.endSite!=null) { + LineManager.setStartAndEndStation(result.startSite!!.toCommonStation(),result.endSite!!.toCommonStation()) + } + //当前任务完成且订单状态到达乘客上车点, 则立马去拉取任务 不再等120s,否则送驾任务要等120s后才能去执行(8.29废) //8.29更新: 当前任务完成且订单状态为乘客已上车, 则立马去拉取任务 不再等120s,否则送驾任务要等120s后才能去执行 // 主要是解决A-B演练任务同时接到A-B订单状态流转的问题 //注意: 需要去除到达乘客上车点的节点, 这个节点不拉取任务 if (QueryCurrentTaskRespBean.isTaskCompleteTaskType(result)) { - mADASStatusCallback?.updateAutopilotStatus(CallerAutoPilotControlManager.isCanStartAutopilot(false)) mTaxiTaskWithOrderCallbackMap.forEach { val listener = it.value listener.onTaskCompleted(result) @@ -1095,6 +1088,7 @@ object TaxiTaskModel { mCurrentTaskTrajectory = it.first { currentTaskLineId == it.lineId } mCurrentTaskTrajectory?.let {traj-> LineManager.setLineInfo(LineInfo(traj.lineId,traj.lineName)) + LineManager.setContraiInfo(traj.toCommonContraiInfo()) } } mTaxiTaskWithOrderCallbackMap.forEach { @@ -1221,15 +1215,6 @@ object TaxiTaskModel { fun startAutoPilot() { - /** - * 存在Session - */ - if (!OchAutoPilotManager.canStartAutopilotBySessionId()) { - return - } - - OchAutopilotAnalytics.triggerClickStartAutopilotTime(System.currentTimeMillis()) - DebugView.printInfoMsg("[启自驾] startAutoPilot") if (!checkCurrentTaskCondition()) { e(TAG, "no order or order is empty.") @@ -1264,81 +1249,7 @@ object TaxiTaskModel { TAG, "isPassStartAutopilotCommand = " + FunctionBuildConfig.isPassStartAutopilotCommand ) - //2、6个条件判断 - if (!CallerAutoPilotControlManager.isCanStartAutopilot(true)) { - return - } - // 3、距离轨迹15m计算 - mCurrentTaskWithOrder?.let { - var resion = OchAutoPilotManager.canStartAutoPilotByDistance(it.lineId) - if (TrajectoryAndDistanceManager.errorTypeNoneLineId == resion) { - val curTaskAndOrder = getCurrentTaskWithOrder() - if (curTaskAndOrder!=null) { - if (curTaskAndOrder.startSite != null && curTaskAndOrder.endSite != null) { - val startStation = MogoLocation() - startStation.longitude = curTaskAndOrder.startSite!!.gcjLon - startStation.latitude = curTaskAndOrder.startSite!!.gcjLat - val endStation = MogoLocation() - endStation.longitude = curTaskAndOrder.endSite!!.gcjLon - endStation.latitude = curTaskAndOrder.endSite!!.gcjLat - TrajectoryAndDistanceManager.setStationPoint( - startStation, - endStation, - curTaskAndOrder.lineId - ) - } - } - resion = OchAutoPilotManager.canStartAutoPilotByDistance(it.lineId) - } - if(!StringUtils.isEmpty(resion)){ - ToastUtils.showShort(resion) - VoiceNotice.showNotice(resion) - return - } - } - // 4、ssm 给出数据 - if (!OchAutoPilotManager.canStartAutoPilotSSM()) { - DebugView.printErrorMsg("[启自驾] ${OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason}") - val orderNo = mCurrentTaskWithOrder?.order?.orderNo - OchAutopilotAnalytics.triggerUnableStartAPReasonEvent( - mCurrentTaskWithOrder!!.startSite!!.siteName, - mCurrentTaskWithOrder!!.endSite!!.siteName, - mCurrentTaskWithOrder!!.lineId.toString(), // todo 这里原来传的是订单号, 现在是任务没有订单号,传了路线id - orderNo?:"", - OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason - ) - return - } - - //点击开始自动驾驶按钮订单状态去流转, 不再与自动驾驶是否启动成功挂钩 - isRestartAutopilot = mCurrentTaskWithOrder!!.currentStatus != TaskStatusEnum.StartTask.code - - val parameters = initAutopilotControlParameters() - if (null == parameters) { - e(TAG, "AutopilotControlParameters is empty.") - return - } - - val sessionId = OchAutoPilotManager.startAutoPilot(parameters) - DebugView.printInfoMsg("[启自驾] 调用成功") - d( - TAG, "start autopilot with parameter: %s", - GsonUtil.jsonFromObject(parameters) - + " ,startSiteName=" + mCurrentTaskWithOrder?.startSite?.siteName - + " ,endSiteName=" + mCurrentTaskWithOrder?.endSite?.siteName - + "isRestartAutopilot = " + isRestartAutopilot - ) - OchAutopilotAnalytics.triggerStartAutopilotEvent( - isRestartAutopilot, - false, - mCurrentTaskWithOrder!!.startSite!!.siteName, - mCurrentTaskWithOrder!!.endSite!!.siteName, - mCurrentTaskWithOrder!!.lineId.toInt(), - if (mCurrentTaskWithOrder!!.order != null) mCurrentTaskWithOrder!!.order!!.orderNo else "", - System.currentTimeMillis(),0 - ) - OchAutopilotAnalytics.triggerUpdateStartAutoPilotSessionId(sessionId) - mControllerStatusCallback?.startOpenAutopilot() + LineManager.startAutopilot() } fun initAutopilotControlParameters(): AutopilotControlParameters? { @@ -1395,65 +1306,20 @@ object TaxiTaskModel { } } - private fun judgeTaskEndSiteStation(currentLocation: MogoLocation) { + private fun judgeTaskEndSiteStation() { if (!checkCurrentTaskCondition() || !QueryCurrentTaskRespBean.isTaskStartTaskType(mCurrentTaskWithOrder)) { return } val endSite = mCurrentTaskWithOrder!!.endSite ?: return - val endLon = endSite.gcjLon - val endLat = endSite.gcjLat - val distance = CoordinateUtils.calculateLineDistance( - endLon, endLat, - currentLocation.longitude, currentLocation.latitude - ).toDouble() - i(TAG, "judgeEndStation() distance = $distance") - if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) { //1、当前位置和站点围栏15m内 - - //2、开始计算当前位置和站点的向量角度 < 90度 未经过 >90度 经过 - val stationAngle = DrivingDirectionUtils.getDegreeOfCar2Poi( - currentLocation.longitude, - currentLocation.latitude, - endLon, - endLat, currentLocation.heading.toInt() - ).toDouble() - i( - TAG, - "judgeEndStation() stationAngle = $stationAngle" - ) - - if (!checkCurrentTaskCondition() - || !QueryCurrentTaskRespBean.isTaskStartTaskType(mCurrentTaskWithOrder) - ) { - i(TAG, "task null or TaskStatus = ${getCurTaskStatus()}") - return - } - //3、刚过站且过站距离在15m内, 提交到站 - if (stationAngle > 90) { - i(TAG, "judgeEndStation() = 刚过站且在15m内") - DebugView.printInfoMsg( - "[自车定位围栏] 触发围栏,任务类型:${ - TaskTypeEnum.valueOf( - mCurrentTaskWithOrder?.taskType ?: 0 - )?.name - },围栏范围:${TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE}米 刚过站且在15m内" - ) - submitArriveSite(endSite.siteId, true) - } else { - // 4、 没有过站距离小于15m 速度小于0.3(根据M1来的模数 可能要调) - if (currentLocation.gnssSpeed < 0.3) { - i(TAG, "judgeEndStation() = 没有过站、速度基本为零且在15m内") - DebugView.printInfoMsg( - "[自车定位围栏] 触发围栏,任务类型:${ - TaskTypeEnum.valueOf( - mCurrentTaskWithOrder?.taskType ?: 0 - )?.name - },围栏范围:${TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE}米 没有过站、速度基本为零且在15m内" - ) - submitArriveSite(endSite.siteId, true) - } - } + if (!checkCurrentTaskCondition() + || !QueryCurrentTaskRespBean.isTaskStartTaskType(mCurrentTaskWithOrder) + ) { + i(TAG, "task null or TaskStatus = ${getCurTaskStatus()}") + return } + + submitArriveSite(endSite.siteId, true) } /** diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentView.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentView.kt index c0e72f1d27..c86f05350e 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentView.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentView.kt @@ -58,6 +58,7 @@ import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.aciv_task_ import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.aciv_task_type_order import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_distance_end import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_end_order +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_order_phone import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_submit_task import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.cancelOrder import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.commonSlideViewStartServer @@ -145,12 +146,13 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi updateNextTaskFragment(currentTaskWithOrder) } + // 全程距离和时间 is TaskWithOrderUIState.UpdateOrderTripInfo -> { dialog?.setOrderMileage(taskAndOrderUiState.mileage*1000) actv_distance_end.text = TaskUtils.getCurrentTaskDistance(taskAndOrderUiState.mileage.toLong()) actv_time_end.text = TaskUtils.getCurrentTaskTime(taskAndOrderUiState.duration.toLong()) } - + // 根据轨迹计算剩余距离和时间 is TaskWithOrderUIState.UpdateTaskTripLocalCalculateInfo -> { actv_distance_end.text = TaskUtils.getCurrentTaskDistance(taskAndOrderUiState.meters.toLong()) actv_time_end.text = TaskUtils.getCurrentTaskTime(taskAndOrderUiState.timeInSecond.toLong()) @@ -299,6 +301,11 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi group_itinerary_info.visibility = GONE include_empty.visibility = VISIBLE prepareTaskCountdownTv.visibility = GONE + + actv_end_order.visibility = GONE + commonSlideViewStartServer.visibility = GONE + actv_submit_task.visibility = GONE + } private fun initOnClickListener() { @@ -410,7 +417,7 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi naviToStart.id, naviToEnd.id -> { - showNaviToEndStationFragment(true) + showNaviToEndStationFragment() } } } @@ -420,10 +427,9 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi * * @param isShow */ - private fun showNaviToEndStationFragment(isShow: Boolean) { + private fun showNaviToEndStationFragment() { fragment?.let { - FlowBus.with(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_START_NAVI_TO_END_STATION) - .post(it.lifecycleScope, isShow) + TaxiTaskModel.startNaviToEndStation(true); } } @@ -455,6 +461,12 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi aciv_task_type_exercise.visibility = View.GONE // 轨迹标识 trajectoryType.visibility = View.GONE + + + actv_end_order.visibility = GONE + commonSlideViewStartServer.visibility = GONE + actv_submit_task.visibility = GONE + } } @@ -505,6 +517,21 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi order.bookingUserPhone, order.passengerSize ) + + var tempPhone = order.bookingUserPhone + tempPhone.let { + if (it.length > 8) { + //截取电话号码前三位 + val phoneNumPre = it.substring(0, 3) + //截取电话号码后四位 + val phoneNumFix = it.substring(7) + tempPhone = "$phoneNumPre****$phoneNumFix" + } + } + actv_order_phone.text = tempPhone + orderPhoneAndNum.text = "${ order.passengerSize}人" + + startStationName.text = order.orderStartSite?.siteName endStationName.text = order.orderEndSite?.siteName TaxiTaskModel.getCurrentOrderTrajectoryList().also { @@ -518,6 +545,9 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi dismissDialog() initContainerView(false) removeAllMapMarker() + actv_end_order.visibility = GONE + commonSlideViewStartServer.visibility = GONE + actv_submit_task.visibility = GONE } TaxiOrderStatusEnum.ArriveAtEnd.code -> { //到达目的地 @@ -549,15 +579,14 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi taskStatus.text = resources.getString(R.string.arrived_start_site) actv_end_order.visibility = GONE - commonSlideViewStartServer.visibility = GONE - actv_submit_task.visibility = VISIBLE + if (order.orderStatus == TaxiOrderStatusEnum.UserArriveAtStart.code) { - actv_submit_task.text = - ResourcesUtils.getString(R.string.module_och_taxi_order_server_start) + commonSlideViewStartServer.visibility = VISIBLE + actv_submit_task.visibility = GONE } else { - actv_submit_task.text = - ResourcesUtils.getString(R.string.module_och_taxi_order_server_start_wait_check) + commonSlideViewStartServer.visibility = GONE + actv_submit_task.visibility = VISIBLE } hideNaviBtns() actv_time_end.text = TaskUtils.getCurrentTaskWaitTimeHtml() @@ -567,7 +596,12 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi dismissDialog() taskStatus.text = resources.getString(R.string.task_start_start_site) actv_end_order.visibility = GONE - commonSlideViewStartServer.visibility = VISIBLE + commonSlideViewStartServer.visibility = GONE + actv_submit_task.visibility = GONE + } + else ->{ + actv_end_order.visibility = GONE + commonSlideViewStartServer.visibility = GONE actv_submit_task.visibility = GONE } } @@ -597,6 +631,10 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi // 演练单标识 aciv_task_type_exercise.visibility = View.VISIBLE + actv_end_order.visibility = GONE + commonSlideViewStartServer.visibility = GONE + actv_submit_task.visibility = GONE + naviToStart.visibility = View.GONE naviToEnd.visibility = if (currentStatus >= TaskStatusEnum.StartTask.code) View.VISIBLE else View.GONE @@ -719,9 +757,11 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi } else if (currentTaskWithOrder.currentStatus == TaskStatusEnum.CompleteTask.code && currentTaskWithOrder.taskType <= TaskTypeEnum.ToOrderStartTask.code ) { - actv_distance_end.text = "已到达 ${currentTaskWithOrder.endSite?.siteName}" + actv_distance_end.text = "" + actv_time_end.text = "" } else { - actv_distance_end.text = "距离 -- 公里, 用时 -- 分钟" + actv_distance_end.text = "-- 公里" + actv_time_end.text = "-- 分钟" } } @@ -815,4 +855,23 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi }, 3000) } + fun onNaviToEndStationByAMap(isShow: Boolean) { + val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() ?: return + fragment?.let { + if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code) + isShow else true + FlowBus.with(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_AMAP_NAVI_TO_STATION_FRAGMENT) + .post(it.lifecycleScope, + if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code) + isShow + else + true + ) + updateRemainDistanceAndTime( + if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code) + isShow else true + ) + } + } + } diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/utils/TaxiTrajectoryManager.java b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/utils/TaxiTrajectoryManager.java index a6765abf80..5a2d1706fb 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/utils/TaxiTrajectoryManager.java +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/utils/TaxiTrajectoryManager.java @@ -70,6 +70,7 @@ public class TaxiTrajectoryManager { * 同步订单信息 */ public void syncTrajectoryInfo() { + OchChainLogManager.writeChainLog("轨迹监控","开始或者结束下发轨迹 轨迹id"+mAutoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY); QueryCurrentTaskRespBean.Result taskAndOrder = TaxiTaskModel.INSTANCE.getCurrentTaskWithOrder(); if (taskAndOrder == null || taskAndOrder.getCurrentStatus() >= TaskStatusEnum.StartTask.getCode()) { CallerLogger.d(M_TAXI + TAG, "syncTrajectoryInfo() stop."); @@ -251,6 +252,7 @@ public class TaxiTrajectoryManager { } private void startTrajReqLoop() { + OchChainLogManager.writeChainLog("轨迹监控","开始下发轨迹 轨迹id"+mAutoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY); if (mSendReqDisposable != null && !mSendReqDisposable.isDisposed()) { return; } @@ -274,6 +276,7 @@ public class TaxiTrajectoryManager { } private void stopTrajReqLoop() { + OchChainLogManager.writeChainLog("轨迹监控","结束下发轨迹 轨迹id"+mAutoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY); DebugView.Companion.printInfoMsg("[下发轨迹] stopTrajectoryReqLoop"); if (mSendReqDisposable != null) { CallerLogger.d(M_TAXI + TAG, "stopTrajReqLoop()"); diff --git a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_current.xml b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_current.xml index c473742cc3..9728f1bef6 100644 --- a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_current.xml +++ b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_current.xml @@ -298,14 +298,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content"/> - - - { + //全融合模式 + FunctionBuildConfig.fusionMode = 1 + prevCheckedKeyForFusionMode?.takeIf { it != KEY_ALL_MERGE_MODE }?.let { + preferenceScreen.findPreferenceReal(it) + }?.also { + changeValue(it, false) + } + prevCheckedKeyForFusionMode = KEY_ALL_MERGE_MODE + preferenceScreen.findPreferenceReal(KEY_ALL_MERGE_MODE)?.also { + it.extras.putBoolean("is_checked", true) + changeValue(it, true) + } + } + 2 -> { + //盲区模式 + FunctionBuildConfig.fusionMode = 2 + prevCheckedKeyForFusionMode?.takeIf { it != KEY_BLIND_AREA_MODE }?.let { + preferenceScreen.findPreferenceReal(it) + }?.also { + changeValue(it, false) + } + prevCheckedKeyForFusionMode = KEY_BLIND_AREA_MODE + preferenceScreen.findPreferenceReal(KEY_BLIND_AREA_MODE)?.also { + it.extras.putBoolean("is_checked", true) + changeValue(it, true) + } + } + 3 -> { + //超视距模式 + FunctionBuildConfig.fusionMode = 3 + prevCheckedKeyForFusionMode?.takeIf { it != KEY_BEYOND_VISUAL_RANGE_MODE }?.let { + preferenceScreen.findPreferenceReal(it) + }?.also { + changeValue(it, false) + } + prevCheckedKeyForFusionMode = KEY_BEYOND_VISUAL_RANGE_MODE + preferenceScreen.findPreferenceReal(KEY_BEYOND_VISUAL_RANGE_MODE)?.also { + it.extras.putBoolean("is_checked", true) + changeValue(it, true) + } + } + 4 -> { + //透传模式 + FunctionBuildConfig.fusionMode = 4 + prevCheckedKeyForFusionMode?.takeIf { it != KEY_TRANSPARENT_TRANSFER_MODE }?.let { + preferenceScreen.findPreferenceReal(it) + }?.also { + changeValue(it, false) + } + prevCheckedKeyForFusionMode = KEY_TRANSPARENT_TRANSFER_MODE + preferenceScreen.findPreferenceReal(KEY_TRANSPARENT_TRANSFER_MODE)?.also { + it.extras.putBoolean("is_checked", true) + changeValue(it, true) + } + } + 5 -> { + //纯路侧模式 + FunctionBuildConfig.fusionMode = 5 + prevCheckedKeyForFusionMode?.takeIf { it != KEY_PURE_OBU_MODE }?.let { + preferenceScreen.findPreferenceReal(it) + }?.also { + changeValue(it, false) + } + prevCheckedKeyForFusionMode = KEY_PURE_OBU_MODE + preferenceScreen.findPreferenceReal(KEY_PURE_OBU_MODE)?.also { + it.extras.putBoolean("is_checked", true) + changeValue(it, true) + } + } + } + if (adasParam.overtakeMaxSpeed > 0) { + FunctionBuildConfig.overTakeSpeed = adasParam.overtakeMaxSpeed + preferenceScreen.findPreferenceReal(KEY_OVERTAKE_SPEED_THRESHOLDSS)?.update(listOf("3.0", "12.5", "${FunctionBuildConfig.overTakeSpeed}", "0.5", "m/s")) + } + } } override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { @@ -983,7 +1075,7 @@ class OperatePanelLayout : LinearLayout { lifecycleScope.launch { if (carConfigResp.speedLimit > 0) { FunctionBuildConfig.maxSpeedLimit = min(carConfigResp.speedLimit * 3.6, 60.0) - preferenceScreen.findPreferenceReal(KEY_AUTO_PILOT_SPEED_THRESHOLDS)?.update(listOf("0", "60.0", "${FunctionBuildConfig.maxSpeedLimit}", "5")) + preferenceScreen.findPreferenceReal(KEY_AUTO_PILOT_SPEED_THRESHOLDS)?.update(listOf("0", "60.0", "${FunctionBuildConfig.maxSpeedLimit}", "5", "km/h")) } } } @@ -1018,48 +1110,28 @@ class OperatePanelLayout : LinearLayout { return FunctionBuildConfig.isFaultSlowDown } KEY_ALL_MERGE_MODE -> { - val checked = FunctionBuildConfig.fusionMode == 1 - if (checked) { - prevCheckedKeyForFusionMode = KEY_ALL_MERGE_MODE - } - return checked + return false } KEY_BLIND_AREA_MODE -> { - val checked = FunctionBuildConfig.fusionMode == 2 - if (checked) { - prevCheckedKeyForFusionMode = KEY_BLIND_AREA_MODE - } - return checked + return false } KEY_BEYOND_VISUAL_RANGE_MODE -> { - val checked = FunctionBuildConfig.fusionMode == 3 - if (checked) { - prevCheckedKeyForFusionMode = KEY_BEYOND_VISUAL_RANGE_MODE - } - return checked + return false } KEY_TRANSPARENT_TRANSFER_MODE -> { - val checked = FunctionBuildConfig.fusionMode == 4 - if (checked) { - prevCheckedKeyForFusionMode = KEY_TRANSPARENT_TRANSFER_MODE - } - return checked + return false } KEY_PURE_OBU_MODE -> { - val checked = FunctionBuildConfig.fusionMode == 5 - if (checked) { - prevCheckedKeyForFusionMode = KEY_PURE_OBU_MODE - } - return checked + return false } KEY_AUTO_PILOT_SPEED_THRESHOLDS -> { - return listOf("0.0", "60.0", "${FunctionBuildConfig.maxSpeedLimit}", "5.0") + return listOf("0.0", "60.0", "${FunctionBuildConfig.maxSpeedLimit}", "5.0", "km/h") } KEY_CHANGE_LANE_SPEED_THRESHOLDS -> { - return listOf("3.0", "7.0", "${FunctionBuildConfig.detouringSpeed}", "0.5") + return listOf("3.0", "7.0", "${FunctionBuildConfig.detouringSpeed}", "0.5", "m/s") } KEY_OVERTAKE_SPEED_THRESHOLDSS -> { - return listOf("3.0", "12.5", "${FunctionBuildConfig.overTakeSpeed}", "0.5") + return listOf("3.0", "12.5", "${FunctionBuildConfig.overTakeSpeed}", "0.5", "m/s") } } return super.getDefaultVal(pref) @@ -1181,6 +1253,10 @@ class OperatePanelLayout : LinearLayout { return true } KEY_ALL_MERGE_MODE -> { + if (preference.extras.containsKey("is_checked")) { + preference.extras.remove("is_checked") + return true + } val isChecked = newValue as? Boolean ?: false if (isChecked) { FunctionBuildConfig.fusionMode = 1 @@ -1197,6 +1273,10 @@ class OperatePanelLayout : LinearLayout { return isChecked } KEY_BLIND_AREA_MODE -> { + if (preference.extras.containsKey("is_checked")) { + preference.extras.remove("is_checked") + return true + } val isChecked = newValue as? Boolean ?: false if (isChecked) { FunctionBuildConfig.fusionMode = 2 @@ -1213,15 +1293,19 @@ class OperatePanelLayout : LinearLayout { return isChecked } KEY_BEYOND_VISUAL_RANGE_MODE -> { + if (preference.extras.containsKey("is_checked")) { + preference.extras.remove("is_checked") + return true + } val isChecked = newValue as? Boolean ?: false if (isChecked) { FunctionBuildConfig.fusionMode = 3 prevCheckedKeyForFusionMode?.takeIf { it != KEY_BEYOND_VISUAL_RANGE_MODE }?.let { - preferenceScreen.findPreferenceReal(it) - }?.also { - prevCheckedKeyForFusionMode = KEY_BEYOND_VISUAL_RANGE_MODE - changeValue(it, false) - } + preferenceScreen.findPreferenceReal(it) + }?.also { + prevCheckedKeyForFusionMode = KEY_BEYOND_VISUAL_RANGE_MODE + changeValue(it, false) + } hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode) clickEventAnalytics("融合模式", true) CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode) @@ -1229,15 +1313,19 @@ class OperatePanelLayout : LinearLayout { return isChecked } KEY_TRANSPARENT_TRANSFER_MODE -> { + if (preference.extras.containsKey("is_checked")) { + preference.extras.remove("is_checked") + return true + } val isChecked = newValue as? Boolean ?: false if (isChecked) { FunctionBuildConfig.fusionMode = 4 prevCheckedKeyForFusionMode?.takeIf { it != KEY_TRANSPARENT_TRANSFER_MODE }?.let { - preferenceScreen.findPreferenceReal(it) - }?.also { - prevCheckedKeyForFusionMode = KEY_TRANSPARENT_TRANSFER_MODE - changeValue(it, false) - } + preferenceScreen.findPreferenceReal(it) + }?.also { + prevCheckedKeyForFusionMode = KEY_TRANSPARENT_TRANSFER_MODE + changeValue(it, false) + } hmiAction("SOP 融合模式, ", FunctionBuildConfig.fusionMode) clickEventAnalytics("融合模式", true) CallerAutoPilotControlManager.sendFusionMode(FunctionBuildConfig.fusionMode) @@ -1245,6 +1333,10 @@ class OperatePanelLayout : LinearLayout { return isChecked } KEY_PURE_OBU_MODE -> { + if (preference.extras.containsKey("is_checked")) { + preference.extras.remove("is_checked") + return true + } val isChecked = newValue as? Boolean ?: false if (isChecked) { FunctionBuildConfig.fusionMode = 5 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/operate/preferences/PreferenceWithSpeedSetting.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/operate/preferences/PreferenceWithSpeedSetting.kt index 1164fc41f1..4647c88469 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/operate/preferences/PreferenceWithSpeedSetting.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/operate/preferences/PreferenceWithSpeedSetting.kt @@ -42,13 +42,14 @@ class PreferenceWithSpeedSetting : Preference { override fun onBindViewHolder(holder: PreferenceViewHolder) { super.onBindViewHolder(holder) val speedData = mSpeedData ?: return - if (speedData !is List<*> || speedData.size != 4) { + if (speedData !is List<*> || speedData.size != 5) { throw AssertionError() } val min = (speedData.elementAt(0) as String).toDouble() val max = (speedData.elementAt(1) as String).toDouble() var cur = (speedData.elementAt(2) as String).toDouble() val step = (speedData.elementAt(3) as String).toDouble() + val unit = speedData.elementAt(4) as String if (min > max) { throw AssertionError() } @@ -60,6 +61,8 @@ class PreferenceWithSpeedSetting : Preference { } val ll = holder.findViewById(R.id.ll_speed) val btnOk = holder.findViewById(R.id.bt_ok) + val speedUnit = holder.findViewById(R.id.tv_speed_unit) as? TextView + speedUnit?.text = unit val speedLimit = holder.findViewById(R.id.tv_speed_limit) as? TextView if (cache.containsKey(key)) { cur = max(cur, cache[key] ?: 0.0) @@ -73,7 +76,7 @@ class PreferenceWithSpeedSetting : Preference { minus.onClickWidthDuration(100) { val minusAfter = cur - step if (minusAfter < min) { - ToastUtils.showShort("阈值最小可为${BigDecimal.valueOf(min).setScale(1)}km/h") + ToastUtils.showShort("阈值最小为${BigDecimal.valueOf(min).setScale(1)}$unit") return@onClickWidthDuration } cur = minusAfter @@ -89,7 +92,7 @@ class PreferenceWithSpeedSetting : Preference { add.onClickWidthDuration(100) { val addAfter = cur + step if (addAfter > max) { - ToastUtils.showShort("阈值最大可为${BigDecimal.valueOf(max).setScale(1)}km/h") + ToastUtils.showShort("阈值最大为${BigDecimal.valueOf(max).setScale(1)}$unit") return@onClickWidthDuration } holder.itemView.isEnabled = false diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/ColdStartView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/ColdStartView.kt new file mode 100644 index 0000000000..21d71e9d08 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/ColdStartView.kt @@ -0,0 +1,80 @@ +package com.mogo.eagle.core.function.hmi.ui.widget + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager +import com.mogo.eagle.core.function.hmi.R +import com.zhjt.mogo.adas.data.AdasConstants +import system_master.SsmInfo +import system_master.SystemStatusInfo + +/** + * 冷启动呈现二期 + * 前置展示冷启动过程和结果 + */ +class ColdStartView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotStatusListener { + + companion object { + const val TAG = "ColdStartView" + } + + init { + LayoutInflater.from(context).inflate(R.layout.view_cold_start, this, true) + initView() + } + + private fun initView(){ + + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerAutoPilotStatusListenerManager.addListener(TAG, this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerAutoPilotStatusListenerManager.removeListener(TAG) + } + + override fun onAutopilotIpcConnectStatusChanged( + status: AdasConstants.IpcConnectionStatus, + reason: String? + ){ + if(status == AdasConstants.IpcConnectionStatus.CONNECTED){ + //域控连接成功 + + }else{ + //域控连接失败 + + } + } + + /** + * 状态查询应答 + * @param status 数据 + * HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用 + */ + override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) { + + } + + + /** + * 定频SSM接口 + * 1hz hq m1 MAP350开始支持,其他车型MAP360开始支持 + * 定频SSM接入后 onStatusQueryResp 状态查询应答接口将弃用 + * @param statusInf 数据 + */ + override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) { + + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_cold_start_fail.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_cold_start_fail.png new file mode 100644 index 0000000000..e469e824d2 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_cold_start_fail.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_cold_start_process.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_cold_start_process.png new file mode 100644 index 0000000000..7ea9bb0363 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_cold_start_process.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_cold_start_success.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_cold_start_success.png new file mode 100644 index 0000000000..3c6cc6ebd9 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_cold_start_success.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_cold_start_divider.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_cold_start_divider.xml new file mode 100644 index 0000000000..c69acc630c --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/bg_cold_start_divider.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_operate_panel_preference_widget_edit_with_button.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_operate_panel_preference_widget_edit_with_button.xml index fde0695380..7c77ecc177 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_operate_panel_preference_widget_edit_with_button.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_operate_panel_preference_widget_edit_with_button.xml @@ -47,11 +47,12 @@ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_cold_start.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_cold_start.xml new file mode 100644 index 0000000000..1da924a954 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_cold_start.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml index 61244a3c46..a219598048 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml @@ -213,4 +213,7 @@ 红绿灯信号来源 已发起上报 + 域控连接状态图标 + SSM连接状态图标 + diff --git a/core/mogo-core-res/src/main/res/values/dimens.xml b/core/mogo-core-res/src/main/res/values/dimens.xml index aec6045a64..4bf0a083d8 100644 --- a/core/mogo-core-res/src/main/res/values/dimens.xml +++ b/core/mogo-core-res/src/main/res/values/dimens.xml @@ -1112,6 +1112,7 @@ 55dp 57dp 69dp + 70dp 72dp 76dp 80dp