SOP面板

This commit is contained in:
xuxinchao
2022-10-20 18:00:28 +08:00
parent 27bf4fe7be
commit db18f69471
12 changed files with 461 additions and 0 deletions

View File

@@ -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)
}
/**
* 获取数据采集录制模式配置列表
*/

View File

@@ -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("变道绕障的目标障碍物速度阈值设置失败")
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

View File

@@ -0,0 +1,196 @@
<?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"
android:layout_width="@dimen/dp_800"
android:layout_height="@dimen/dp_1100"
android:background="#FFFFFF">
<!--绕障类功能-->
<ToggleButton
android:id="@+id/tbObstacleAvoidance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="开启绕障类功能"
android:textOn="关闭绕障类功能"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toTopOf="parent"
/>
<!--危险障碍物颜色标记-->
<ToggleButton
android:id="@+id/tbMarkingObstacles"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="开启「危险障碍物颜色标记」"
android:textOn="关闭「危险障碍物颜色标记」"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbObstacleAvoidance"
/>
<!--引导线动态效果-->
<ToggleButton
android:id="@+id/tbRouteDynamicEffect"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="开启「引导线动态效果」"
android:textOn="关闭「引导线动态效果」"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbMarkingObstacles"
/>
<!--红绿灯标识-->
<ToggleButton
android:id="@+id/tbTrafficLight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="隐藏红绿灯标识"
android:textOn="展示红绿灯标识"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbRouteDynamicEffect"
/>
<!--限速标识-->
<ToggleButton
android:id="@+id/tbSpeedLimit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="展示限速标识"
android:textOn="隐藏限速标识"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbTrafficLight"
/>
<!--自车感知到的他车碰撞预警-->
<ToggleButton
android:id="@+id/tbCollisionWarning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="开启「自车感知到的他车碰撞预警」"
android:textOn="关闭「自车感知到的他车碰撞预警」"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbSpeedLimit"
/>
<ToggleButton
android:id="@+id/tbDemoMode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="开启美化模式"
android:textOn="关闭美化模式"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbCollisionWarning"
/>
<ToggleButton
android:id="@+id/tbRainMode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="开启雨天模式"
android:textOn="关闭雨天模式"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbDemoMode"
/>
<ToggleButton
android:id="@+id/tbObu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/radio_button_normal_background_right"
android:textColor="#000"
android:textOff="关闭OBU"
android:textOn="开启OBU"
android:textSize="@dimen/dp_24"
app:layout_constraintTop_toBottomOf="@id/tbRainMode"
/>
<TextView
android:id="@+id/tvSpeedThresholdTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tbObu"
android:text="变道速度阈值:"
android:textSize="18sp"
android:textColor="#1A1A1A"
android:layout_margin="10dp"
/>
<ImageView
android:id="@+id/ivSpeedReduce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@id/tvSpeedThresholdTitle"
app:layout_constraintTop_toTopOf="@id/tvSpeedThresholdTitle"
app:layout_constraintBottom_toBottomOf="@id/tvSpeedThresholdTitle"
android:src="@drawable/icon_reduce"
android:padding="10dp"
/>
<TextView
android:id="@+id/tvSpeed"
android:layout_width="wrap_content"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="@id/ivSpeedReduce"
app:layout_constraintBottom_toBottomOf="@id/ivSpeedReduce"
app:layout_constraintLeft_toRightOf="@id/ivSpeedReduce"
android:textSize="18sp"
android:gravity="center"
android:background="@drawable/debug_setting_edit_bg"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
/>
<ImageView
android:id="@+id/ivSpeedAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/tvSpeed"
app:layout_constraintBottom_toBottomOf="@id/tvSpeed"
app:layout_constraintLeft_toRightOf="@id/tvSpeed"
android:src="@drawable/icon_add"
android:padding="10dp"
/>
<Button
android:id="@+id/btnSpeedSet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/ivSpeedAdd"
app:layout_constraintBottom_toBottomOf="@id/ivSpeedAdd"
app:layout_constraintLeft_toRightOf="@id/ivSpeedAdd"
android:text="设置阈值"
android:layout_marginStart="10dp"
/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="#F0F0F0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnSpeedSet"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -54,5 +54,12 @@ class MoGoObuProvider : IMoGoObuProvider {
}
override fun disConnect() {
MogoPrivateObuManager.INSTANCE.disConnectObu()
}
override fun isConnected(): Boolean {
return MogoPrivateObuManager.INSTANCE.isConnected()
}
}

View File

@@ -77,6 +77,14 @@ class MogoPrivateObuManager private constructor() {
}
}
fun disConnectObu(){
MogoObuManager.getInstance().disConnect()
}
fun isConnected(): Boolean{
return MogoObuManager.getInstance().isConnected
}
private val mogoObuListener: OnMogoObuListener = object : OnMogoObuListener() {
// OBU连接成功
override fun onConnected() {

View File

@@ -29,6 +29,22 @@ object FunctionBuildConfig {
@JvmField
var isRainMode = false
/**
* 是否开启绕障类功能
* 默认开启
*/
@Volatile
@JvmField
var isDetouring = true
/**
* 变道绕障的目标障碍物速度阈值
* 默认 3 m/s
*/
@Volatile
@JvmField
var detouringSpeed = 3
/**
* 是否是感知优化模式
* 默认开启

View File

@@ -151,6 +151,21 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider {
*/
fun setRainMode(isEnable: Boolean)
/**
* 绕障类功能开关
* isEnable = true 开启
* isEnable = false 关闭
* @return boolean
*/
fun sendDetouring(isEnable: Boolean): Boolean
/**
* 变道绕障的目标障碍物速度阈值
* @param speed 速度阈值 m/s
* @return boolean
*/
fun sendDetouringSpeed(speed: Double): Boolean
/**
* 获取数据采集录制模式配置列表
*/

View File

@@ -11,4 +11,7 @@ interface IMoGoObuProvider : IMoGoFunctionServerProvider {
fun connect(ipAddress: String)
fun disConnect()
fun isConnected(): Boolean
}

View File

@@ -228,6 +228,25 @@ object CallerAutoPilotManager {
providerApi?.setRainMode(isEnable)
}
/**
* 绕障类功能开关
* isEnable = true 开启
* isEnable = false 关闭
* @return boolean
*/
fun sendDetouring(isEnable: Boolean): Boolean?{
return providerApi?.sendDetouring(isEnable)
}
/**
* 变道绕障的目标障碍物速度阈值
* @param speed 速度阈值 m/s
* @return boolean
*/
fun sendDetouringSpeed(speed: Double): Boolean?{
return providerApi?.sendDetouringSpeed(speed)
}
/**
* 获取数据采集录制模式配置列表
*/

View File

@@ -26,4 +26,19 @@ object CallerOBUManager {
providerApi.connect(ipAddress)
}
/**
* 断开OBU连接
*/
fun disConnectObu(){
providerApi.disConnect()
}
/**
* 获取OBU连接状态
* @return boolean 连接状态
*/
fun isConnected(): Boolean{
return providerApi.isConnected()
}
}