[dev_arch_opt_3.0]

[Change]
[1、拆分汽车底盘数据透出,都采用单个类型数据回调]

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2023-01-05 21:21:02 +08:00
parent 22198c92ec
commit 723540b9a4
26 changed files with 333 additions and 325 deletions

View File

@@ -37,7 +37,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutopilotStatusRespByQuery
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager.invokeAutopilotAbility
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager.invokeAutopilotCarConfigData
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager.invokeAutopilotCarStateData
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyDataUpdate
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotIdentifyPlanningObj
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager.invokeAutopilotWarnMessage
@@ -45,6 +44,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningAction
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordConfig
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordResult
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager.invokeAutopilotStatistics
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssInfoListenerManager.invokeAutopilotCarStateData
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager.invokeAutopilotRotting
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningTrajectoryListenerManager.invokeAutopilotTrajectory
import com.mogo.eagle.core.function.call.autopilot.CallerStartAutopilotFailedListenerManager.invokeStartAutopilotFailed
@@ -159,15 +159,15 @@ class MoGoAdasListenerImpl : OnAdasListener {
//刹车灯数据
CallerChassisLamplightListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus)
//方向盘转向角数据
CallerAutopilotVehicleStateListenerManager.invokeAutopilotSteeringData(vehicleState.steering)
CallerChassisSteeringStateListenerManager.invokeAutopilotSteeringData(vehicleState.steering)
//挂挡档位数据
CallerAutopilotVehicleStateListenerManager.invokeAutopilotGearData(vehicleState.gear)
CallerChassisGearStateListenerManager.invokeAutopilotGearData(vehicleState.gear)
//加速度
CallerAutopilotVehicleStateListenerManager.invokeAutopilotAcc(vehicleState.accel)
CallerChassisAccStateListenerManager.invokeAutopilotAcc(vehicleState.accel)
//油门
CallerAutopilotVehicleStateListenerManager.invokeAutopilotThrottle(vehicleState.throttle)
CallerChassisThrottleStateListenerManager.invokeAutopilotThrottle(vehicleState.throttle)
//刹车
CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrake(vehicleState.brake)
CallerChassisBrakeStateListenerManager.invokeAutopilotBrake(vehicleState.brake)
//清扫车(福田)清扫控制系统状态
vehicleState.sweeperFutianCleanSystemState?.also {
CallerSweeperFutianCleanSystemListenerManager.invokeSweeperFutianCleanSystemState(it)

View File

@@ -11,13 +11,11 @@ import androidx.annotation.Nullable;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.eagle.core.data.constants.MoGoConfig;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssInfoListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssInfoListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager;
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
@@ -30,9 +28,8 @@ import chassis.Chassis;
import mogo.telematics.pad.MessagePad;
public class MoGoHandAdasMsgManager implements
IMoGoAutopilotVehicleStateListener,
IMoGoAutopilotCarConfigListener,
IMoGoAutopilotCarStateListener,
IMoGoChassisGnssInfoListener,
IMoGoChassisLamplightListener {
private final String TAG = "AdasEventManager";
@@ -41,9 +38,8 @@ public class MoGoHandAdasMsgManager implements
private Context mContext;
private MoGoHandAdasMsgManager(Context context) {
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, this);
CallerAutopilotCarConfigListenerManager.INSTANCE.addListener(TAG, this);
CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, this);
CallerChassisGnssInfoListenerManager.INSTANCE.addListener(TAG, this);
CallerChassisLamplightListenerManager.INSTANCE.addListener(TAG, this);
mContext = context;
}
@@ -147,44 +143,4 @@ public class MoGoHandAdasMsgManager implements
}
}
/**
* 车辆方向盘转向角回调
*
* @param steering 方向盘转向角
*/
@Override
public void onAutopilotSteeringData(float steering) {
}
/**
* 车辆挂挡档位
*
* @param gear 档位
*/
@Override
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
}
@Override
public void onAutopilotDataException(long timestamp) {
}
@Override
public void onAutopilotAcc(float carAcc) {
}
@Override
public void onAutopilotThrottle(float throttle) {
}
@Override
public void onAutopilotBrake(float brake) {
}
}

