[6.4.0][启自驾指引] 丰富埋点数据;优化代码逻辑
This commit is contained in:
@@ -8,6 +8,7 @@ import chassis.Chassis.GearPosition.GEAR_R
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLine
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType.DEFAULT
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisBrakeStateListenerManager
|
||||
@@ -15,6 +16,8 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListene
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateListenerManager
|
||||
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.UnableLaunchReason
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.SourceType.CHASSIS
|
||||
@@ -28,6 +31,7 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
import mogo_msg.MogoReportMsg.MogoMsgTimestamp
|
||||
import mogo_msg.MogoReportMsg.MogoReportMessage
|
||||
import org.junit.Before
|
||||
@@ -64,8 +68,11 @@ class TestAutoPilotBeforeLaunch {
|
||||
delay(delayLong)
|
||||
launch(Dispatchers.IO) {
|
||||
val line = AutoPilotLine(10L, "", "","", "", System.currentTimeMillis(), "")
|
||||
var flag = false
|
||||
var flag = 1
|
||||
while (true) {
|
||||
if (flag > 4) {
|
||||
flag = 1
|
||||
}
|
||||
CallerAutoPilotStatusListenerManager.invokeTrajectoryDownloadReq(line, 0)
|
||||
CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian(
|
||||
MogoReportMessage.getDefaultInstance()
|
||||
@@ -73,7 +80,7 @@ class TestAutoPilotBeforeLaunch {
|
||||
.setTimestamp(MogoMsgTimestamp.getDefaultInstance().toBuilder().setSec(1).setNsec(1).build())
|
||||
.setSrc("1")
|
||||
.setLevel("1")
|
||||
.setCode("ISYS_INIT_TRAJECTORY_START")
|
||||
.setCode(MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_START)
|
||||
.setMsg("lineid:10")
|
||||
.build())
|
||||
delay(2000)
|
||||
@@ -83,11 +90,41 @@ class TestAutoPilotBeforeLaunch {
|
||||
.setTimestamp(MogoMsgTimestamp.getDefaultInstance().toBuilder().setSec(1).setNsec(1).build())
|
||||
.setSrc("1")
|
||||
.setLevel("1")
|
||||
.setCode(if (flag) "ISYS_INIT_TRAJECTORY_SUCCESS" else "ISYS_INIT_TRAJECTORY_FAILURE")
|
||||
.setCode(
|
||||
when(flag) {
|
||||
1 -> {
|
||||
withContext(Dispatchers.Main) {
|
||||
ToastUtils.showShort("轨迹下载成功")
|
||||
}
|
||||
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_SUCCESS
|
||||
}
|
||||
2 -> {
|
||||
withContext(Dispatchers.Main) {
|
||||
ToastUtils.showShort("轨迹下载失败(超时)")
|
||||
}
|
||||
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_TIMEOUT
|
||||
}
|
||||
3 -> {
|
||||
withContext(Dispatchers.Main) {
|
||||
ToastUtils.showShort("轨迹下载失败(警告)")
|
||||
}
|
||||
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_WARNING
|
||||
}
|
||||
4 -> {
|
||||
withContext(Dispatchers.Main) {
|
||||
ToastUtils.showShort("轨迹下载失败")
|
||||
}
|
||||
MogoReport.Code.Info.ISYS.INIT_TRAJECTORY_FAILURE
|
||||
}
|
||||
else -> {
|
||||
throw AssertionError()
|
||||
}
|
||||
}
|
||||
)
|
||||
.setMsg("lineid:10")
|
||||
.build())
|
||||
delay(10000)
|
||||
flag = !flag
|
||||
delay(5000)
|
||||
flag++
|
||||
}
|
||||
}
|
||||
launch(Dispatchers.IO) {
|
||||
@@ -97,50 +134,50 @@ class TestAutoPilotBeforeLaunch {
|
||||
CallerChassisGearStateListenerManager.invokeAutopilotGearData(GEAR_R)
|
||||
val current = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
|
||||
CallerChassisLocationGCJ02ListenerManager.invokeChassisLocationGCJ02(current.also { it.gnssSpeed = Random.nextInt(0 ..20).toFloat() }, DEFAULT)
|
||||
delay(500)
|
||||
delay(Random.nextInt(10..50).toLong())
|
||||
}
|
||||
}
|
||||
launch(Dispatchers.IO) {
|
||||
var flag = 1
|
||||
var isAbility = false
|
||||
while (true) {
|
||||
if (flag > 6) {
|
||||
flag = 1
|
||||
}
|
||||
CallerAutopilotActionsListenerManager.setConnected(true)
|
||||
CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE
|
||||
if (flag == 1) {
|
||||
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(isAbility, 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, 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 {
|
||||
it += UnableLaunchReason(CHASSIS, CHASSIS_GEAR, "gear")
|
||||
})
|
||||
}
|
||||
|
||||
if (flag == 2) {
|
||||
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(isAbility, 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, 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 {
|
||||
it += UnableLaunchReason(CHASSIS, CHASSIS_STEERING, "steering")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if (flag == 3) {
|
||||
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(isAbility, 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, 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 {
|
||||
it += UnableLaunchReason(CHASSIS, CHASSIS_BRAKE, "brake")
|
||||
})
|
||||
}
|
||||
|
||||
if (flag == 4) {
|
||||
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(isAbility, 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, 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 {
|
||||
it += UnableLaunchReason(CHASSIS, CHASSIS_HAZARD_LIGHTS, "lights")
|
||||
})
|
||||
}
|
||||
|
||||
if (flag == 5) {
|
||||
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(isAbility, 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, 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 {
|
||||
it += UnableLaunchReason(CHASSIS, CHASSIS_THROTTLE, "throttle")
|
||||
})
|
||||
}
|
||||
|
||||
if (flag == 6) {
|
||||
CallerAutopilotActionsListenerManager.invokeAutopilotAbility(isAbility, 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, 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 {
|
||||
it += UnableLaunchReason(CHASSIS, CHASSIS_GEAR, "gear")
|
||||
it += UnableLaunchReason(CHASSIS, CHASSIS_STEERING, "steering")
|
||||
it += UnableLaunchReason(CHASSIS, CHASSIS_HAZARD_LIGHTS, "lights")
|
||||
@@ -148,8 +185,9 @@ class TestAutoPilotBeforeLaunch {
|
||||
it += UnableLaunchReason(CHASSIS, CHASSIS_BRAKE, "brake")
|
||||
})
|
||||
}
|
||||
delay(2000)
|
||||
// isAbility = !isAbility
|
||||
delay(500)
|
||||
CallerAutoPilotControlManager.isCanStartAutopilot(true)
|
||||
delay(5000)
|
||||
flag ++
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user