[3.4.0-map-sdk] loc wgs84 opt , get instead of callback , add func of traffic light cross road
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
package com.mogo.eagle.core.function.business;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager;
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerLimitingVelocityListenerManager;
|
||||
import com.mogo.map.MapDataWrapper;
|
||||
@@ -12,19 +10,14 @@ import com.mogo.map.MapDataWrapper;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
|
||||
/**
|
||||
* 限速
|
||||
*
|
||||
* @author mogoauto
|
||||
*/
|
||||
public class SpeedLimitDataManager implements IMoGoChassisLocationWGS84Listener {
|
||||
public class SpeedLimitDataManager {
|
||||
|
||||
private final static String TAG = "SpeedLimitDataManager";
|
||||
private static volatile SpeedLimitDataManager instance;
|
||||
private volatile MogoLocation mLocation;
|
||||
|
||||
private SpeedLimitDataManager() {
|
||||
}
|
||||
@@ -40,34 +33,26 @@ public class SpeedLimitDataManager implements IMoGoChassisLocationWGS84Listener
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChassisLocationWGS84(@Nullable MogoLocation gnssInfo) {
|
||||
mLocation = gnssInfo;
|
||||
}
|
||||
|
||||
private class SpeedTimerTask extends TimerTask {
|
||||
private static class SpeedTimerTask extends TimerTask {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mLocation != null) {
|
||||
getSpeedLimit();
|
||||
}
|
||||
getSpeedLimit();
|
||||
}
|
||||
|
||||
private void getSpeedLimit() {
|
||||
MapDataWrapper.INSTANCE.getLimitSpeed(mLocation.getLongitude(), mLocation.getLatitude(), (float) mLocation.getHeading(), new Function1<Integer, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(Integer integer) {
|
||||
MogoLocation loc = CallerChassisLocationWGS84ListenerManager.INSTANCE.getChassisLocationWGS84();
|
||||
if (loc.getLatitude() > 0 && loc.getLongitude() > 0) {
|
||||
MapDataWrapper.INSTANCE.getLimitSpeed(loc.getLongitude(), loc.getLatitude(), (float) loc.getHeading(), integer -> {
|
||||
if (integer != null && integer > 0) {
|
||||
CallerLimitingVelocityListenerManager.INSTANCE.invokeUnion(integer, DataSourceType.MAP);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void start() {
|
||||
CallerChassisLocationWGS84ListenerManager.INSTANCE.addListener(TAG, this);
|
||||
Timer mTimer = new Timer();
|
||||
mTimer.schedule(new SpeedTimerTask(), 3000, 1000);
|
||||
}
|
||||
|
||||
@@ -75,18 +75,18 @@ public class MogoRouteOverlayManager implements
|
||||
if (gnssInfo == null) {
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "-- onChassisLocationGCJ02 -- 1 ---" + ":auto-mode:" + autopilotMode.get() + ", isArriveAtStation: " + isArriveAtStation.get());
|
||||
// Log.d(TAG, "-- onChassisLocationGCJ02 -- 1 ---" + ":auto-mode:" + autopilotMode.get() + ", isArriveAtStation: " + isArriveAtStation.get());
|
||||
if (isArriveAtStation.get() && autopilotMode.get() != 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:" + autopilotMode.get() + ", isDemoMode:" + FunctionBuildConfig.isDemoMode + ", force:" + FunctionBuildConfig.isForceDrawAutopilotTrajectoryByDebugSettingView);
|
||||
boolean force = FunctionBuildConfig.isForceDrawAutopilotTrajectoryByDebugSettingView || FunctionBuildConfig.isDemoMode && FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData;
|
||||
if (!force && autopilotMode.get() != 2) {
|
||||
RouteOverlayDrawer.getInstance().clearMogoRouteOverlay();
|
||||
return;
|
||||
}
|
||||
Log.d(TAG, "-- onChassisLocationGCJ02 -- 3 ---");
|
||||
// Log.d(TAG, "-- onChassisLocationGCJ02 -- 3 ---");
|
||||
synchronized (queue) {
|
||||
if (!queue.isEmpty()) {
|
||||
List<MessagePad.TrajectoryPoint> items = queue.pollLast();
|
||||
|
||||
Reference in New Issue
Block a user