View File

@@ -10,10 +10,10 @@ import android.widget.RadioButton
import android.widget.TextView
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssInfoListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssInfoListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
@@ -37,7 +37,7 @@ import java.util.*
* @since: 2022/7/12
*/
class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener,
IMoGoAutopilotRecordListener, IMoGoAutopilotCarStateListener {
IMoGoAutopilotRecordListener, IMoGoChassisGnssInfoListener {
companion object {
const val TAG = "AIDataCollectWindow"
@@ -117,7 +117,7 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
//采集结果回调监听
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(), this)
// 添加 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.addListener(this.hashCode().toString(), this)
CallerChassisGnssInfoListenerManager.addListener(this.hashCode().toString(), this)
//开始录制AI数据采集Bag包
CallerAutoPilotManager.recordPackage(
99,
@@ -341,7 +341,7 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener
//注销采集结果回调监听
CallerAutopilotRecordListenerManager.removeListener(this.hashCode().toString())
// 移除 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.removeListener(this.hashCode().toString())
CallerChassisGnssInfoListenerManager.removeListener(this.hashCode().toString())
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
}

View File

@@ -14,10 +14,10 @@ import android.widget.TextView
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.badcase.RecordCaseEntity
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssInfoListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssInfoListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
@@ -47,7 +47,7 @@ import java.util.*
* @since: 2022/7/13
*/
class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchListener,
IMoGoAutopilotRecordListener, IMoGoAutopilotCarStateListener {
IMoGoAutopilotRecordListener, IMoGoChassisGnssInfoListener {
companion object {
const val TAG = "InitiativeBadCaseWindow"
@@ -140,7 +140,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
//采集结果回调监听
CallerAutopilotRecordListenerManager.addListener(this.hashCode().toString(), this)
// 添加 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.addListener(this.hashCode().toString(), this)
CallerChassisGnssInfoListenerManager.addListener(this.hashCode().toString(), this)
viewAudioButton.setOnClickListener {
audioStatus = !audioStatus
setAudio(audioStatus)
@@ -367,7 +367,7 @@ class InitiativeBadCaseWindow constructor(activity: Activity) : View.OnTouchList
//注销采集结果回调监听
CallerAutopilotRecordListenerManager.removeListener(this.hashCode().toString())
// 移除 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.removeListener(this.hashCode().toString())
CallerChassisGnssInfoListenerManager.removeListener(this.hashCode().toString())
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
}

View File

@@ -17,8 +17,8 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.RecordBagMsg
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssInfoListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssInfoListenerManager
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
@@ -44,7 +44,7 @@ import java.io.File
* @since: 2022/7/17
*/
class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListener,
IMoGoAutopilotCarStateListener, CompoundButton.OnCheckedChangeListener {
IMoGoChassisGnssInfoListener, CompoundButton.OnCheckedChangeListener {
companion object {
const val TAG = "PassiveBadCaseWindow"
@@ -117,7 +117,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
"时间:${millis2String(System.currentTimeMillis(), TimeUtils.getHourMinSecondFormat())}"
tvPassiveIdentity.text = "身份:${BadCaseConfig.identity}"
// 添加 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
CallerChassisGnssInfoListenerManager.addListener(TAG, this)
viewAudioButton.setOnClickListener {
audioStatus = !audioStatus
setAudio(audioStatus)
@@ -361,7 +361,7 @@ class PassiveBadCaseWindow constructor(activity: Activity) : View.OnTouchListene
fun hideFloatWindow() {
// 移除 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
CallerChassisGnssInfoListenerManager.removeListener(TAG)
if (mFloatLayout.parent != null) mWindowManager!!.removeView(mFloatLayout)
}

View File

@@ -5,14 +5,8 @@ import android.util.Log
import chassis.Chassis.GearPosition
import chassis.Chassis.LightSwitch
import chassis.VehicleStateOuterClass
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
import com.mogo.eagle.core.function.api.autopilot.*
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
import com.zhjt.mogo_core_function_devatools.status.entity.CanStatus
import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
@@ -24,9 +18,17 @@ import mogo_msg.MogoReportMsg.MogoReportMessage
import system_master.SystemStatusInfo.StatusInfo
import java.util.concurrent.atomic.AtomicInteger
internal class CanImpl(ctx: Context):
internal class CanImpl(ctx: Context) :
IFlow<CanStatus>(ctx),
IMoGoAutopilotVehicleStateListener,
IMoGoChassisAccStateListener,
IMoGoChassisSteeringStateListener,
IMoGoChassisGearStateListener,
IMoGoChassisBrakeStateListener,
IMoGoChassisThrottleStateListener,
IMoGoAutopilotStatusListener,
IMoGoChassisLamplightListener,
IMoGoSweeperFutianCleanSystemListener {
@@ -40,7 +42,13 @@ internal class CanImpl(ctx: Context):
override fun onCreate() {
send(CanStatus(CallerAutoPilotManager.isConnected()))
CallerAutopilotVehicleStateListenerManager.addListener(TAG, this)
CallerChassisAccStateListenerManager.addListener(TAG, this)
CallerChassisBrakeStateListenerManager.addListener(TAG, this)
CallerChassisGearStateListenerManager.addListener(TAG, this)
CallerChassisSteeringStateListenerManager.addListener(TAG, this)
CallerChassisThrottleStateListenerManager.addListener(TAG, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerChassisLamplightListenerManager.addListener(TAG, this)
}
@@ -121,13 +129,19 @@ internal class CanImpl(ctx: Context):
launch(Dispatchers.Unconfined) {
delay(4000)
send(CanStatus(isCanEnabled()))
}.also { job = it }
}.also { job = it }
}
override fun onDestroy() {
super.onDestroy()
job?.safeCancel()
CallerAutopilotVehicleStateListenerManager.removeListener(TAG)
CallerChassisAccStateListenerManager.removeListener(TAG)
CallerChassisBrakeStateListenerManager.removeListener(TAG)
CallerChassisGearStateListenerManager.removeListener(TAG)
CallerChassisSteeringStateListenerManager.removeListener(TAG)
CallerChassisThrottleStateListenerManager.removeListener(TAG)
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerChassisLamplightListenerManager.removeListener(TAG)
}

View File

@@ -14,7 +14,7 @@ import system_master.SystemStatusInfo.HealthInfo
import system_master.SystemStatusInfo.StatusInfo
import java.util.concurrent.atomic.*
internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener {
internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatusListener, IMoGoChassisGnssInfoListener {
companion object {
const val TAG = "RTKImpl"
}
@@ -34,7 +34,7 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
send(RTKStatus(getDesc(), getCode()))
CallerLogger.d("$M_DEVA$TAG", "-- onCreate --")
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
CallerChassisGnssInfoListenerManager.addListener(TAG, this)
if (CallerAutoPilotManager.isConnected()) {
check()
}
@@ -95,7 +95,7 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
private fun isRTKEnabled(): Boolean {
val code = CallerAutoPilotStatusListenerManager.getAutoPilotReportMessageCode()
val gnssInfo = CallerAutopilotCarStatusListenerManager.getCurrentGnssInfo()
val gnssInfo = CallerChassisGnssInfoListenerManager.getCurrentGnssInfo()
return CallerAutoPilotManager.isConnected() && (
code != "EHW_RTK" &&
code != "EHW_GNSS" &&
@@ -117,6 +117,6 @@ internal class RTKImpl(ctx: Context): IFlow<RTKStatus>(ctx), IMoGoAutopilotStatu
isOldVersion.set(false)
CallerLogger.d("$M_DEVA$TAG", "-- onDestroy --")
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
CallerChassisGnssInfoListenerManager.removeListener(TAG)
}
}

View File

@@ -101,15 +101,19 @@ class DebugSettingView @JvmOverloads constructor(
) : ConstraintLayout(context, attrs, defStyleAttr),
IMoGoObuStatusListener,
IMoGoAutopilotStatusListener,
IMoGoAutopilotCarStateListener,
IMoGoChassisGnssInfoListener,
IMoGoMapLocationListener,
IMoGoAutopilotIdentifyListener,
IMoGoPlanningRottingListener,
IMoGoPlanningTrajectoryListener,
IMoGoAutopilotVehicleStateListener,
IMoGoDevaToolsFuncConfigListener,
IMoGoChassisLamplightListener,
IMoGoDevaToolsListener,
IMoGoChassisAccStateListener,
IMoGoChassisSteeringStateListener,
IMoGoChassisGearStateListener,
IMoGoChassisBrakeStateListener,
IMoGoChassisThrottleStateListener,
IMoGoSweeperFutianCleanSystemListener{
private val TAG = "DebugSettingView"
@@ -194,7 +198,7 @@ class DebugSettingView @JvmOverloads constructor(
// 添加 ADAS状态 监听
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
// 添加 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
CallerChassisGnssInfoListenerManager.addListener(TAG, this)
// 添加 地图样式改变 监听
CallerMapLocationListenerManager.addListener(TAG, this, false)
// 添加 域控制器感知数据 监听
@@ -203,7 +207,12 @@ class DebugSettingView @JvmOverloads constructor(
CallerPlanningRottingListenerManager.addListener(TAG, this)
CallerPlanningTrajectoryListenerManager.addListener(TAG, this)
//添加 车辆底盘数据回调 监听
CallerAutopilotVehicleStateListenerManager.addListener(TAG, this)
CallerChassisAccStateListenerManager.addListener(TAG, this)
CallerChassisBrakeStateListenerManager.addListener(TAG, this)
CallerChassisGearStateListenerManager.addListener(TAG, this)
CallerChassisSteeringStateListenerManager.addListener(TAG, this)
CallerChassisThrottleStateListenerManager.addListener(TAG, this)
//添加 开发套件工具接口 监听
CallerDevaToolsListenerManager.addListener(TAG, this)
//添加 底盘灯光数据 监听
@@ -232,7 +241,7 @@ class DebugSettingView @JvmOverloads constructor(
// 移除 ADAS状态 监听
CallerAutoPilotStatusListenerManager.removeListener(TAG)
// 移除 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
CallerChassisGnssInfoListenerManager.removeListener(TAG)
// 移除 地图样式改变 监听
CallerMapLocationListenerManager.removeListener(TAG, false)
// 移除 域控制器感知数据 监听
@@ -241,7 +250,11 @@ class DebugSettingView @JvmOverloads constructor(
CallerPlanningRottingListenerManager.removeListener(TAG)
CallerPlanningTrajectoryListenerManager.removeListener(TAG)
// 移除 车辆底盘数据回调 监听
CallerAutopilotVehicleStateListenerManager.removeListener(TAG)
CallerChassisAccStateListenerManager.removeListener(TAG)
CallerChassisBrakeStateListenerManager.removeListener(TAG)
CallerChassisGearStateListenerManager.removeListener(TAG)
CallerChassisSteeringStateListenerManager.removeListener(TAG)
CallerChassisThrottleStateListenerManager.removeListener(TAG)
// 移除 开发套件工具接口 监听
CallerDevaToolsListenerManager.removeListener(TAG)
// 移除 底盘灯光数据 监听

View File

@@ -18,9 +18,11 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
@@ -29,7 +31,6 @@ import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import org.jetbrains.annotations.NotNull;
import chassis.Chassis;
import chassis.VehicleStateOuterClass;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SystemStatusInfo;
@@ -41,7 +42,9 @@ import system_master.SystemStatusInfo;
* 档位随CAN数据做切换和高亮显示
* @since: 4/7/22
*/
public class SteeringWheelView extends ConstraintLayout {
public class SteeringWheelView extends ConstraintLayout implements
IMoGoChassisSteeringStateListener,
IMoGoChassisGearStateListener {
private static final String TAG = "SteeringWheelView";
private ImageView autopilotIV;
private TextView steeringTVL;
@@ -65,7 +68,8 @@ public class SteeringWheelView extends ConstraintLayout {
}
initView();
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, mIMoGoAutopilotVehicleStateListener);
CallerChassisGearStateListenerManager.INSTANCE.addListener(TAG, this);
CallerChassisSteeringStateListenerManager.INSTANCE.addListener(TAG, this);
tapPositionView.updateWithGear(Chassis.GearPosition.GEAR_R);
}
@@ -163,92 +167,59 @@ public class SteeringWheelView extends ConstraintLayout {
}
};
private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() {
/**
* @param brake 刹车
*/
@Override
public void onAutopilotBrake(float brake) {
/**
* 方向盘转向角 左+右-
* @param steering
*/
@Override
public void onAutopilotSteeringData(float steering) {
if (Math.abs(steering) < 1) {
steering = 0;
}
/**
* @param throttle 油门
*/
@Override
public void onAutopilotThrottle(float throttle) {
}
/**
* 车辆加速度
* @param carAcc
*/
@Override
public void onAutopilotAcc(float carAcc) {
}
/**
* 方向盘转向角 左+右-
* @param steering
*/
@Override
public void onAutopilotSteeringData(float steering) {
if (Math.abs(steering) < 1) {
steering = 0;
float steeringValue = steering;
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (steeringTVL != null && steeringValue > 0) {
steeringTVR.setVisibility(View.INVISIBLE);
steeringTVL.setVisibility(View.VISIBLE);
steeringTVL.setText(String.valueOf((int) steeringValue) + "°");
} else if (steeringTVR != null && steeringValue <= 0) {
steeringTVL.setVisibility(View.INVISIBLE);
steeringTVR.setVisibility(View.VISIBLE);
steeringTVR.setText(String.valueOf((int) -steeringValue) + "°");
} else {
CallerLogger.INSTANCE.d(TAG, "onAutopilotSteeringData error");
}
animationWithSteeringData(-steeringValue);
if (steeringCircularV != null) {
steeringCircularV.setProgress((int) (-steeringValue * 100) / 360, 20);
}
if (steeringCircularVAlpha != null) {
steeringCircularVAlpha.setProgress((int) (-steeringValue * 100) / 360, 20);
}
}
float steeringValue = steering;
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (steeringTVL != null && steeringValue > 0) {
steeringTVR.setVisibility(View.INVISIBLE);
steeringTVL.setVisibility(View.VISIBLE);
steeringTVL.setText(String.valueOf((int) steeringValue) + "°");
} else if (steeringTVR != null && steeringValue <= 0) {
steeringTVL.setVisibility(View.INVISIBLE);
steeringTVR.setVisibility(View.VISIBLE);
steeringTVR.setText(String.valueOf((int) -steeringValue) + "°");
} else {
CallerLogger.INSTANCE.d(TAG, "onAutopilotSteeringData error");
}
animationWithSteeringData(-steeringValue);
if (steeringCircularV != null) {
steeringCircularV.setProgress((int) (-steeringValue * 100) / 360, 20);
}
if (steeringCircularVAlpha != null) {
steeringCircularVAlpha.setProgress((int) (-steeringValue * 100) / 360, 20);
}
});
}
/**
* 档位
* @param gear
*/
@Override
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
CallerLogger.INSTANCE.d(TAG, "乘客屏档位" + gear.toString());
if (tapPositionView != null) {
tapPositionView.updateWithGear(gear);
}
});
}
});
}
/**
* 档位
* @param gear
*/
@Override
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
CallerLogger.INSTANCE.d(TAG, "乘客屏档位" + gear.toString());
if (tapPositionView != null) {
tapPositionView.updateWithGear(gear);
}
}
});
}
@Override
public void onAutopilotDataException(long timestamp) {
}
};
}
/**
* 方向盘随CAN数据做方向和角度旋转

View File

@@ -15,10 +15,16 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningActionsListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisBrakeStateListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateListenerManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
@@ -32,7 +38,11 @@ import chassis.Chassis;
* @description 速度 加速度 档位 刹车 油门状态值
* @since: 6/24/22
*/
public class TrafficDataView extends ConstraintLayout {
public class TrafficDataView extends ConstraintLayout implements
IMoGoChassisSteeringStateListener,
IMoGoChassisGearStateListener ,
IMoGoChassisBrakeStateListener,
IMoGoChassisThrottleStateListener {
private static final String TAG = "TrafficDataView";
private TapPositionView tapPositionView;
private TextView speedTextView;
@@ -100,7 +110,10 @@ public class TrafficDataView extends ConstraintLayout {
protected void onAttachedToWindow() {
super.onAttachedToWindow();
handler.sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L);
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, mIMoGoAutopilotVehicleStateListener);
CallerChassisSteeringStateListenerManager.INSTANCE.addListener(TAG, this);
CallerChassisGearStateListenerManager.INSTANCE.addListener(TAG, this);
CallerChassisBrakeStateListenerManager.INSTANCE.addListener(TAG, this);
CallerChassisThrottleStateListenerManager.INSTANCE.addListener(TAG, this);
CallerAutopilotPlanningActionsListenerManager.INSTANCE.addListener(TAG, planningActionMsg -> acceleration = planningActionMsg.getDestinationAcc());
}
@@ -116,63 +129,52 @@ public class TrafficDataView extends ConstraintLayout {
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
CallerAutopilotVehicleStateListenerManager.INSTANCE.removeListener(TAG);
CallerChassisSteeringStateListenerManager.INSTANCE.removeListener(TAG);
CallerChassisGearStateListenerManager.INSTANCE.removeListener(TAG);
CallerChassisBrakeStateListenerManager.INSTANCE.removeListener(TAG);
CallerChassisThrottleStateListenerManager.INSTANCE.removeListener(TAG);
CallerAutopilotPlanningActionsListenerManager.INSTANCE.removeListener(TAG);
}
private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() {
/**
* 方向盘转向角 左+右-
* @param steering
*/
@Override
public void onAutopilotSteeringData(float steering) {
CallerLogger.INSTANCE.d(TAG, "steering原始值====" + steering);
if (Math.abs(steering) < 1) {
steering = 0;
/**
* 方向盘转向角 左+右-
* @param steering
*/
@Override
public void onAutopilotSteeringData(float steering) {
CallerLogger.INSTANCE.d(TAG, "steering原始值====" + steering);
if (Math.abs(steering) < 1) {
steering = 0;
}
CallerLogger.INSTANCE.d(TAG, "steering忽略小数点后====" + (int) steering);
}
/**
* 档位
* @param gear
*/
@Override
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
CallerLogger.INSTANCE.d(TAG, "司机屏档位" + gear.toString());
ThreadUtils.runOnUiThread(() -> {
if (tapPositionView != null) {
tapPositionView.updateWithGear(gear);
}
CallerLogger.INSTANCE.d(TAG, "steering忽略小数点后====" + (int) steering);
}
});
}
/**
* 档位
* @param gear
*/
@Override
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
CallerLogger.INSTANCE.d(TAG, "司机屏档位" + gear.toString());
ThreadUtils.runOnUiThread(() -> {
if (tapPositionView != null) {
tapPositionView.updateWithGear(gear);
}
});
}
@Override
public void onAutopilotDataException(long timestamp) {
}
@Override
public void onAutopilotAcc(float carAcc) {
}
@Override
public void onAutopilotBrake(float brake) {
CallerLogger.INSTANCE.d(TAG, "刹车:" + brake);
mBrake = brake;
}
@Override
public void onAutopilotThrottle(float throttle) {
CallerLogger.INSTANCE.d(TAG, "油门:" + throttle);
mThrottle = throttle;
}
};
@Override
public void onAutopilotBrake(float brake) {
CallerLogger.INSTANCE.d(TAG, "刹车:" + brake);
mBrake = brake;
}
@Override
public void onAutopilotThrottle(float throttle) {
CallerLogger.INSTANCE.d(TAG, "油门:" + throttle);
mThrottle = throttle;
}
/**
* 设置弧形颜色
*

View File

@@ -1,43 +1,14 @@
package com.mogo.eagle.core.function.api.autopilot
import chassis.Chassis
/**
* 车辆底盘 数据 回调监听
*/
interface IMoGoAutopilotVehicleStateListener {
/**
* 车辆方向盘转向角回调
* @param steering 方向盘转向角
*/
fun onAutopilotSteeringData(steering: Float)
/**
* 车辆挂挡档位
* @param gear 档位
*/
fun onAutopilotGearData(gear: Chassis.GearPosition)
/**
* 没有自车状态数据
*/
fun onAutopilotDataException(timestamp: Long){}
/**
* 车辆加速度
*/
fun onAutopilotAcc(carAcc: Float)
/**
* 油门
*/
fun onAutopilotThrottle(throttle: Float)
/**
* 刹车
*/
fun onAutopilotBrake(brake: Float)
}

View File

@@ -0,0 +1,13 @@
package com.mogo.eagle.core.function.api.autopilot
/**
* 车辆加速度 数据 回调监听
*/
interface IMoGoChassisAccStateListener {
/**
* 车辆加速度
*/
fun onAutopilotAcc(carAcc: Float)
}

View File

@@ -0,0 +1,12 @@
package com.mogo.eagle.core.function.api.autopilot
/**
* 刹车 数据 回调监听
*/
interface IMoGoChassisBrakeStateListener {
/**
* 刹车
*/
fun onAutopilotBrake(brake: Float)
}

View File

@@ -0,0 +1,16 @@
package com.mogo.eagle.core.function.api.autopilot
import chassis.Chassis
/**
* 车辆挂挡档位 数据 回调监听
*/
interface IMoGoChassisGearStateListener {
/**
* 车辆挂挡档位
* @param gear 档位
*/
fun onAutopilotGearData(gear: Chassis.GearPosition)
}

View File

@@ -5,9 +5,9 @@ import mogo.telematics.pad.MessagePad
/**
*@author xiaoyuzhou
*@date 2021/11/2 2:06 下午
* 车辆状态&定位 数据 数据 回调监听
* 车辆定位 数据 数据 回调监听
*/
interface IMoGoAutopilotCarStateListener {
interface IMoGoChassisGnssInfoListener {
/**
* 车辆状态&定位 数据

View File

@@ -3,7 +3,7 @@ package com.mogo.eagle.core.function.api.autopilot
/**
* 车辆方向盘转向角 数据 回调监听
*/
interface IMoGoSteeringStateListener {
interface IMoGoChassisSteeringStateListener {
/**
* 车辆方向盘转向角回调

View File

@@ -0,0 +1,12 @@
package com.mogo.eagle.core.function.api.autopilot
/**
* 油门 数据 回调监听
*/
interface IMoGoChassisThrottleStateListener {
/**
* 油门
*/
fun onAutopilotThrottle(throttle: Float)
}

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.function.api.autopilot
import com.zhidao.support.adas.high.bean.AutopilotAbility
import mogo_msg.MogoReportMsg

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.function.call.autopilot
import chassis.Chassis
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
@@ -12,59 +11,6 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase<IMoGoAutopilotVeh
@Volatile
private var timeStamp: Long = 0L
/**
* 车辆方向盘转向角回调
* @param steering 方向盘转向角
*/
fun invokeAutopilotSteeringData(steering: Float){
M_LISTENERS.forEach{
val listener = it.value
listener.onAutopilotSteeringData(steering)
}
}
/**
* 车辆挂挡档位
* @param gear 档位
*/
fun invokeAutopilotGearData(gear: Chassis.GearPosition){
M_LISTENERS.forEach{
val listener = it.value
listener.onAutopilotGearData(gear)
}
}
/**
* 车辆加速度
* acc 加速度
*/
fun invokeAutopilotAcc(carAcc: Float){
M_LISTENERS.forEach{
val listener = it.value
listener.onAutopilotAcc(carAcc)
}
}
/**
* throttle 油门
*/
fun invokeAutopilotThrottle(throttle: Float){
M_LISTENERS.forEach{
val listener = it.value
listener.onAutopilotThrottle(throttle)
}
}
/**
* brake 刹车
*/
fun invokeAutopilotBrake(brake: Float){
M_LISTENERS.forEach{
val listener = it.value
listener.onAutopilotBrake(brake)
}
}
/**
* 工控机时间回调
*/

View File

@@ -0,0 +1,22 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisAccStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 车辆加速度 回调监听
*/
object CallerChassisAccStateListenerManager : CallerBase<IMoGoChassisAccStateListener>() {
/**
* 车辆加速度
* acc 加速度
*/
fun invokeAutopilotAcc(carAcc: Float) {
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotAcc(carAcc)
}
}
}

View File

@@ -0,0 +1,21 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 车辆挂挡档位 回调监听
*/
object CallerChassisBrakeStateListenerManager : CallerBase<IMoGoChassisBrakeStateListener>() {
/**
* brake 刹车
*/
fun invokeAutopilotBrake(brake: Float){
M_LISTENERS.forEach{
val listener = it.value
listener.onAutopilotBrake(brake)
}
}
}

View File

@@ -0,0 +1,22 @@
package com.mogo.eagle.core.function.call.autopilot
import chassis.Chassis
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 车辆挂挡档位 回调监听
*/
object CallerChassisGearStateListenerManager : CallerBase<IMoGoChassisGearStateListener>() {
/**
* 车辆挂挡档位
* @param gear 档位
*/
fun invokeAutopilotGearData(gear: Chassis.GearPosition) {
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotGearData(gear)
}
}
}

View File

@@ -1,6 +1,6 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGnssInfoListener
import com.mogo.eagle.core.function.call.base.CallerBase
import mogo.telematics.pad.MessagePad
@@ -9,7 +9,7 @@ import mogo.telematics.pad.MessagePad
* @date 2021/9/30 5:48 下午
* 车辆状态&定位 数据 数据 回调监听
*/
object CallerAutopilotCarStatusListenerManager : CallerBase<IMoGoAutopilotCarStateListener>() {
object CallerChassisGnssInfoListenerManager : CallerBase<IMoGoChassisGnssInfoListener>() {
@Volatile
private var gnssInfo: MessagePad.GnssInfo? = null
@@ -32,5 +32,4 @@ object CallerAutopilotCarStatusListenerManager : CallerBase<IMoGoAutopilotCarSta
}
}
}

View File

@@ -1,12 +1,12 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoSteeringStateListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 车辆方向盘转向角 回调监听
*/
object CallerSteeringStateListenerManager : CallerBase<IMoGoSteeringStateListener>() {
object CallerChassisSteeringStateListenerManager : CallerBase<IMoGoChassisSteeringStateListener>() {
/**
* 车辆方向盘转向角回调

View File

@@ -0,0 +1,20 @@
package com.mogo.eagle.core.function.call.autopilot
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* throttle 油门 回调监听
*/
object CallerChassisThrottleStateListenerManager : CallerBase<IMoGoChassisThrottleStateListener>() {
/**
* throttle 油门
*/
fun invokeAutopilotThrottle(throttle: Float) {
M_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotThrottle(throttle)
}
}
}

View File

@@ -17,7 +17,6 @@ object CallerPlanningTrajectoryListenerManager : CallerBase<IMoGoPlanningTraject
*/
@Synchronized
fun invokeAutopilotTrajectory(trajectoryInfo: MutableList<MessagePad.TrajectoryPoint>) {
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value