[8.2.8][需求] AIP开关修改为随时开关,引导线更改为aip开启时使用不同的颜色
This commit is contained in:
@@ -7,16 +7,15 @@ import chassis.VehicleStateOuterClass
|
||||
import com.mogo.commons.constants.SharedPrefsConstants
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_ALL_ERROR
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_ARRIVE
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_ARRIVE_QUERY
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_AUTOPILOT_INFO
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_CAR_CONFIG
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_CAR_LOC
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_COLD_START_STATE
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_ALL_ERROR
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_FM_MSG
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_FSM_MSG
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ADAS_GUARDIAN
|
||||
@@ -37,9 +36,6 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SO
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_TRAJECTORY
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_SOCKET_VEHICLE
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_TYPE_STATUS
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.SSMMsg
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeArriveAtStation
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.invokeAutoPilotInfo
|
||||
@@ -92,9 +88,8 @@ import com.mogo.eagle.core.function.call.autopilot.CallerVlmManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerCaptureImgManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDiskCopyManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerNDECloudManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerV2XManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerOTAManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerV2XManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuMapMathListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsiListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuWarningRsmListenerManager
|
||||
@@ -169,19 +164,27 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
const val TAG = "MoGoAdasListenerImpl"
|
||||
}
|
||||
|
||||
|
||||
override fun onTrajectory(header: MessagePad.Header, trajectory: MessagePad.Trajectory?) {
|
||||
if (trajectory!=null){
|
||||
onTrajectory(header, trajectory.isAIPTrajectory, trajectory.pointsList)
|
||||
}
|
||||
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
if (trajectory != null && trajectory.pointsList.size > 0) {
|
||||
invokeAutopilotTrajectory(trajectory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//车前引导线
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_TYPE_SOCKET_TRAJECTORY,
|
||||
linkCode = CHAIN_SOURCE_ADAS,
|
||||
nodeAliasCode = CHAIN_CODE_ADAS_TRAJECTORY,
|
||||
paramIndexes = [0, 1]
|
||||
paramIndexes = [0, 1, 2]
|
||||
)
|
||||
override fun onTrajectory(header: MessagePad.Header, trajectory: MessagePad.Trajectory?) {
|
||||
if (HdMapBuildConfig.isMapLoaded) {
|
||||
if (trajectory != null && trajectory.pointsList.size > 0) {
|
||||
invokeAutopilotTrajectory(trajectory.pointsList)
|
||||
}
|
||||
}
|
||||
private fun onTrajectory(header: MessagePad.Header, isAIPTrajectory: Boolean, points: List<MessagePad.TrajectoryPoint>) {
|
||||
}
|
||||
|
||||
override fun onTrackedObjects(
|
||||
|
||||
@@ -1851,10 +1851,10 @@ class OperatePanelLayout : LinearLayout {
|
||||
val isEnable = CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
CallerLogger.i(TAG, "isEnable=$isEnable 自驾状态=${CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state}")
|
||||
//AIP功能
|
||||
preferenceScreen.findPreferenceReal<PreferenceGrayableSwitch>(KEY_AIP_FUNCTION)?.let {
|
||||
it.shouldDisableView = isEnable
|
||||
it.isEnabled = isEnable
|
||||
}
|
||||
// preferenceScreen.findPreferenceReal<PreferenceGrayableSwitch>(KEY_AIP_FUNCTION)?.let {
|
||||
// it.shouldDisableView = isEnable
|
||||
// it.isEnabled = isEnable
|
||||
// }
|
||||
//驾驶模式 - 正常模式
|
||||
preferenceScreen.findPreferenceReal<PreferenceGrayableCheckBox>(KEY_DRIVING_STYLE_NORMAL)?.let {
|
||||
it.shouldDisableView = isEnable
|
||||
|
||||
@@ -402,6 +402,10 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
@Volatile
|
||||
private var mTrajectoryInfoSize = 0
|
||||
|
||||
// 引导线是否是AIP数据
|
||||
@Volatile
|
||||
private var mTrajectoryIsAIPTrajectory = false
|
||||
|
||||
// 全局路径规划点个数
|
||||
@Volatile
|
||||
private var mRouteInfoSize = 0
|
||||
@@ -2339,9 +2343,9 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
"「未知类型」感知数据个数:${mUnknownIdentifyDataSize}\n"
|
||||
|
||||
tvTrajectoryInfoSize.text =
|
||||
"引导线点个数:${mTrajectoryInfoSize}"
|
||||
"引导线点个数:${mTrajectoryInfoSize} 当前轨迹输出:${if (mTrajectoryIsAIPTrajectory) "AIP" else "RBP"}"
|
||||
tvTrajectoryInfoSizeCopy.text =
|
||||
"引导线点个数:${mTrajectoryInfoSize}"
|
||||
"引导线点个数:${mTrajectoryInfoSize} 当前轨迹输出:${if (mTrajectoryIsAIPTrajectory) "AIP" else "RBP"}"
|
||||
|
||||
tvRouteInfoSize.text =
|
||||
"全局路径规划点个数:${mRouteInfoSize}"
|
||||
@@ -2352,6 +2356,7 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
mIdentifyDataSize = 0
|
||||
mUnknownIdentifyDataSize = 0
|
||||
mTrajectoryInfoSize = 0
|
||||
mTrajectoryIsAIPTrajectory = false
|
||||
mRouteInfoSize = 0
|
||||
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
@@ -2570,8 +2575,9 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotTrajectory(trajectoryInfos: MutableList<MessagePad.TrajectoryPoint>) {
|
||||
mTrajectoryInfoSize = trajectoryInfos.size
|
||||
override fun onAutopilotTrajectory(trajectory: MessagePad.Trajectory) {
|
||||
mTrajectoryIsAIPTrajectory = trajectory.isAIPTrajectory
|
||||
mTrajectoryInfoSize = trajectory.pointsList.size
|
||||
}
|
||||
|
||||
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
|
||||
|
||||
@@ -93,12 +93,12 @@ class DecisionDataManager private constructor() : IMoGoPlanningTrajectoryListene
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotTrajectory(trajectoryInfos: MutableList<MessagePad.TrajectoryPoint>) {
|
||||
override fun onAutopilotTrajectory(trajectory: MessagePad.Trajectory) {
|
||||
ThreadUtils.getCpuPool().execute {
|
||||
val mogoMap = mapInstance.getMogoMap(MogoMap.DEFAULT)
|
||||
mogoMap?.let { map ->
|
||||
val lonLatList = ArrayList<android.graphics.Point>()
|
||||
trajectoryInfos.forEach {
|
||||
trajectory.pointsList.forEach {
|
||||
map.toScreenLocation(it.longitude, it.latitude)?.let { point ->
|
||||
lonLatList.add(point)
|
||||
Log.d(TAG, "转换后的屏幕坐标为:(${point.x},${point.y})")
|
||||
|
||||
@@ -28,7 +28,7 @@ public class MogoRouteOverlayManager implements
|
||||
private static volatile MogoRouteOverlayManager sInstance;
|
||||
private static final String TAG = "Route";
|
||||
|
||||
private final LinkedList<List<MessagePad.TrajectoryPoint>> queue = new LinkedList<>();
|
||||
private final LinkedList<MessagePad.Trajectory> queue = new LinkedList<>();
|
||||
|
||||
private final AtomicBoolean hasGreenWave = new AtomicBoolean(false);
|
||||
|
||||
@@ -118,11 +118,11 @@ public class MogoRouteOverlayManager implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotTrajectory(@NonNull List<MessagePad.TrajectoryPoint> items) {
|
||||
public void onAutopilotTrajectory(@NonNull MessagePad.Trajectory trajectory) {
|
||||
// Log.d(TAG, "-- onAutopilotTrajectory --: " + (items != null ? items.size() : "0"));
|
||||
synchronized (queue) {
|
||||
queue.clear();
|
||||
queue.offer(items);
|
||||
queue.offer(trajectory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,8 +147,8 @@ public class MogoRouteOverlayManager implements
|
||||
// Log.d(TAG, "-- onChassisLocationGCJ02 -- 3 ---");
|
||||
synchronized (queue) {
|
||||
if (!queue.isEmpty()) {
|
||||
List<MessagePad.TrajectoryPoint> items = queue.pollLast();
|
||||
if (items != null && !items.isEmpty()) {
|
||||
MessagePad.Trajectory items = queue.pollLast();
|
||||
if (items != null && !items.getPointsList().isEmpty()) {
|
||||
RouteOverlayDrawer.getInstance().drawTrajectoryList(items, gnssInfo.getHeading(), hasGreenWave.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,7 @@ public class RouteOverlayDrawer {
|
||||
|
||||
private class RenderTask implements Runnable {
|
||||
private volatile List<MessagePad.TrajectoryPoint> routeList;
|
||||
private volatile boolean isAIPTrajectory;
|
||||
|
||||
private final Pools.Pool<MogoLatLng> pools;
|
||||
private final LinkedList<MogoLatLng> points;
|
||||
@@ -113,8 +114,9 @@ public class RouteOverlayDrawer {
|
||||
this.points = new LinkedList<>();
|
||||
}
|
||||
|
||||
public void setData(List<MessagePad.TrajectoryPoint> routeList, double bearing, boolean hasGreenWave) {
|
||||
this.routeList = routeList;
|
||||
public void setData(MessagePad.Trajectory trajectory, double bearing, boolean hasGreenWave) {
|
||||
this.routeList = trajectory.getPointsList();
|
||||
this.isAIPTrajectory = trajectory.getIsAIPTrajectory();
|
||||
this.bearing = bearing;
|
||||
this.hasGreenWave = hasGreenWave;
|
||||
}
|
||||
@@ -139,7 +141,8 @@ public class RouteOverlayDrawer {
|
||||
}
|
||||
boolean isColorfulStrategy = !hasGreenWave && !AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode) || !AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode);
|
||||
if (isColorfulStrategy) {
|
||||
RouteStrategy.INSTANCE.start();
|
||||
RouteStrategy.INSTANCE.start(isAIPTrajectory);
|
||||
// RouteStrategy.INSTANCE.start(FunctionBuildConfig.isActivateAip);
|
||||
} else {
|
||||
if (colors == null || colors.isEmpty()) {
|
||||
ArrayList<Pair<Integer, Integer>> temps = new ArrayList<>();
|
||||
@@ -294,12 +297,12 @@ public class RouteOverlayDrawer {
|
||||
|
||||
private volatile RenderTask mRenderTask;
|
||||
|
||||
public void drawTrajectoryList(List<MessagePad.TrajectoryPoint> routeList, double bearing, boolean hasGreenWave) {
|
||||
public void drawTrajectoryList(MessagePad.Trajectory trajectory, double bearing, boolean hasGreenWave) {
|
||||
if (mogoOverlayManager != null) {
|
||||
if (mRenderTask == null) {
|
||||
mRenderTask = new RenderTask();
|
||||
}
|
||||
mRenderTask.setData(routeList, bearing, hasGreenWave);
|
||||
mRenderTask.setData(trajectory, bearing, hasGreenWave);
|
||||
if (mRenderHandler != null) {
|
||||
mRenderHandler.removeCallbacks(mRenderTask);
|
||||
mRenderHandler.post(mRenderTask);
|
||||
|
||||
@@ -23,6 +23,12 @@ class Colors {
|
||||
val COLOR_BLUE_DARK = Color.parseColor("#FF074EFF")
|
||||
val COLOR_RED_DARK = Color.parseColor("#FFFF5F00")
|
||||
val COLOR_TRANSPARENT = Color.parseColor("#0030A3FF")
|
||||
|
||||
// 新增:AIP 模式颜色定义
|
||||
val COLOR_AIP_GREEN = Color.parseColor("#FFA428E1")
|
||||
val COLOR_AIP_GREEN_DARK = Color.parseColor("#FFB948F8")
|
||||
val COLOR_AIP_ORANGE = Color.parseColor("#FFFFF938")
|
||||
val COLOR_AIP_TRANSPARENT = Color.parseColor("#00EA49FF")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +59,10 @@ object RouteStrategy {
|
||||
|
||||
private var index = 0
|
||||
|
||||
// 默认颜色映射表
|
||||
private val sorted: NavigableMap<Double, Int> by lazy { TreeMap() }
|
||||
// 新增:AIP 颜色映射表
|
||||
private val aipSorted: NavigableMap<Double, Int> by lazy { TreeMap() }
|
||||
|
||||
private var endEvaluator: ArgbEvaluator? = null
|
||||
|
||||
@@ -61,10 +70,18 @@ object RouteStrategy {
|
||||
|
||||
private var hasLessThan0 = false
|
||||
|
||||
// 新增:当前是否为 AIP 模式
|
||||
private var isAipMode = false
|
||||
|
||||
// 修改:增加 isAip 参数,默认为 false
|
||||
fun start() {
|
||||
if (sorted.isEmpty()) {
|
||||
start(false)
|
||||
}
|
||||
fun start(isAip: Boolean = false) {
|
||||
if (sorted.isEmpty() || aipSorted.isEmpty()) {
|
||||
fill()
|
||||
}
|
||||
isAipMode = isAip // 记录当前模式
|
||||
strategy = null
|
||||
index = 0
|
||||
startColor = Int.MAX_VALUE
|
||||
@@ -88,7 +105,9 @@ object RouteStrategy {
|
||||
if (!isEnable) {
|
||||
return
|
||||
}
|
||||
if (sorted.isEmpty()) {
|
||||
// 根据模式选择对应的 Map
|
||||
val currentMap = if (isAipMode) aipSorted else sorted
|
||||
if (currentMap.isEmpty()) {
|
||||
return
|
||||
}
|
||||
if (acc < 0) {
|
||||
@@ -96,7 +115,8 @@ object RouteStrategy {
|
||||
}
|
||||
val delta = (total * 0.35).toInt()
|
||||
val last = total - delta
|
||||
val entry = sorted.floorEntry(acc)
|
||||
|
||||
val entry = currentMap.floorEntry(acc)
|
||||
if (entry != null) {
|
||||
if (index >= last - 1) {
|
||||
if (startColor == Int.MAX_VALUE) {
|
||||
@@ -108,10 +128,12 @@ object RouteStrategy {
|
||||
} else {
|
||||
if (endEvaluator != null) {
|
||||
val fraction = (index - last) * 1.0f / delta
|
||||
// 根据模式选择对应的透明尾色
|
||||
val targetTransparent = if (isAipMode) Colors.COLOR_AIP_TRANSPARENT else COLOR_TRANSPARENT
|
||||
colors += endEvaluator!!.evaluate(
|
||||
fraction,
|
||||
startColor,
|
||||
COLOR_TRANSPARENT
|
||||
targetTransparent
|
||||
) as Int
|
||||
}
|
||||
}
|
||||
@@ -126,10 +148,12 @@ object RouteStrategy {
|
||||
if (!isEnable) {
|
||||
return emptyList()
|
||||
}
|
||||
if (sorted.isEmpty()) {
|
||||
// 根据模式选择对应的 Map 进行移除操作
|
||||
val currentMap = if (isAipMode) aipSorted else sorted
|
||||
if (currentMap.isEmpty()) {
|
||||
throw AssertionError("sorted map must not be null.")
|
||||
}
|
||||
val entry = sorted.floorEntry(acc)
|
||||
val entry = currentMap.floorEntry(acc)
|
||||
if (entry != null) {
|
||||
colors.remove(entry.value)
|
||||
}
|
||||
@@ -137,12 +161,15 @@ object RouteStrategy {
|
||||
}
|
||||
|
||||
private fun fill() {
|
||||
var startValue = -4.0
|
||||
var endValue = 0.0
|
||||
val step = 0.01
|
||||
var current = startValue
|
||||
val evaluator = ArgbEvaluator()
|
||||
val interceptor = AccelerateInterpolator()
|
||||
val step = 0.01
|
||||
|
||||
// 1. 填充默认颜色 (sorted)
|
||||
// 减速段 (-4.0 ~ 0.0): 红 -> 蓝
|
||||
var startValue = -4.0
|
||||
var endValue = 0.0
|
||||
var current = startValue
|
||||
var total = endValue - startValue
|
||||
while (current <= endValue) {
|
||||
val fraction = interceptor.getInterpolation(((current - startValue) / total).toFloat())
|
||||
@@ -150,17 +177,44 @@ object RouteStrategy {
|
||||
sorted[current] = colorValue
|
||||
current += step
|
||||
}
|
||||
// 加速段 (0.01 ~ 3.0): 蓝 -> 深蓝
|
||||
startValue = 0.01
|
||||
endValue = 3.0
|
||||
current = startValue
|
||||
total = endValue - startValue
|
||||
while (current <= endValue) {
|
||||
val fraction = (current - startValue) / total
|
||||
val colorValue =
|
||||
evaluator.evaluate(fraction.toFloat(), COLOR_BLUE, COLOR_BLUE_DARK) as Int
|
||||
val colorValue = evaluator.evaluate(fraction.toFloat(), COLOR_BLUE, COLOR_BLUE_DARK) as Int
|
||||
sorted[current] = colorValue
|
||||
current += step
|
||||
}
|
||||
|
||||
// 2. 填充 AIP 颜色 (aipSorted)
|
||||
// 逻辑仿照上方:减速用 橙->绿,加速用 绿->深绿
|
||||
|
||||
// AIP 减速段 (-4.0 ~ 0.0): 橙色 -> 绿色
|
||||
startValue = -4.0
|
||||
endValue = 0.0
|
||||
current = startValue
|
||||
total = endValue - startValue
|
||||
while (current <= endValue) {
|
||||
val fraction = interceptor.getInterpolation(((current - startValue) / total).toFloat())
|
||||
val colorValue = evaluator.evaluate(fraction, Colors.COLOR_AIP_ORANGE, Colors.COLOR_AIP_GREEN) as Int
|
||||
aipSorted[current] = colorValue
|
||||
current += step
|
||||
}
|
||||
|
||||
// AIP 加速段 (0.01 ~ 3.0): 绿色 -> 深绿色
|
||||
startValue = 0.01
|
||||
endValue = 3.0
|
||||
current = startValue
|
||||
total = endValue - startValue
|
||||
while (current <= endValue) {
|
||||
val fraction = (current - startValue) / total
|
||||
val colorValue = evaluator.evaluate(fraction.toFloat(), Colors.COLOR_AIP_GREEN, Colors.COLOR_AIP_GREEN_DARK) as Int
|
||||
aipSorted[current] = colorValue
|
||||
current += step
|
||||
}
|
||||
}
|
||||
|
||||
fun getStrategy(): Strategy = if (isEnable) {
|
||||
|
||||
Reference in New Issue
Block a user