完成了自动驾驶状态信息回传

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-10-12 21:24:58 +08:00
parent 870af04059
commit 9802124169
15 changed files with 309 additions and 37 deletions

View File

@@ -5,7 +5,6 @@ import android.content.Context;
import com.mogo.eagle.core.data.autopilot.AdasControlCommandParameter;
import com.mogo.eagle.core.data.autopilot.RemoteControlAutoPilotParameters;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutoPilotProvider;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutoPilotStatusListener;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.eagle.core.utilcode.util.LogUtils;
import com.zhidao.support.adas.high.AdasManager;

View File

@@ -6,9 +6,13 @@ import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.autopilot.AdasOCHData
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.constants.MoGoConfig
import com.mogo.eagle.core.data.obu.ObuStatusInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutoPilotStatusListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
import com.mogo.eagle.core.function.hmi.R
@@ -30,7 +34,8 @@ class DebugSettingView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener {
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener,
IMoGoAutoPilotStatusListener {
private val TAG = "DebugSettingView"
@@ -42,16 +47,19 @@ class DebugSettingView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerObuListenerManager.addListener(TAG, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerObuListenerManager.removeListener(TAG)
CallerAutoPilotStatusListenerManager.removeListener(TAG)
}
private fun initView() {
tvObuInfo.text = CallerObuListenerManager.getObuStatusInfo()
tvObuInfo.text = CallerObuListenerManager.getObuStatusInfoJsonString()
tvAutopilotInfo.text =
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfoJsonString()
// 初始化App 配置信息
val appConfigInfo = AppConfigInfo()
@@ -89,4 +97,19 @@ class DebugSettingView @JvmOverloads constructor(
tvObuInfo.text = GsonUtils.toJson(obuStatusInfo)
}
/**
* 自动驾驶相关回调
*/
override fun onAutoPilotArriveAtStation(data: AdasOCHData?) {
}
override fun onAutoPilotStateChanged(state: Int, reason: String?) {
}
override fun onAutoPilotStatusResponse(autopilotStatusInfo: AutopilotStatusInfo?) {
tvAutopilotInfo.text = GsonUtils.toJson(autopilotStatusInfo)
}
}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_1000"
android:layout_height="@dimen/dp_700"
android:layout_width="@dimen/dp_1300"
android:layout_height="@dimen/dp_1000"
android:background="#FFFFFF">
<ScrollView
@@ -21,6 +21,8 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#B200BCD4"
android:padding="@dimen/dp_10"
android:text="鹰眼应用配置信息"
android:textColor="#000"
android:textSize="@dimen/dp_34"
@@ -44,20 +46,22 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#B200BCD4"
android:padding="@dimen/dp_10"
android:text="OBU 配置信息"
android:textColor="#000"
android:textSize="@dimen/dp_34"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etObuIP"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#32009688"
android:gravity="center"
android:padding="@dimen/dp_5"
android:text="192.168.1.199"
android:textSize="@dimen/dp_34" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etObuIP"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#32009688"
android:gravity="center"
android:padding="@dimen/dp_5"
android:text="192.168.1.199"
android:textSize="@dimen/dp_34" />
<Button
android:id="@+id/btnSetObuIP"
@@ -83,6 +87,23 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#B200BCD4"
android:padding="@dimen/dp_10"
android:text="域控制器(工控机)配置信息"
android:textColor="#000"
android:textSize="@dimen/dp_34"
android:textStyle="bold" />
<TextView
android:id="@+id/tvAutopilotInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000"
android:textSize="@dimen/dp_34" />
</LinearLayout>
</LinearLayout>

View File

@@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.obu.mogo
import android.content.Context
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.obu.ObuStatusInfo
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
@@ -39,7 +38,7 @@ class MogoPrivateObuManager private constructor() {
private var mMogoServiceApis: IMogoServiceApis? = null
private var mIMogoMapService: IMogoMapService? = null
private var mContext: Context? = null
private var mObuStatusInfo = ObuStatusInfo()
private var mObuStatusInfo = CallerObuListenerManager.getObuStatusInfo()
fun init(context: Context, ipAddress: String) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "obuManager初始化--")
@@ -447,7 +446,10 @@ class MogoPrivateObuManager private constructor() {
-> {
if (info.ext_info != null) {
// 计算为千米每小时 TODO 这里需要做一下向上取整数406080120等
Logger.d(MogoObuConst.TAG_MOGO_OBU, "info.ext_info.speed_limit_max ------> ${info.ext_info.speed_limit_max}")
Logger.d(
MogoObuConst.TAG_MOGO_OBU,
"info.ext_info.speed_limit_max ------> ${info.ext_info.speed_limit_max}"
)
CallerHmiManager.showLimitingVelocity((Math.ceil(((info.ext_info.speed_limit_max * 60 * 60) / 1000) / 10) * 10).toInt())
}
}