[644][adas] 能否启动自驾 添加原始数据日志

This commit is contained in:
xinfengkun
2024-05-22 20:01:14 +08:00
parent d8f7b53444
commit 98edf0ca49
23 changed files with 432 additions and 178 deletions

View File

@@ -14,7 +14,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.ParseVersionUtils;
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback;
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
import com.zhjt.mogo.adas.data.bean.LaunchConditionData;
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason;
import java.util.ArrayList;
@@ -29,7 +29,7 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo
private static final String TAG = OCHAdasAbilityManager.class.getSimpleName();
private boolean isAutopilotAbility;
private UnableLaunchData unableLaunchData;
private LaunchConditionData launchConditionData;
private ArrayList<UnableLaunchReason> unableAutopilotReasons;
private String startFailedCode = "";
private String startFailedMessage = "";
@@ -46,7 +46,7 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo
public void init(Context context) {
this.isAutopilotAbility = CallerAutopilotActionsListenerManager.INSTANCE.isAutopilotAbility();
this.unableLaunchData = CallerAutopilotActionsListenerManager.INSTANCE.getUnableLaunchData();
this.launchConditionData = CallerAutopilotActionsListenerManager.INSTANCE.getLaunchConditionData();
this.unableAutopilotReasons = CallerAutopilotActionsListenerManager.INSTANCE.getUnableAutopilotReasons();
initListeners();
}
@@ -60,7 +60,7 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo
}
public String getOriginalData() {
return unableLaunchData == null ? "" : unableLaunchData.getJson();
return launchConditionData == null ? "" : launchConditionData.getJson();
}
public String getAutopilotUnAbilityReason(){
try {
@@ -103,11 +103,11 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener, IMo
}
@Override
public void onAutopilotAbility(boolean isAutopilotAbility,@Nullable UnableLaunchData unableLaunchData, @Nullable ArrayList<UnableLaunchReason> unableAutopilotReasons) {
public void onAutopilotAbility(boolean isAutopilotAbility, @Nullable LaunchConditionData launchConditionData, @Nullable ArrayList<UnableLaunchReason> unableAutopilotReasons) {
this.isAutopilotAbility = isAutopilotAbility;
this.unableLaunchData = unableLaunchData;
this.launchConditionData = launchConditionData;
this.unableAutopilotReasons = unableAutopilotReasons;
Logger.d(TAG, "是否可以启动自动驾驶=" + isAutopilotAbility + " 原因=" + (unableAutopilotReasons == null ? null : unableAutopilotReasons.toString()) + " 原始数据=" + (unableLaunchData == null ? null : unableLaunchData.getJson()));
Logger.d(TAG, "是否可以启动自动驾驶=" + isAutopilotAbility + " 原因=" + (unableAutopilotReasons == null ? null : unableAutopilotReasons.toString()) + " 原始数据=" + (launchConditionData == null ? null : launchConditionData.getJson()));
if (unableAutopilotReasons != null && getMapVersion() < 30600) {
//刹车变化回调
Logger.d(TAG,"onAutopilotAbility = " + isAutopilotAbility +

View File

@@ -18,7 +18,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateLis
import com.mogo.eagle.core.function.main.MainLauncherActivity
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.zhjt.mogo.adas.data.bean.MogoReport
import com.zhjt.mogo.adas.data.bean.UnableLaunchData
import com.zhjt.mogo.adas.data.bean.LaunchConditionData
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.SourceType.CHASSIS
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_BRAKE
@@ -146,38 +146,92 @@ class TestAutoPilotBeforeLaunch {
CallerAutopilotActionsListenerManager.setConnected(true)
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE
if (flag == 1) {
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, UnableLaunchData("", SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder().setSysState(SYS_RUNNING).build(), SsmStatusInf.getDefaultInstance().toBuilder().setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false).setRemotePilotReady(false).build(), FSMStatusReasonRespond.getDefaultInstance()), ArrayList<UnableLaunchReason>().also {
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false,
LaunchConditionData(
"",
SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder()
.setSysState(SYS_RUNNING).build(),
SsmStatusInf.getDefaultInstance().toBuilder()
.setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false)
.setRemotePilotReady(false).build(),
FSMStatusReasonRespond.getDefaultInstance()
), ArrayList<UnableLaunchReason>().also {
it += UnableLaunchReason(CHASSIS, CHASSIS_GEAR, "gear")
})
}
if (flag == 2) {
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, UnableLaunchData("", SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder().setSysState(SYS_RUNNING).build(), SsmStatusInf.getDefaultInstance().toBuilder().setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false).setRemotePilotReady(false).build(), FSMStatusReasonRespond.getDefaultInstance()), ArrayList<UnableLaunchReason>().also {
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false,
LaunchConditionData(
"",
SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder()
.setSysState(SYS_RUNNING).build(),
SsmStatusInf.getDefaultInstance().toBuilder()
.setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false)
.setRemotePilotReady(false).build(),
FSMStatusReasonRespond.getDefaultInstance()
), ArrayList<UnableLaunchReason>().also {
it += UnableLaunchReason(CHASSIS, CHASSIS_STEERING, "steering")
})
}
if (flag == 3) {
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, UnableLaunchData("", SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder().setSysState(SYS_RUNNING).build(), SsmStatusInf.getDefaultInstance().toBuilder().setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false).setRemotePilotReady(false).build(), FSMStatusReasonRespond.getDefaultInstance()), ArrayList<UnableLaunchReason>().also {
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false,
LaunchConditionData(
"",
SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder()
.setSysState(SYS_RUNNING).build(),
SsmStatusInf.getDefaultInstance().toBuilder()
.setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false)
.setRemotePilotReady(false).build(),
FSMStatusReasonRespond.getDefaultInstance()
), ArrayList<UnableLaunchReason>().also {
it += UnableLaunchReason(CHASSIS, CHASSIS_BRAKE, "brake")
})
}
if (flag == 4) {
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, UnableLaunchData("", SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder().setSysState(SYS_RUNNING).build(), SsmStatusInf.getDefaultInstance().toBuilder().setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false).setRemotePilotReady(false).build(), FSMStatusReasonRespond.getDefaultInstance()), ArrayList<UnableLaunchReason>().also {
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false,
LaunchConditionData(
"",
SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder()
.setSysState(SYS_RUNNING).build(),
SsmStatusInf.getDefaultInstance().toBuilder()
.setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false)
.setRemotePilotReady(false).build(),
FSMStatusReasonRespond.getDefaultInstance()
), ArrayList<UnableLaunchReason>().also {
it += UnableLaunchReason(CHASSIS, CHASSIS_HAZARD_LIGHTS, "lights")
})
}
if (flag == 5) {
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, UnableLaunchData("", SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder().setSysState(SYS_RUNNING).build(), SsmStatusInf.getDefaultInstance().toBuilder().setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false).setRemotePilotReady(false).build(), FSMStatusReasonRespond.getDefaultInstance()), ArrayList<UnableLaunchReason>().also {
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false,
LaunchConditionData(
"",
SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder()
.setSysState(SYS_RUNNING).build(),
SsmStatusInf.getDefaultInstance().toBuilder()
.setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false)
.setRemotePilotReady(false).build(),
FSMStatusReasonRespond.getDefaultInstance()
), ArrayList<UnableLaunchReason>().also {
it += UnableLaunchReason(CHASSIS, CHASSIS_THROTTLE, "throttle")
})
}
if (flag == 6) {
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false, UnableLaunchData("", SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder().setSysState(SYS_RUNNING).build(), SsmStatusInf.getDefaultInstance().toBuilder().setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false).setRemotePilotReady(false).build(), FSMStatusReasonRespond.getDefaultInstance()), ArrayList<UnableLaunchReason>().also {
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(false,
LaunchConditionData(
"",
SystemStatusInfo.StatusInfo.getDefaultInstance().toBuilder()
.setSysState(SYS_RUNNING).build(),
SsmStatusInf.getDefaultInstance().toBuilder()
.setModeState(ModeState.MODE_RUN_READY).setAutoPilotReady(false)
.setRemotePilotReady(false).build(),
FSMStatusReasonRespond.getDefaultInstance()
), ArrayList<UnableLaunchReason>().also {
it += UnableLaunchReason(CHASSIS, CHASSIS_GEAR, "gear")
it += UnableLaunchReason(CHASSIS, CHASSIS_STEERING, "steering")
it += UnableLaunchReason(CHASSIS, CHASSIS_HAZARD_LIGHTS, "lights")

View File

@@ -59,11 +59,10 @@ import com.mogo.support.obu.ObuScene
import com.zhidao.support.adas.high.OnAdasListener
import com.zhjt.mogo.adas.data.bean.AdasParam
import com.zhidao.support.adas.high.common.ProtocolStatus
import com.zhjt.mogo.adas.data.AdasConstants
import com.zhjt.mogo.adas.data.AiCloudTask
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
import com.zhjt.mogo.adas.data.bean.ReceivedAck
import com.zhjt.mogo.adas.data.bean.UnableLaunchData
import com.zhjt.mogo.adas.data.bean.LaunchConditionData
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask
@@ -168,6 +167,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
header: MessagePad.Header,
vehicleState: VehicleStateOuterClass.VehicleState?
) {
CallerAutopilotActionsListenerManager.setVehicleState(vehicleState)
if (vehicleState != null) {
//转向灯数据
// CallerChassisLamplightListenerManager.invokeAutopilotLightSwitchData(vehicleState.light)
@@ -230,6 +230,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
header: MessagePad.Header,
chassisStates: ChassisStatesOuterClass.ChassisStates?
) {
CallerAutopilotActionsListenerManager.setChassisStates(chassisStates)
if (chassisStates != null) {
chassisStates.bcmSystemStates?.let { bcmSystemStates ->
// bcmSystemStates.turnLightState?.let {
@@ -937,13 +938,13 @@ class MoGoAdasListenerImpl : OnAdasListener {
*/
override fun onAutopilotAbility(
isAutopilotAbility: Boolean,
unableLaunchData: UnableLaunchData,
launchConditionData: LaunchConditionData,
unableAutopilotReasons: ArrayList<UnableLaunchReason>?
) {
if (unableAutopilotReasons != null && unableAutopilotReasons.size > 0) {
autopilotAbilityCheck(isAutopilotAbility, unableAutopilotReasons.toString(), unableLaunchData)
autopilotAbilityCheck(isAutopilotAbility, unableAutopilotReasons.toString(), launchConditionData)
}
invokeAutopilotAbility(isAutopilotAbility, unableLaunchData, unableAutopilotReasons)
invokeAutopilotAbility(isAutopilotAbility, launchConditionData, unableAutopilotReasons)
}
override fun onParallelDrivingAbility(
@@ -968,7 +969,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
nodeAliasCode = CHAIN_CODE_ADAS_ABILITY,
paramIndexes = [0, 1]
)
private fun autopilotAbilityCheck(isAutopilotAbility: Boolean, reason: String, unableLaunchData: UnableLaunchData) {
private fun autopilotAbilityCheck(isAutopilotAbility: Boolean, reason: String, launchConditionData: LaunchConditionData) {
}

View File

@@ -9,6 +9,7 @@ import androidx.lifecycle.Lifecycle.Event
import androidx.lifecycle.Lifecycle.Event.ON_CREATE
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
import com.mogo.commons.utils.MogoAnalyticUtils
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager
import com.mogo.eagle.core.utilcode.kotlin.*
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.mogo.eagle.core.utilcode.util.*
@@ -192,6 +193,7 @@ object StatusManager {
if (source != -2) {
l.filter { it.isException() }.also { ll ->
val time = System.currentTimeMillis()
val launchCondition = CallerAutopilotActionsListenerManager.getLaunchCondition()
ThreadUtils.getIoPool().execute {
val result = runCatching {
MogoAnalyticUtils.track(
@@ -210,6 +212,7 @@ object StatusManager {
else -> "其它"
}
}
itx["launch_condition"] = launchCondition
itx["data"] = GsonUtils.toJson(ll)
})
}

View File

@@ -5,7 +5,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateListenerManager
import com.zhjt.mogo.adas.data.bean.UnableLaunchData
import com.zhjt.mogo.adas.data.bean.LaunchConditionData
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_THROTTLE
import com.zhjt.mogo_core_function_devatools.status.entity.AcceleratorStatus
@@ -47,7 +47,7 @@ internal class AcceleratorImpl(ctx: Context): IFlow<AcceleratorStatus>(ctx), IMo
}
}
override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
if (!isAutopilotAbility) {
val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_THROTTLE }?.also { itx ->
isError = true

View File

@@ -5,7 +5,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisBrakeStateListenerManager
import com.zhjt.mogo.adas.data.bean.UnableLaunchData
import com.zhjt.mogo.adas.data.bean.LaunchConditionData
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_BRAKE
import com.zhjt.mogo_core_function_devatools.status.entity.BrakeStatus
@@ -46,7 +46,7 @@ internal class BrakeImpl(ctx: Context): IFlow<BrakeStatus>(ctx), IMoGoChassisBra
}
}
override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
if (!isAutopilotAbility) {
val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_BRAKE }?.also { itx ->
isError = true

View File

@@ -8,11 +8,9 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.zhjt.mogo.adas.data.bean.UnableLaunchData
import com.zhjt.mogo.adas.data.bean.LaunchConditionData
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_HAZARD_LIGHTS
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_THROTTLE
import com.zhjt.mogo_core_function_devatools.status.entity.AcceleratorStatus
import com.zhjt.mogo_core_function_devatools.status.entity.DoubleFlashStatus
import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
@@ -54,7 +52,7 @@ internal class DoubleFlashImpl(ctx: Context): IFlow<DoubleFlashStatus>(ctx), IMo
}
override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
if (!isAutopilotAbility) {
val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_HAZARD_LIGHTS }?.also { itx ->
isError = true

View File

@@ -7,12 +7,10 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.zhjt.mogo.adas.data.bean.UnableLaunchData
import com.zhjt.mogo.adas.data.bean.LaunchConditionData
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_GEAR
import com.zhjt.mogo_core_function_devatools.status.entity.GearStatus
import com.zhjt.mogo_core_function_devatools.status.entity.SteerStatus
import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
internal class GearImpl(ctx: Context): IFlow<GearStatus>(ctx), IMoGoChassisGearStateListener, IMoGoAutopilotActionsListener {
@@ -48,7 +46,7 @@ internal class GearImpl(ctx: Context): IFlow<GearStatus>(ctx), IMoGoChassisGearS
}
}
override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
if (!isAutopilotAbility) {
val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_GEAR }?.also { itx ->
isError = true

View File

@@ -6,7 +6,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListe
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.zhjt.mogo.adas.data.bean.UnableLaunchData
import com.zhjt.mogo.adas.data.bean.LaunchConditionData
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_STEERING
import com.zhjt.mogo_core_function_devatools.status.entity.SteerStatus
@@ -45,8 +45,8 @@ internal class SteerImpl(ctx: Context): IFlow<SteerStatus>(ctx), IMoGoChassisSte
}
}
override fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
Logger.d(TAG, "onAutopilotAbility->($isAutopilotAbility, $unableLaunchData, ${unableAutopilotReasons?.joinToString(",")}")
override fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?) {
Logger.d(TAG, "onAutopilotAbility->($isAutopilotAbility, $launchConditionData, ${unableAutopilotReasons?.joinToString(",")}")
if (!isAutopilotAbility) {
val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_STEERING }?.also { itx ->
isError = true

View File

@@ -1,6 +1,6 @@
package com.mogo.eagle.core.function.api.autopilot
import com.zhjt.mogo.adas.data.bean.UnableLaunchData
import com.zhjt.mogo.adas.data.bean.LaunchConditionData
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
@@ -9,5 +9,5 @@ import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
*/
interface IMoGoAutopilotActionsListener {
fun onAutopilotAbility(isAutopilotAbility: Boolean, unableLaunchData: UnableLaunchData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?)
fun onAutopilotAbility(isAutopilotAbility: Boolean, launchConditionData: LaunchConditionData?, unableAutopilotReasons: ArrayList<UnableLaunchReason>?)
}

View File

@@ -1,9 +1,14 @@
package com.mogo.eagle.core.function.call.autopilot
import chassis.ChassisStatesOuterClass
import chassis.VehicleStateOuterClass
import com.google.protobuf.TextFormat
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.zhjt.mogo.adas.data.bean.UnableLaunchData
import com.zhjt.mogo.adas.data.bean.LaunchConditionData
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
import org.json.JSONException
import org.json.JSONObject
/**
@@ -17,16 +22,27 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
private var isAutopilotAbility: Boolean = false
@Volatile
private var unableLaunchData: UnableLaunchData? = null
private var launchConditionData: LaunchConditionData? = null
@Volatile
private var unableAutopilotReasons: ArrayList<UnableLaunchReason>? = null
private var vehicleState: VehicleStateOuterClass.VehicleState? = null
private var chassisStates: ChassisStatesOuterClass.ChassisStates? = null
init {
isAutopilotAbility = false
unableAutopilotReasons = disconnectedReason()
}
fun setVehicleState(vehicleState: VehicleStateOuterClass.VehicleState?) {
this.vehicleState = vehicleState;
}
fun setChassisStates(chassisStates: ChassisStatesOuterClass.ChassisStates?) {
this.chassisStates = chassisStates;
}
private fun disconnectedReason(): ArrayList<UnableLaunchReason> {
val list = ArrayList<UnableLaunchReason>()
list.add(
@@ -47,12 +63,134 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
}
//获取域控发的原始数据目前包括新老SSM和FM数据
fun getOriginalData(): String {
return unableLaunchData?.json ?: ""
fun getLaunchConditionOriginalData(): String {
return launchConditionData?.json ?: ""
}
fun getUnableLaunchData(): UnableLaunchData? {
return unableLaunchData
fun getLaunchConditionData(): LaunchConditionData? {
return launchConditionData
}
fun getLaunchCondition(): String {
val jsonObject = JSONObject()
val chassisStatesObject = JSONObject()
val vehicleStateObject = JSONObject()
if (chassisStates != null) {
try {
if (chassisStates!!.hasHeader()) {
chassisStatesObject.put(
"data_header", TextFormat.printer().escapingNonAscii(false).printToString(
chassisStates!!.header
)
)
}
//制动踏板
var temp = "未知"
if (chassisStates!!.hasBrakeSystemStates()) {
val brake = chassisStates!!.brakeSystemStates.brakePedalResponsePosition
temp = brake.toString()
}
chassisStatesObject.put("brake", temp)
//油门踏板
temp = "未知"
if (chassisStates!!.hasDrivingSystemStates()) {
val throttle = chassisStates!!.drivingSystemStates.throttleResponsePosition
temp = throttle.toString()
}
chassisStatesObject.put("throttle", temp)
//档位
temp = "未知"
if (chassisStates!!.hasGearSystemStates()) {
val gear = chassisStates!!.gearSystemStates.gearPosition
temp = gear.name
}
chassisStatesObject.put("gear", temp)
//方向盘
temp = "未知"
if (chassisStates!!.hasSteerSystemStates()) {
val steerSystemStates = chassisStates!!.steerSystemStates
if (steerSystemStates.hasSteeringWheelAngle()) {
val throttle = steerSystemStates.steeringWheelAngle
temp = throttle.toString()
}
}
chassisStatesObject.put("steering", temp)
//车灯
temp = "未知"
if (chassisStates!!.hasBcmSystemStates()) {
val bcm = chassisStates!!.bcmSystemStates
temp = bcm.turnLightState.name
}
chassisStatesObject.put("light", temp)
} catch (e: Exception) {
e.printStackTrace()
}
}
if (vehicleState != null) {
if (vehicleState!!.hasHeader()) {
vehicleStateObject.put(
"data_header", TextFormat.printer().escapingNonAscii(false).printToString(
vehicleState!!.header
)
)
}
try {
//制动踏板
var temp = "未知"
if (vehicleState!!.hasBrake()) {
val brake = vehicleState!!.brake
temp = brake.toString()
}
vehicleStateObject.put("brake", temp)
//油门踏板
temp = "未知"
if (vehicleState!!.hasThrottle()) {
val throttle = vehicleState!!.throttle
temp = throttle.toString()
}
vehicleStateObject.put("throttle", temp)
//档位
temp = "未知"
if (vehicleState!!.hasGear()) {
val gear = vehicleState!!.gear
temp = gear.name
}
vehicleStateObject.put("gear", temp)
//方向盘
temp = "未知"
if (vehicleState!!.hasSteering()) {
val steering = vehicleState!!.steering
temp = steering.toString()
}
vehicleStateObject.put("steering", temp)
//车灯
temp = "未知"
if (vehicleState!!.hasLight()) {
val light = vehicleState!!.light
temp = light.name
}
vehicleStateObject.put("light", temp)
} catch (e: Exception) {
e.printStackTrace()
}
}
try {
jsonObject.put("chassis_states", chassisStatesObject)
} catch (e: JSONException) {
e.printStackTrace()
}
try {
jsonObject.put("vehicle_state", vehicleStateObject)
} catch (e: JSONException) {
e.printStackTrace()
}
try {
jsonObject.put("launch_condition_data", launchConditionData?.json ?: "")
} catch (e: JSONException) {
e.printStackTrace()
}
return jsonObject.toString()
}
/**
@@ -75,9 +213,10 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
@Synchronized
fun invokeAutopilotAbility(
isAutopilotAbility: Boolean,
unableLaunchData: UnableLaunchData,
launchCondition: LaunchConditionData,
unableAutopilotReasons: ArrayList<UnableLaunchReason>?
) {
this.launchConditionData = launchCondition
if (isConnected) {
var isEquals = true
if (unableAutopilotReasons != null && this.unableAutopilotReasons != null) {
@@ -92,7 +231,6 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
!(unableAutopilotReasons != null || this.unableAutopilotReasons != null)
if (this.isAutopilotAbility != isAutopilotAbility || !isEquals) {
this.isAutopilotAbility = isAutopilotAbility
this.unableLaunchData = unableLaunchData
this.unableAutopilotReasons = unableAutopilotReasons
notification()
}
@@ -104,7 +242,7 @@ object CallerAutopilotActionsListenerManager : CallerBase<IMoGoAutopilotActionsL
val listener = it.value
listener.onAutopilotAbility(
isAutopilotAbility,
unableLaunchData,
launchConditionData,
unableAutopilotReasons
)
}

View File

@@ -0,0 +1,163 @@
package com.zhjt.mogo.adas.data.bean;
import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.TextFormat;
import com.google.protobuf.util.JsonFormat;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import chassis.Chassis;
import chassis.ChassisStatesOuterClass;
import function_state_management.FSMStatusReasonQueryOuterClass;
import system_master.SsmInfo;
import system_master.SystemStatusInfo;
/**
* 检测启动自动驾驶的数据
* 此类目前主要用于启动自驾命令下发后的域控数据记录
*/
public class LaunchConditionData {
/**
* 所使用的检测版本
*/
public final String abilityVersion;
/**
* 底盘数据
* null表示未用到此数据
*/
public final ChassisStatesOuterClass.ChassisStates chassisStates;
public final Chassis.LightSwitch light;
public final float oldSteering;
/**
* 老SSM数据
* null表示未用到此数据
*/
public final SystemStatusInfo.StatusInfo statusInfo;
/**
* 新SSM数据
* null表示未用到此数据
*/
public final SsmInfo.SsmStatusInf ssmInfo;
public final FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond;//FSM数据
public final long createTime;
public LaunchConditionData(String abilityVersion,
SystemStatusInfo.StatusInfo statusInfo,
SsmInfo.SsmStatusInf ssmInfo,
FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond) {
this(abilityVersion, null, Float.MAX_VALUE, null, statusInfo, ssmInfo, fsmStatusReasonRespond);
}
public LaunchConditionData(String abilityVersion,
ChassisStatesOuterClass.ChassisStates chassisStates,
float oldSteering,
Chassis.LightSwitch light,
SystemStatusInfo.StatusInfo statusInfo,
SsmInfo.SsmStatusInf ssmInfo,
FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond) {
this.abilityVersion = abilityVersion;
this.chassisStates = chassisStates;
this.oldSteering = oldSteering;
this.light = light;
this.statusInfo = statusInfo;
this.ssmInfo = ssmInfo;
this.fsmStatusReasonRespond = fsmStatusReasonRespond;
createTime = System.currentTimeMillis();
}
public String getJson() {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("ability_version", abilityVersion);
jsonObject.put("create_object_time", createTime);
JSONArray array = new JSONArray();
JSONObject chassisStatesObject = new JSONObject();
chassisStatesObject.put("name", "ChassisStates");
if (chassisStates != null) {
if (chassisStates.hasHeader()) {
chassisStatesObject.put("data_header", TextFormat.printer().escapingNonAscii(false).printToString(chassisStates.getHeader()));
}
//制动踏板
String temp = "未知";
if (chassisStates.hasBrakeSystemStates()) {
float brake = chassisStates.getBrakeSystemStates().getBrakePedalResponsePosition();
temp = String.valueOf(brake);
}
chassisStatesObject.put("brake", temp);
//油门踏板
temp = "未知";
if (chassisStates.hasDrivingSystemStates()) {
float throttle = chassisStates.getDrivingSystemStates().getThrottleResponsePosition();
temp = String.valueOf(throttle);
}
chassisStatesObject.put("throttle", temp);
//档位
temp = "未知";
if (chassisStates.hasGearSystemStates()) {
Chassis.GearPosition gear = chassisStates.getGearSystemStates().getGearPosition();
temp = gear.name();
}
chassisStatesObject.put("gear", temp);
//方向盘
temp = "未知";
if (chassisStates.hasSteerSystemStates()) {
ChassisStatesOuterClass.SteerSystemStates steerSystemStates = chassisStates.getSteerSystemStates();
if (steerSystemStates.hasSteeringWheelAngle()) {
float steering = steerSystemStates.getSteeringWheelAngle();
temp = String.valueOf(steering);
}
}
chassisStatesObject.put("old_steering", oldSteering == Float.MAX_VALUE ? "未知" : oldSteering);
chassisStatesObject.put("steering", temp);
}
//车灯
if (light != null) {
chassisStatesObject.put("light", light.name());
}
array.put(chassisStatesObject);
if (statusInfo != null) {
arrayPut(array, statusInfo.getClass().getName(), statusInfo.getAutoPilotReady(), statusInfo.getAutoPilotUnreadyReason());
}
if (ssmInfo != null) {
arrayPut(array, ssmInfo.getClass().getName(), ssmInfo.getAutoPilotReady(), ssmInfo.getAutoPilotUnreadyReason());
}
if (fsmStatusReasonRespond != null) {
arrayPut(array, fsmStatusReasonRespond);
}
if (array.length() > 0) {
jsonObject.put("data", array);
}
} catch (Exception e) {
e.printStackTrace();
}
return jsonObject.toString();
}
private void arrayPut(JSONArray array, String name, boolean isReady, String reason) throws JSONException {
JSONObject objectParse = new JSONObject();
objectParse.put("auto_pilot_ready", isReady);
if (reason != null) {
objectParse.put("auto_pilot_unready_reason", reason);
}
JSONObject object = new JSONObject();
object.put("name", name);
object.put("parse", objectParse);
array.put(object);
}
private void arrayPut(JSONArray array, GeneratedMessageV3 message) throws JSONException, InvalidProtocolBufferException {
JSONObject object = new JSONObject();
object.put("name", message.getClass().getName());
// object.put("original", ByteUtil.byteArrToHex(message.toByteArray(), false));
object.put("parse", new JSONObject(JsonFormat.printer().print(message)));
array.put(object);
}
}

View File

@@ -1,104 +0,0 @@
package com.zhjt.mogo.adas.data.bean;
import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.util.JsonFormat;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import function_state_management.FSMStatusReasonQueryOuterClass;
import system_master.SsmInfo;
import system_master.SystemStatusInfo;
/**
* 检测到不能启动自动驾驶的数据
* 此类目前主要用于启动自驾命令下发后的域控数据记录
*/
public class UnableLaunchData {
/**
* 所使用的检测版本
*/
public final String abilityVersion;
/**
* 老底盘数据
* null表示未用到此数据
* TODO 不需要底盘数据,如果底盘数据存在不能启动自驾的原因会限制启动自驾命令的下发
*/
// public final VehicleStateOuterClass.VehicleState vehicleState;
/**
* 新底盘数据
* null表示未用到此数据
* TODO 不需要底盘数据,如果底盘数据存在不能启动自驾的原因会限制启动自驾命令的下发
*/
// public final ChassisStatesOuterClass.ChassisStates chassisStates;
/**
* 老SSM数据
* null表示未用到此数据
*/
public final SystemStatusInfo.StatusInfo statusInfo;
/**
* 新SSM数据
* null表示未用到此数据
*/
public final SsmInfo.SsmStatusInf ssmInfo;
public final FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond;//FSM数据
public UnableLaunchData(String abilityVersion,
SystemStatusInfo.StatusInfo statusInfo,
SsmInfo.SsmStatusInf ssmInfo,
FSMStatusReasonQueryOuterClass.FSMStatusReasonRespond fsmStatusReasonRespond) {
this.abilityVersion = abilityVersion;
this.statusInfo = statusInfo;
this.ssmInfo = ssmInfo;
this.fsmStatusReasonRespond = fsmStatusReasonRespond;
}
public String getJson() {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("ability_version", abilityVersion);
JSONArray array = new JSONArray();
if (statusInfo != null) {
arrayPut(array, statusInfo.getClass().getName(), statusInfo.getAutoPilotReady(), statusInfo.getAutoPilotUnreadyReason());
}
if (ssmInfo != null) {
arrayPut(array, ssmInfo.getClass().getName(), ssmInfo.getAutoPilotReady(), ssmInfo.getAutoPilotUnreadyReason());
}
if (fsmStatusReasonRespond != null) {
arrayPut(array, fsmStatusReasonRespond);
}
if (array.length() > 0) {
jsonObject.put("data", array);
}
} catch (JSONException | InvalidProtocolBufferException e) {
e.printStackTrace();
}
return jsonObject.toString();
}
private void arrayPut(JSONArray array, String name, boolean isReady, String reason) throws JSONException {
JSONObject objectParse = new JSONObject();
objectParse.put("auto_pilot_ready", isReady);
if (reason != null) {
objectParse.put("auto_pilot_unready_reason", reason);
}
JSONObject object = new JSONObject();
object.put("name", name);
object.put("parse", objectParse);
array.put(object);
}
private void arrayPut(JSONArray array, GeneratedMessageV3 message) throws JSONException, InvalidProtocolBufferException {
JSONObject object = new JSONObject();
object.put("name", message.getClass().getName());
// object.put("original", ByteUtil.byteArrToHex(message.toByteArray(), false));
object.put("parse", new JSONObject(JsonFormat.printer().print(message)));
array.put(object);
}
}

View File

@@ -58,12 +58,12 @@ public class UnableLaunchReason {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UnableLaunchReason that = (UnableLaunchReason) o;
return source == that.source && TextUtils.equals(unableLaunchReason, that.unableLaunchReason);
return source == that.source && unableType == that.unableType && TextUtils.equals(unableLaunchReason, that.unableLaunchReason);
}
@Override
public int hashCode() {
return Objects.hash(source, unableLaunchReason);
return Objects.hash(source, unableType, unableLaunchReason);
}
@Override

View File

@@ -12,7 +12,7 @@ import com.zhjt.mogo.adas.data.AiCloudTask;
import com.zhjt.mogo.adas.data.bean.AdasParam;
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics;
import com.zhjt.mogo.adas.data.bean.ReceivedAck;
import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
import com.zhjt.mogo.adas.data.bean.LaunchConditionData;
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason;
import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable;
import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask;
@@ -492,10 +492,10 @@ public interface OnAdasListener {
* 是否有能力启动自动驾驶
*
* @param isAutopilotAbility 是否能启动自动驾驶
* @param unableLaunchData 原始数据
* @param launchConditionData 原始数据
* @param unableAutopilotReasons 不能启动自动驾驶原因
*/
void onAutopilotAbility(boolean isAutopilotAbility, @NonNull UnableLaunchData unableLaunchData, @Nullable ArrayList<UnableLaunchReason> unableAutopilotReasons);
void onAutopilotAbility(boolean isAutopilotAbility, @NonNull LaunchConditionData launchConditionData, @Nullable ArrayList<UnableLaunchReason> unableAutopilotReasons);
/**

View File

@@ -2,7 +2,7 @@ package com.zhidao.support.adas.high.common.autopilot.ability;
import androidx.annotation.NonNull;
import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
import com.zhjt.mogo.adas.data.bean.LaunchConditionData;
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason;
import java.util.ArrayList;
@@ -30,7 +30,7 @@ public class AutopilotAbility230 extends BaseAutopilotAbilityChassis {
unableAutopilotReasons = onCallbackChassis(unableAutopilotReasons);
if (listener != null) {
boolean isAutopilotAbility = unableAutopilotReasons == null || unableAutopilotReasons.isEmpty();//是否能启动自动驾驶
listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), null, null, null), unableAutopilotReasons);
listener.onAutopilotAbility(isAutopilotAbility, new LaunchConditionData(this.getClass().getSimpleName(), chassisStates, oldSteering, getLightSwitch(), null, null, null), unableAutopilotReasons);
}
}

View File

@@ -4,7 +4,7 @@ import androidx.annotation.NonNull;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
import com.zhjt.mogo.adas.data.bean.LaunchConditionData;
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason;
import java.util.ArrayList;
@@ -107,7 +107,7 @@ public class AutopilotAbility250 extends BaseAutopilotAbilityChassis {
unableAutopilotReasons = onCallbackChassis(unableAutopilotReasons);
if (listener != null) {
boolean isAutopilotAbility = unableAutopilotReasons == null || unableAutopilotReasons.isEmpty();//是否能启动自动驾驶
listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), statusInfo, null, null), unableAutopilotReasons);
listener.onAutopilotAbility(isAutopilotAbility, new LaunchConditionData(this.getClass().getSimpleName(), chassisStates, oldSteering, getLightSwitch(), statusInfo, null, null), unableAutopilotReasons);
}
}

View File

@@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
import com.zhjt.mogo.adas.data.bean.LaunchConditionData;
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason;
import java.util.ArrayList;
@@ -138,7 +138,7 @@ public class AutopilotAbility330 {
}
}
if (listener != null) {
listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), statusInfo, null, fsmStatusReasonRespond), unableAutopilotReasons);
listener.onAutopilotAbility(isAutopilotAbility, new LaunchConditionData(this.getClass().getSimpleName(), statusInfo, null, fsmStatusReasonRespond), unableAutopilotReasons);
}
fsmStatusReasonRespond = null;
}

View File

@@ -4,7 +4,7 @@ import androidx.annotation.NonNull;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
import com.zhjt.mogo.adas.data.bean.LaunchConditionData;
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason;
import java.util.ArrayList;
@@ -88,7 +88,7 @@ public class AutopilotAbility350And360 extends BaseAutopilotAbilityChassis {
unableAutopilotReasons = onCallbackChassis(unableAutopilotReasons);
if (listener != null) {
boolean isAutopilotAbility = unableAutopilotReasons == null || unableAutopilotReasons.isEmpty();//是否能启动自动驾驶
listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), null, statusInfo, null), unableAutopilotReasons);
listener.onAutopilotAbility(isAutopilotAbility, new LaunchConditionData(this.getClass().getSimpleName(), chassisStates, oldSteering, getLightSwitch(), null, statusInfo, null), unableAutopilotReasons);
}
}

View File

@@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
import com.zhjt.mogo.adas.data.bean.LaunchConditionData;
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason;
import java.util.ArrayList;
@@ -117,7 +117,7 @@ public class AutopilotAbility360 {
}
}
if (listener != null) {
listener.onAutopilotAbility(isAutopilotAbility, new UnableLaunchData(this.getClass().getSimpleName(), null, statusInfo, fsmStatusReasonRespond), unableAutopilotReasons);
listener.onAutopilotAbility(isAutopilotAbility, new LaunchConditionData(this.getClass().getSimpleName(), null, statusInfo, fsmStatusReasonRespond), unableAutopilotReasons);
}
fsmStatusReasonRespond = null;
}

View File

@@ -7,7 +7,7 @@ import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhjt.mogo.adas.data.AdasConstants;
import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
import com.zhjt.mogo.adas.data.bean.LaunchConditionData;
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason;
import java.util.ArrayList;
@@ -131,9 +131,9 @@ public class AutopilotAbilityManager implements OnAutopilotAbilityListener {
}
@Override
public void onAutopilotAbility(boolean isAutopilotAbility, @NonNull UnableLaunchData unableLaunchData, @Nullable ArrayList<UnableLaunchReason> unableAutopilotReasons) {
public void onAutopilotAbility(boolean isAutopilotAbility, @NonNull LaunchConditionData launchConditionData, @Nullable ArrayList<UnableLaunchReason> unableAutopilotReasons) {
if (listener != null) {
listener.onAutopilotAbility(isAutopilotAbility, unableLaunchData, unableAutopilotReasons);
listener.onAutopilotAbility(isAutopilotAbility, launchConditionData, unableAutopilotReasons);
}
}

View File

@@ -24,7 +24,7 @@ public abstract class BaseAutopilotAbilityChassis {
private static final String REASON_CHASSIS_STEERING = "方向盘";
@NonNull
protected final AutopilotAbilityManager manager;
private ChassisStatesOuterClass.ChassisStates chassisStates;
protected ChassisStatesOuterClass.ChassisStates chassisStates;
protected OnAutopilotAbilityListener listener;
protected int mapVersion = -1;//工控机版本
protected boolean isJinlv = false;//是否是金旅小巴
@@ -39,7 +39,7 @@ public abstract class BaseAutopilotAbilityChassis {
*/
private Set<Chassis.GearPosition> launchAutopilotGear;
private float oldThrottle = Float.MAX_VALUE;//方向盘转角
protected float oldSteering = Float.MAX_VALUE;//方向盘转角
public BaseAutopilotAbilityChassis(@NonNull AutopilotAbilityManager manager) {
this.manager = manager;
@@ -60,6 +60,9 @@ public abstract class BaseAutopilotAbilityChassis {
currentLight.set(light);
}
protected Chassis.LightSwitch getLightSwitch() {
return currentLight.get();
}
public void setLaunchAutopilotGear(Set<Chassis.GearPosition> launchAutopilotGear) {
this.launchAutopilotGear = launchAutopilotGear;
@@ -138,13 +141,13 @@ public abstract class BaseAutopilotAbilityChassis {
if (chassisStates.hasSteerSystemStates()) {
ChassisStatesOuterClass.SteerSystemStates steerSystemStates = chassisStates.getSteerSystemStates();
if (steerSystemStates.hasSteeringWheelAngle()) {
float throttle = steerSystemStates.getSteeringWheelAngle();
if (oldThrottle == Float.MAX_VALUE) {
oldThrottle = throttle;
float steering = steerSystemStates.getSteeringWheelAngle();
if (oldSteering == Float.MAX_VALUE) {
oldSteering = steering;
} else {
// CupidLogUtils.log(TAG, "方向盘当前角度=" + oldThrottle + " 方向盘1秒前角度=" + throttle);
boolean isTurning = Math.abs(throttle - oldThrottle) > 8.0F;
oldThrottle = throttle;
// CupidLogUtils.log(TAG, "方向盘当前角度=" + oldSteering + " 方向盘1秒前角度=" + steering);
boolean isTurning = Math.abs(steering - oldSteering) > 8.0F;
oldSteering = steering;
// CupidLogUtils.log(TAG, "方向盘是否转动=" + isTurning);
if (isTurning) {
unableAutopilotReasons = manager.addUnableAutopilotReason(unableAutopilotReasons, UnableLaunchReason.SourceType.CHASSIS, UnableLaunchReason.UnableType.CHASSIS_STEERING, REASON_CHASSIS_STEERING);

View File

@@ -3,11 +3,11 @@ package com.zhidao.support.adas.high.common.autopilot.ability;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.zhjt.mogo.adas.data.bean.UnableLaunchData;
import com.zhjt.mogo.adas.data.bean.LaunchConditionData;
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason;
import java.util.ArrayList;
interface OnAutopilotAbilityListener {
void onAutopilotAbility(boolean isAutopilotAbility, @NonNull UnableLaunchData unableLaunchData, @Nullable ArrayList<UnableLaunchReason> unableAutopilotReasons);
void onAutopilotAbility(boolean isAutopilotAbility, @NonNull LaunchConditionData launchConditionData, @Nullable ArrayList<UnableLaunchReason> unableAutopilotReasons);
}