Merge branch 'refs/heads/dev_robotaxi-d_240912_6.7.0' into dev_robotaxi-d_240912_6.7.2_local

This commit is contained in:
donghongyu-pc
2024-10-15 19:43:18 +08:00
29 changed files with 483 additions and 482 deletions

View File

@@ -133,12 +133,13 @@ object LineManager : CallerBase<ILineCallback>() {
}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<ILineCallback>() {
CallerEagleBaseFunctionCall4OchManager.updateOrderLine(sb.toString())
}
}
OchChainLogManager.writeChainLogAutopilot("自驾参数", "线路信息:${contraiInfo}")
}
fun getStations(): Pair<BusStationBean?, BusStationBean?> {

View File

@@ -33,4 +33,5 @@ data class ContraiInfo(
var passPoints: MutableList<BusStationBean>?=null, // 用于算路的经停点
var blackPoints: MutableList<BusStationBean>?=null, // 用于算路的黑名單點
val source:Int = 1, //轨迹来源1 录制2 自主计算
)

View File

@@ -249,10 +249,6 @@ object LineModel {
}
}
// 到站
fun arrivedStation() {
}
fun arrivedStationSuccess(){
mBusLinesCallbackMap.forEach {callback->
callback.value.onArriveStationSuccess()

View File

@@ -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

View File

@@ -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

View File

@@ -77,6 +77,7 @@ class SwtichTaskModel : ViewModel(), IBusLinesCallback {
fun hideLoading()
fun startTaskSuccess()
fun showErrorInfo()
fun resetRecycleView()
}
fun onBusLineTasks(o: MutableList<TaskDataBean>?) {
@@ -96,6 +97,7 @@ class SwtichTaskModel : ViewModel(), IBusLinesCallback {
BizLoopManager.runInMainThread{
viewCallback?.hideLoading()
viewCallback?.startTaskSuccess()
viewCallback?.resetRecycleView()
}
}
// 选择线路失败

View File

@@ -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();

View File

@@ -47,16 +47,16 @@
app:layout_constraintTop_toBottomOf="@+id/actv_last_refresh_date"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="@dimen/dp_22" />
<include
<com.mogo.och.common.module.wigets.commonview.EmptyView
android:id="@+id/include_empty"
layout="@layout/shuttle_weak_empty_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
app:empty_title="暂无线路"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -101,16 +101,16 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<include
<com.mogo.och.common.module.wigets.commonview.EmptyView
android:id="@+id/include_empty"
layout="@layout/shuttle_weak_empty_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
app:empty_title="暂无班次"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<include
android:id="@+id/include_error"

View File

@@ -4,6 +4,8 @@ import com.mogo.eagle.core.data.BaseData
import com.mogo.och.data.taxi.BaseOrderBean
import com.mogo.och.unmanned.taxi.constant.TaskStatusEnum
import com.mogo.och.common.module.biz.order.TaxiOrderStatusEnum
import com.mogo.och.data.bean.BusStationBean
import com.mogo.och.data.bean.ContraiInfo
/**
* @author: wangmingjun
@@ -73,6 +75,17 @@ data class Site(
if (wgs84Lat != other.wgs84Lat) return false
return true
}
fun toCommonStation(): BusStationBean {
val result = BusStationBean()
result.siteId = siteId.toInt()
result.name = siteName
result.gcjLat = gcjLat
result.gcjLon = gcjLon
result.lat = wgs84Lat
result.lon = wgs84Lon
result.isLeaving = true
return result
}
}
data class QueryCurrentTaskRespBean(var data: Result?) : BaseData() {
@@ -254,6 +267,11 @@ data class TrajectoryListRespBean(var data: MutableList<Result>?) : 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
}
}
}

View File

@@ -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);
}

View File

@@ -9,9 +9,6 @@ import com.mogo.eagle.core.data.map.MogoLocation;
*/
public interface ITaxiControllerStatusCallback {
//开始开启自动驾驶
void startOpenAutopilot();
//自动开启自动驾驶
void startOpenAutopilotNonManual();

View File

@@ -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<TaxiFragment?, TaxiPresenter?>(),
@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<TaxiFragment?, TaxiPresenter?>(),
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<TaxiFragment?, TaxiPresenter?>(),
fun setGuidHide() {
}
fun updateAutopilotStatus(status: Int, canStartAuto: Boolean) {
onAutopilotStatusChanged(status, canStartAuto)
}
/**
* 状态变更
* @param inOperation true 可以接单 false 暂停接单
@@ -423,9 +332,8 @@ class TaxiFragment :MvpFragment<TaxiFragment?, TaxiPresenter?>(),
if (MogoStatusManager.getInstance().isTaxiUnmanedDriverLineRoutingVerifyMode) {
showAmapNaviToStationFragment(isShow)
} else {
// TODO: 需要复原
// if (null == taskTabFragment || taskTabFragment!!.get() == null) return
// taskTabFragment!!.get()!!.onNaviToEndStationByAMap(isShow)
val currentItinerary = findViewById<ItineraryCurrentView>(R.id.currentItinerary)
currentItinerary?.onNaviToEndStationByAMap(isShow)
}
} else if (isShow) { //使用routing数据
showRoutingToStationFragment(true)

View File

@@ -79,7 +79,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> 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<TaxiFragment> 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<TaxiFragment> 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<TaxiFragment> implements ITaxiADASS
@Override
public void run() {
if(mView!=null) {
mView.startOrStopLoadingAnim(true);
mView.showStartAutopilotBlinkAnimation();
}
}
@@ -215,8 +126,6 @@ public class TaxiPresenter extends Presenter<TaxiFragment> 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<TaxiFragment> 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<TaxiFragment> implements ITaxiADASS
@Override
public void run() {
if(mView!=null) {
mView.startOrStopLoadingAnim(true);
mView.resumeAutopilotBlinkAnimation();
}
}

View File

@@ -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_RUNNINGmeaning=自动驾驶中")
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_DISABLEmeaning=不可自动驾驶")
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_DRIVINGmeaning=平行驾驶中")
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)
}
/**

View File

@@ -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<Boolean>(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<Boolean>(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
)
}
}
}

View File

@@ -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()");

View File

@@ -298,14 +298,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.constraintlayout.widget.Group
android:id="@+id/group_itinerary_actions"
android:visibility="gone"
app:constraint_referenced_ids="actv_submit_task,commonSlideViewStartServer,actv_end_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.mogo.och.common.module.wigets.commonview.EmptyView
android:id="@+id/include_empty"
android:layout_width="wrap_content"

View File

@@ -25,6 +25,7 @@ import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
import com.mogo.eagle.core.data.obu.MogoObuConst
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoGetParamResponseListener
import com.mogo.eagle.core.function.api.devatools.mofang.IMoGoMoFangProvider
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener.Companion.FUNC_MODE_DEMO
@@ -33,6 +34,7 @@ import com.mogo.eagle.core.function.api.setting.ISopSettingListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotGetParamResponseDispatcher
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
@@ -58,6 +60,8 @@ import com.mogo.eagle.core.utilcode.mogo.vehicle.SweeperVehicleConfigUtils
import com.mogo.eagle.core.utilcode.rv.divider.CommonDividerItemDecoration
import com.mogo.eagle.core.utilcode.util.AppStateManager
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.zhjt.mogo.adas.data.AdasConstants
import com.zhjt.mogo.adas.data.bean.AdasParam
import kotlinx.android.synthetic.main.layout_operate_panel.view.iv_operate_panel_close
import kotlinx.coroutines.launch
import me.jessyan.autosize.utils.AutoSizeUtils
@@ -915,7 +919,7 @@ class OperatePanelLayout : LinearLayout {
}
}
class VehiclesPreferenceFragmentCompat : OperatePanelDetailBase(), IMoGoAutopilotCarConfigListener, ISopSettingListener, IViewControlListener {
class VehiclesPreferenceFragmentCompat : OperatePanelDetailBase(), IMoGoAutopilotCarConfigListener, ISopSettingListener, IViewControlListener, IMoGoGetParamResponseListener {
companion object {
private const val TAG = "VehiclesPreferenceFragmentCompat"
private const val KEY_PNC_PARK_INTERSECTION_CAR = "pnc_park_intersection_car"
@@ -938,15 +942,28 @@ class OperatePanelLayout : LinearLayout {
private var prevCheckedKeyForFusionMode: String? = null
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
Logger.d(TAG, "--- onCreateView --- 1 ---")
if (AppConfigInfo.isConnectAutopilot) {
CallerAutoPilotControlManager.getCarConfig()
Logger.d(TAG, "--- onCreateView --- 2 ---") //获取车辆配置
CallerAutoPilotControlManager.getCarConfig() //查询融合模式
CallerAutoPilotControlManager.sendGetParamReq(AdasConstants.MapSystemParamType.FUSION_MODE)
CallerAutoPilotControlManager.sendGetParamReq(AdasConstants.MapSystemParamType.OVERTAKE_MAX_SPEED)
}
CallerAutopilotGetParamResponseDispatcher.addListener(TAG, this)
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
CallerSopSettingManager.addListener(TAG, this)
CallerHmiViewControlListenerManager.addListener(TAG, this)
return super.onCreateView(inflater, container, savedInstanceState)
}
override fun onDestroyView() {
CallerAutopilotGetParamResponseDispatcher.removeListener(TAG)
CallerAutopilotCarConfigListenerManager.removeListener(TAG)
CallerSopSettingManager.removeListener(TAG)
CallerHmiViewControlListenerManager.removeListener(TAG)
super.onDestroyView()
}
override fun updateFuncMode(tag: String, boolean: Boolean) {
super.updateFuncMode(tag, boolean)
if (tag == FUNC_MODE_RAIN) {
@@ -957,11 +974,86 @@ class OperatePanelLayout : LinearLayout {
}
}
override fun onDestroyView() {
CallerAutopilotCarConfigListenerManager.removeListener(TAG)
CallerSopSettingManager.removeListener(TAG)
CallerHmiViewControlListenerManager.removeListener(TAG)
super.onDestroyView()
override fun onGetParamResp(header: MessagePad.Header, getParamResp: MessagePad.SetParamReq, adasParam: AdasParam) {
Logger.d(TAG, "-- onGetParamResp --: fusion-mode:${adasParam.fusionMode}, over-take-speed:${adasParam.overtakeMaxSpeed} ")
lifecycleScope.launch {
when(adasParam.fusionMode) {
1 -> {
//全融合模式
FunctionBuildConfig.fusionMode = 1
prevCheckedKeyForFusionMode?.takeIf { it != KEY_ALL_MERGE_MODE }?.let {
preferenceScreen.findPreferenceReal<TwoStatePreference>(it)
}?.also {
changeValue(it, false)
}
prevCheckedKeyForFusionMode = KEY_ALL_MERGE_MODE
preferenceScreen.findPreferenceReal<TwoStatePreference>(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<TwoStatePreference>(it)
}?.also {
changeValue(it, false)
}
prevCheckedKeyForFusionMode = KEY_BLIND_AREA_MODE
preferenceScreen.findPreferenceReal<TwoStatePreference>(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<TwoStatePreference>(it)
}?.also {
changeValue(it, false)
}
prevCheckedKeyForFusionMode = KEY_BEYOND_VISUAL_RANGE_MODE
preferenceScreen.findPreferenceReal<TwoStatePreference>(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<TwoStatePreference>(it)
}?.also {
changeValue(it, false)
}
prevCheckedKeyForFusionMode = KEY_TRANSPARENT_TRANSFER_MODE
preferenceScreen.findPreferenceReal<TwoStatePreference>(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<TwoStatePreference>(it)
}?.also {
changeValue(it, false)
}
prevCheckedKeyForFusionMode = KEY_PURE_OBU_MODE
preferenceScreen.findPreferenceReal<TwoStatePreference>(KEY_PURE_OBU_MODE)?.also {
it.extras.putBoolean("is_checked", true)
changeValue(it, true)
}
}
}
if (adasParam.overtakeMaxSpeed > 0) {
FunctionBuildConfig.overTakeSpeed = adasParam.overtakeMaxSpeed
preferenceScreen.findPreferenceReal<PreferenceWithSpeedSetting>(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<PreferenceWithSpeedSetting>(KEY_AUTO_PILOT_SPEED_THRESHOLDS)?.update(listOf("0", "60.0", "${FunctionBuildConfig.maxSpeedLimit}", "5"))
preferenceScreen.findPreferenceReal<PreferenceWithSpeedSetting>(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<TwoStatePreference>(it)
}?.also {
prevCheckedKeyForFusionMode = KEY_BEYOND_VISUAL_RANGE_MODE
changeValue(it, false)
}
preferenceScreen.findPreferenceReal<TwoStatePreference>(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<TwoStatePreference>(it)
}?.also {
prevCheckedKeyForFusionMode = KEY_TRANSPARENT_TRANSFER_MODE
changeValue(it, false)
}
preferenceScreen.findPreferenceReal<TwoStatePreference>(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

View File

@@ -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

View File

@@ -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) {
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/dp_2"/>
<solid android:color="#4CFFFFFF" />
</shape>

View File

@@ -47,11 +47,12 @@
</LinearLayout>
<TextView
android:id="@+id/tv_speed_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/dp_10"
android:text="km/h"
tools:text="km/h"
android:textColor="#ffffff"
android:textSize="@dimen/dp_30"
tools:ignore="HardcodedText,SpUsage" />

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<TextView
android:id="@+id/tvSystemStartupTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="@dimen/sp_70"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
/>
<ImageView
android:id="@+id/ivIpcConnectStatus"
android:layout_width="@dimen/dp_40"
android:layout_height="@dimen/dp_40"
app:layout_constraintTop_toBottomOf="@id/tvSystemStartupTitle"
app:layout_constraintLeft_toLeftOf="@id/tvSystemStartupTitle"
android:contentDescription="@string/ipc_connect_icon"
/>
<TextView
android:id="@+id/tvIpcConnectContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/ivIpcConnectStatus"
app:layout_constraintBottom_toBottomOf="@id/ivIpcConnectStatus"
app:layout_constraintLeft_toRightOf="@id/ivIpcConnectStatus"
android:textSize="@dimen/sp_36"
android:textColor="@color/white"
android:layout_marginStart="@dimen/dp_15"
/>
<View
android:id="@+id/viewSsmConnectDivider"
android:layout_width="@dimen/dp_4"
android:layout_height="@dimen/dp_26"
app:layout_constraintLeft_toLeftOf="@id/ivIpcConnectStatus"
app:layout_constraintRight_toRightOf="@id/ivIpcConnectStatus"
app:layout_constraintTop_toBottomOf="@id/ivIpcConnectStatus"
android:layout_marginTop="@dimen/dp_5"
android:background="@drawable/bg_cold_start_divider"
/>
<ImageView
android:id="@+id/ivSsmConnectStatus"
android:layout_width="@dimen/dp_40"
android:layout_height="@dimen/dp_40"
app:layout_constraintTop_toBottomOf="@id/viewSsmConnectDivider"
app:layout_constraintLeft_toLeftOf="@id/viewSsmConnectDivider"
app:layout_constraintRight_toRightOf="@id/viewSsmConnectDivider"
android:contentDescription="@string/ssm_connect_icon"
/>
<TextView
android:id="@+id/tvSsmConnectContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/ivSsmConnectStatus"
app:layout_constraintBottom_toBottomOf="@id/ivSsmConnectStatus"
app:layout_constraintLeft_toRightOf="@id/ivSsmConnectStatus"
android:textSize="@dimen/sp_36"
android:textColor="@color/white"
android:layout_marginStart="@dimen/dp_15"
/>
<View
android:id="@+id/viewColdStartDivider"
android:layout_width="@dimen/dp_4"
android:layout_height="@dimen/dp_26"
app:layout_constraintLeft_toLeftOf="@id/ivSsmConnectStatus"
app:layout_constraintRight_toRightOf="@id/ivSsmConnectStatus"
app:layout_constraintTop_toBottomOf="@id/ivSsmConnectStatus"
android:layout_marginTop="@dimen/dp_5"
android:background="@drawable/bg_cold_start_divider"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -213,4 +213,7 @@
<string name="traffic_light_source">红绿灯信号来源</string>
<string name="report_success">已发起上报</string>
<string name="ipc_connect_icon">域控连接状态图标</string>
<string name="ssm_connect_icon">SSM连接状态图标</string>
</resources>

View File

@@ -1112,6 +1112,7 @@
<dimen name="sp_55">55dp</dimen>
<dimen name="sp_57">57dp</dimen>
<dimen name="sp_69">69dp</dimen>
<dimen name="sp_70">70dp</dimen>
<dimen name="sp_72">72dp</dimen>
<dimen name="sp_76">76dp</dimen>
<dimen name="sp_80">80dp</dimen>