Merge branch 'dev_robotaxi-d_240401_6.4.0' into dev_robotaxi-d_240401_6.4.0_bailing
This commit is contained in:
@@ -39,6 +39,9 @@ import com.tencent.matrix.trace.config.SharePluginInfo
|
||||
import com.tencent.matrix.trace.config.TraceConfig
|
||||
import com.zhjt.mogo_core_function_devatools.apm.*
|
||||
import com.mogo.eagle.core.function.api.upgrade.*
|
||||
import com.mogo.eagle.core.utilcode.kotlin.lifeCycleScope
|
||||
import com.mogo.eagle.core.utilcode.util.AppStateManager
|
||||
import com.mogo.eagle.core.utilcode.util.IAppStateListener
|
||||
import com.mogo.weak.network.SdtManager
|
||||
import com.zhjt.mogo_core_function_devatools.adas.PowerOffManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
|
||||
@@ -70,11 +73,13 @@ import com.zhjt.mogo_core_function_devatools.upgrade.UpgradeManager.Companion.up
|
||||
import com.zhjt.mogo_core_function_devatools.weaknetwork.DetectResultImpl
|
||||
import com.zhjt.mogo_core_function_devatools.weaknetwork.WeakNetworkStrategy
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
@Route(path = MogoServicePaths.PATH_DEVA_TOOLS)
|
||||
class DevaToolsProvider : IDevaToolsProvider {
|
||||
class DevaToolsProvider : IDevaToolsProvider, IAppStateListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "DevaToolsProvider"
|
||||
@@ -169,7 +174,23 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
block.init(it)
|
||||
block.start()
|
||||
}
|
||||
StatusManager.addListener(TAG, statusListener)
|
||||
AppStateManager.registerAppStateListener(this)
|
||||
}
|
||||
|
||||
override fun onAppStateChanged(isForeground: Boolean) {
|
||||
if (isForeground && !StatusManager.hasInit()) {
|
||||
mContext?.lifeCycleScope?.launch {
|
||||
while (!StatusManager.hasInit()) {
|
||||
val activity = AppStateManager.currentActivity()
|
||||
if (activity == null) {
|
||||
delay(500)
|
||||
continue
|
||||
}
|
||||
StatusManager.init(activity)
|
||||
StatusManager.addListener(TAG, statusListener)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun checkMonitorDb() {
|
||||
@@ -532,8 +553,8 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
group.addView(child, ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
|
||||
}
|
||||
|
||||
override fun getExceptionStatusBeforeLaunchAutopilot(): Int {
|
||||
return StatusManager.getExceptionStatusBeforeLaunchAutopilot()
|
||||
override fun getExceptionStatusBeforeLaunchAutopilot(source: Int): Int {
|
||||
return StatusManager.getExceptionStatusBeforeLaunchAutopilot(source)
|
||||
}
|
||||
|
||||
override fun registerRouteDownloadListener(tag: String, block: (state: Int) -> Unit) {
|
||||
|
||||
@@ -245,10 +245,10 @@ internal class MoFangCommandExecutor {
|
||||
linkedLog?.record(mapOf("执行:${System.currentTimeMillis()}" to "$message, $json"))
|
||||
Log.d(TAG, "--- 启动自驾 ----入参:$json")
|
||||
//清扫车有FSM模块,魔方启动自驾时需要将Source修改为魔方,以便telamatics做区分并在转发时增加flag标记
|
||||
if (CallerAutoPilotControlManager.isCanStartAutopilot(true)) {
|
||||
if (AppIdentityModeUtils.isSweeper(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerAutoPilotControlManager.startAutoPilotByMoFang(parameters)
|
||||
} else{
|
||||
if (AppIdentityModeUtils.isSweeper(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerAutoPilotControlManager.startAutoPilotByMoFang(parameters)
|
||||
} else {
|
||||
if (CallerAutoPilotControlManager.isCanStartAutopilot(true, -1)) {
|
||||
CallerAutoPilotControlManager.startAutoPilot(parameters)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,23 +184,42 @@ object StatusManager {
|
||||
listeners.remove(tag)
|
||||
}
|
||||
|
||||
fun getExceptionStatusBeforeLaunchAutopilot(): Int {
|
||||
fun getExceptionStatusBeforeLaunchAutopilot(source: Int): Int {
|
||||
if (!hasInit) {
|
||||
return 0
|
||||
}
|
||||
var ret = 0
|
||||
model.status.value?.second?.filter {
|
||||
it is IAutopilotPreLaunchStatus
|
||||
}?.takeIf {
|
||||
it.isNotEmpty()
|
||||
}?.also { l ->
|
||||
l.filter { it.isException() }.takeIf { it.isNotEmpty() }?.also { ll ->
|
||||
val result = runCatching {
|
||||
MogoAnalyticUtils.track(
|
||||
"vehicle_state_exp",
|
||||
HashMap<String, Any>().also { itx ->
|
||||
itx["data"] = ll.joinToString(",") { it.toString() }
|
||||
})
|
||||
}
|
||||
if (result.isFailure) {
|
||||
Logger.w(TAG, "error => ${result.exceptionOrNull()?.stackTraceToString() }")
|
||||
l.filter { it.isException() }.also { ll ->
|
||||
val time = System.currentTimeMillis()
|
||||
ThreadUtils.getIoPool().execute {
|
||||
val result = runCatching {
|
||||
MogoAnalyticUtils.track(
|
||||
"vehicle_start_autopilot_state_check",
|
||||
HashMap<String, Any>().also { itx ->
|
||||
itx["time"] = time
|
||||
itx["src"] = source
|
||||
itx["desc"] = ll.joinToString(",") { item ->
|
||||
when (item) {
|
||||
is SteerStatus -> "方向盘"
|
||||
is AcceleratorStatus -> "油门"
|
||||
is BrakeStatus -> "刹车"
|
||||
is DoubleFlashStatus -> "双闪"
|
||||
is GearStatus -> "档位"
|
||||
is RouteDownloadStatus -> if (item.state == RouteStart) "轨迹下载中" else "轨迹下载失败"
|
||||
else -> "其它"
|
||||
}
|
||||
}
|
||||
itx["data"] = GsonUtils.toJson(ll)
|
||||
})
|
||||
}
|
||||
if (result.isFailure) {
|
||||
Logger.w(TAG, "error => ${result.exceptionOrNull()?.stackTraceToString() }")
|
||||
}
|
||||
}
|
||||
}
|
||||
}?.forEachIndexed { index, status ->
|
||||
@@ -221,6 +240,10 @@ object StatusManager {
|
||||
return ret
|
||||
}
|
||||
|
||||
fun hasInit(): Boolean {
|
||||
return hasInit
|
||||
}
|
||||
|
||||
interface IStatusListener {
|
||||
fun onStatusChanged(data: List<Status>, hasException: Boolean)
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ interface IAutopilotPreLaunchStatus
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
data class SpeedStatus(val speed: Float, var acc: Float): Status(), IAutopilotPreLaunchStatus {
|
||||
data class SpeedStatus(val speed: Int): Status(), IAutopilotPreLaunchStatus {
|
||||
|
||||
override fun isException(): Boolean {
|
||||
return false
|
||||
@@ -306,22 +306,13 @@ data class SpeedStatus(val speed: Float, var acc: Float): Status(), IAutopilotPr
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as SpeedStatus
|
||||
|
||||
if (speed != other.speed) return false
|
||||
if (acc != other.acc) return false
|
||||
|
||||
return true
|
||||
return speed == other.speed
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = speed.hashCode()
|
||||
result = 31 * result + acc.hashCode()
|
||||
return result
|
||||
return speed.hashCode()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,12 +328,9 @@ data class SteerStatus(val angle: Float, var isError: Boolean = false): Status()
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as SteerStatus
|
||||
|
||||
if (angle != other.angle) return false
|
||||
if (isError != other.isError) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -362,7 +350,7 @@ data class SteerStatus(val angle: Float, var isError: Boolean = false): Status()
|
||||
/**
|
||||
* 油门
|
||||
*/
|
||||
data class AcceleratorStatus(val angle: Float, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus {
|
||||
data class AcceleratorStatus(val angle: Int, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus {
|
||||
|
||||
override fun isException(): Boolean {
|
||||
return isError && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
@@ -394,7 +382,7 @@ data class AcceleratorStatus(val angle: Float, var isError: Boolean = false): St
|
||||
/**
|
||||
* 刹车
|
||||
*/
|
||||
data class BrakeStatus(val angle: Float, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus {
|
||||
data class BrakeStatus(val angle: Int, var isError: Boolean = false): Status(), IAutopilotPreLaunchStatus {
|
||||
|
||||
override fun isException(): Boolean {
|
||||
return isError && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
|
||||
@@ -19,7 +19,7 @@ internal class AcceleratorImpl(ctx: Context): IFlow<AcceleratorStatus>(ctx), IMo
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var last: Float? = null
|
||||
private var last: Int? = null
|
||||
|
||||
@Volatile
|
||||
private var isError: Boolean = false
|
||||
@@ -40,9 +40,10 @@ internal class AcceleratorImpl(ctx: Context): IFlow<AcceleratorStatus>(ctx), IMo
|
||||
|
||||
override fun onAutopilotThrottle(throttle: Float) {
|
||||
super.onAutopilotThrottle(throttle)
|
||||
if (last != throttle) {
|
||||
send(AcceleratorStatus(throttle, isError).also { it.rawData = extra })
|
||||
last = throttle
|
||||
val current = throttle.toInt()
|
||||
if (last != current) {
|
||||
send(AcceleratorStatus(current, isError).also { it.rawData = extra })
|
||||
last = current
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,17 +51,17 @@ internal class AcceleratorImpl(ctx: Context): IFlow<AcceleratorStatus>(ctx), IMo
|
||||
if (!isAutopilotAbility) {
|
||||
val target = unableAutopilotReasons?.find { it.unableType == CHASSIS_THROTTLE }?.also { itx ->
|
||||
isError = true
|
||||
send(AcceleratorStatus(last ?: 0.0f, true).also { extra = itx; it.rawData = itx })
|
||||
send(AcceleratorStatus(last ?: 0, true).also { extra = itx; it.rawData = itx })
|
||||
}
|
||||
if (target == null) {
|
||||
isError = false
|
||||
extra = null
|
||||
send(AcceleratorStatus(last ?: 0.0f, false))
|
||||
send(AcceleratorStatus(last ?: 0, false))
|
||||
}
|
||||
} else {
|
||||
isError = false
|
||||
extra = null
|
||||
send(AcceleratorStatus(last ?: 0.0f, false))
|
||||
send(AcceleratorStatus(last ?: 0, false))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,11 @@ 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.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchData
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchReason.UnableType.CHASSIS_BRAKE
|
||||
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.BrakeStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.autopilot.AcceleratorImpl.Companion
|
||||
|
||||
internal class BrakeImpl(ctx: Context): IFlow<BrakeStatus>(ctx), IMoGoChassisBrakeStateListener, IMoGoAutopilotActionsListener {
|
||||
|
||||
@@ -22,7 +18,7 @@ internal class BrakeImpl(ctx: Context): IFlow<BrakeStatus>(ctx), IMoGoChassisBra
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var last: Float = 0.0f
|
||||
private var last: Int = 0
|
||||
|
||||
@Volatile
|
||||
private var isError: Boolean = false
|
||||
@@ -43,9 +39,10 @@ internal class BrakeImpl(ctx: Context): IFlow<BrakeStatus>(ctx), IMoGoChassisBra
|
||||
|
||||
override fun onAutopilotBrake(brake: Float) {
|
||||
super.onAutopilotBrake(brake)
|
||||
if (last != brake) {
|
||||
send(BrakeStatus(brake, isError).also { it.rawData = extra })
|
||||
last = brake
|
||||
val current = brake.toInt()
|
||||
if (last != current) {
|
||||
send(BrakeStatus(current, isError).also { it.rawData = extra })
|
||||
last = current
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,19 +2,11 @@ package com.zhjt.mogo_core_function_devatools.status.flow.autopilot
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
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.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.zhjt.mogo.adas.data.bean.UnableLaunchData
|
||||
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
|
||||
import com.zhjt.mogo_core_function_devatools.status.entity.SpeedStatus
|
||||
import com.zhjt.mogo_core_function_devatools.status.flow.IFlow
|
||||
import kotlin.math.abs
|
||||
|
||||
internal class SpeedImpl(ctx: Context): IFlow<SpeedStatus>(ctx), IMoGoChassisLocationGCJ02Listener {
|
||||
|
||||
@@ -24,10 +16,7 @@ internal class SpeedImpl(ctx: Context): IFlow<SpeedStatus>(ctx), IMoGoChassisLoc
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var lastSpeed: Float? = null
|
||||
|
||||
@Volatile
|
||||
private var lastAcc: Float? = null
|
||||
private var lastSpeed: Int? = null
|
||||
|
||||
override fun onCreate() {
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 5, this)
|
||||
@@ -40,16 +29,13 @@ internal class SpeedImpl(ctx: Context): IFlow<SpeedStatus>(ctx), IMoGoChassisLoc
|
||||
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
var isChanged = false
|
||||
if (lastSpeed != mogoLocation?.gnssSpeed) {
|
||||
val speed = (abs(mogoLocation?.gnssSpeed ?: 0f) * 3.6f).toInt()
|
||||
if (lastSpeed != speed) {
|
||||
isChanged = true
|
||||
lastSpeed = mogoLocation?.gnssSpeed
|
||||
}
|
||||
if (!isChanged && lastAcc != mogoLocation?.acceleration) {
|
||||
isChanged = true
|
||||
lastAcc = mogoLocation?.acceleration
|
||||
lastSpeed = speed
|
||||
}
|
||||
if (isChanged) {
|
||||
send(SpeedStatus(mogoLocation?.gnssSpeed ?: 0f, mogoLocation?.acceleration ?: 0f))
|
||||
send(SpeedStatus(speed))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,13 +20,13 @@ internal class StatusModel : ViewModel() {
|
||||
it += RTKStatus("", -1)
|
||||
// it += NetStatus(false)
|
||||
// it += GpsStatus(enabled = false, isGranted = false)
|
||||
it += SteerStatus(0.0f)
|
||||
it += AcceleratorStatus(0.0f)
|
||||
it += BrakeStatus(0.0f)
|
||||
it += SteerStatus(0f)
|
||||
it += AcceleratorStatus(0)
|
||||
it += BrakeStatus(0)
|
||||
it += DoubleFlashStatus(0)
|
||||
it += GearStatus(0)
|
||||
it += RouteDownloadStatus()
|
||||
it += SpeedStatus(0f, 0f)
|
||||
it += SpeedStatus(0)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhjt.mogo_core_function_devatools.status.ui
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
@@ -63,6 +64,7 @@ class AutoPilotLaunchBeforeView: LinearLayout, IStatusListener {
|
||||
StatusManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onStatusChanged(data: List<Status>, hasException: Boolean) {
|
||||
data.filter { it is IAutopilotPreLaunchStatus }.forEach { status ->
|
||||
val isError = status.isException() && CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
@@ -89,11 +91,11 @@ class AutoPilotLaunchBeforeView: LinearLayout, IStatusListener {
|
||||
}
|
||||
is AcceleratorStatus -> {
|
||||
iv_brake_or_accelerator?.isSelected = isError
|
||||
tv_brake_or_accelerator?.text = "${abs(status.angle)}%"
|
||||
}
|
||||
is BrakeStatus -> {
|
||||
val angle = status.angle
|
||||
iv_brake_or_accelerator?.isSelected = isError
|
||||
tv_brake_or_accelerator?.text = "a:-${angle.toInt()}"
|
||||
tv_brake_or_accelerator?.text = "${-abs(status.angle)}%"
|
||||
}
|
||||
is DoubleFlashStatus -> {
|
||||
iv_double_flash?.isSelected = isError
|
||||
@@ -102,8 +104,7 @@ class AutoPilotLaunchBeforeView: LinearLayout, IStatusListener {
|
||||
iv_steer?.isSelected = isError
|
||||
}
|
||||
is SpeedStatus -> {
|
||||
speed?.text = "${(abs(status.speed) * 3.6f).toInt()}"
|
||||
tv_brake_or_accelerator?.text = String.format("%.1f", status.acc)
|
||||
speed?.text = "${status.speed}"
|
||||
}
|
||||
else -> {
|
||||
Logger.d(TAG, "other state: $status")
|
||||
|
||||
@@ -134,14 +134,15 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_brake_or_accelerator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_85"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/dp_30"
|
||||
android:gravity="end"
|
||||
android:layout_marginTop="-1dp"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
tools:text="a:-100"
|
||||
android:text="a:0"/>
|
||||
tools:text="-100%"
|
||||
android:text="0%"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</merge>
|
||||
@@ -63,7 +63,6 @@ class StatusBarView @JvmOverloads constructor(
|
||||
updateStatusBarLeftView(true, FUNC_MODE_DEMO, DemoModeView(this.context))
|
||||
updateStatusBarLeftView(true, FUNC_MODE_RAIN, RainModeView(this.context))
|
||||
CallerDevaToolsManager.registerRouteDownloadListener(TAG) { state ->
|
||||
routeDownloadStatusRoot?.visibility = View.VISIBLE
|
||||
when(state) {
|
||||
0 -> {
|
||||
routeDownloadStatusRoot?.visibility = View.GONE
|
||||
|
||||
@@ -27,13 +27,15 @@ public class MainPresenter extends Presenter<MainView> {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
switch (msg.what) {
|
||||
case MainConstants.MSG_HIDE_MAP_COVER_FRAME:
|
||||
mView.hideCoverUpLayout();
|
||||
break;
|
||||
case MainConstants.MSG_LOAD_MODULES:
|
||||
mView.loadModules();
|
||||
break;
|
||||
if(mView!=null) {
|
||||
switch (msg.what) {
|
||||
case MainConstants.MSG_HIDE_MAP_COVER_FRAME:
|
||||
mView.hideCoverUpLayout();
|
||||
break;
|
||||
case MainConstants.MSG_LOAD_MODULES:
|
||||
mView.loadModules();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user