diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt index ff9e9558c2..8246bcc13a 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -151,6 +151,8 @@ class MoGoAdasListenerImpl : OnAdasListener { CallerAutopilotVehicleStateListenerManager.invokeAutopilotSteeringData(vehicleState.steering) //挂挡档位数据 CallerAutopilotVehicleStateListenerManager.invokeAutopilotGearData(vehicleState.gear) + //加速度 + CallerAutopilotVehicleStateListenerManager.invokeAutopilotAcc(vehicleState.accel) } else { CallerAutopilotVehicleStateListenerManager.invokeAutopilotDataException(header.timestamp.toLong()) } diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java index 70b6dd7f54..90f6c23382 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/adapter/MoGoHandAdasMsgManager.java @@ -150,4 +150,9 @@ public class MoGoHandAdasMsgManager implements @Override public void onAutopilotDataException(long timestamp) { } + + @Override + public void onAutopilotAcc(float carAcc) { + + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt index d5b6e167e1..67a6be07fb 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/status/flow/can/CanImpl.kt @@ -4,15 +4,17 @@ import android.content.* import android.util.* import chassis.Chassis.GearPosition import chassis.Chassis.LightSwitch +import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo import com.mogo.eagle.core.function.api.autopilot.* import com.mogo.eagle.core.function.call.autopilot.* import com.mogo.eagle.core.utilcode.kotlin.* import com.zhjt.mogo_core_function_devatools.status.flow.IFlow import com.zhjt.mogo_core_function_devatools.status.entity.CanStatus import kotlinx.coroutines.* +import mogo.telematics.pad.MessagePad import mogo_msg.MogoReportMsg.MogoReportMessage -internal class CanImpl(ctx: Context): IFlow(ctx), IMoGoAutopilotVehicleStateListener, IMoGoAutopilotStatusListener { +internal class CanImpl(ctx: Context) : IFlow(ctx), IMoGoAutopilotVehicleStateListener, IMoGoAutopilotStatusListener { companion object { const val TAG = "CanImpl" @@ -67,13 +69,18 @@ internal class CanImpl(ctx: Context): IFlow(ctx), IMoGoAutopilotVehic timeOutCheck() } + override fun onAutopilotAcc(carAcc: Float) { + send(CanStatus(isCanEnabled())) + timeOutCheck() + } + private fun timeOutCheck() { job?.safeCancel() launch(Dispatchers.Default) { delay(4000) send(CanStatus(false)) - }.also { job = it } + }.also { job = it } } override fun onDestroy() { diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 4ea05b2f14..90a078343f 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -1835,6 +1835,13 @@ class DebugSettingView @JvmOverloads constructor( } } + /** + * 车辆加速度 + */ + override fun onAutopilotAcc(carAcc: Float) { + TODO("Not yet implemented") + } + /** * 吐司提示 */ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java index 4e4f7402fc..a72a6d9c8a 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java @@ -171,6 +171,15 @@ public class SteeringWheelView extends ConstraintLayout { Log.d(TAG, "刹车灯:" + String.valueOf(brakeLight)); } + /** + * 车辆加速度 + * @param carAcc + */ + @Override + public void onAutopilotAcc(float carAcc) { + + } + /** * 方向盘转向角 左+右- * @param steering diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java index f63f0f3a3b..4da68513b4 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/TrafficDataView.java @@ -21,6 +21,8 @@ import com.mogo.eagle.core.utilcode.util.ThreadUtils; import org.jetbrains.annotations.NotNull; +import java.math.BigDecimal; + import chassis.Chassis; /** @@ -66,6 +68,13 @@ public class TrafficDataView extends ConstraintLayout { speedTextView = findViewById(R.id.speedTextView); accTextView = findViewById(R.id.speedAccTextView); } + //onVehicleState + +// @Override +// public void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState) { +// VehicleState base = new VehicleState(header, vehicleState, sdf); +// DataDistribution.getInstance().addData(base); +// } private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() { /** @@ -128,6 +137,13 @@ public class TrafficDataView extends ConstraintLayout { public void onAutopilotDataException(long timestamp) { } + + @Override + public void onAutopilotAcc(float carAcc) { + Log.d(TAG, "加速度:" + carAcc); + BigDecimal acc = new BigDecimal(String.valueOf(carAcc)).setScale(2); + accTextView.setText(String.valueOf(acc)); + } }; /** diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt index bca93e135e..7d6520926d 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotVehicleStateListener.kt @@ -1,6 +1,7 @@ package com.mogo.eagle.core.function.api.autopilot import chassis.Chassis +import mogo.telematics.pad.MessagePad /** * 车辆底盘 数据 回调监听 @@ -36,4 +37,9 @@ interface IMoGoAutopilotVehicleStateListener { * 没有自车状态数据 */ fun onAutopilotDataException(timestamp: Long){} + + /** + * 车辆加速度 + */ + fun onAutopilotAcc(carAcc: Float) } \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt index 37653bb62d..3c5fef077a 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotVehicleStateListenerManager.kt @@ -4,6 +4,7 @@ import androidx.annotation.Nullable import chassis.Chassis import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener import com.mogo.eagle.core.function.call.base.CallerBase +import mogo.telematics.pad.MessagePad import java.util.concurrent.ConcurrentHashMap /** @@ -100,6 +101,18 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { } } + /** + * 车辆加速度 + * acc 加速度 + */ + fun invokeAutopilotAcc(carAcc: Float){ + M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + val listener = it.value + listener.onAutopilotAcc(carAcc) + } + } + + /** * 工控机时间回调 */