[dev_arch_opt_3.0]
[Change] [1、拆分汽车底盘数据透出,都采用单个类型数据回调] Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -101,15 +101,19 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr),
|
||||
IMoGoObuStatusListener,
|
||||
IMoGoAutopilotStatusListener,
|
||||
IMoGoAutopilotCarStateListener,
|
||||
IMoGoChassisGnssInfoListener,
|
||||
IMoGoMapLocationListener,
|
||||
IMoGoAutopilotIdentifyListener,
|
||||
IMoGoPlanningRottingListener,
|
||||
IMoGoPlanningTrajectoryListener,
|
||||
IMoGoAutopilotVehicleStateListener,
|
||||
IMoGoDevaToolsFuncConfigListener,
|
||||
IMoGoChassisLamplightListener,
|
||||
IMoGoDevaToolsListener,
|
||||
IMoGoChassisAccStateListener,
|
||||
IMoGoChassisSteeringStateListener,
|
||||
IMoGoChassisGearStateListener,
|
||||
IMoGoChassisBrakeStateListener,
|
||||
IMoGoChassisThrottleStateListener,
|
||||
IMoGoSweeperFutianCleanSystemListener{
|
||||
|
||||
private val TAG = "DebugSettingView"
|
||||
@@ -194,7 +198,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
// 添加 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
// 添加 ADAS车辆状态&定位 监听
|
||||
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
|
||||
CallerChassisGnssInfoListenerManager.addListener(TAG, this)
|
||||
// 添加 地图样式改变 监听
|
||||
CallerMapLocationListenerManager.addListener(TAG, this, false)
|
||||
// 添加 域控制器感知数据 监听
|
||||
@@ -203,7 +207,12 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, this)
|
||||
CallerPlanningTrajectoryListenerManager.addListener(TAG, this)
|
||||
//添加 车辆底盘数据回调 监听
|
||||
CallerAutopilotVehicleStateListenerManager.addListener(TAG, this)
|
||||
CallerChassisAccStateListenerManager.addListener(TAG, this)
|
||||
CallerChassisBrakeStateListenerManager.addListener(TAG, this)
|
||||
CallerChassisGearStateListenerManager.addListener(TAG, this)
|
||||
CallerChassisSteeringStateListenerManager.addListener(TAG, this)
|
||||
CallerChassisThrottleStateListenerManager.addListener(TAG, this)
|
||||
|
||||
//添加 开发套件工具接口 监听
|
||||
CallerDevaToolsListenerManager.addListener(TAG, this)
|
||||
//添加 底盘灯光数据 监听
|
||||
@@ -232,7 +241,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
// 移除 ADAS状态 监听
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
// 移除 ADAS车辆状态&定位 监听
|
||||
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
|
||||
CallerChassisGnssInfoListenerManager.removeListener(TAG)
|
||||
// 移除 地图样式改变 监听
|
||||
CallerMapLocationListenerManager.removeListener(TAG, false)
|
||||
// 移除 域控制器感知数据 监听
|
||||
@@ -241,7 +250,11 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
CallerPlanningRottingListenerManager.removeListener(TAG)
|
||||
CallerPlanningTrajectoryListenerManager.removeListener(TAG)
|
||||
// 移除 车辆底盘数据回调 监听
|
||||
CallerAutopilotVehicleStateListenerManager.removeListener(TAG)
|
||||
CallerChassisAccStateListenerManager.removeListener(TAG)
|
||||
CallerChassisBrakeStateListenerManager.removeListener(TAG)
|
||||
CallerChassisGearStateListenerManager.removeListener(TAG)
|
||||
CallerChassisSteeringStateListenerManager.removeListener(TAG)
|
||||
CallerChassisThrottleStateListenerManager.removeListener(TAG)
|
||||
// 移除 开发套件工具接口 监听
|
||||
CallerDevaToolsListenerManager.removeListener(TAG)
|
||||
// 移除 底盘灯光数据 监听
|
||||
|
||||
@@ -18,9 +18,11 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
@@ -29,7 +31,6 @@ 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 mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
@@ -41,7 +42,9 @@ import system_master.SystemStatusInfo;
|
||||
* 档位随CAN数据做切换和高亮显示
|
||||
* @since: 4/7/22
|
||||
*/
|
||||
public class SteeringWheelView extends ConstraintLayout {
|
||||
public class SteeringWheelView extends ConstraintLayout implements
|
||||
IMoGoChassisSteeringStateListener,
|
||||
IMoGoChassisGearStateListener {
|
||||
private static final String TAG = "SteeringWheelView";
|
||||
private ImageView autopilotIV;
|
||||
private TextView steeringTVL;
|
||||
@@ -65,7 +68,8 @@ public class SteeringWheelView extends ConstraintLayout {
|
||||
}
|
||||
initView();
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
|
||||
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, mIMoGoAutopilotVehicleStateListener);
|
||||
CallerChassisGearStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisSteeringStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
tapPositionView.updateWithGear(Chassis.GearPosition.GEAR_R);
|
||||
}
|
||||
|
||||
@@ -163,92 +167,59 @@ public class SteeringWheelView extends ConstraintLayout {
|
||||
}
|
||||
};
|
||||
|
||||
private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() {
|
||||
|
||||
/**
|
||||
* @param brake 刹车
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotBrake(float brake) {
|
||||
|
||||
/**
|
||||
* 方向盘转向角 左+右-
|
||||
* @param steering
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotSteeringData(float steering) {
|
||||
if (Math.abs(steering) < 1) {
|
||||
steering = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param throttle 油门
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotThrottle(float throttle) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆加速度
|
||||
* @param carAcc
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotAcc(float carAcc) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 方向盘转向角 左+右-
|
||||
* @param steering
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotSteeringData(float steering) {
|
||||
if (Math.abs(steering) < 1) {
|
||||
steering = 0;
|
||||
float steeringValue = steering;
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (steeringTVL != null && steeringValue > 0) {
|
||||
steeringTVR.setVisibility(View.INVISIBLE);
|
||||
steeringTVL.setVisibility(View.VISIBLE);
|
||||
steeringTVL.setText(String.valueOf((int) steeringValue) + "°");
|
||||
} else if (steeringTVR != null && steeringValue <= 0) {
|
||||
steeringTVL.setVisibility(View.INVISIBLE);
|
||||
steeringTVR.setVisibility(View.VISIBLE);
|
||||
steeringTVR.setText(String.valueOf((int) -steeringValue) + "°");
|
||||
} else {
|
||||
CallerLogger.INSTANCE.d(TAG, "onAutopilotSteeringData error");
|
||||
}
|
||||
animationWithSteeringData(-steeringValue);
|
||||
if (steeringCircularV != null) {
|
||||
steeringCircularV.setProgress((int) (-steeringValue * 100) / 360, 20);
|
||||
}
|
||||
if (steeringCircularVAlpha != null) {
|
||||
steeringCircularVAlpha.setProgress((int) (-steeringValue * 100) / 360, 20);
|
||||
}
|
||||
}
|
||||
float steeringValue = steering;
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (steeringTVL != null && steeringValue > 0) {
|
||||
steeringTVR.setVisibility(View.INVISIBLE);
|
||||
steeringTVL.setVisibility(View.VISIBLE);
|
||||
steeringTVL.setText(String.valueOf((int) steeringValue) + "°");
|
||||
} else if (steeringTVR != null && steeringValue <= 0) {
|
||||
steeringTVL.setVisibility(View.INVISIBLE);
|
||||
steeringTVR.setVisibility(View.VISIBLE);
|
||||
steeringTVR.setText(String.valueOf((int) -steeringValue) + "°");
|
||||
} else {
|
||||
CallerLogger.INSTANCE.d(TAG, "onAutopilotSteeringData error");
|
||||
}
|
||||
animationWithSteeringData(-steeringValue);
|
||||
if (steeringCircularV != null) {
|
||||
steeringCircularV.setProgress((int) (-steeringValue * 100) / 360, 20);
|
||||
}
|
||||
if (steeringCircularVAlpha != null) {
|
||||
steeringCircularVAlpha.setProgress((int) (-steeringValue * 100) / 360, 20);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 档位
|
||||
* @param gear
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CallerLogger.INSTANCE.d(TAG, "乘客屏档位" + gear.toString());
|
||||
if (tapPositionView != null) {
|
||||
tapPositionView.updateWithGear(gear);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 档位
|
||||
* @param gear
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CallerLogger.INSTANCE.d(TAG, "乘客屏档位" + gear.toString());
|
||||
if (tapPositionView != null) {
|
||||
tapPositionView.updateWithGear(gear);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDataException(long timestamp) {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 方向盘随CAN数据做方向和角度旋转
|
||||
|
||||
@@ -15,10 +15,16 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisBrakeStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisGearStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisSteeringStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisThrottleStateListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningActionsListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisBrakeStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGearStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisSteeringStateListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisThrottleStateListenerManager;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
@@ -32,7 +38,11 @@ import chassis.Chassis;
|
||||
* @description 速度 加速度 档位 刹车 油门状态值
|
||||
* @since: 6/24/22
|
||||
*/
|
||||
public class TrafficDataView extends ConstraintLayout {
|
||||
public class TrafficDataView extends ConstraintLayout implements
|
||||
IMoGoChassisSteeringStateListener,
|
||||
IMoGoChassisGearStateListener ,
|
||||
IMoGoChassisBrakeStateListener,
|
||||
IMoGoChassisThrottleStateListener {
|
||||
private static final String TAG = "TrafficDataView";
|
||||
private TapPositionView tapPositionView;
|
||||
private TextView speedTextView;
|
||||
@@ -100,7 +110,10 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
handler.sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L);
|
||||
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, mIMoGoAutopilotVehicleStateListener);
|
||||
CallerChassisSteeringStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisGearStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisBrakeStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisThrottleStateListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutopilotPlanningActionsListenerManager.INSTANCE.addListener(TAG, planningActionMsg -> acceleration = planningActionMsg.getDestinationAcc());
|
||||
}
|
||||
|
||||
@@ -116,63 +129,52 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
CallerAutopilotVehicleStateListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerChassisSteeringStateListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerChassisGearStateListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerChassisBrakeStateListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerChassisThrottleStateListenerManager.INSTANCE.removeListener(TAG);
|
||||
CallerAutopilotPlanningActionsListenerManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
private final IMoGoAutopilotVehicleStateListener mIMoGoAutopilotVehicleStateListener = new IMoGoAutopilotVehicleStateListener() {
|
||||
|
||||
/**
|
||||
* 方向盘转向角 左+右-
|
||||
* @param steering
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotSteeringData(float steering) {
|
||||
CallerLogger.INSTANCE.d(TAG, "steering原始值====" + steering);
|
||||
if (Math.abs(steering) < 1) {
|
||||
steering = 0;
|
||||
/**
|
||||
* 方向盘转向角 左+右-
|
||||
* @param steering
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotSteeringData(float steering) {
|
||||
CallerLogger.INSTANCE.d(TAG, "steering原始值====" + steering);
|
||||
if (Math.abs(steering) < 1) {
|
||||
steering = 0;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(TAG, "steering忽略小数点后====" + (int) steering);
|
||||
}
|
||||
|
||||
/**
|
||||
* 档位
|
||||
* @param gear
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
|
||||
CallerLogger.INSTANCE.d(TAG, "司机屏档位" + gear.toString());
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if (tapPositionView != null) {
|
||||
tapPositionView.updateWithGear(gear);
|
||||
}
|
||||
CallerLogger.INSTANCE.d(TAG, "steering忽略小数点后====" + (int) steering);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 档位
|
||||
* @param gear
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotGearData(@NotNull Chassis.GearPosition gear) {
|
||||
CallerLogger.INSTANCE.d(TAG, "司机屏档位" + gear.toString());
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if (tapPositionView != null) {
|
||||
tapPositionView.updateWithGear(gear);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDataException(long timestamp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotAcc(float carAcc) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotBrake(float brake) {
|
||||
CallerLogger.INSTANCE.d(TAG, "刹车:" + brake);
|
||||
mBrake = brake;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotThrottle(float throttle) {
|
||||
CallerLogger.INSTANCE.d(TAG, "油门:" + throttle);
|
||||
mThrottle = throttle;
|
||||
}
|
||||
|
||||
};
|
||||
@Override
|
||||
public void onAutopilotBrake(float brake) {
|
||||
CallerLogger.INSTANCE.d(TAG, "刹车:" + brake);
|
||||
mBrake = brake;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotThrottle(float throttle) {
|
||||
CallerLogger.INSTANCE.d(TAG, "油门:" + throttle);
|
||||
mThrottle = throttle;
|
||||
}
|
||||
/**
|
||||
* 设置弧形颜色
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user