[6.1.0][车前引导线] 优化因自驾状态未同步,导致引导线未绘制的问题
This commit is contained in:
@@ -30,14 +30,10 @@ import system_master.SystemStatusInfo;
|
||||
|
||||
public class MogoRouteOverlayManager implements
|
||||
IMoGoPlanningTrajectoryListener,
|
||||
IMoGoAutopilotStatusListener,
|
||||
IMoGoChassisLocationGCJ02Listener {
|
||||
private static volatile MogoRouteOverlayManager sInstance;
|
||||
private static final String TAG = "Route";
|
||||
|
||||
private final AtomicBoolean isArriveAtStation = new AtomicBoolean(false);
|
||||
private final AtomicInteger autopilotMode = new AtomicInteger(0);
|
||||
|
||||
private final LinkedList<List<MessagePad.TrajectoryPoint>> queue = new LinkedList<>();
|
||||
|
||||
private MogoRouteOverlayManager() {
|
||||
@@ -46,7 +42,6 @@ public class MogoRouteOverlayManager implements
|
||||
|
||||
public void init() {
|
||||
CallerPlanningTrajectoryListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerChassisLocationGCJ02ListenerManager.INSTANCE.addListener(TAG, 20,this);
|
||||
}
|
||||
|
||||
@@ -75,14 +70,16 @@ public class MogoRouteOverlayManager implements
|
||||
if (gnssInfo == null) {
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "-- onChassisLocationGCJ02 -- 1 ---" + ":auto-mode:" + autopilotMode.get() + ", isArriveAtStation: " + isArriveAtStation.get());
|
||||
if (isArriveAtStation.get() && autopilotMode.get() != 2) {
|
||||
int autoPilotState = CallerAutoPilotStatusListenerManager.INSTANCE.getState();
|
||||
boolean isArriveAtStation = CallerAutoPilotStatusListenerManager.INSTANCE.isArriveAtStation();
|
||||
Log.d(TAG, "-- onChassisLocationGCJ02 -- 1 ---" + ":auto-mode:" + autoPilotState + ", isArriveAtStation: " + isArriveAtStation);
|
||||
if (isArriveAtStation && autoPilotState != 2) {
|
||||
RouteOverlayDrawer.getInstance().clearMogoRouteOverlay();
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "-- onChassisLocationGCJ02 -- 2 ---" + "auto-mode:" + autopilotMode.get() + ", isDemoMode:" + FunctionBuildConfig.isDemoMode + ", force:" + FunctionBuildConfig.isForceDrawAutopilotTrajectoryByDebugSettingView);
|
||||
Log.d(TAG, "-- onChassisLocationGCJ02 -- 2 ---" + "auto-mode:" + autoPilotState + ", isDemoMode:" + FunctionBuildConfig.isDemoMode + ", force:" + FunctionBuildConfig.isForceDrawAutopilotTrajectoryByDebugSettingView);
|
||||
boolean force = FunctionBuildConfig.isForceDrawAutopilotTrajectoryByDebugSettingView || FunctionBuildConfig.isDemoMode && FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData;
|
||||
if (!force && autopilotMode.get() != 2) {
|
||||
if (!force && autoPilotState != 2) {
|
||||
RouteOverlayDrawer.getInstance().clearMogoRouteOverlay();
|
||||
return;
|
||||
}
|
||||
@@ -96,66 +93,4 @@ public class MogoRouteOverlayManager implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(int state) {
|
||||
if (state == 2) {
|
||||
isArriveAtStation.set(false);
|
||||
}
|
||||
Log.d(TAG, "-- onAutopilotStatusResponse ---: state:" + state);
|
||||
this.autopilotMode.set(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) {
|
||||
Log.d(TAG, "-- onAutopilotArriveAtStation --- 1 ---");
|
||||
if (arrivalNotification == null) {
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "-- onAutopilotArriveAtStation --- 2 ---");
|
||||
if(!HdMapBuildConfig.isMapLoaded){
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "-- onAutopilotArriveAtStation --- 3 ---");
|
||||
if (!isArriveAtStation.get()) {
|
||||
isArriveAtStation.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotIpcConnectStatusChanged(int status, @androidx.annotation.Nullable String reason) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSystemStatus(@NonNull SsmInfo.SsmStatusInf statusInf) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRouteLineId(long lineId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDockerInfo(@NonNull String dockerVersion) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -70,6 +70,12 @@ open class AutopilotStatusInfo : Serializable, Cloneable {
|
||||
@Volatile
|
||||
var autopilotControlParameters: AutopilotControlParameters? = null
|
||||
|
||||
/**
|
||||
* 是否到站
|
||||
*/
|
||||
@Volatile
|
||||
var isArriveAtStation: Boolean = false
|
||||
|
||||
override fun toString(): String {
|
||||
return "connectIP=$connectIP, connectPort=$connectPort, " +
|
||||
"connectStatus=$connectStatus, connectDescribe=$connectStatusDescribe, version=$version, dockVersion=$dockVersion," +
|
||||
|
||||
@@ -34,6 +34,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
||||
|
||||
private var autopilotState: Int by Delegates.observable(0) { _, oldValue, newValue ->
|
||||
if (oldValue != newValue) {
|
||||
fixAtStationState(newValue)
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotStatusResponse(newValue)
|
||||
@@ -41,6 +42,19 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
||||
}
|
||||
}
|
||||
|
||||
private fun fixAtStationState(autoPilotMode: Int) {
|
||||
if (autoPilotMode == 2) {
|
||||
//自驾状态下,将到站状态置为false
|
||||
mAutopilotStatusInfo.isArriveAtStation = false
|
||||
} else {
|
||||
//其它状态下, 将到站状态置为false
|
||||
val arriveAtStation = mAutopilotStatusInfo.isArriveAtStation
|
||||
if (arriveAtStation) {
|
||||
mAutopilotStatusInfo.isArriveAtStation = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var dockerV: String by Delegates.observable("") { _, oldValue, newValue ->
|
||||
if (!oldValue.contentEquals(newValue)) {
|
||||
M_LISTENERS.forEach {
|
||||
@@ -105,6 +119,8 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
||||
|
||||
fun getAutoPilotReportMessageContent(): String = autoPilotMessageContent
|
||||
|
||||
fun isArriveAtStation(): Boolean = mAutopilotStatusInfo.isArriveAtStation
|
||||
|
||||
/**
|
||||
* 通过Gnss定位更新来同步更新自动驾驶状态
|
||||
*/
|
||||
@@ -156,6 +172,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
||||
*/
|
||||
@Synchronized
|
||||
fun invokeArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) {
|
||||
mAutopilotStatusInfo.isArriveAtStation = true
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onAutopilotArriveAtStation(arrivalNotification)
|
||||
|
||||
Reference in New Issue
Block a user