[pb12][清扫车新老底盘兼容] 清扫车分支 老地盘数据转新地盘数据

This commit is contained in:
xinfengkun
2023-01-09 16:58:46 +08:00
parent d48c59f1bf
commit 23b96286ee
25 changed files with 625 additions and 87 deletions

View File

@@ -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())

View File

@@ -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) {
}
}

View File

@@ -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<CanStatus>(ctx), IMoGoAutopilotVehic
timeOutCheck()
}
override fun onSweeperFutianCleanSystemState(cleanSystemState: VehicleStateOuterClass.SweeperFuTianCleanSystemState) {
override fun onSweeperFutianCleanSystemState(cleanSystemState: ChassisStatesOuterClass.SweeperFuTianTaskSystemStates) {
send(CanStatus(isCanEnabled()))
timeOutCheck()
}

View File

@@ -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) {
}

View File

@@ -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) {
}
/**

View File

@@ -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) {
}
/**

View File

@@ -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)
}

View File

@@ -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)
}