[3.4.0-map-sdk] loc wgs84 opt , get instead of callback , add func of traffic light cross road

This commit is contained in:
zhongchao
2023-09-21 19:33:37 +08:00
parent 056ec28709
commit 39b7d8907f
13 changed files with 175 additions and 245 deletions

View File

@@ -13,14 +13,6 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<!--刹车、转向-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@@ -14,7 +14,6 @@ import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.map.MogoLocation
@@ -33,11 +32,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
import com.mogo.eagle.core.utilcode.util.NetworkUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager
import com.mogo.och.common.module.biz.common.socketmessage.data.OCHOperationalMessage
import com.mogo.och.common.module.biz.constant.LoginStatusManager
@@ -54,22 +49,9 @@ import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceM
import com.mogo.och.common.module.map.AmapNaviToDestinationModel
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjLocations
import com.mogo.och.common.module.voice.VoiceNotice
import com.mogo.och.taxi.bean.PrepareTaskRespBean
import com.mogo.och.taxi.bean.QueryCarOrderByNoRespBean
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
import com.mogo.och.taxi.bean.StartServiceRespBean
import com.mogo.och.taxi.bean.TrajectoryListRespBean
import com.mogo.och.taxi.callback.IOCHTaxiAutopilotPlanningCallback
import com.mogo.och.taxi.callback.ITaxiADASStatusCallback
import com.mogo.och.taxi.callback.ITaxiCarServiceCallback
import com.mogo.och.taxi.callback.ITaxiControllerStatusCallback
import com.mogo.och.taxi.callback.ITaxiOrderStatusCallback
import com.mogo.och.taxi.callback.ITaxiTaskWithOrderCallback
import com.mogo.och.taxi.constant.TaskStatusEnum
import com.mogo.och.taxi.constant.TaskTypeEnum
import com.mogo.och.taxi.constant.TaxiCarServingStatusManager
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
import com.mogo.och.taxi.constant.TaxiUnmannedConst
import com.mogo.och.taxi.bean.*
import com.mogo.och.taxi.callback.*
import com.mogo.och.taxi.constant.*
import com.mogo.och.taxi.constant.TaxiUnmannedConst.Companion.BUSINESSTYPE
import com.mogo.och.taxi.network.TaxiTaskWithOrderServiceManager
import com.mogo.och.taxi.ui.debug.DebugView
@@ -84,8 +66,6 @@ import io.reactivex.schedulers.Schedulers
import mogo.telematics.pad.MessagePad.ArrivalNotification
import mogo.telematics.pad.MessagePad.GlobalPathResp
import mogo_msg.MogoReportMsg.MogoReportMessage
import system_master.SsmInfo
import system_master.SystemStatusInfo
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.TimeUnit
@@ -183,7 +163,7 @@ object TaxiTaskModel {
return mCurrentTaskWithOrder
}
fun getCurrentOrderTrajectoryList(): MutableList<TrajectoryListRespBean.Result>? {
fun getCurrentOrderTrajectoryList(): MutableList<TrajectoryListRespBean.Result> {
return mTaskTrajectoryList
}
@@ -250,18 +230,26 @@ object TaxiTaskModel {
* false: 暂停启动自驾
*/
fun handleBrakeStatusChange(brakeStatus: Boolean) {
if (brakeStatus){
mControllerStatusCallback?.resumeOpenAutopilotNonManual()
}else{
mControllerStatusCallback?.pauseOpenAutopilotNonManual()
}
if (brakeStatus) {
mControllerStatusCallback?.resumeOpenAutopilotNonManual()
} else {
mControllerStatusCallback?.pauseOpenAutopilotNonManual()
}
}
private val mMogoAutopilotStatusListener: IMoGoAutopilotStatusListener =
object : IMoGoAutopilotStatusListener {
override fun onAutopilotIpcConnectStatusChanged(status: Int, reason: String?) {
DebugView.printInfoMsg("[域控连接状态变化] status=$status, reason=${if (TextUtils.isEmpty(reason)) "" else reason}")
DebugView.printInfoMsg(
"[域控连接状态变化] status=$status, reason=${
if (TextUtils.isEmpty(
reason
)
) "" else reason
}"
)
}
override fun onAutopilotGuardian(guardianInfo: MogoReportMessage?) {
TaxiTrajectoryManager.getInstance().onAutopilotGuardian(guardianInfo)
}
@@ -295,7 +283,8 @@ object TaxiTaskModel {
if ((FunctionBuildConfig.isDemoMode
&& checkCurrentTaskCondition()
&& QueryCurrentTaskRespBean.isStartTaskType(mCurrentTaskWithOrder)
)){
)
) {
// 当美化模式演示模式开启时且有订单、且为去往目的地状态维持自动驾驶icon开启状态
return
}
@@ -305,20 +294,20 @@ object TaxiTaskModel {
if ((FunctionBuildConfig.isDemoMode
&& checkCurrentTaskCondition()
&& QueryCurrentTaskRespBean.isStartTaskType(mCurrentTaskWithOrder)
)
)
) {
// 当美化模式演示模式开启时且有订单、且为去往目的地状态维持自动驾驶icon开启状态
return
}
if (mADASStatusCallback != null) {
mADASStatusCallback!!.onAutopilotDisable()
}
mADASStatusCallback?.onAutopilotDisable()
} else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) {
DebugView.printInfoMsg("[自驾状态变化] afterValue=STATUS_PARALLEL_DRIVINGmeaning=平行驾驶中")
if (FunctionBuildConfig.isDemoMode) {
if ((checkCurrentTaskCondition()
&& QueryCurrentTaskRespBean.isStartTaskType(mCurrentTaskWithOrder)
)
&& QueryCurrentTaskRespBean.isStartTaskType(
mCurrentTaskWithOrder
)
)
) { //订单中
// 当美化模式演示模式开启时且有订单、且为去往目的地状态维持自动驾驶icon开启状态
} else { //美化模式下没订单,显示人工驾驶
@@ -330,7 +319,6 @@ object TaxiTaskModel {
}
}
override fun onAutopilotSNRequest() {}
override fun onAutopilotArriveAtStation(arrivalNotification: ArrivalNotification?) {
i(TAG, "onAutopilotArriveAtStation = ${arrivalNotification.toString()}")
DebugView.printInfoMsg("[MAP到站通知] 上报到站location=${arrivalNotification?.endLocation}")
@@ -354,9 +342,6 @@ object TaxiTaskModel {
}
}
override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {}
override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {}
}
private val mMogoStatusChangedListener: IMogoStatusChangedListener =
@@ -402,7 +387,7 @@ object TaxiTaskModel {
if (checkCurrentTaskCondition()) {
d(TAG, "--------本地开始计算全路径数据---------- ")
//转换成高德坐标系
if (mCurrentTaskRoutePointsGcj!!.size > 0) {
if (mCurrentTaskRoutePointsGcj.size > 0) {
mCurrentTaskRoutePointsGcj.clear()
}
mCurrentTaskRoutePointsGcj.addAll(
@@ -450,7 +435,7 @@ object TaxiTaskModel {
return OCHOperationalMessage::class.java
}
override fun onMsgReceived(obj: OCHOperationalMessage) {
override fun onMsgReceived(obj: OCHOperationalMessage?) {
if (obj == null) {
d(TAG, "onMsgReceived = null")
return
@@ -478,17 +463,18 @@ object TaxiTaskModel {
}
private val localCalculateDistanceListener: IDistanceListener = object : IDistanceListener {
override fun distanceCallback(lastSumLength: Float) {
val lastTime = lastSumLength / TaxiUnmannedConst.TAXI_AVERAGE_SPEED * 3.6 //秒
override fun distanceCallback(distance: Float) {
val lastTime = distance / TaxiUnmannedConst.TAXI_AVERAGE_SPEED * 3.6 //秒
d(
TAG,
"dynamicCalculateRouteInfo: lastSumLength=$lastSumLength, lastTime=$lastTime, threadName=Thread.currentThread().name"
"dynamicCalculateRouteInfo: lastSumLength=$distance, lastTime=$lastTime, threadName=Thread.currentThread().name"
)
mTaxiTaskWithOrderCallbackMap.forEach {
val listener = it.value
listener.onTaskTripInfoLocalCalculateChanged(
lastSumLength.toLong(),
lastTime.toLong())
distance.toLong(),
lastTime.toLong()
)
}
}
}
@@ -520,7 +506,7 @@ object TaxiTaskModel {
)
routeArrivingTemp.add(temp)
}
mAutopilotPlanningCallback!!.routeResult(
mAutopilotPlanningCallback?.routeResult(
routeArriviedTemp,
routeArrivingTemp,
location
@@ -569,7 +555,7 @@ object TaxiTaskModel {
siteId: Long, isArriveAtEndSite: Boolean,
isArrivedNearestStation: Boolean = false
) {
if (mIsArrivedSiteTag){
if (mIsArrivedSiteTag) {
DebugView.printInfoMsg("arriveSite接口正在调用中")
i(TAG, message = "arriveSite接口正在调用中 mIsArrivedSite = $mIsArrivedSiteTag")
return
@@ -678,7 +664,7 @@ object TaxiTaskModel {
)
return
}
val result: QueryCurrentTaskRespBean.Result = data.data!!
val result: QueryCurrentTaskRespBean.Result? = data.data
d(
TAG,
"queryCurrentTaskOnce onSuccessresult=${GsonUtil.jsonFromObject(result)}"
@@ -705,15 +691,13 @@ object TaxiTaskModel {
}
//订单或者伪任务更新, 都去刷新下界面
if (mCurrentTaskWithOrder == null
|| !mCurrentTaskWithOrder!!.equals(result)
) {
if (mCurrentTaskWithOrder == null || mCurrentTaskWithOrder!! != result) {
d(TAG, "queryCurrentTaskOnce: 更新本地数据")
mCurrentTaskWithOrder = result
// 任务为空
if (result.endSite == null && result.order == null) {
if (result?.endSite == null && result?.order == null) {
d(TAG, "queryCurrentTaskOnce: 任务为空")
if (mDriveToNearestStationTask == null) {
mTaxiTaskWithOrderCallbackMap.forEach {
@@ -728,7 +712,7 @@ object TaxiTaskModel {
//8.29更新: 当前任务完成且订单状态为乘客已上车, 则立马去拉取任务 不再等120s,否则送驾任务要等120s后才能去执行
// 主要是解决A-B演练任务同时接到A-B订单状态流转的问题
//注意: 需要去除到达乘客上车点的节点, 这个节点不拉取任务
if (result?.currentStatus == TaskStatusEnum.CompleteTask.code
if (result.currentStatus == TaskStatusEnum.CompleteTask.code
) {
mADASStatusCallback?.updateAutopilotStatus()
mTaxiTaskWithOrderCallbackMap.forEach {
@@ -749,7 +733,7 @@ object TaxiTaskModel {
}
//根据lineId集合去查轨迹集合, 返回的只是接驾任务的line集合, 没有送驾任务
var linesIds = arrayListOf<Long>()
val linesIds = arrayListOf<Long>()
linesIds.add(result.lineId) // 当前任务的
result.order?.also {
linesIds.addAll(it.planningLines) // 接驾
@@ -886,7 +870,7 @@ object TaxiTaskModel {
object : OchCommonServiceCallback<BaseData> {
override fun onSuccess(data: BaseData?) {
DebugView.printInfoMsg("[开始任务] 请求successlindId=$lineId")
if (isStartAutopilot){
if (isStartAutopilot) {
startAutoPilot() //自驾开启
}
d(TAG, "startTask onSuccess: data=${GsonUtil.jsonFromObject(data)}")
@@ -911,7 +895,7 @@ object TaxiTaskModel {
})
}
fun prepareNextTask(delayTime: Long,siteId: Long) {
fun prepareNextTask(delayTime: Long, siteId: Long) {
DebugView.printInfoMsg("[PrepareNextTask] 准备发送请求, siteId=$siteId")
TaxiTaskWithOrderServiceManager.prepareTask(
mContext,
@@ -930,7 +914,7 @@ object TaxiTaskModel {
DebugView.printErrorMsg("[PrepareNextTask] 请求fail, code=$code ,msg=$msg")
d(TAG, "prepareNextTask onFail: code=$code ,msg=$msg")
if (LoginStatusManager.isLogin() && TaxiCarServingStatusManager.isCarServingStatus()) {
startPrepareTaskDelay(delayTime,siteId)
startPrepareTaskDelay(delayTime, siteId)
}
}
})
@@ -940,12 +924,12 @@ object TaxiTaskModel {
removePrepareTaskDelay()
mPrepareTaskDelayRunnable = Runnable {
prepareNextTask(delayTime,siteId)
prepareNextTask(delayTime, siteId)
}
mTaxiTaskWithOrderCallbackMap.forEach {
val listener = it.value
listener.onStartPrepareTaskUI(delayTime,true)
listener.onStartPrepareTaskUI(delayTime, true)
}
DebugView.printInfoMsg("[PrepareNextTask] 倒计时${delayTime / 1000}秒后prepareNextTask, siteId=$siteId")
UiThreadHandler.postDelayed(
@@ -960,7 +944,7 @@ object TaxiTaskModel {
UiThreadHandler.removeCallbacks(mPrepareTaskDelayRunnable)
mTaxiTaskWithOrderCallbackMap.forEach {
val listener = it.value
listener.onStartPrepareTaskUI(0,false)
listener.onStartPrepareTaskUI(0, false)
}
mPrepareTaskDelayRunnable = null
}
@@ -970,7 +954,13 @@ object TaxiTaskModel {
* 查询当前任务的轨迹
*/
fun queryTaskTrajectoryByLineIds(planningLineIds: Array<Long>, currentTaskLineId: Long) {
DebugView.printInfoMsg("[查询轨迹信息] 准备发送请求currentTaskLineId=$currentTaskLineId, planningLineIds=${GsonUtil.jsonFromObject(planningLineIds)}")
DebugView.printInfoMsg(
"[查询轨迹信息] 准备发送请求currentTaskLineId=$currentTaskLineId, planningLineIds=${
GsonUtil.jsonFromObject(
planningLineIds
)
}"
)
TaxiTaskWithOrderServiceManager.queryTrajectoryByLindIds(
mContext,
planningLineIds,
@@ -980,7 +970,13 @@ object TaxiTaskModel {
TAG,
"queryTaskTrajectoryByLineIds onSuccess: ${GsonUtil.jsonFromObject(data?.data)}"
)
DebugView.printInfoMsg("[查询轨迹信息] 请求success, currentTaskLineId=$currentTaskLineId, planningLineIds=${GsonUtil.jsonFromObject(planningLineIds)}")
DebugView.printInfoMsg(
"[查询轨迹信息] 请求success, currentTaskLineId=$currentTaskLineId, planningLineIds=${
GsonUtil.jsonFromObject(
planningLineIds
)
}"
)
data?.data?.also {
mTaskTrajectoryList.addAll(it)
mCurrentTaskTrajectory = it.first { currentTaskLineId == it.lineId }
@@ -1033,8 +1029,8 @@ object TaxiTaskModel {
//暂停接单状态下,去接单
DebugView.printInfoMsg("[开始接单] 准备发送请求")
TaxiTaskWithOrderServiceManager.startService(mContext,
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().latitude,
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().longitude,
getChassisLocationGCJ02().latitude,
getChassisLocationGCJ02().longitude,
object : OchCommonServiceCallback<StartServiceRespBean> {
override fun onSuccess(data: StartServiceRespBean?) {
if (data == null) return
@@ -1079,13 +1075,13 @@ object TaxiTaskModel {
paramIndexes = [-1]
)
fun startAutopilotByClick(){
fun startAutopilotByClick() {
//订单状态流转成功, 点击了开启自驾按钮, 启动自驾
if (QueryCurrentTaskRespBean.isStartTaskType(mCurrentTaskWithOrder)) {
startAutoPilot()
}else if (QueryCurrentTaskRespBean.isGetTaskType(mCurrentTaskWithOrder)){
} else if (QueryCurrentTaskRespBean.isGetTaskType(mCurrentTaskWithOrder)) {
startTask(mCurrentTaskWithOrder!!.lineId, true)
}else{
} else {
e(TAG, "task currentStatus is not StartTask.")
DebugView.printInfoMsg("[启自驾] task currentStatus is not StartTask")
}
@@ -1168,9 +1164,7 @@ object TaxiTaskModel {
mCurrentTaskWithOrder!!.lineId,
if (mCurrentTaskWithOrder!!.order != null) mCurrentTaskWithOrder!!.order!!.orderNo else ""
)
if (mControllerStatusCallback != null) {
mControllerStatusCallback!!.startOpenAutopilot()
}
mControllerStatusCallback?.startOpenAutopilot()
}
private fun initAutopilotControlParameters(): AutopilotControlParameters? {
@@ -1306,16 +1300,12 @@ object TaxiTaskModel {
curTaskAndOrder.endSite!!.gcjLat,
curTaskAndOrder.endSite!!.gcjLon
)
if (mAutopilotPlanningCallback != null) {
mAutopilotPlanningCallback!!.setLineMarker(startStation, endStation)
}
mAutopilotPlanningCallback?.setLineMarker(startStation, endStation)
}
}
private fun cleanLineMarker() {
if (mAutopilotPlanningCallback != null) {
mAutopilotPlanningCallback!!.setLineMarker(null, null)
}
mAutopilotPlanningCallback?.setLineMarker(null, null)
}
/**
@@ -1339,7 +1329,7 @@ object TaxiTaskModel {
// 登出
fun logout() {
loginService!!.loginOut(
loginService?.loginOut(
getChassisLocationGCJ02().latitude,
getChassisLocationGCJ02().longitude
)
@@ -1350,18 +1340,15 @@ object TaxiTaskModel {
//导航去订单终点目的地
fun startNaviToEndStation(isShow: Boolean) {
if (mCurrentTaskRoutePointsGcj == null) return
if (mCurrentTaskRoutePointsGcj.size > 0) { //使用自驾轨迹
if (mOrderStatusCallback != null) {
mOrderStatusCallback!!.onNaviToEnd(false, isShow)
}
mOrderStatusCallback?.onNaviToEnd(false, isShow)
} else { //若直接要显示导航地图则直接导航, 若不是则2s后若无轨迹数据使用高德导航
if (isShow && mOrderStatusCallback != null) {
mOrderStatusCallback!!.onNaviToEnd(true, true)
if (isShow) {
mOrderStatusCallback?.onNaviToEnd(true, true)
} else {
UiThreadHandler.postDelayed({
if (mCurrentTaskRoutePointsGcj.size == 0 && mOrderStatusCallback != null) {
mOrderStatusCallback!!.onNaviToEnd(true, false)
if (mCurrentTaskRoutePointsGcj.size == 0) {
mOrderStatusCallback?.onNaviToEnd(true, false)
}
}, 2000L)
}
@@ -1453,7 +1440,7 @@ object TaxiTaskModel {
d(
TAG, "stopAutoStartAutopilot = ${mCurrentTaskWithOrder?.currentStatus}"
)
if (QueryCurrentTaskRespBean.isGetTaskType(mCurrentTaskWithOrder)){
if (QueryCurrentTaskRespBean.isGetTaskType(mCurrentTaskWithOrder)) {
mControllerStatusCallback?.stopOpenAutopilotNonManual()
mTaxiTaskWithOrderCallbackMap.forEach {
val listener = it.value
@@ -1462,14 +1449,14 @@ object TaxiTaskModel {
}
}
fun pauseStartAutopilot(){
fun pauseStartAutopilot() {
mTaxiTaskWithOrderCallbackMap.forEach {
val listener = it.value
listener.onPauseStartAutopilot()
}
}
fun resumeStartAutopilot(remainingTime: Long){
fun resumeStartAutopilot(remainingTime: Long) {
mTaxiTaskWithOrderCallbackMap.forEach {
val listener = it.value
listener.onStartAutopilot(remainingTime)