[Feat]添加自动驾驶设置车速功能

This commit is contained in:
chenfufeng
2021-12-10 16:14:42 +08:00
parent d2f20a0e4c
commit d4a9ccede9
13 changed files with 317 additions and 7 deletions

View File

@@ -114,7 +114,7 @@ ext {
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.3", obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.3",
mogoobu : 'com.zhidao.support.obu:mogoobu:1.0.0.19', mogoobu : 'com.zhidao.support.obu:mogoobu:1.0.0.19',
mogoami : 'com.zhidao.support.obu.ami:mogoami:1.0.0.10', mogoami : 'com.zhidao.support.obu.ami:mogoami:1.0.0.10',
adasHigh : 'com.zhidao.support.adas:high:1.2.0.14', adasHigh : 'com.zhidao.support.adas:high:1.2.1.1',
// google // google
googlezxing : "com.google.zxing:core:3.3.3", googlezxing : "com.google.zxing:core:3.3.3",

View File

@@ -57,7 +57,7 @@ class MoGoAutopilotProvider :
} }
override fun recordPackage(): Boolean { override fun recordPackage(): Boolean {
return AdasManager.getInstance().recordPackage() return AdasManager.getInstance().recordPackage(1, (System.currentTimeMillis() / 1000).toInt())
} }
override fun setEnableLog(isEnableLog: Boolean) { override fun setEnableLog(isEnableLog: Boolean) {
@@ -72,5 +72,7 @@ class MoGoAutopilotProvider :
} }
override fun setAutoPilotSpeed(speed: Int) {
AdasManager.getInstance().setSpeed(speed)
}
} }

View File

