From 23b96286ee408ef10bb53fc8f95051034d2b6f5d Mon Sep 17 00:00:00 2001 From: xinfengkun Date: Mon, 9 Jan 2023 16:58:46 +0800 Subject: [PATCH] =?UTF-8?q?[pb12][=E6=B8=85=E6=89=AB=E8=BD=A6=E6=96=B0?= =?UTF-8?q?=E8=80=81=E5=BA=95=E7=9B=98=E5=85=BC=E5=AE=B9]=20=E6=B8=85?= =?UTF-8?q?=E6=89=AB=E8=BD=A6=E5=88=86=E6=94=AF=20=E8=80=81=E5=9C=B0?= =?UTF-8?q?=E7=9B=98=E6=95=B0=E6=8D=AE=E8=BD=AC=E6=96=B0=E5=9C=B0=E7=9B=98?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sweeper/ui/SweeperOperatePanelView.java | 18 +- .../zhidao/adas/client/DataDistribution.java | 10 + .../adas/client/bean/ChassisStates.java | 24 ++ .../zhidao/adas/client/ui/InfoFragment.java | 4 +- .../zhidao/adas/client/ui/MainActivity.java | 9 + .../zhidao/adas/client/utils/Constants.java | 1 + .../autopilot/adapter/MoGoAdasListenerImpl.kt | 83 +++-- .../adapter/MoGoHandAdasMsgManager.java | 4 +- .../status/flow/can/CanImpl.kt | 4 +- .../hmi/ui/setting/DebugSettingView.kt | 4 +- .../hmi/ui/widget/SteeringWheelView.java | 4 +- .../hmi/ui/widget/TrafficDataView.java | 5 +- .../IMoGoAutopilotVehicleStateListener.kt | 6 +- ...lerAutopilotVehicleStateListenerManager.kt | 29 +- .../src/main/proto/bag_manager.proto | 69 ++++ .../src/main/proto/chassis.proto | 5 +- .../src/main/proto/message_pad.proto | 17 +- .../src/main/proto/obu_warning_event.proto | 31 +- .../main/proto/robo_sweeper_task_index.proto | 6 +- .../src/main/proto/system_status_info.proto | 23 +- .../support/adas/high/OnAdasListener.java | 14 +- .../support/adas/high/common/MessageType.java | 5 +- .../adas/high/msg/ChassisStatesMessage.java | 22 ++ .../adas/high/msg/MyMessageFactory.java | 9 +- .../adas/high/msg/VehicleStateMessage.java | 306 ++++++++++++++++++ 25 files changed, 625 insertions(+), 87 deletions(-) create mode 100644 app_ipc_monitoring/src/main/java/com/zhidao/adas/client/bean/ChassisStates.java create mode 100644 libraries/mogo-adas-data/src/main/proto/bag_manager.proto create mode 100644 libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ChassisStatesMessage.java diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java index c163ce8230..4765373f02 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/ui/SweeperOperatePanelView.java @@ -40,8 +40,8 @@ import java.util.HashMap; import java.util.List; import chassis.Chassis; +import chassis.ChassisStatesOuterClass; import chassis.SpecialVehicleTaskCmdOuterClass; -import chassis.VehicleStateOuterClass; /** * 清扫车操作面板View @@ -179,7 +179,7 @@ public class SweeperOperatePanelView extends LinearLayout { } @Override - public boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + public boolean onCheckIfCmdSuccess(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) { boolean success = false; if (cleanSystemState == null) { return success; @@ -285,7 +285,7 @@ public class SweeperOperatePanelView extends LinearLayout { } @Override - public boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + public boolean onCheckIfCmdSuccess(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) { boolean success = false; if (cleanSystemState == null) { return success; @@ -403,7 +403,7 @@ public class SweeperOperatePanelView extends LinearLayout { } @Override - public boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + public boolean onCheckIfCmdSuccess(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) { boolean success = false; if (cleanSystemState == null) { return success; @@ -491,7 +491,7 @@ public class SweeperOperatePanelView extends LinearLayout { } @Override - public boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + public boolean onCheckIfCmdSuccess(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) { boolean success = false; if (cleanSystemState == null) { return success; @@ -791,7 +791,7 @@ public class SweeperOperatePanelView extends LinearLayout { } @Override - public void onSweeperFutianCleanSystemState(@NonNull VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + public void onSweeperFutianCleanSystemState(@NonNull ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) { long current = System.currentTimeMillis(); if (current - mCurrentTimeMillis <= VEHICLE_STATE_INTERVAL_MILLIS) { return; @@ -842,7 +842,7 @@ public class SweeperOperatePanelView extends LinearLayout { mSyncingVehicleState = true; } - private synchronized void onSyncVehicleStateCallBack(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + private synchronized void onSyncVehicleStateCallBack(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) { if (cleanSystemState == null) return; mSyncingVehicleState = false; // 清扫作业开启状态(以电机状态为true代表Open成功,实际控制端控制步骤为:1.发送远程控制上装指令 2.发送电机启动指令) @@ -934,7 +934,7 @@ public class SweeperOperatePanelView extends LinearLayout { * @param cleanSystemState * @return */ - private boolean checkIfCleanModePureSweep(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + private boolean checkIfCleanModePureSweep(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) { // 作业模式状态 // 洗扫 boolean clean_mode_wash_sweep = cleanSystemState.getSecuModWashSweepSts(); @@ -1051,7 +1051,7 @@ public class SweeperOperatePanelView extends LinearLayout { void onCountDownTick(int senonds); - boolean onCheckIfCmdSuccess(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState); + boolean onCheckIfCmdSuccess(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState); void onCmdSuccess(); diff --git a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/DataDistribution.java b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/DataDistribution.java index 9421872e3f..f5d3a779d7 100644 --- a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/DataDistribution.java +++ b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/DataDistribution.java @@ -7,6 +7,7 @@ import com.zhidao.adas.client.bean.AutopilotState; import com.zhidao.adas.client.bean.BaseInfo; import com.zhidao.adas.client.bean.BasicInfoReq; import com.zhidao.adas.client.bean.CarConfigResp; +import com.zhidao.adas.client.bean.ChassisStates; import com.zhidao.adas.client.bean.ErrorData; import com.zhidao.adas.client.bean.GlobalPathResp; import com.zhidao.adas.client.bean.GnssInfo; @@ -117,6 +118,7 @@ public class DataDistribution { public final List listOriginalPointCloud = new ArrayList<>(); public final List listPlanningObjects = new ArrayList<>(); public final List listPlanningDecisionState = new ArrayList<>(); + public final List listChassisStates = new ArrayList<>(); public String cutDown(String str) { if (isCutDown && str.length() > 650) { @@ -184,6 +186,14 @@ public class DataDistribution { if (listener != null && Constants.TITLE.RECEIVE_VEHICLE_STATE.equals(listener.first)) { listener.second.onRefresh(); } + } else if (data instanceof ChassisStates) { + listChassisStates.add(0, time + str); + if (listChassisStates.size() > LIST_SIZE) { + listChassisStates.remove(listChassisStates.size() - 1); + } + if (listener != null && Constants.TITLE.RECEIVE_CHASSIS_STATES.equals(listener.first)) { + listener.second.onRefresh(); + } } else if (data instanceof AutopilotState) { listAutopilotState.add(0, time + str); if (listAutopilotState.size() > LIST_SIZE) { diff --git a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/bean/ChassisStates.java b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/bean/ChassisStates.java new file mode 100644 index 0000000000..f18d4564a5 --- /dev/null +++ b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/bean/ChassisStates.java @@ -0,0 +1,24 @@ +package com.zhidao.adas.client.bean; + +import com.google.protobuf.TextFormat; + +import java.text.SimpleDateFormat; + +import chassis.ChassisStatesOuterClass; +import mogo.telematics.pad.MessagePad; + +public class ChassisStates extends BaseInfo { + public final ChassisStatesOuterClass.ChassisStates bean; + + public ChassisStates(MessagePad.Header header, ChassisStatesOuterClass.ChassisStates bean, SimpleDateFormat sdf) { + super("接收", bean.getSerializedSize(), header, sdf); + this.bean = bean; + } + + + @Override + public String toString() { + return super.toString() + TextFormat.printer().escapingNonAscii(false).printToString(bean); + } + +} diff --git a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/InfoFragment.java b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/InfoFragment.java index 7cf79e26e6..c37d161df6 100644 --- a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/InfoFragment.java +++ b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/InfoFragment.java @@ -105,7 +105,9 @@ public class InfoFragment extends BaseFragment { adapter.setData(DataDistribution.getInstance().listGnssInfo); } else if (Constants.TITLE.RECEIVE_VEHICLE_STATE.equals(title)) { adapter.setData(DataDistribution.getInstance().listVehicleState); - } else if (Constants.TITLE.RECEIVE_TRACKED_OBJECTS.equals(title)) { + } else if (Constants.TITLE.RECEIVE_CHASSIS_STATES.equals(title)) { + adapter.setData(DataDistribution.getInstance().listChassisStates); + }else if (Constants.TITLE.RECEIVE_TRACKED_OBJECTS.equals(title)) { adapter.setData(DataDistribution.getInstance().listTrackedObjects); } else if (Constants.TITLE.RECEIVE_AUTOPILOT_STATE.equals(title)) { adapter.setData(DataDistribution.getInstance().listAutopilotState); diff --git a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java index 185f094cd6..e062ff1db2 100644 --- a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java +++ b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/ui/MainActivity.java @@ -59,6 +59,7 @@ import com.zhidao.adas.client.bean.ArrivalNotification; import com.zhidao.adas.client.bean.AutopilotState; import com.zhidao.adas.client.bean.BasicInfoReq; import com.zhidao.adas.client.bean.CarConfigResp; +import com.zhidao.adas.client.bean.ChassisStates; import com.zhidao.adas.client.bean.ErrorData; import com.zhidao.adas.client.bean.GlobalPathResp; import com.zhidao.adas.client.bean.GnssInfo; @@ -113,6 +114,7 @@ import java.util.Locale; import java.util.concurrent.ScheduledExecutorService; import chassis.Chassis; +import chassis.ChassisStatesOuterClass; import chassis.VehicleStateOuterClass; import io.netty.channel.Channel; import mogo.telematics.pad.MessagePad; @@ -629,6 +631,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas titleFragmentData.add(Constants.TITLE.RECEIVE_TRAJECTORY); titleFragmentData.add(Constants.TITLE.RECEIVE_TRACKED_OBJECTS); titleFragmentData.add(Constants.TITLE.RECEIVE_VEHICLE_STATE); + titleFragmentData.add(Constants.TITLE.RECEIVE_CHASSIS_STATES); titleFragmentData.add(Constants.TITLE.RECEIVE_AUTOPILOT_STATE); titleFragmentData.add(Constants.TITLE.RECEIVE_REPORT_MESSAGE); titleFragmentData.add(Constants.TITLE.RECEIVE_PERCEPTION_TRAFFIC_LIGHT); @@ -895,6 +898,12 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas DataDistribution.getInstance().addData(base); } + @Override + public void onChassisStates(MessagePad.Header header, ChassisStatesOuterClass.ChassisStates chassisStates) { + ChassisStates base = new ChassisStates(header, chassisStates, sdf); + DataDistribution.getInstance().addData(base); + } + @Override public void onAutopilotState(MessagePad.Header header, MessagePad.AutopilotState autopilotState) { AutopilotState base = new AutopilotState(header, autopilotState, sdf); diff --git a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/utils/Constants.java b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/utils/Constants.java index 77a8b48dff..c2c121a5fb 100644 --- a/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/utils/Constants.java +++ b/app_ipc_monitoring/src/main/java/com/zhidao/adas/client/utils/Constants.java @@ -151,6 +151,7 @@ public class Constants { String RECEIVE_TRACKED_OBJECTS = MessageType.TYPE_RECEIVE_TRACKED_OBJECTS.desc; String RECEIVE_GNSS_INFO = MessageType.TYPE_RECEIVE_GNSS_INFO.desc; String RECEIVE_VEHICLE_STATE = MessageType.TYPE_RECEIVE_VEHICLE_STATE.desc; + String RECEIVE_CHASSIS_STATES = MessageType.TYPE_RECEIVE_CHASSIS_STATES.desc; String RECEIVE_AUTOPILOT_STATE = MessageType.TYPE_RECEIVE_AUTOPILOT_STATE.desc; String RECEIVE_REPORT_MESSAGE = MessageType.TYPE_RECEIVE_REPORT_MESSAGE.desc; String RECEIVE_PERCEPTION_TRAFFIC_LIGHT = MessageType.TYPE_RECEIVE_PERCEPTION_TRAFFIC_LIGHT.desc; 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 e2be4c4680..aa5a1d3326 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 @@ -1,5 +1,6 @@ package com.mogo.eagle.core.function.autopilot.adapter +import chassis.ChassisStatesOuterClass import chassis.VehicleStateOuterClass import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.config.FunctionBuildConfig @@ -141,38 +142,66 @@ class MoGoAdasListenerImpl : OnAdasListener { } } - //自车状态(底盘),车灯等。 - @ChainLog( - linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_VEHICLE, - linkCode = CHAIN_LINK_ADAS, - endpoint = PAD, - nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_VEHICLE, - paramIndexes = [0, 1], - clientPkFileName = "sn" - ) + /** + * 老底盘 + * TODO 老地盘数据会转发到新地盘 + * TODO 鹰眼不要用此接口展示页面相关,可以用来记录链路日志 + * + * @param header 头 + * @param vehicleState 数据 + */ override fun onVehicleState( header: MessagePad.Header, vehicleState: VehicleStateOuterClass.VehicleState? ) { - if (vehicleState != null) { - //转向灯数据 - CallerAutopilotVehicleStateListenerManager.invokeAutopilotLightSwitchData(vehicleState.light) - //刹车灯数据 - CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrakeLightData(vehicleState.brakeLightStatus) - //方向盘转向角数据 - CallerAutopilotVehicleStateListenerManager.invokeAutopilotSteeringData(vehicleState.steering) - //挂挡档位数据 - CallerAutopilotVehicleStateListenerManager.invokeAutopilotGearData(vehicleState.gear) - //加速度 - CallerAutopilotVehicleStateListenerManager.invokeAutopilotAcc(vehicleState.accel) - //油门 - CallerAutopilotVehicleStateListenerManager.invokeAutopilotThrottle(vehicleState.throttle) - //刹车 - CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrake(vehicleState.brake) - //清扫车(福田)清扫控制系统状态 - vehicleState.sweeperFutianCleanSystemState?.also { - CallerAutopilotVehicleStateListenerManager.invokeSweeperFutianCleanSystemState(it) + } + + @ChainLog( + linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_VEHICLE, + linkCode = CHAIN_LINK_ADAS, + endpoint = PAD, + nodeAliasCode = CHAIN_ALIAS_CODE_ADAS_MESSAGE_AUTOPILOT_VEHICLE, + paramIndexes = [0, 1], + clientPkFileName = "sn" + ) + override fun onChassisStates(header: MessagePad.Header, chassisStates: ChassisStatesOuterClass.ChassisStates?) { + if (chassisStates != null) { + chassisStates.bcmSystemStates?.let { bcmSystemStates -> + bcmSystemStates.turnLightState?.let { + //转向灯数据 + CallerAutopilotVehicleStateListenerManager.invokeAutopilotLightSwitchData(it) + } + //刹车灯数据 + CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrakeLightData(bcmSystemStates.brakeLightState != 0) + } + chassisStates.steerSystemStates?.let { + //方向盘转向角数据 + CallerAutopilotVehicleStateListenerManager.invokeAutopilotSteeringData(it.steeringWheelAngle) + } + chassisStates.gearSystemStates?.let { gearSystemStates -> + gearSystemStates.gearPosition?.let { + //挂挡档位数据 + CallerAutopilotVehicleStateListenerManager.invokeAutopilotGearData(it) + } + } + chassisStates.vehicleMotionStates?.let { + //加速度 + CallerAutopilotVehicleStateListenerManager.invokeAutopilotAcc(it.acceleration) + } + chassisStates.drivingSystemStates?.let { + //油门 + CallerAutopilotVehicleStateListenerManager.invokeAutopilotThrottle(it.throttleResponsePosition) + } + chassisStates.brakeSystemStates?.let { + //刹车 + CallerAutopilotVehicleStateListenerManager.invokeAutopilotBrake(it.brakePedalResponsePosition) + } + chassisStates.taskSystemStates?.let { taskSystemStates -> + taskSystemStates.sweeperFutianTaskSystemStates?.let { + //清扫车(福田)清扫控制系统状态 + CallerAutopilotVehicleStateListenerManager.invokeSweeperFutianCleanSystemState(it) + } } } 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 aa40c4e56c..64f7b136a5 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 @@ -28,7 +28,7 @@ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr; import org.jetbrains.annotations.NotNull; import chassis.Chassis; -import chassis.VehicleStateOuterClass; +import chassis.ChassisStatesOuterClass; import mogo.telematics.pad.MessagePad; public class MoGoHandAdasMsgManager implements @@ -187,7 +187,7 @@ public class MoGoHandAdasMsgManager implements @Override - public void onSweeperFutianCleanSystemState(VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + public void onSweeperFutianCleanSystemState(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) { } } \ 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 c8b1ad4876..d11d4e5190 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,7 +4,7 @@ import android.content.* import android.util.Log import chassis.Chassis.GearPosition import chassis.Chassis.LightSwitch -import chassis.VehicleStateOuterClass +import chassis.ChassisStatesOuterClass import com.mogo.eagle.core.function.api.autopilot.* import com.mogo.eagle.core.function.call.autopilot.* import com.mogo.eagle.core.utilcode.kotlin.* @@ -82,7 +82,7 @@ internal class CanImpl(ctx: Context): IFlow(ctx), IMoGoAutopilotVehic timeOutCheck() } - override fun onSweeperFutianCleanSystemState(cleanSystemState: VehicleStateOuterClass.SweeperFuTianCleanSystemState) { + override fun onSweeperFutianCleanSystemState(cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates) { send(CanStatus(isCanEnabled())) timeOutCheck() } 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 c98bbfc1e0..50eed604b8 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 @@ -18,7 +18,7 @@ import androidx.core.content.ContextCompat import androidx.core.view.* import androidx.recyclerview.widget.LinearLayoutManager import chassis.Chassis -import chassis.VehicleStateOuterClass +import chassis.ChassisStatesOuterClass import com.mogo.cloud.passport.MoGoAiCloudClient import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.commons.debug.DebugConfig @@ -2164,7 +2164,7 @@ class DebugSettingView @JvmOverloads constructor( /** * 清扫车(福田)清扫控制系统状态 */ - override fun onSweeperFutianCleanSystemState(cleanSystemState: VehicleStateOuterClass.SweeperFuTianCleanSystemState) { + override fun onSweeperFutianCleanSystemState(cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates) { } 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 fbf8c38268..68462b033b 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 @@ -27,7 +27,7 @@ import com.mogo.eagle.core.utilcode.util.ThreadUtils; import org.jetbrains.annotations.NotNull; import chassis.Chassis; -import chassis.VehicleStateOuterClass; +import chassis.ChassisStatesOuterClass; import mogo.telematics.pad.MessagePad; import mogo_msg.MogoReportMsg; import system_master.SystemStatusInfo; @@ -166,7 +166,7 @@ public class SteeringWheelView extends ConstraintLayout { private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() { @Override - public void onSweeperFutianCleanSystemState(@NonNull VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + public void onSweeperFutianCleanSystemState(@NonNull ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) { } /** 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 afa2fd8782..59ca396ea8 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 @@ -26,8 +26,7 @@ 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 chassis.ChassisStatesOuterClass; /** * @author Jing @@ -124,7 +123,7 @@ public class TrafficDataView extends ConstraintLayout { private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() { @Override - public void onSweeperFutianCleanSystemState(@NonNull VehicleStateOuterClass.SweeperFuTianCleanSystemState cleanSystemState) { + public void onSweeperFutianCleanSystemState(@NonNull ChassisStatesOuterClass.SweeperFuTianTaskSystemStates cleanSystemState) { } /** 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 bc80cc6fd9..32546477ec 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,7 +1,7 @@ package com.mogo.eagle.core.function.api.autopilot import chassis.Chassis -import chassis.VehicleStateOuterClass +import chassis.ChassisStatesOuterClass /** * 车辆底盘 数据 回调监听 @@ -36,7 +36,7 @@ interface IMoGoAutopilotVehicleStateListener { /** * 没有自车状态数据 */ - fun onAutopilotDataException(timestamp: Long){} + fun onAutopilotDataException(timestamp: Long) {} /** * 车辆加速度 @@ -56,5 +56,5 @@ interface IMoGoAutopilotVehicleStateListener { /** * 清扫车(福田)清扫控制系统状态 */ - fun onSweeperFutianCleanSystemState(cleanSystemState: VehicleStateOuterClass.SweeperFuTianCleanSystemState) + fun onSweeperFutianCleanSystemState(cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates) } \ 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 a704804633..16ab9661eb 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 @@ -2,10 +2,9 @@ package com.mogo.eagle.core.function.call.autopilot import androidx.annotation.Nullable import chassis.Chassis -import chassis.VehicleStateOuterClass +import chassis.ChassisStatesOuterClass 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 /** @@ -84,8 +83,8 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { * 车辆方向盘转向角回调 * @param steering 方向盘转向角 */ - fun invokeAutopilotSteeringData(steering: Float){ - M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + fun invokeAutopilotSteeringData(steering: Float) { + M_AUTOPILOT_VEHICLE_LISTENERS.forEach { val listener = it.value listener.onAutopilotSteeringData(steering) } @@ -95,8 +94,8 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { * 车辆挂挡档位 * @param gear 档位 */ - fun invokeAutopilotGearData(gear: Chassis.GearPosition){ - M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + fun invokeAutopilotGearData(gear: Chassis.GearPosition) { + M_AUTOPILOT_VEHICLE_LISTENERS.forEach { val listener = it.value listener.onAutopilotGearData(gear) } @@ -106,8 +105,8 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { * 车辆加速度 * acc 加速度 */ - fun invokeAutopilotAcc(carAcc: Float){ - M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + fun invokeAutopilotAcc(carAcc: Float) { + M_AUTOPILOT_VEHICLE_LISTENERS.forEach { val listener = it.value listener.onAutopilotAcc(carAcc) } @@ -116,8 +115,8 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { /** * throttle 油门 */ - fun invokeAutopilotThrottle(throttle: Float){ - M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + fun invokeAutopilotThrottle(throttle: Float) { + M_AUTOPILOT_VEHICLE_LISTENERS.forEach { val listener = it.value listener.onAutopilotThrottle(throttle) } @@ -126,8 +125,8 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { /** * brake 刹车 */ - fun invokeAutopilotBrake(brake: Float){ - M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + fun invokeAutopilotBrake(brake: Float) { + M_AUTOPILOT_VEHICLE_LISTENERS.forEach { val listener = it.value listener.onAutopilotBrake(brake) } @@ -136,8 +135,8 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { /** * clean system state 清扫车(福田)清扫控制系统状态 */ - fun invokeSweeperFutianCleanSystemState(cleanSystemState: VehicleStateOuterClass.SweeperFuTianCleanSystemState){ - M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + fun invokeSweeperFutianCleanSystemState(cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates) { + M_AUTOPILOT_VEHICLE_LISTENERS.forEach { val listener = it.value listener.onSweeperFutianCleanSystemState(cleanSystemState) } @@ -159,7 +158,7 @@ object CallerAutopilotVehicleStateListenerManager : CallerBase() { } fun invokeAutopilotDataException(timestamp: Long) { - M_AUTOPILOT_VEHICLE_LISTENERS.forEach{ + M_AUTOPILOT_VEHICLE_LISTENERS.forEach { val listener = it.value listener.onAutopilotDataException(timestamp) } diff --git a/libraries/mogo-adas-data/src/main/proto/bag_manager.proto b/libraries/mogo-adas-data/src/main/proto/bag_manager.proto new file mode 100644 index 0000000000..448e1bfdb9 --- /dev/null +++ b/libraries/mogo-adas-data/src/main/proto/bag_manager.proto @@ -0,0 +1,69 @@ +syntax = "proto2"; +package bag_manager; + +enum BagStat{ + SUCCEED = 0; + EXECUTING = 1; + EXECUTEERROR = 2; + COPYERROR = 3; + MERGEERROR = 4; + UPLOADCOSERROR = 5; +} + +// 上传cos桶状态 +message UploadCosStat{ + required uint64 key = 1; + required uint32 stat = 2; // 0-成功 1-执行中 2-copy过程失败 3-合并过程失败 4-上传过程失败 + optional string message = 3; // 失败时的具体描述 +} + +//空间使用情况 +message SpaceInfo{ + optional string directory = 1; // 路径名,为空表示总空间,否则表示对应的/home/mogo/data/bags下的子目录 + optional uint64 total = 2; // 总空间 + optional uint64 free = 3; // 可用空间 + optional uint64 used = 4; // 已用空间 +} +// bag目录空间使用情况 +message BagSpaceInfo{ + optional string host = 1; // 主机名 + optional SpaceInfo diskSpaceInfo = 2; // 硬盘空间信息 + repeated SpaceInfo BagDirsSpaceInfo = 3; // /home/mogo/data/bags下各子空间信息 +} + +// bag附加信息(录音,备注,接管信息) +message BagDescription{ + optional string description = 1; // bag接管描述或重命名信息 + optional bool hasAudio = 2; // 此bag是否具有录音文件 + optional string audioUrl = 3; // bag附加录音文件的文件名 + optional bool reportBI = 4; //上报BI状态 +} + +// 各主机上报的包信息 +message SubBag { + required uint64 key = 1; // bag key值 + required string host = 2; // 主机名 + optional uint64 size = 3; // 此子包的大小 +} + +// 单个key值对应的包信息 +message BagInfo{ + required uint64 key = 1; // bag key值 + optional uint64 totalSize = 2; // 所有子包或合并后的包的总大小 + optional string timestamp = 3; // 时间戳 + optional string bagPath = 4; // bag所在路径 + optional bool mergeStat = 5; // 合并状态 + optional bool uploadStat = 6; // 上传cos桶状态 + optional BagDescription description = 7; // 包描述信息 + repeated SubBag subBags = 8; // 子包信息 +} + +// 包管理请求 +message BagManager{ + required uint32 reqType = 1; // 请求类型:0-invalid 1-获取空间使用信息 2-遍历所有bag 3-上传cos 4-删除bag 5-为bag添加附加信息 + optional uint64 keyReq = 2; // 要操作的包的key值,发送请求且reqType=(3,4,5)时有效 + optional BagDescription descReq = 3; // 更新包附加信息,发送请求且reqType=5时有效 + repeated BagSpaceInfo spaceInfoResp = 4; // 空间使用信息,获取响应且reqType=1时有效 + repeated BagInfo bagsInfoResp = 5; // 包信息列表,获取响应且reqType=2时有效 + optional UploadCosStat uploadCosResp = 6; //反馈上传cos桶结果,获取响应且reqType=3时有效 +} \ No newline at end of file diff --git a/libraries/mogo-adas-data/src/main/proto/chassis.proto b/libraries/mogo-adas-data/src/main/proto/chassis.proto index c0d10d8dca..015f089efb 100644 --- a/libraries/mogo-adas-data/src/main/proto/chassis.proto +++ b/libraries/mogo-adas-data/src/main/proto/chassis.proto @@ -24,7 +24,8 @@ enum PilotMode { MODE_STEER_ONLY = 2; MODE_SPEED_ONLY = 3; MODE_REMOTE_DRIVE = 6; - CHASSID_TELECONTROL_DRIVE = 7; + MODE_TELECONTROL_DRIVE = 7; + MODE_INVALID = 8; } enum LongitudeDrivingMode { @@ -98,4 +99,4 @@ enum CleanSystemControlMode { Clean_PureWash_Both_Side_Work = 12; Clean_PureWash_Left_Work = 13; Clean_PureWash_Right_Work = 14; -} \ No newline at end of file +} diff --git a/libraries/mogo-adas-data/src/main/proto/message_pad.proto b/libraries/mogo-adas-data/src/main/proto/message_pad.proto index 91ac5b1b84..0693615023 100644 --- a/libraries/mogo-adas-data/src/main/proto/message_pad.proto +++ b/libraries/mogo-adas-data/src/main/proto/message_pad.proto @@ -6,7 +6,7 @@ import "geometry.proto"; enum ProtocolVersion { Defaultver = 0; - CurrentVersion = 9; //每次修改proto文件增加1 + CurrentVersion = 12; //每次修改proto文件增加1 } enum MessageType @@ -58,6 +58,7 @@ enum MessageType MsgTypeSpecialVehicleTaskCmd = 0x10118; //特种车辆命令 MsgTypeSetParamReq = 0x10119; //设置参数命令 MsgTypeTripInfoEvent = 0x1011a; //行程信息 + MsgTypeBagManagerCmd = 0x1011b; //bag管理 } message Header @@ -208,6 +209,7 @@ message Line message TrajectoryDownloadReq { Line line = 1; //路线 + uint32 source = 2; //来源方, 0:invalid, 1:pad, 2:aicloud } // message definition for MessageType: MsgTypeBasicInfoReq @@ -452,9 +454,14 @@ enum DrivingState AUTO_LANE_CHANGE_RIGHT = 6; //主动向左变道状态: driving_action:1 表示触发变道;driving_action:2 表示执行变道;driving_action:3 表示变道取消;driving_action:4 表示变道完成 LANE_AVOID_LEFT = 7; //主动向左绕行状态: driving_action:1 表示触发绕行;driving_action:2 表示执行绕行;driving_action:3 表示绕行取消;driving_action:4 表示绕行完成 LANE_AVOID_RIGHT = 8; //主动向右绕行状态: driving_action:1 表示触发绕行;driving_action:2 表示执行绕行;driving_action:3 表示绕行取消;driving_action:4 表示绕行完成 - START_UP = 9; //起步状态: driving_action:1 表示正常启动;driving_action:2 表示择机起步; - PULL_OVER = 10; //靠边停车状态: driving_action:1 表示正常靠边停车;driving_action:2 表示择机靠边停车; - UN_PROTECTED_INTERSECTION = 11; //路口预测响应状态: driving_action:1 表示触发了预测响应; + START_UP = 9; //起步状态: driving_action:1 表示正常启动;driving_action:2 表示择机起步 + PULL_OVER = 10; //靠边停车状态: driving_action:1 表示正常靠边停车;driving_action:2 表示择机靠边停车 + UN_PROTECTED_INTERSECTION = 11; //路口预测响应状态: driving_action:1 表示触发了预测响应 + AUTO_LANE_CHANGE_LEFT_V2N = 12; //V2N主动向左变道状态: driving_action:1 表示触发变道;driving_action:2 表示执行变道;driving_action:3 表示变道取消;driving_action:4 表示变道完成 + AUTO_LANE_CHANGE_RIGHT_V2N = 13; //V2N主动向右变道状态: driving_action:1 表示触发变道;driving_action:2 表示执行变道;driving_action:3 表示变道取消;driving_action:4 表示变道完成 + LANE_AVOID_LEFT_V2N = 14; //V2N主动向左绕行状态: driving_action:1 表示触发绕行;driving_action:2 表示执行绕行;driving_action:3 表示绕行取消;driving_action:4 表示绕行完成 + LANE_AVOID_RIGHT_V2N = 15; //V2N主动向右绕行状态: driving_action:1 表示触发绕行;driving_action:2 表示执行绕行;driving_action:3 表示绕行取消;driving_action:4 表示绕行完成 + WAITING_V2N = 16; //V2N正在等待变道避让施工场景/静止障碍物: driving_action:1 表示正在等待;driving_action:2 表示等待超时请求平行驾驶; } enum DrivingAction @@ -515,4 +522,6 @@ message TripInfoEvent //message definition for MsgTypeObuWarningData //refer to obu_warning_event.proto for details +//message definition for MsgTypeBagManagerCmd +//refer to bag_manager.proto for details diff --git a/libraries/mogo-adas-data/src/main/proto/obu_warning_event.proto b/libraries/mogo-adas-data/src/main/proto/obu_warning_event.proto index 3d3f89e613..a0fc6b36f8 100644 --- a/libraries/mogo-adas-data/src/main/proto/obu_warning_event.proto +++ b/libraries/mogo-adas-data/src/main/proto/obu_warning_event.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package mogo.v2x.v2i; +package mogo.v2x; import "header.proto"; import "mogo_v2x.proto"; @@ -91,10 +91,27 @@ message SpatWarningData{ repeated SpatLight lights = 3; /* 灯色信息集合 */ } -message ObuWarningData{ - common.Header header = 1; - int32 MsgDataType = 2; /*1:rsiEvent; 2:RsmEvent; 3:SpatEvent*/ - RsiWarningData rsiEvent = 3; - RsmWarningData RsmEvent = 4; - SpatWarningData SpatEvent = 5; +message NodeID{ + int32 region = 1;/* 定义地图中划分区域的ID号 */ + int32 id = 2; /* 定义地图节点ID */ } + +message MapMatchData{ + int32 status = 1;/* 状态信息,0:更新,1:添加,2:删除 */ + int32 unitMask = 2;/* 描述所属字段有效性 */ + NodeID currentNodeID = 3;/* 前方节点信息 */ + NodeID upstreamNodeID = 4;/* 上游节点信息 */ + int32 matchingLaneID = 5;/* 匹配车道ID,0:无效 */ + int32 speedMaxLimit = 6;/* 建议最大车速,单位(0.02m/s) */ + int32 speedMinLimit = 7;/* 建议最小车速,单位(0.02m/s) */ +} + +message ObuWarningData{ + common.Header header = 1; + int32 msgDataType = 2; /*1:rsiEvent; 2:rsmEvent; 3:spatEvent; 4:mapMatchData*/ + RsiWarningData rsiEvent = 3; + RsmWarningData rsmEvent = 4; + SpatWarningData spatEvent = 5; + MapMatchData mapMatchData = 6; +} + diff --git a/libraries/mogo-adas-data/src/main/proto/robo_sweeper_task_index.proto b/libraries/mogo-adas-data/src/main/proto/robo_sweeper_task_index.proto index 5d442b3ae6..9f78494d75 100644 --- a/libraries/mogo-adas-data/src/main/proto/robo_sweeper_task_index.proto +++ b/libraries/mogo-adas-data/src/main/proto/robo_sweeper_task_index.proto @@ -17,4 +17,8 @@ message RoboSweeperTaskIndex { double ref_edge_point_lon = 10; // 投影边沿点经度 double ref_edge_point_lat = 11; // 投影边沿点纬度 double dist_to_ref_edge_point = 12; // 自车到投影边沿点的距离 正值为在投影边沿点的右边 ,负值为在投影边沿点的右边 -} \ No newline at end of file + + uint32 clean_mode = 13; // 清扫作业模式 1–纯扫 2--洗扫, 3--纯洗, 4--纯吸 + uint32 clean_direction = 14; // 清扫方向 1--两侧, 2--左侧, 3--右侧 + uint32 clean_intensity= 15; // 作业强度 1–标准 2--强力 +} diff --git a/libraries/mogo-adas-data/src/main/proto/system_status_info.proto b/libraries/mogo-adas-data/src/main/proto/system_status_info.proto index 58c511d8c8..0a4953f7f8 100644 --- a/libraries/mogo-adas-data/src/main/proto/system_status_info.proto +++ b/libraries/mogo-adas-data/src/main/proto/system_status_info.proto @@ -30,7 +30,6 @@ message HealthInfo{ message TopicInfo{ optional string name = 1; //topic name optional int32 hz = 2; //Topic发送的频率 - // optional int32 max_delay = 3; //unit: msec } message DropTopic{ @@ -38,10 +37,28 @@ message DropTopic{ repeated TopicInfo topic = 2; } +message NodeInfo{ + optional string node_name = 1; //node name + optional string launch_name = 2; //launch name + optional int32 state = 3; //0:未知状态None,1:依赖未就绪Waiting,2:启动中Starting,3:运行running,4:停止stopping,5:无法启动状态,6:人为启动状态,7:人为关闭状态 +} + +message NodeFaultList{ + required int32 sum = 1; //下述node总数 + repeated NodeInfo node = 2; +} message StatusInfo { - required SystemState sys_state=1; // 当前消息状态 + required SystemState sys_state=1; // 当前系统状态 repeated HealthInfo health_info=2; // 健康检查状态信息 optional DropTopic topic_drop_info=3; // topic 掉频信息, 如有掉频添加没有不添加 - optional string reserved = 4; // 预留可选字段,用于接口扩充或者,其他信息补充 + optional string reserved = 4; // 用于表示idle模式,'idle' 表示idle模式 'work' 表示正常工作 + // add by liyl 20220907 + optional int32 pilot_mode = 5; // 0: manaul 1: autopilot 2: RemotePilot + optional string map_version = 6; // MAP 版本信息 + optional string master_version = 7; // system_master 版本信息 + optional bool auto_pilot_ready = 8; // 自动驾驶状态就绪, 20221111增加 + optional bool remote_pilot_ready = 9; // 平行驾驶状态就绪 + optional NodeFaultList auto_pilot_unready_list = 10; //20221128 增加 + optional NodeFaultList remote_pilot_unready_list = 11; //20221128 增加 } diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java index 649cbf48d7..c7f12a0607 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java @@ -4,6 +4,7 @@ import com.zhidao.support.adas.high.bean.AutopilotAbility; import com.zhidao.support.adas.high.bean.AutopilotStatistics; import com.zhidao.support.adas.high.common.ProtocolStatus; +import chassis.ChassisStatesOuterClass; import chassis.VehicleStateOuterClass; import mogo.telematics.pad.MessagePad; import mogo_msg.MogoReportMsg; @@ -51,13 +52,24 @@ public interface OnAdasListener { void onGnssInfo(MessagePad.Header header, MessagePad.GnssInfo gnssInfo); /** - * 底盘信息, 透传底盘状态,pb参考底盘 + * 老底盘信息,透传底盘状态,pb参考底盘 + * TODO 老地盘数据会转发到新地盘 + * TODO 鹰眼不要用此接口展示页面相关,可以用来记录链路日志 + * TODO 后期可能会优化掉 * * @param header 头 * @param vehicleState 数据 */ void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState); + /** + * 底盘状态 + * + * @param header 头 + * @param chassisStates 头 + */ + void onChassisStates(MessagePad.Header header, ChassisStatesOuterClass.ChassisStates chassisStates); + /** * 自动驾驶状态 * diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageType.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageType.java index af484038ee..bba5e81ba8 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageType.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageType.java @@ -16,13 +16,14 @@ public enum MessageType { TYPE_RECEIVE_TRAJECTORY(MessagePad.MessageType.MsgTypeTrajectory, "车前引导线"), TYPE_RECEIVE_TRACKED_OBJECTS(MessagePad.MessageType.MsgTypeTrackedObjects, "障碍物信息"), TYPE_RECEIVE_GNSS_INFO(MessagePad.MessageType.MsgTypeGnssInfo, "惯导信息"), - TYPE_RECEIVE_VEHICLE_STATE(MessagePad.MessageType.MsgTypeVehicleState, "底盘信息"), + TYPE_RECEIVE_VEHICLE_STATE(MessagePad.MessageType.MsgTypeVehicleState, "老底盘状态"), TYPE_RECEIVE_AUTOPILOT_STATE(MessagePad.MessageType.MsgTypeAutopilotState, "自动驾驶状态"), TYPE_RECEIVE_REPORT_MESSAGE(MessagePad.MessageType.MsgTypeReportMessage, "监控事件报告"), TYPE_RECEIVE_PERCEPTION_TRAFFIC_LIGHT(MessagePad.MessageType.MsgTypePerceptionTrafficLight, "感知红绿灯"), TYPE_RECEIVE_PREDICTION_OBSTACLE_TRAJECTORY(MessagePad.MessageType.MsgTypePredictionObstacleTrajectory, "他车轨迹预测"), TYPE_RECEIVE_POINT_CLOUD(MessagePad.MessageType.MsgTypePointCloud, "点云透传"), TYPE_RECEIVE_PLANNING_OBJECTS(MessagePad.MessageType.MsgTypePlanningObjects, "Planning障碍物"), + TYPE_RECEIVE_CHASSIS_STATES(MessagePad.MessageType.MsgTypeChassisStates, "底盘状态"), TYPE_RECEIVE_BASIC_INFO_REQ(MessagePad.MessageType.MsgTypeBasicInfoReq, "自动驾驶设备基础信息请求"), TYPE_SEND_BASIC_INFO_RESP(MessagePad.MessageType.MsgTypeBasicInfoResp, "自动驾驶设备基础信息应答"), @@ -52,7 +53,7 @@ public enum MessageType { TYPE_SEND_SET_PARAM_REQ(MessagePad.MessageType.MsgTypeSetParamReq, "设置参数命令"), TYPE_SEND_TRIP_INFO_REQ(MessagePad.MessageType.MsgTypeTripInfoEvent, "行程信息"), TYPE_SEND_SPECIAL_VEHICLE_TASK_CMD(MessagePad.MessageType.MsgTypeSpecialVehicleTaskCmd, "特种车辆命令"), - //透传 原始pb文件中不存在以下type。由于Java中无法强转所以在mogo-adas-data message_pad.proto中放开注释 + //TODO 透传原始pb文件中不存在以下type。由于Java中无法强转,所以在mogo-adas-data/message_pad.proto中放开注释 TYPE_RECEIVE_PLANNING_DECISION_STATE(MessagePad.MessageType.MsgTypePlanningDecisionState, "Planning决策状态"); diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ChassisStatesMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ChassisStatesMessage.java new file mode 100644 index 0000000000..1fb5af656b --- /dev/null +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/ChassisStatesMessage.java @@ -0,0 +1,22 @@ +package com.zhidao.support.adas.high.msg; + +import com.google.protobuf.InvalidProtocolBufferException; +import com.zhidao.support.adas.high.OnAdasListener; +import com.zhidao.support.adas.high.protocol.RawData; + +import chassis.ChassisStatesOuterClass; + +/** + * 重构后的底盘状态 + */ +public class ChassisStatesMessage extends MyAbstractMessageHandler { + + @Override + public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException { + ChassisStatesOuterClass.ChassisStates chassisStates = ChassisStatesOuterClass.ChassisStates.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue()); + if (adasListener != null) { + adasListener.onChassisStates(raw.getHeader(), chassisStates); + } + } + +} diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java index 5786c0803b..81db876d97 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java @@ -15,7 +15,8 @@ public class MyMessageFactory implements IMyMessageFactory { private IMsg trajectoryMessage;//局部轨迹消息 private IMsg trackedObjectsMessage;//障碍物信息 private IMsg gnssInfoMessage;//惯导信息 - private IMsg vehicleStateMessage;//底盘信息, 透传底盘状态,pb参考底盘 + private IMsg vehicleStateMessage;//老底盘信息, 透传底盘状态,pb参考底盘 + private IMsg chassisStatesMessage;//重构后的底盘状态 private IMsg autopilotStateMessage;//自动驾驶状态 private IMsg reportMessage;//监控事件报告 private IMsg perceptionTrafficLightMessage;//感知红绿灯 @@ -64,6 +65,12 @@ public class MyMessageFactory implements IMyMessageFactory { vehicleStateMessage = new VehicleStateMessage(); } return vehicleStateMessage; + } else if (messageType == MessageType.TYPE_RECEIVE_CHASSIS_STATES.typeCode) { + //重构后的底盘状态 + if (chassisStatesMessage == null) { + chassisStatesMessage = new ChassisStatesMessage(); + } + return chassisStatesMessage; } else if (messageType == MessageType.TYPE_RECEIVE_AUTOPILOT_STATE.typeCode) { //自动驾驶状态 if (autopilotStateMessage == null) { diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java index ccfc0ec84d..24512ac952 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/VehicleStateMessage.java @@ -9,7 +9,10 @@ import com.zhidao.support.adas.high.common.AutopilotAbilityManager; import com.zhidao.support.adas.high.common.CupidLogUtils; import com.zhidao.support.adas.high.protocol.RawData; +import chassis.Chassis; +import chassis.ChassisStatesOuterClass; import chassis.VehicleStateOuterClass; +import common.HeaderOuterClass; /** * 底盘信息, 透传底盘状态,pb参考底盘 @@ -25,9 +28,312 @@ public class VehicleStateMessage extends MyAbstractMessageHandler { if (CupidLogUtils.isEnableLog()) nowTime = SystemClock.elapsedRealtime(); if (adasListener != null) { + compatibility(adasListener, raw, vehicleState); adasListener.onVehicleState(raw.getHeader(), vehicleState); } AdasChannel.calculateTimeConsumingBusiness("底盘信息", nowTime); // CupidLogUtils.e("底盘信息--->" + vehicleState.toString()); } + + /** + * 将老地盘数据转换成新地盘数据 + * 字段注释中 鹰眼已用 的 已和底盘相关开发 确认过,其他字段均为确认对应关系 + * 新底盘中未找到字段: + * parking_brake longitude_driving_mode eps_steering_mode + * steering_sign location_missing trajectory_missing + * chassis_status_missing pilot_mode_condition_met vehicletakeoverstatus + */ + private void compatibility(OnAdasListener adasListener, RawData raw, VehicleStateOuterClass.VehicleState vehicleState) throws InvalidProtocolBufferException { + /**************老地盘转换成新地盘PB***************/ + ChassisStatesOuterClass.ChassisStates.Builder builder = ChassisStatesOuterClass.ChassisStates.newBuilder(); + //工控机所用Header + if (vehicleState.hasHeader()) { + HeaderOuterClass.Header outHeader = vehicleState.getHeader(); + if (outHeader != null) { + builder.setHeader(HeaderOuterClass.Header.parseFrom(vehicleState.getHeader().toByteArray())); + } + } + setBCMSystemStates(builder, vehicleState); + setSteerSystemStates(builder, vehicleState); + setGearSystemStates(builder, vehicleState); + setVehicleMotionStates(builder, vehicleState); + setDrivingSystemStates(builder, vehicleState); + setBrakeSystemStates(builder, vehicleState); + setChassisAutopilotAssistanceInformation(builder, vehicleState); + //电子驻车制动系统 + if (vehicleState.hasEpb()) { + Chassis.EPBWorkStatus old = vehicleState.getEpb(); + if (old != null) { + ChassisStatesOuterClass.EPBWorkStates epb = null; + if (old == Chassis.EPBWorkStatus.EPBSTATUS_NONE) { + epb = ChassisStatesOuterClass.EPBWorkStates.EPB_STATE_NONE; + } else if (old == Chassis.EPBWorkStatus.EPBSTATUS_LOCKED) { + epb = ChassisStatesOuterClass.EPBWorkStates.EPB_STATE_LOCKED; + } else if (old == Chassis.EPBWorkStatus.EPBSTATUS_RELEASED) { + epb = ChassisStatesOuterClass.EPBWorkStates.EPB_STATE_RELEASED; + } else if (old == Chassis.EPBWorkStatus.EPBSTATUS_LOCKED_FAIL) { + epb = ChassisStatesOuterClass.EPBWorkStates.EPB_STATE_LOCKED_FAIL; + } else if (old == Chassis.EPBWorkStatus.EPBSTATUS_RELEASE_FAIL) { + epb = ChassisStatesOuterClass.EPBWorkStates.EPB_STATE_RELEASE_FAIL; + } else if (old == Chassis.EPBWorkStatus.EPBSTATUS_FAULT) { + epb = ChassisStatesOuterClass.EPBWorkStates.EPB_STATE_FAULT; + } + if (epb != null) { + builder.setEpbSystemStates(ChassisStatesOuterClass.EPBSystemStates.newBuilder() + .setEpbWorkState(epb)); + } + } + } + // 整车故障状态 + if (vehicleState.hasVehiclefaultlevel()) { + Chassis.VehicleFaultLevel vehicleFaultLevel = vehicleState.getVehiclefaultlevel(); + if (vehicleFaultLevel != null) { + ChassisStatesOuterClass.VehicleFaultLevels vehicleFaultLevels = null; + if (vehicleFaultLevel == Chassis.VehicleFaultLevel.None_Fault) { + vehicleFaultLevels = ChassisStatesOuterClass.VehicleFaultLevels.NONE_FAULT; + } else if (vehicleFaultLevel == Chassis.VehicleFaultLevel.General_Fault) { + vehicleFaultLevels = ChassisStatesOuterClass.VehicleFaultLevels.GENERAL_FAULT; + } else if (vehicleFaultLevel == Chassis.VehicleFaultLevel.Serious_Fault) { + vehicleFaultLevels = ChassisStatesOuterClass.VehicleFaultLevels.SERIOUS_FAULT; + } else if (vehicleFaultLevel == Chassis.VehicleFaultLevel.Critical_Fault) { + vehicleFaultLevels = ChassisStatesOuterClass.VehicleFaultLevels.CRITICAL_FAULT; + } + if (vehicleFaultLevels != null) { + builder.setVehicleChassisFaultInformation(ChassisStatesOuterClass.VehicleChassisFaultInformation.newBuilder() + .setVehiclefaultlevel(vehicleFaultLevels)); + } + } + } + //电量 + if (vehicleState.hasBmsSoc()) { + builder.setBmsSystemStates(ChassisStatesOuterClass.BMSSystemStates.newBuilder().setBmsSoc(vehicleState.getBmsSoc())); + } + //清扫车(福田)清扫控制系统状态 + if (vehicleState.hasSweeperFutianCleanSystemState()) { + VehicleStateOuterClass.SweeperFuTianCleanSystemState sweeperFuTianCleanSystemState = vehicleState.getSweeperFutianCleanSystemState(); + if (sweeperFuTianCleanSystemState != null) { + byte[] bytes = sweeperFuTianCleanSystemState.toByteArray(); + builder.setTaskSystemStates(ChassisStatesOuterClass.TaskSystemStates.newBuilder() + .setSweeperFutianTaskSystemStates(ChassisStatesOuterClass.SweeperFuTianTaskSystemStates.parseFrom(bytes)));//鹰眼已用 清扫车专用 + } + } + adasListener.onChassisStates(raw.getHeader(), builder.build()); + } + + + private void setChassisAutopilotAssistanceInformation(ChassisStatesOuterClass.ChassisStates.Builder builder, VehicleStateOuterClass.VehicleState vehicleState) { + ChassisStatesOuterClass.ChassisAutopilotAssistanceInformation.Builder chassisAutopilotAssistanceInformation = null; + if (vehicleState.hasPilotMode()) { + Chassis.PilotMode pilotMode = vehicleState.getPilotMode(); + if (pilotMode != null) { + chassisAutopilotAssistanceInformation = ChassisStatesOuterClass.ChassisAutopilotAssistanceInformation.newBuilder(); + chassisAutopilotAssistanceInformation.setChassisPilotModeState(pilotMode); + } + } + if (vehicleState.hasEmergencyStopSwitch()) { + if (chassisAutopilotAssistanceInformation == null) { + chassisAutopilotAssistanceInformation = ChassisStatesOuterClass.ChassisAutopilotAssistanceInformation.newBuilder(); + } + // 急停开关状态 + chassisAutopilotAssistanceInformation.setEmergencyStopSwitchState(vehicleState.getEmergencyStopSwitch()); + } + if (chassisAutopilotAssistanceInformation != null) { + builder.setChassisAutopilotAssistanceInformation(chassisAutopilotAssistanceInformation); + } + } + + /** + * 档位 + */ + private void setGearSystemStates(ChassisStatesOuterClass.ChassisStates.Builder builder, VehicleStateOuterClass.VehicleState vehicleState) { + ChassisStatesOuterClass.GearSystemStates.Builder gearSystemStates = null; + if (vehicleState.hasGear()) { + Chassis.GearPosition gear = vehicleState.getGear(); + if (gear != null) { + gearSystemStates = ChassisStatesOuterClass.GearSystemStates.newBuilder(); + //挂挡档位数据 + gearSystemStates.setGearPosition(gear);//鹰眼已用 + } + } + if (vehicleState.hasGearSwitchInference()) { + if (gearSystemStates == null) { + gearSystemStates = ChassisStatesOuterClass.GearSystemStates.newBuilder(); + } + //档位干预 + gearSystemStates.setGearSwitchInferenceState(vehicleState.getGearSwitchInference()); + } + if (gearSystemStates != null) { + builder.setGearSystemStates(gearSystemStates); + } + } + + /** + * 油门 + */ + private void setDrivingSystemStates(ChassisStatesOuterClass.ChassisStates.Builder builder, VehicleStateOuterClass.VehicleState vehicleState) { + ChassisStatesOuterClass.DrivingSystemStates.Builder drivingSystemStates = null; + if (vehicleState.hasThrottle()) { + drivingSystemStates = ChassisStatesOuterClass.DrivingSystemStates.newBuilder(); + //油门 + drivingSystemStates.setThrottleResponsePosition(vehicleState.getThrottle());//鹰眼已用 + } + if (vehicleState.hasAccelInference()) { + if (drivingSystemStates == null) { + drivingSystemStates = ChassisStatesOuterClass.DrivingSystemStates.newBuilder(); + } + //加速踏板干预 + drivingSystemStates.setAccelerationPedalInferenceState(vehicleState.getAccelInference()); + } + if (drivingSystemStates != null) { + builder.setDrivingSystemStates(drivingSystemStates); + } + } + + /** + * 刹车 + */ + private void setBrakeSystemStates(ChassisStatesOuterClass.ChassisStates.Builder builder, VehicleStateOuterClass.VehicleState vehicleState) { + ChassisStatesOuterClass.BrakeSystemStates.Builder brakeSystemStates = null; + if (vehicleState.hasBrake()) { + brakeSystemStates = ChassisStatesOuterClass.BrakeSystemStates.newBuilder(); + //刹车 + brakeSystemStates.setBrakePedalResponsePosition(vehicleState.getBrake());//鹰眼已用 + } + if (vehicleState.hasBrakeInference()) { + if (brakeSystemStates == null) { + brakeSystemStates = ChassisStatesOuterClass.BrakeSystemStates.newBuilder(); + } + //刹车干预 + brakeSystemStates.setBrakePedalInferenceState(vehicleState.getBrakeInference()); + } + if (brakeSystemStates != null) { + builder.setBrakeSystemStates(brakeSystemStates); + } + } + + /** + * 方向盘 + */ + private void setSteerSystemStates(ChassisStatesOuterClass.ChassisStates.Builder builder, VehicleStateOuterClass.VehicleState vehicleState) { + ChassisStatesOuterClass.SteerSystemStates.Builder steerSystemStates = null; + if (vehicleState.hasSteering()) { + steerSystemStates = ChassisStatesOuterClass.SteerSystemStates.newBuilder(); + //方向盘转向角数据 + steerSystemStates.setSteeringWheelAngle(vehicleState.getSteering());//鹰眼已用 + } + if (vehicleState.hasSteerInference()) { + if (steerSystemStates == null) { + steerSystemStates = ChassisStatesOuterClass.SteerSystemStates.newBuilder(); + } + //方向盘干预 + steerSystemStates.setSteeringWheelInferenceState(vehicleState.getSteerInference()); + } + if (vehicleState.hasSteeringSpd()) { + if (steerSystemStates == null) { + steerSystemStates = ChassisStatesOuterClass.SteerSystemStates.newBuilder(); + } + steerSystemStates.setSteeringWheelSpeed(vehicleState.getSteeringSpd()); + } + if (vehicleState.hasLeftFrontWheelAngle()) { + if (steerSystemStates == null) { + steerSystemStates = ChassisStatesOuterClass.SteerSystemStates.newBuilder(); + } + steerSystemStates.setFrontLeftWheelAngle(vehicleState.getLeftFrontWheelAngle()); + } + if (vehicleState.hasRightFrontWheelAngle()) { + if (steerSystemStates == null) { + steerSystemStates = ChassisStatesOuterClass.SteerSystemStates.newBuilder(); + } + steerSystemStates.setFrontRightWheelAngle(vehicleState.getRightFrontWheelAngle()); + } + if (steerSystemStates != null) { + builder.setSteerSystemStates(steerSystemStates); + } + } + + private void setVehicleMotionStates(ChassisStatesOuterClass.ChassisStates.Builder builder, VehicleStateOuterClass.VehicleState vehicleState) { + ChassisStatesOuterClass.VehicleMotionStates.Builder vehicleMotionStates = null; + if (vehicleState.hasSpeed()) { + vehicleMotionStates = ChassisStatesOuterClass.VehicleMotionStates.newBuilder(); + vehicleMotionStates.setSpeed(vehicleState.getSpeed()); + } + if (vehicleState.hasAccel()) { + if (vehicleMotionStates == null) { + vehicleMotionStates = ChassisStatesOuterClass.VehicleMotionStates.newBuilder(); + } + //加速度 + vehicleMotionStates.setAcceleration(vehicleState.getAccel());//鹰眼已用 + } + if (vehicleMotionStates != null) { + builder.setVehicleMotionStates(vehicleMotionStates); + } + } + + /** + * 车身控制模块 + */ + private void setBCMSystemStates(ChassisStatesOuterClass.ChassisStates.Builder builder, VehicleStateOuterClass.VehicleState vehicleState) { + ChassisStatesOuterClass.BCMSystemStates.Builder bcmSystemStates = null; + if (vehicleState.hasLight()) { + Chassis.LightSwitch light = vehicleState.getLight(); + if (light != null) { + bcmSystemStates = ChassisStatesOuterClass.BCMSystemStates.newBuilder(); + //转向灯数据 + bcmSystemStates.setTurnLightState(light);//鹰眼已用 + } + } + if (vehicleState.hasBrakeLightStatus()) { + if (bcmSystemStates == null) { + bcmSystemStates = ChassisStatesOuterClass.BCMSystemStates.newBuilder(); + } + //刹车灯数据 + bcmSystemStates.setBrakeLightState(vehicleState.getBrakeLightStatus() ? 1 : 0);//鹰眼已用 + } + if (vehicleState.hasHorn()) { + if (bcmSystemStates == null) { + bcmSystemStates = ChassisStatesOuterClass.BCMSystemStates.newBuilder(); + } + //鸣笛 + bcmSystemStates.setHornState(vehicleState.getHorn() ? 1 : 0); + } + if (vehicleState.hasHighbeam()) { + if (bcmSystemStates == null) { + bcmSystemStates = ChassisStatesOuterClass.BCMSystemStates.newBuilder(); + } + //远光灯 + bcmSystemStates.setHighbeamState(vehicleState.getHighbeam() ? 1 : 0); + } + if (vehicleState.hasLowbeam()) { + if (bcmSystemStates == null) { + bcmSystemStates = ChassisStatesOuterClass.BCMSystemStates.newBuilder(); + } + //近光灯 + bcmSystemStates.setLowbeamState(vehicleState.getLowbeam() ? 1 : 0); + } + if (vehicleState.hasFoglight()) { + if (bcmSystemStates == null) { + bcmSystemStates = ChassisStatesOuterClass.BCMSystemStates.newBuilder(); + } + //雾灯 新底盘分前后雾灯 老地盘只有一个 所以同时赋值 + bcmSystemStates.setFrontFoglightState(vehicleState.getFoglight() ? 1 : 0); + bcmSystemStates.setBackFoglightState(vehicleState.getFoglight() ? 1 : 0); + } + if (vehicleState.hasClearanceLamps()) { + if (bcmSystemStates == null) { + bcmSystemStates = ChassisStatesOuterClass.BCMSystemStates.newBuilder(); + } + //示廓灯 + bcmSystemStates.setClearanceLampsState(vehicleState.getClearanceLamps() ? 1 : 0); + } + if (vehicleState.hasWarnLight()) { + if (bcmSystemStates == null) { + bcmSystemStates = ChassisStatesOuterClass.BCMSystemStates.newBuilder(); + } + //报警灯 + bcmSystemStates.setAlarmLightState(vehicleState.getWarnLight() ? 1 : 0); + } + if (bcmSystemStates != null) { + builder.setBcmSystemStates(bcmSystemStates); + } + } }