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