@@ -18,6 +18,7 @@ import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWaringProvider
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.call.check.CallerCheckManager
import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager import com.mogo.eagle.core.function.call.monitor.CallerMonitorManager
import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.WaringConst import com.mogo.eagle.core.function.hmi.WaringConst
@@ -29,9 +30,11 @@ import com.mogo.eagle.core.function.hmi.ui.camera.CameraListView
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeBannerView import com.mogo.eagle.core.function.hmi.ui.notice.NoticeBannerView
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeNormalBannerView import com.mogo.eagle.core.function.hmi.ui.notice.NoticeNormalBannerView
import com.mogo.eagle.core.function.hmi.ui.setting.DebugSettingView import com.mogo.eagle.core.function.hmi.ui.setting.DebugSettingView
import com.mogo.eagle.core.function.hmi.ui.tools.AutoPilotAndCheckView
import com.mogo.eagle.core.function.hmi.ui.utils.visible import com.mogo.eagle.core.function.hmi.ui.utils.visible
import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView
import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.module.common.enums.EventTypeEnum import com.mogo.module.common.enums.EventTypeEnum
import com.mogo.utils.logger.Logger import com.mogo.utils.logger.Logger
import kotlinx.android.synthetic.main.fragment_hmi.* import kotlinx.android.synthetic.main.fragment_hmi.*
@@ -62,6 +65,10 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
private var cameraListView: CameraListView? = null private var cameraListView: CameraListView? = null
private var cameraViewFloat: WarningFloat.Builder? = null private var cameraViewFloat: WarningFloat.Builder? = null
private var toolsView: AutoPilotAndCheckView? = null
// 检测、自动驾驶速度设置
private var toolsViewFloat: WarningFloat.Builder? = null
override fun vipIdentification(visible: Boolean) { override fun vipIdentification(visible: Boolean) {
ThreadUtils.runOnUiThread { ThreadUtils.runOnUiThread {
Logger.d(TAG, "vipIdentification") Logger.d(TAG, "vipIdentification")
@@ -80,6 +87,11 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
showCameraList(CallerMonitorManager.getCameraList()) showCameraList(CallerMonitorManager.getCameraList())
} }
} }
viewCheckStatus?.setOnClickListener {
if (toolsViewFloat == null) {
showToolsFloat()
}
}
viewShowDebugView.setOnLongClickListener { viewShowDebugView.setOnLongClickListener {
Log.d(TAG, "长按显示状态工具栏") Log.d(TAG, "长按显示状态工具栏")
@@ -126,6 +138,65 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
} }
} }
private fun showToolsFloat() {
Logger.d(TAG, "showToolsFloat")
context?.let {
if (toolsViewFloat == null) {
if (toolsView == null) {
toolsView = AutoPilotAndCheckView(it)
toolsView!!.setClickListener(object : AutoPilotAndCheckView.ClickListener {
override fun go2CheckPage() {
// 启动检测页面
CallerCheckManager.startCheckActivity(context)
dismissToolsFloatView()
}
override fun onClose(v: View) {
dismissToolsFloatView()
}
})
}
toolsViewFloat = WarningFloat.with(it)
.setTag("ToolsViewFloat")
.setLayout(toolsView!!)
.setSidePattern(SidePattern.LEFT)
.setGravity(Gravity.LEFT, offsetY = 72)
.setImmersionStatusBar(true)
.setAnimator(object : DefaultAnimator() {
override fun enterAnim(
view: View,
params: WindowManager.LayoutParams,
windowManager: WindowManager,
sidePattern: SidePattern
): Animator? =
super.enterAnim(view, params, windowManager, sidePattern)
?.apply {
interpolator = OvershootInterpolator()
}
override fun exitAnim(
view: View,
params: WindowManager.LayoutParams,
windowManager: WindowManager,
sidePattern: SidePattern
): Animator? =
super.exitAnim(view, params, windowManager, sidePattern)
?.setDuration(200)
})
.addWarningStatusListener(object : IMoGoWarningStatusListener {
override fun onDismiss() {
toolsViewFloat = null
toolsView = null
// TODO:("")
}
})
.show()
} else {
toolsViewFloat?.show()
}
}
}
/** /**
* 根据配置文件初始化视图显示 * 根据配置文件初始化视图显示
*/ */
@@ -468,6 +539,18 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
cameraListView?.showNoSignal() cameraListView?.showNoSignal()
} }
override fun showToolsView() {
if (toolsViewFloat == null) {
showToolsFloat()
} else {
ToastUtils.showShort("弹窗状态有误!")
}
}
override fun hideToolsView() {
dismissToolsFloatView()
}
private fun showCameraList(cameraList: List<CameraEntity>?) { private fun showCameraList(cameraList: List<CameraEntity>?) {
context?.let { context?.let {
if (cameraViewFloat == null) { if (cameraViewFloat == null) {
@@ -544,6 +627,14 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
} }
} }
private fun dismissToolsFloatView() {
toolsViewFloat?.let {
WarningFloat.dismiss(it.config.floatTag, false)
toolsViewFloat = null
toolsView = null
}
}
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
Log.d(TAG, "onDestroy") Log.d(TAG, "onDestroy")

View File

@@ -0,0 +1,59 @@
package com.mogo.eagle.core.function.hmi.ui.tools
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
import com.mogo.eagle.core.function.call.check.CallerCheckManager
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_auto_pilot_check.view.*
/**
* @author ChenFufeng
* 设置自动驾驶速度和检测页入口
*/
class AutoPilotAndCheckView : FrameLayout {
private val TAG = "AutoPilotAndCheckView"
private var clickListener: ClickListener? = null
@JvmOverloads
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : super(
context,
attrs,
defStyleAttr
)
init {
LayoutInflater.from(context).inflate(R.layout.view_auto_pilot_check, this, true)
initView()
}
private fun initView() {
ivCloseIcon.setOnClickListener {
clickListener?.onClose(it)
}
ivCheckIcon.setOnClickListener {
clickListener?.go2CheckPage()
}
}
fun setClickListener(clickListener: ClickListener) {
this.clickListener = clickListener
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
}
interface ClickListener {
fun go2CheckPage()
fun onClose(v: View)
}
}

View File

@@ -27,10 +27,10 @@ class CheckStatusView @JvmOverloads constructor(
setBackgroundResource(R.drawable.module_ext_check) setBackgroundResource(R.drawable.module_ext_check)
setOnClickListener { // setOnClickListener {
// 启动检测页面 // // 启动检测页面
CallerCheckManager.startCheckActivity(getContext()) // CallerCheckManager.startCheckActivity(getContext())
} // }
} }
private fun showErrorIcon() { private fun showErrorIcon() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#263869" />
<corners android:radius="20px" />
<stroke android:color="#5EBFFF" android:width="2px" />
</shape>

View File

@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="960px"
android:layout_height="1600px"
android:background="@color/notice_check_dialog_bg_color"
>
<View
android:layout_width="14px"
android:layout_height="50px"
android:background="#FF2966EC"
android:layout_marginStart="80px"
android:layout_marginTop="158px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<TextView
android:layout_width="84px"
android:layout_height="86px"
android:text="检测"
android:textColor="#FFFFFFFF"
android:textSize="42px"
android:layout_marginStart="113px"
android:layout_marginTop="140px"
android:gravity="center"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<ImageView
android:id="@+id/ivCheckIcon"
android:layout_width="150px"
android:layout_height="150px"
android:layout_marginTop="266px"
android:layout_marginStart="113px"
android:background="@drawable/check_car_nor"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvCheck"
android:layout_width="128px"
android:layout_height="42px"
android:text="车辆检测"
android:textColor="#FFA7B6F0"
android:textSize="32px"
android:layout_marginStart="124px"
android:layout_marginTop="23px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivCheckIcon"
/>
<View
android:layout_width="14px"
android:layout_height="50px"
android:background="#FF2966EC"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCheck"
android:layout_marginTop="94px"
android:layout_marginStart="80px"
/>
<TextView
android:id="@+id/tvSpeedTitle"
android:layout_width="168px"
android:layout_height="86px"
android:text="车速设置"
android:textColor="#FFFFFFFF"
android:textSize="42px"
android:gravity="center"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCheck"
android:layout_marginStart="113px"
android:layout_marginTop="76px"
/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="390px"
android:layout_height="140px"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSpeedTitle"
android:background="@drawable/pilot_speed_bg"
android:layout_marginTop="40px"
android:layout_marginStart="113px"
>
<androidx.appcompat.widget.AppCompatEditText
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginStart="92px"
android:textColor="#FFFFFFFF"
android:text="30"
android:textSize="80px"
android:gravity="center"
/>
<TextView
android:layout_width="93px"
android:layout_height="53px"
android:text="km/h"
android:textColor="#B3FFFFFF"
android:textSize="38px"
android:layout_marginEnd="28px"
/>
</androidx.appcompat.widget.LinearLayoutCompat>
<ImageView
android:id="@+id/ivCloseIcon"
android:layout_width="107px"
android:layout_height="107px"
android:layout_marginTop="65px"
android:layout_marginEnd="40px"
android:background="@drawable/icon_close_nor"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="500px"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@color/notice_blue"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -56,4 +56,5 @@ public interface IMoGoAutopilotProvider extends IMoGoFunctionServerProvider {
*/ */
void setIsWriteLog(boolean isWriteLog); void setIsWriteLog(boolean isWriteLog);
void setAutoPilotSpeed(int speed);
} }

