From db18f6947141db929dd8cc6df705e4700b64acc7 Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Thu, 20 Oct 2022 18:00:28 +0800 Subject: [PATCH] =?UTF-8?q?SOP=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autopilot/MoGoAutopilotProvider.kt | 23 ++ .../function/hmi/ui/setting/SOPSettingView.kt | 159 ++++++++++++++ .../src/main/res/drawable-xxhdpi/icon_add.png | Bin 0 -> 387 bytes .../main/res/drawable-xxhdpi/icon_reduce.png | Bin 0 -> 302 bytes .../src/main/res/layout/view_sop_setting.xml | 196 ++++++++++++++++++ .../core/function/obu/mogo/MoGoObuProvider.kt | 7 + .../obu/mogo/MogoPrivateObuManager.kt | 8 + .../core/data/config/FunctionBuildConfig.kt | 16 ++ .../api/autopilot/IMoGoAutopilotProvider.kt | 15 ++ .../core/function/api/obu/IMoGoObuProvider.kt | 3 + .../call/autopilot/CallerAutoPilotManager.kt | 19 ++ .../function/call/obu/CallerOBUManager.kt | 15 ++ 12 files changed, 461 insertions(+) create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_add.png create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_reduce.png create mode 100644 core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt index 1368eae5ec..02e192cb3c 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt @@ -496,6 +496,29 @@ class MoGoAutopilotProvider : } } + /** + * 绕障类功能开关 + * isEnable = true 开启 + * isEnable = false 关闭 + * @return boolean + */ + override fun sendDetouring(isEnable: Boolean): Boolean { + return if(isEnable){ + AdasManager.getInstance().sendDetouring(1) + }else{ + AdasManager.getInstance().sendDetouring(0) + } + } + + /** + * 变道绕障的目标障碍物速度阈值 + * @param speed 速度阈值 m/s + * @return boolean + */ + override fun sendDetouringSpeed(speed: Double): Boolean { + return AdasManager.getInstance().sendDetouringSpeed(speed) + } + /** * 获取数据采集录制模式配置列表 */ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt new file mode 100644 index 0000000000..a9cb80c07c --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt @@ -0,0 +1,159 @@ +package com.mogo.eagle.core.function.hmi.ui.setting + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.data.config.FunctionBuildConfig +import com.mogo.eagle.core.data.config.HmiBuildConfig +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.obu.CallerOBUManager +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils +import com.mogo.eagle.core.utilcode.util.ToastUtils +import com.mogo.module.service.routeoverlay.RouteStrategy +import kotlinx.android.synthetic.main.view_sop_setting.view.* + +/** + * SOP设置窗口 + */ +class SOPSettingView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr){ + + init { + LayoutInflater.from(context).inflate(R.layout.view_sop_setting, this, true) + initView() + } + + private fun initView() { + //绕障类功能开关 + tbObstacleAvoidance.isChecked = FunctionBuildConfig.isDetouring + tbObstacleAvoidance.setOnCheckedChangeListener { _, isChecked -> + CallerAutoPilotManager.sendDetouring(isChecked) + FunctionBuildConfig.isDetouring = isChecked + } + + //危险障碍物颜色标记开关 + tbMarkingObstacles.setOnCheckedChangeListener { _, isChecked -> + + } + + //引导线动态效果 + tbRouteDynamicEffect.isChecked = + AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) && !AppIdentityModeUtils.isBus( + FunctionBuildConfig.appIdentityMode + ) + tbRouteDynamicEffect.setOnCheckedChangeListener { _, isChecked -> + if (isChecked) { + RouteStrategy.enable(true) + } else { + RouteStrategy.enable(false) + } + } + + //红绿灯标识 + tbTrafficLight.isChecked = HmiBuildConfig.isShowTrafficLightView + tbTrafficLight.setOnCheckedChangeListener { _, isChecked -> + if(!isChecked){ + HmiBuildConfig.isShowTrafficLightView = false + }else{ + HmiBuildConfig.isShowTrafficLightView = true + CallerHmiManager.disableWarningTrafficLight() + } + } + + //限速标识 + tbSpeedLimit.isChecked = HmiBuildConfig.isShowLimitingVelocityView + tbSpeedLimit.setOnCheckedChangeListener { _, isChecked -> + if(isChecked){ + HmiBuildConfig.isShowLimitingVelocityView = true + }else{ + HmiBuildConfig.isShowLimitingVelocityView = false + CallerHmiManager.disableLimitingVelocity() + } + } + + //自车感知到的他车碰撞预警 + tbCollisionWarning.setOnCheckedChangeListener { buttonView, isChecked -> + + } + + // 演示模式,上一次勾选的数据 + tbDemoMode.isChecked = FunctionBuildConfig.isDemoMode + // 演示模式 + tbDemoMode.setOnCheckedChangeListener { _, isChecked -> + CallerAutoPilotManager.setDemoMode(isChecked) + if (!isChecked) { + //关闭美化模式时,通知工控机 + CallerAutoPilotManager.setIPCDemoMode(isChecked) + } + FunctionBuildConfig.isDemoMode = isChecked + } + //只在司机端设置美化模式开关功能 + if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { + tbDemoMode.visibility = View.GONE + } + + + // 雨天模式,上一次勾选的数据 + tbRainMode.isChecked = FunctionBuildConfig.isRainMode + //雨天模式 + tbRainMode.setOnCheckedChangeListener { _, isChecked -> + CallerAutoPilotManager.setRainMode(isChecked) + FunctionBuildConfig.isRainMode = isChecked + } + //雨天模式按钮只在司机屏生效,乘客屏不显示 + if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { + tbRainMode.visibility = View.GONE + } + + //OBU控制总开关 + tbObu.isChecked = CallerOBUManager.isConnected() + tbObu.setOnCheckedChangeListener { _, isChecked -> + if(!isChecked){ + if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){ + CallerOBUManager.resetObuIpAddress("192.168.1.199") + }else if(AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)){ + CallerOBUManager.resetObuIpAddress("192.168.8.199") + } + }else{ + //断开链接 + CallerOBUManager.disConnectObu() + } + } + + //变道绕障的目标障碍物速度阈值 + tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s" + ivSpeedReduce.setOnClickListener { + if(FunctionBuildConfig.detouringSpeed<=0){ + ToastUtils.showShort("阈值小可为0 m/s") + }else{ + FunctionBuildConfig.detouringSpeed-- + tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s" + } + } + ivSpeedAdd.setOnClickListener { + if(FunctionBuildConfig.detouringSpeed>=7){ + ToastUtils.showShort("阈值最大可为7 m/s") + }else{ + FunctionBuildConfig.detouringSpeed++ + tvSpeed.text = "${FunctionBuildConfig.detouringSpeed} m/s" + } + } + btnSpeedSet.setOnClickListener { + val isSuccess = CallerAutoPilotManager.sendDetouringSpeed(FunctionBuildConfig.detouringSpeed.toDouble()) + if(isSuccess == true){ + ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置成功") + }else{ + ToastUtils.showShort("变道绕障的目标障碍物速度阈值设置失败") + } + } + + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_add.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xxhdpi/icon_add.png new file mode 100644 index 0000000000000000000000000000000000000000..429d1196be1f24b7497827644df0ac5cf0b6ed9e GIT binary patch literal 387 zcmV-}0et?6P)Nkl19vEUu_z5wPGoI~$0!Ya@a#E@wqyRIXxdSJ6zQp%s^pq&G{P(Zq zeR5IbqcmQ>5C8`>t^ix0aRYD&rfq?UI2(rHu9WiCb=^nb_pcdl%oN~R((ShBjqR(} z1Q@0T+fHdl%A#Z85rF_WV4?t9fHQzYFy%l_S(L8;pFwf}L5L(s6ov(WAz%m?`cnWJ zga#|6!HBq&bT4U~*EEj0Xq~0Oh zqwR6tJ7xt~s%T&c7y^cXAz%m?0)~DSfCiz#N@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +