调试面板

控制中心增加车辆状态模块,目前会展示方向盘转向角和档位信息
This commit is contained in:
xuxinchao
2022-04-01 17:29:06 +08:00
parent 0d245e2210
commit 0d8ecec882
6 changed files with 162 additions and 4 deletions

View File

@@ -152,6 +152,10 @@ class MoGoAdasListenerImpl : OnAdasListener {
CallerAutopilotVehicleStateListenerManager.invokeAutopilotLightSwitchData(vehicleState.light)
//刹车灯数据
CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus)
//方向盘转向角数据
CallerAutopilotVehicleStateListenerManager.invokeAutopilotSteeringData(vehicleState.steering)
//挂挡档位数据
CallerAutopilotVehicleStateListenerManager.invokeAutopilotGearData(vehicleState.gear)
}
}

View File

@@ -1,7 +1,5 @@
package com.mogo.eagle.core.function.autopilot.adapter;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_DEVA;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
@@ -20,7 +18,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListen
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.module.common.drawer.IdentifyDataDrawer;
@@ -159,4 +156,22 @@ public class MoGoHandAdasMsgManager implements
}
}
/**
* 车辆方向盘转向角回调
* @param steering 方向盘转向角
*/
@Override
public void onAutopilotSteeringData(float steering) {
}
/**
* 车辆挂挡档位
* @param gear 档位
*/
@Override
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
}
}

View File

@@ -12,6 +12,7 @@ import androidx.annotation.RequiresApi
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import chassis.Chassis
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.debug.DebugConfig
@@ -77,7 +78,8 @@ class DebugSettingView @JvmOverloads constructor(
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener,
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener,
IMoGoMapLocationListener, IMoGoAutopilotIdentifyListener,
IMoGoAutopilotPlanningListener, IMoGoAutopilotCarConfigListener {
IMoGoAutopilotPlanningListener, IMoGoAutopilotCarConfigListener
,IMoGoAutopilotVehicleStateListener{
private val TAG = "DebugSettingView"
@@ -170,6 +172,8 @@ class DebugSettingView @JvmOverloads constructor(
CallerAutopilotPlanningListenerManager.addListener(TAG, this)
// 添加 工控机基础信息回调 监听
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
//添加 车辆底盘数据回调 监听
CallerAutopilotVehicleStateListenerManager.addListener(TAG,this)
if (logInfoView != null) {
logInfoView!!.onEnterForeground()
}
@@ -191,6 +195,11 @@ class DebugSettingView @JvmOverloads constructor(
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
// 移除 规划路径相关回调 监听
CallerAutopilotPlanningListenerManager.removeListener(TAG)
// 移除 工控机基础信息回调 监听
CallerAutopilotCarConfigListenerManager.removeListener(TAG)
//移除 车辆底盘数据回调 监听
CallerAutopilotVehicleStateListenerManager.removeListener(TAG)
if (logInfoView != null) {
logInfoView!!.onEnterBackground()
}
@@ -318,6 +327,21 @@ class DebugSettingView @JvmOverloads constructor(
}
}
/**
* 车辆状态控制中心
*/
tbVehicleStateController.setOnCheckedChangeListener { buttonView, isChecked ->
if(isChecked){
buttonView.setCompoundDrawables(null, null, iconDown, null)
//展示车辆状态中心
vehicleStateLayout.visibility = View.VISIBLE
} else {
buttonView.setCompoundDrawables(null, null, iconRight, null)
//隐藏车辆状态中心
vehicleStateLayout.visibility = View.GONE
}
}
/**
* HMI控制中心
*/
@@ -1615,6 +1639,38 @@ class DebugSettingView @JvmOverloads constructor(
tvObuDelay.text = "obu时延" + delayTime.toString()
}
/**
* 车辆转向灯 数据
* @param lightSwitch
*/
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
}
/**
* 车辆刹车灯 数据
* @param brakeLight
*/
override fun onAutopilotBrakeLightData(brakeLight: Boolean) {
}
/**
* 车辆方向盘转向角回调
* @param steering 方向盘转向角
*/
override fun onAutopilotSteeringData(steering: Float) {
tvSteeringInfo.text = "方向盘转向角:${steering}"
}
/**
* 车辆挂挡档位
* @param gear 档位
*/
override fun onAutopilotGearData(gear: Chassis.GearPosition) {
tvGearInfo.text = "挂挡档位:${gear}"
}
/**
* 吐司提示
*/

View File

@@ -843,6 +843,53 @@
app:layout_constraintTop_toBottomOf="@id/obuDivider2" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ToggleButton
android:id="@+id/tbVehicleStateController"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/setting_toggle_button_background"
android:drawableEnd="@drawable/icon_right"
android:padding="@dimen/dp_20"
android:textOff="车辆状态"
android:textOn="车辆状态"
/>
<LinearLayout
android:id="@+id/vehicleStateLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="@+id/tvSteeringInfo"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="方向盘转向角:"
/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0" />
<TextView
android:id="@+id/tvGearInfo"
style="@style/DebugSettingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="挂挡档位:"
/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F0F0F0" />
</LinearLayout>
<ToggleButton
android:id="@+id/tbHmiController"
android:layout_width="match_parent"