View File

@@ -144,4 +144,8 @@ interface IMoGoWaringProvider {
fun startRoadCameraLive(flvUrl: String) fun startRoadCameraLive(flvUrl: String)
fun showNoSignView() fun showNoSignView()
fun showToolsView()
fun hideToolsView()
} }

View File

@@ -63,4 +63,7 @@ object CallerAutoPilotManager {
providerApi.setIsWriteLog(isWriteLog) providerApi.setIsWriteLog(isWriteLog)
} }
fun setAutoPilotSpeed(speed: Int) {
providerApi.setAutoPilotSpeed(speed)
}
} }

View File

@@ -200,4 +200,12 @@ object CallerHmiManager : CallerBase() {
fun showNoSignalView() { fun showNoSignalView() {
waringProviderApi.showNoSignView() waringProviderApi.showNoSignView()
} }
fun showToolsView() {
waringProviderApi.showToolsView()
}
fun hideToolsView() {
waringProviderApi.hideToolsView()
}
} }

View File

@@ -28,6 +28,7 @@ import com.zhidao.support.adas.high.bean.RectInfo;
import com.zhidao.support.adas.high.bean.TrajectoryInfo; import com.zhidao.support.adas.high.bean.TrajectoryInfo;
import com.zhidao.support.adas.high.bean.WarnMessageInfo; import com.zhidao.support.adas.high.bean.WarnMessageInfo;
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo; import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo;
import com.zhidao.support.adas.high.bean.record.AutopilotRecordResult;
import com.zhidao.support.obu.ami.AmiClientManager; import com.zhidao.support.obu.ami.AmiClientManager;
import java.util.ArrayList; import java.util.ArrayList;
@@ -150,6 +151,11 @@ public class OnAdasListenerAdapter implements OnAdasListener {
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotGuardian(autopilotRoute); CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotGuardian(autopilotRoute);
} }
@Override
public void onAutopilotRecord(AutopilotRecordResult result) {
}
@Override @Override
public void onLightStateData(LightStatueInfo lightStatueInfo) { public void onLightStateData(LightStatueInfo lightStatueInfo) {