合并dev_MogoAP_eagle-930_210926_8.0.12分支,并将规划全局路径以及引导线按照新架构中的监听合并,测试可用,在工控机上执行sh roadPlanning.sh 使用带有引导线的数据包

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-10-28 15:25:26 +08:00
parent 02f5f7cbee
commit a70eed4475
20 changed files with 377 additions and 471 deletions

View File

@@ -25,7 +25,6 @@ import com.mogo.och.taxi.OCHTaxiOverlayManager;
import com.mogo.och.taxi.R;
import com.mogo.och.view.SlidePanelView;
import com.mogo.service.adas.IMogoAdasOCHCallback;
import com.mogo.service.adas.IMogoAdasRouteCallBack;
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
@@ -46,7 +45,6 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
IMogoOCHTaxiArriveCallback,
IMogoADASAutoPilotStatusChangedListener,
IOperationChangedListener,
IMogoAdasRouteCallBack,
IMogoAdasOCHCallback,
IMogoCarLocationChangedListener2 {
@@ -118,7 +116,6 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
.getApis()
.getRegisterCenterApi()
.registerCarLocationChangedListener( TAG, this );
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasAutopilotRouteCallBack(this);
}
@NonNull
@@ -363,17 +360,6 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
OCHTaxiUiController.getInstance().runOnUIThread( () -> {
calculateTravelDistance( location );
} );
//坐标转换
MogoLocation loc = new MogoLocation();
loc.setTime(loc.getTime());
loc.setAccuracy(location.getAccuracy());
loc.setSpeed(location.getSpeed());
loc.setLongitude(location.getLongitude());
loc.setLatitude(location.getLatitude());
loc.setAltitude(location.getAltitude());
loc.setBearing(location.getBearing());
loc.setProvider(location.getProvider());
drawRouteOverlay(loc);
}
/**
@@ -476,26 +462,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
updateOrderStatus();
});
}
private OCHTaxiOverlayManager ochTaxiOverlayManager;
private List<MogoLatLng> mRouteList;
@Override
public void routeResult(List<MogoLatLng> routeList) {
mRouteList = routeList;
}
private void drawRouteOverlay(MogoLocation location){
if (mRouteList == null && ochTaxiOverlayManager!= null){
ochTaxiOverlayManager.clearMogoRouteOverlay();
return;
}
if (mRouteList.size() >0){
//adas回调导航路径 绘制引导线
if ( ochTaxiOverlayManager == null){
ochTaxiOverlayManager = new OCHTaxiOverlayManager(this.getContext());
}
ochTaxiOverlayManager.draw(location,mRouteList);
}
}
public double calculateTravelDistance(MogoLocation carLocation,List<MogoLatLng> routeList){
List<MogoLatLng> mPolylinePointList = new ArrayList<>();

View File

@@ -5,14 +5,13 @@ import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import java.util.List;
import java.util.ArrayList;
/**
* @author xiaoyuzhou
@@ -21,7 +20,7 @@ import java.util.List;
public class MoGoAutopilotStatusListenerImpl implements IMoGoAutopilotStatusListener {
@Override
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
}
@Override
@@ -34,10 +33,6 @@ public class MoGoAutopilotStatusListenerImpl implements IMoGoAutopilotStatusList
}
@Override
public void onAutopilotRoute(@Nullable AutopilotRouteInfo autopilotRoute) {
}
@Override
public void onAutopilotSNRequest() {
@@ -50,7 +45,7 @@ public class MoGoAutopilotStatusListenerImpl implements IMoGoAutopilotStatusList
}
@Override
public void onAutopilotIdentifyDataUpdate(@Nullable List<TrafficData> trafficData) {
public void onAutopilotIdentifyDataUpdate(@Nullable ArrayList<TrafficData> trafficData) {
}
@@ -58,4 +53,5 @@ public class MoGoAutopilotStatusListenerImpl implements IMoGoAutopilotStatusList
public void onAutopilotWarnMessage(@Nullable AutopilotWarnMessage autopilotWarnMessage) {
}
}

View File

@@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.hmi.ui.setting
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.commons.AbsMogoApplication
@@ -24,12 +23,12 @@ import com.mogo.eagle.core.utilcode.util.AppUtils
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.map.MogoMap
import com.mogo.service.statusmanager.StatusDescriptor
import com.mogo.utils.DeviceIdUtils
import com.mogo.utils.UiThreadHandler
import com.mogo.utils.network.utils.GsonUtil
import com.mogo.utils.storage.SharedPrefsMgr
import kotlinx.android.synthetic.main.view_debug_setting.view.*
import java.util.*
/**
* @author xiaoyuzhou
@@ -185,10 +184,6 @@ class DebugSettingView @JvmOverloads constructor(
}
override fun onAutopilotRoute(autopilotRoute: AutopilotRouteInfo?) {
}
override fun onAutopilotSNRequest() {
}
@@ -197,7 +192,7 @@ class DebugSettingView @JvmOverloads constructor(
}
override fun onAutopilotIdentifyDataUpdate(trafficData: List<TrafficData>?) {
override fun onAutopilotIdentifyDataUpdate(trafficData: ArrayList<TrafficData>?) {
}

View File

@@ -1,6 +1,5 @@
package com.mogo.eagle.core.function.hmi.ui.widget;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;

View File

@@ -64,6 +64,7 @@ dependencies {
implementation project(':core:mogo-core-res')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
}
}

View File

@@ -10,14 +10,18 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.api.map.smp.IMogoSmallMapProvider;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.service.adas.IMogoAdasRouteCallBack;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
import com.mogo.eagle.core.function.api.map.smp.IMogoSmallMapProvider;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import java.util.ArrayList;
import java.util.List;
/**
@@ -25,7 +29,7 @@ import java.util.List;
* @date 12/10/20 1:34 PM
*/
@Route(path = MogoServicePaths.PATH_SMALL_MAP)
public class SmallMapProvider implements IMogoSmallMapProvider, IMogoStatusChangedListener, IMogoAdasRouteCallBack {
public class SmallMapProvider implements IMogoSmallMapProvider, IMogoStatusChangedListener, IMoGoAutopilotPlanningListener {
private final String TAG = "SmallMapProvider";
private Context mContext;
@@ -40,7 +44,7 @@ public class SmallMapProvider implements IMogoSmallMapProvider, IMogoStatusChang
mActivity = activity;
mContainerId = containerId;
SmpServiceManager.init(mActivity);
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasAutopilotRouteCallBack(this);
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
}
@Override
@@ -85,7 +89,7 @@ public class SmallMapProvider implements IMogoSmallMapProvider, IMogoStatusChang
Log.d(TAG, "准备show fragment");
mActivity.getSupportFragmentManager().beginTransaction().show(mSmallMapFragment).commitAllowingStateLoss();
} catch (Exception e) {
Log.d(TAG, "add fragment 失败 ======"+e.getMessage());
Log.d(TAG, "add fragment 失败 ======" + e.getMessage());
e.printStackTrace();
}
}
@@ -130,15 +134,6 @@ public class SmallMapProvider implements IMogoSmallMapProvider, IMogoStatusChang
}
}
@Override
public void routeResult(List<MogoLatLng> routeList) {
Log.e("lianglihui","SmallMapProvider");
if (routeList != null && routeList.size() > 0) {
drawablePolyline(routeList);
} else {
clearPolyline();
}
}
@Nullable
@Override
@@ -154,6 +149,28 @@ public class SmallMapProvider implements IMogoSmallMapProvider, IMogoStatusChang
@Override
public void onDestroy() {
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(TAG);
}
@Override
public void onAutopilotTrajectory(ArrayList<ADASTrajectoryInfo> trajectoryInfos) {
}
@Override
public void onAutopilotRotting(AutopilotRouteInfo routeList) {
if (routeList.getModels() == null || routeList.getModels().size() == 0) {
return;
}
List<MogoLatLng> latLngList = new ArrayList<>();
for (AutopilotRouteInfo.RouteModels routeModel : routeList.getModels()) {
latLngList.add(new MogoLatLng(routeModel.getLat(), routeModel.getLon()));
}
Log.e(TAG, "routeResult:" + latLngList.size());
if (latLngList.size() > 0) {
drawablePolyline(latLngList);
} else {
clearPolyline();
}
}
}

View File

@@ -1,115 +1,115 @@
package com.mogo.service.adas.entity;
/**
* @author song kenan
* @des
* @date 2021/10/21
*/
public class ADASTrajectoryInfo {
//经度
private Double lon;
//纬度
private Double lat;
//高度
private Double alt;
//时间 秒s
private Double time;
//速度 m/s
private Double velocity;
//加速度
private Double acceleration;
//速度方向
private Double theta;
//曲率
private Double kappa;
//从起点到目前的总距离
private Double accumulatedDis;
public void setLon(Double lon) {
this.lon = lon;
}
public void setLat(Double lat) {
this.lat = lat;
}
public void setAlt(Double alt) {
this.alt = alt;
}
public void setTime(Double time) {
this.time = time;
}
public void setVelocity(Double velocity) {
this.velocity = velocity;
}
public void setAcceleration(Double acceleration) {
this.acceleration = acceleration;
}
public void setTheta(Double theta) {
this.theta = theta;
}
public void setKappa(Double kappa) {
this.kappa = kappa;
}
public void setAccumulatedDis(Double accumulatedDis) {
this.accumulatedDis = accumulatedDis;
}
public Double getLon() {
return lon;
}
public Double getLat() {
return lat;
}
public Double getAlt() {
return alt;
}
public Double getTime() {
return time;
}
public Double getVelocity() {
return velocity;
}
public Double getAcceleration() {
return acceleration;
}
public Double getTheta() {
return theta;
}
public Double getKappa() {
return kappa;
}
public Double getAccumulatedDis() {
return accumulatedDis;
}
@Override
public String toString() {
return "TrajectoryModels{" +
"lon=" + lon +
", lat=" + lat +
", alt=" + alt +
", time='" + time + '\'' +
", velocity=" + velocity +
", acceleration=" + acceleration +
", theta=" + theta +
", kappa=" + kappa +
", accumulatedDis=" + accumulatedDis +
'}';
}
}
package com.mogo.eagle.core.data.autopilot;
/**
* @author song kenan
* @des
* @date 2021/10/21
*/
public class ADASTrajectoryInfo {
//经度
private Double lon;
//纬度
private Double lat;
//高度
private Double alt;
//时间 秒s
private Double time;
//速度 m/s
private Double velocity;
//加速度
private Double acceleration;
//速度方向
private Double theta;
//曲率
private Double kappa;
//从起点到目前的总距离
private Double accumulatedDis;
public void setLon(Double lon) {
this.lon = lon;
}
public void setLat(Double lat) {
this.lat = lat;
}
public void setAlt(Double alt) {
this.alt = alt;
}
public void setTime(Double time) {
this.time = time;
}
public void setVelocity(Double velocity) {
this.velocity = velocity;
}
public void setAcceleration(Double acceleration) {
this.acceleration = acceleration;
}
public void setTheta(Double theta) {
this.theta = theta;
}
public void setKappa(Double kappa) {
this.kappa = kappa;
}
public void setAccumulatedDis(Double accumulatedDis) {
this.accumulatedDis = accumulatedDis;
}
public Double getLon() {
return lon;
}
public Double getLat() {
return lat;
}
public Double getAlt() {
return alt;
}
public Double getTime() {
return time;
}
public Double getVelocity() {
return velocity;
}
public Double getAcceleration() {
return acceleration;
}
public Double getTheta() {
return theta;
}
public Double getKappa() {
return kappa;
}
public Double getAccumulatedDis() {
return accumulatedDis;
}
@Override
public String toString() {
return "TrajectoryModels{" +
"lon=" + lon +
", lat=" + lat +
", alt=" + alt +
", time='" + time + '\'' +
", velocity=" + velocity +
", acceleration=" + acceleration +
", theta=" + theta +
", kappa=" + kappa +
", accumulatedDis=" + accumulatedDis +
'}';
}
}

View File

@@ -0,0 +1,27 @@
package com.mogo.eagle.core.function.api.autopilot;
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
import java.util.ArrayList;
/**
* 自动驾驶规划路线相关的监听
*/
public interface IMoGoAutopilotPlanningListener {
/**
* 工控机引导线数据
*
* @param trajectoryInfos 引导线数据经纬度
*/
void onAutopilotTrajectory(ArrayList<ADASTrajectoryInfo> trajectoryInfos);
/**
* 2021/6/23 工控机经纬度 绘制时转成高德经纬度
*
* @param routeList 工控机全局规划路径
*/
void onAutopilotRotting(AutopilotRouteInfo routeList);
}

View File

@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.api.autopilot
import com.mogo.eagle.core.data.autopilot.*
import com.mogo.eagle.core.data.traffic.TrafficData
import java.util.*
/**
* @author xiaoyuzhou
@@ -32,17 +33,10 @@ interface IMoGoAutopilotStatusListener {
*/
fun onAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?)
/**
* 自动驾驶路径
*
* @param autopilotRoute
*/
fun onAutopilotRoute(autopilotRoute: AutopilotRouteInfo?)
/**
* 工控机获取SN
*/
fun onAutopilotSNRequest()
fun onAutopilotSNRequest(){}
/**
* 工控机监控节点
@@ -54,7 +48,7 @@ interface IMoGoAutopilotStatusListener {
*
* @param trafficData 交通元素信息列表
*/
fun onAutopilotIdentifyDataUpdate(trafficData: List<TrafficData>?)
fun onAutopilotIdentifyDataUpdate(trafficData: ArrayList<TrafficData>?)
/**
* 报警信息

View File

@@ -6,7 +6,6 @@ import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
import com.mogo.eagle.core.function.call.base.CallerBase
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.GsonUtils
/**
@@ -126,20 +125,6 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
}
}
/**
* 自动驾驶路径 回调
* @param routeInfo
*/
@Synchronized
fun invokeAutopilotRoute(routeInfo: AutopilotRouteInfo?) {
//Logger.d(TAG, "$routeInfo")
M_AUTOPILOT_STATUS_LISTENERS.forEach {
val tag = it.key
val listener = it.value
//Logger.d(TAG, "tag:$tag listener:$listener")
listener.onAutopilotRoute(routeInfo)
}
}
/**
* 工控机获取SN 回调
@@ -173,7 +158,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
* 识别交通元素数据发生更新 回调
*/
@Synchronized
fun invokeAutopilotIdentifyDataUpdate(trafficData: List<TrafficData>?) {
fun invokeAutopilotIdentifyDataUpdate(trafficData: ArrayList<TrafficData>?) {
//Logger.d(TAG, "$trafficData")
M_AUTOPILOT_STATUS_LISTENERS.forEach {
val tag = it.key

View File

@@ -0,0 +1,86 @@
package com.mogo.eagle.core.function.call.autopilot
import androidx.annotation.Nullable
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* @author xiaoyuzhou
* @date 2021/9/30 5:48 下午
* 规划路径相关回调
*/
object CallerAutopilotPlanningListenerManager : CallerBase() {
private val TAG = "CallerAutopilotPlanningListenerManager"
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val M_AUTOPILOT_PLANNING_LISTENER: HashMap<String, IMoGoAutopilotPlanningListener> =
HashMap()
/**
* 添加监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
fun addListener(
@Nullable tag: String,
@Nullable listener: IMoGoAutopilotPlanningListener
) {
M_AUTOPILOT_PLANNING_LISTENER[tag] = listener
}
/**
* 删除监听
* @param tag 标记,用来注销监听使用
*/
fun removeListener(@Nullable tag: String) {
M_AUTOPILOT_PLANNING_LISTENER.remove(tag)
}
/**
* 删除自动驾驶按钮选中监听
* @param listener 要删除的监听对象
*/
fun removeListener(@Nullable listener: IMoGoObuStatusListener) {
M_AUTOPILOT_PLANNING_LISTENER.forEach {
if (it.value == listener) {
M_AUTOPILOT_PLANNING_LISTENER.remove(it.key)
}
}
}
/**
* 车前引导线 回调
* @param trajectoryInfo 自动驾驶状态信息
*/
@Synchronized
fun invokeAutopilotTrajectory(trajectoryInfo: ArrayList<ADASTrajectoryInfo>) {
//Logger.d(TAG, "$trajectoryInfo")
M_AUTOPILOT_PLANNING_LISTENER.forEach {
val tag = it.key
val listener = it.value
//Logger.d(TAG, "tag:$tag listener:$listener")
listener.onAutopilotTrajectory(trajectoryInfo)
}
}
/**
* 路径规划 回调
* @param routeList 自动驾驶网约车回调数据
*/
@Synchronized
fun invokeAutopilotRotting(routeList: AutopilotRouteInfo) {
//Logger.d(TAG, "$routeList")
M_AUTOPILOT_PLANNING_LISTENER.forEach {
val tag = it.key
val listener = it.value
//Logger.d(TAG, "tag:$tag listener:$listener")
listener.onAutopilotRotting(routeList)
}
}
}

View File

@@ -3,9 +3,8 @@ package com.mogo.module.adas;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.util.Log;
import com.google.gson.Gson;
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
@@ -14,8 +13,10 @@ import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.module.adas.model.AdasServiceModel;
import com.mogo.module.common.drawer.IdentifyDataDrawer;
@@ -24,22 +25,9 @@ import com.mogo.utils.network.utils.GsonUtil;
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.OnAdasMsgConnectStatusListener;
import com.zhidao.support.adas.high.bean.AutopilotRoute;
import com.zhidao.support.adas.high.bean.AutopilotStatus;
import com.zhidao.support.adas.high.bean.AutopilotWayArrive;
import com.zhidao.support.adas.high.bean.CarLaneInfo;
import com.zhidao.support.adas.high.bean.CarStateInfo;
import com.zhidao.support.adas.high.bean.LightStatueInfo;
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
import com.zhidao.support.adas.high.bean.RectInfo;
import com.zhidao.support.adas.high.bean.TrajectoryInfo;
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo;
import com.zhidao.support.adas.high.common.MsgActionType;
import com.zhidao.support.obu.ami.AmiClientManager;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.Flowable;
@@ -51,7 +39,8 @@ import io.reactivex.schedulers.Schedulers;
*/
public class AdasEventManager implements
OnAdasMsgConnectStatusListener,
IMoGoAutopilotStatusListener {
IMoGoAutopilotStatusListener,
IMoGoAutopilotPlanningListener {
private final String TAG = "AdasEventManager";
@@ -73,6 +62,7 @@ public class AdasEventManager implements
private AdasEventManager() {
gson = GsonUtil.getGson();
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
}
public static AdasEventManager getInstance() {
@@ -118,18 +108,6 @@ public class AdasEventManager implements
}
@Override
public void onAutopilotTrajectory(List<TrajectoryInfo> trajectoryList) {
// Log.e("lianglihui","adas onAutopilotTrajectory");
if(trajectoryList != null && trajectoryList.size() >0){
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.onAutopilotTrajectory(trajectoryList);
}
}
}
}
@Override
public void onAutopilotSNRequest() {
if (providerBizListener != null) {
@@ -139,11 +117,6 @@ public class AdasEventManager implements
}
}
@Override
public void onAutopilotGuardian(AutopilotGuardianInfo guardianInfo) {
}
@Override
public void onWebSocketConnectSuccess() {
Logger.d(TAG, "webSocket 连接成功");
@@ -237,7 +210,6 @@ public class AdasEventManager implements
}
//can数据转发
AutopilotCarStateInfo.ValuesBean bean = autoPilotCarStateInfo.getValues();
if (bean != null) {
@@ -246,18 +218,6 @@ public class AdasEventManager implements
}
}
@Override
public void onAutopilotRoute(@Nullable AutopilotRouteInfo autopilotRoute) {
if (autopilotRoute.getModels() == null || autopilotRoute.getModels().size() == 0) {
Logger.d(TAG, "onAutopilotRoute is null !");
return;
}
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.autopilotRoute(autopilotRoute);
}
}
}
@Override
public void onAutopilotGuardian(@Nullable AutopilotGuardianStatusInfo guardianInfo) {
@@ -265,7 +225,7 @@ public class AdasEventManager implements
}
@Override
public void onAutopilotIdentifyDataUpdate(@Nullable List<TrafficData> trafficData) {
public void onAutopilotIdentifyDataUpdate(@Nullable ArrayList<TrafficData> trafficData) {
try {
if (trafficData == null) {
IdentifyDataDrawer.getInstance().clearOldMarker();
@@ -294,4 +254,30 @@ public class AdasEventManager implements
}
}
}
@Override
public void onAutopilotTrajectory(ArrayList<ADASTrajectoryInfo> trajectoryInfo) {
if (trajectoryInfo != null && trajectoryInfo.size() > 0) {
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.onAutopilotTrajectory(trajectoryInfo);
}
}
}
}
@Override
public void onAutopilotRotting(@Nullable AutopilotRouteInfo autopilotRoute) {
if (autopilotRoute.getModels() == null || autopilotRoute.getModels().size() == 0) {
Logger.d(TAG, "onAutopilotRoute is null !");
return;
}
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.autopilotRoute(autopilotRoute);
}
}
}
}

View File

@@ -1,6 +1,5 @@
package com.mogo.module.adas
import android.util.Log
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo
@@ -13,7 +12,6 @@ import com.zhidao.support.adas.high.bean.CarStateInfo
import com.zhidao.support.adas.high.bean.RectInfo.RectBean
import com.zhidao.support.adas.high.bean.WarnMessageInfo
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo
import java.util.*
/**
* @author congtaowang
@@ -62,11 +60,11 @@ object AdasObjectUtils {
return warnMessage
}
fun regroupTrafficDataData(datums: List<RectBean?>?): List<TrafficData>? {
fun regroupTrafficDataData(datums: List<RectBean?>?): ArrayList<TrafficData>? {
if (datums == null || datums.isEmpty()) {
return null
}
val recognizedListResults: MutableList<TrafficData> = ArrayList()
val recognizedListResults: ArrayList<TrafficData> = ArrayList()
for (model in datums) {
if (model == null) {
continue

View File

@@ -1,19 +1,12 @@
package com.mogo.module.adas;
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
import com.mogo.module.adas.entity.WarnMessageModel;
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarRectModel;
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarStateModel;
import com.zhidao.support.adas.high.bean.AutopilotRoute;
import com.zhidao.support.adas.high.bean.AutopilotStatus;
import com.zhidao.support.adas.high.bean.RectInfo;
import com.zhidao.support.adas.high.bean.TrajectoryInfo;
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
import java.util.ArrayList;
import java.util.List;
@@ -65,8 +58,7 @@ public interface IAdasDataListener {
* 车前引导路径回调
* @param trajectory
*/
default void onAutopilotTrajectory(List<TrajectoryInfo> trajectory) {
default void onAutopilotTrajectory(ArrayList<ADASTrajectoryInfo> trajectory) {
}

View File

@@ -1,5 +1,8 @@
package com.mogo.module.adas;
import android.util.Log;
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
@@ -8,6 +11,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.utils.logger.Logger;
import com.zhidao.support.adas.high.AdasManager;
import com.zhidao.support.adas.high.OnAdasListener;
@@ -24,6 +28,7 @@ import com.zhidao.support.adas.high.bean.WarnMessageInfo;
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo;
import com.zhidao.support.obu.ami.AmiClientManager;
import java.util.ArrayList;
import java.util.List;
/**
@@ -37,7 +42,7 @@ public class OnAdasListenerAdapter implements OnAdasListener {
@Override
public void onRectData(RectInfo rectInfo) {
List<TrafficData> recognizedListResults = AdasObjectUtils.INSTANCE.regroupTrafficDataData(rectInfo.getModels());
ArrayList<TrafficData> recognizedListResults = AdasObjectUtils.INSTANCE.regroupTrafficDataData(rectInfo.getModels());
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotIdentifyDataUpdate(recognizedListResults);
}
@@ -95,12 +100,29 @@ public class OnAdasListenerAdapter implements OnAdasListener {
public void onAutopilotRoute(AutopilotRoute route) {
Logger.d(TAG, "onAutopilotRoute : " + route.toString());
AutopilotRouteInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAdasAutopilotRoute(route);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotRoute(autopilotRoute);
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotRotting(autopilotRoute);
}
@Override
public void onAutopilotTrajectory(List<TrajectoryInfo> trajectoryList) {
ArrayList<ADASTrajectoryInfo> trajectoryInfoArrayList = new ArrayList<>();
if (trajectoryList != null && trajectoryList.size() > 0) {
for (TrajectoryInfo trajectory : trajectoryList) {
ADASTrajectoryInfo adasTrajectoryInfo = new ADASTrajectoryInfo();
adasTrajectoryInfo.setLat(trajectory.getLat());
adasTrajectoryInfo.setLon(trajectory.getLon());
adasTrajectoryInfo.setAcceleration(trajectory.getAcceleration());
adasTrajectoryInfo.setAccumulatedDis(trajectory.getAccumulatedDis());
adasTrajectoryInfo.setTime(trajectory.getTime());
adasTrajectoryInfo.setVelocity(trajectory.getVelocity());
adasTrajectoryInfo.setAlt(trajectory.getAlt());
adasTrajectoryInfo.setKappa(trajectory.getKappa());
adasTrajectoryInfo.setTheta(trajectory.getTheta());
trajectoryInfoArrayList.add(adasTrajectoryInfo);
}
Log.e(TAG, "time:" + System.currentTimeMillis() + "trajectoryInfoArrayList:" + trajectoryInfoArrayList);
}
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotTrajectory(trajectoryInfoArrayList);
}
@Override

View File

@@ -4,53 +4,33 @@ import android.content.Context;
import android.location.Location;
import android.util.Log;
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.adas.IMogoAdasRouteCallBack;
import com.mogo.service.adas.IMogoAdasTrajectoryDataCallBack;
import com.mogo.service.adas.entity.ADASTrajectoryInfo;
import java.util.ArrayList;
import java.util.List;
public class MogoRouteOverlayManager implements IMogoCarLocationChangedListener2 {
private static volatile MogoRouteOverlayManager sInstance;
public class MogoRouteOverlayManager implements IMogoCarLocationChangedListener2, IMoGoAutopilotPlanningListener {
private static volatile MogoRouteOverlayManager sInstance;
private Context mContext;
private String TAG = "MogoRouteOverlayManager";
private MogoRouteOverlayManager(Context context){
private MogoRouteOverlayManager(Context context) {
mContext = context;
}
public void init() {
MogoApisHandler.getInstance()
.getApis()
.getRegisterCenterApi()
.registerCarLocationChangedListener( "MogoRouteOverlayManager",this);
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasAutopilotRouteCallBack(new IMogoAdasRouteCallBack(){
@Override
public void routeResult(List<MogoLatLng> routeList) {
Log.e("lianglihui","routeResult:"+routeList.size());
RouteOverlayDrawer.getInstance(mContext).putRouteList(routeList);
}
});
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasTrajectoryDataCallBack(new IMogoAdasTrajectoryDataCallBack() {
@Override
public void onAutopilotTrajectory(List<ADASTrajectoryInfo> trajectoryInfos) {
if (trajectoryInfos == null || trajectoryInfos.size() == 0){
return;
}
Log.e("lianglihui","trajectoryInfos:"+trajectoryInfos.size());
List<MogoLatLng> mogoLatLngs = new ArrayList<>();
for (ADASTrajectoryInfo a:trajectoryInfos) {
mogoLatLngs.add(new MogoLatLng(a.getLat(),a.getLon()));
}
RouteOverlayDrawer.getInstance(mContext).drawTrajectoryList(mogoLatLngs);
}
});
MogoApisHandler.getInstance()
.getApis()
.getRegisterCenterApi()
.registerCarLocationChangedListener("MogoRouteOverlayManager", this);
CallerAutopilotPlanningListenerManager.INSTANCE.addListener("MogoRouteOverlayManager", this);
}
public static MogoRouteOverlayManager getInstance(Context context) {
@@ -74,8 +54,9 @@ public class MogoRouteOverlayManager implements IMogoCarLocationChangedListener2
public void onCarLocationChanged(MogoLatLng latLng) {
}
public void updateLocation(Location location){
if (location == null){
public void updateLocation(Location location) {
if (location == null) {
return;
}
//坐标转换
@@ -90,4 +71,30 @@ public class MogoRouteOverlayManager implements IMogoCarLocationChangedListener2
loc.setProvider(location.getProvider());
RouteOverlayDrawer.getInstance(mContext).drawRouteOverlay(loc);
}
@Override
public void onAutopilotTrajectory(ArrayList<ADASTrajectoryInfo> trajectoryInfos) {
if (trajectoryInfos == null || trajectoryInfos.size() == 0) {
return;
}
Log.e(TAG, "trajectoryInfos:" + trajectoryInfos.size());
List<MogoLatLng> mogoLatLngs = new ArrayList<>();
for (ADASTrajectoryInfo a : trajectoryInfos) {
mogoLatLngs.add(new MogoLatLng(a.getLat(), a.getLon()));
}
RouteOverlayDrawer.getInstance(mContext).drawTrajectoryList(mogoLatLngs);
}
@Override
public void onAutopilotRotting(AutopilotRouteInfo routeList) {
if (routeList.getModels() == null || routeList.getModels().size() == 0) {
return;
}
List<MogoLatLng> latLngList = new ArrayList<>();
for (AutopilotRouteInfo.RouteModels routeModel : routeList.getModels()) {
latLngList.add(new MogoLatLng(routeModel.getLat(), routeModel.getLon()));
}
Log.e(TAG, "routeResult:" + latLngList.size());
RouteOverlayDrawer.getInstance(mContext).putRouteList(latLngList);
}
}

View File

@@ -2,12 +2,7 @@ package com.mogo.service.adas;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.service.adas.entity.ADASRecognizedResult;
import com.mogo.service.adas.entity.ADASTrajectoryInfo;
import java.util.List;
/**
* @author congtaowang
@@ -89,20 +84,6 @@ public interface IMogoADASController extends IProvider {
*/
void removeAdasWarnMessageCallback(IMogoAdasWarnMessageCallback callback);
/**
* 添加adas自动驾驶路线回调
*
* @param callBack
*/
void addAdasAutopilotRouteCallBack(IMogoAdasRouteCallBack callBack);
/**
* 移除adas自动驾驶路线回调
*
* @param callBack
*/
void removeAdasAutopilotRouteCallBack(IMogoAdasRouteCallBack callBack);
/**
* 查询自动驾驶路线
*/
@@ -171,15 +152,4 @@ public interface IMogoADASController extends IProvider {
*/
void cancelAutopilot();
/**
* 添加车前引导线回调
* @param
*/
void addAdasTrajectoryDataCallBack(IMogoAdasTrajectoryDataCallBack callBack);
/**
* 移除车前引导线回调
* @param
*/
void removeAdasTrajectoryDataCallBack(IMogoAdasTrajectoryDataCallBack callBack);
}

View File

@@ -1,10 +0,0 @@
package com.mogo.service.adas;
import com.mogo.eagle.core.data.map.MogoLatLng;
import java.util.List;
public interface IMogoAdasRouteCallBack {
// TODO: 2021/6/23 工控机经纬度 绘制时转成高德经纬度
void routeResult(List<MogoLatLng> routeList);
}

View File

@@ -1,9 +0,0 @@
package com.mogo.service.adas;
import com.mogo.service.adas.entity.ADASTrajectoryInfo;
import java.util.List;
public interface IMogoAdasTrajectoryDataCallBack {
void onAutopilotTrajectory(List<ADASTrajectoryInfo> trajectoryInfo);
}

View File

@@ -3,11 +3,6 @@ package com.mogo.service.impl.adas;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
@@ -16,13 +11,10 @@ import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotControlCmdParameter;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.module.adas.AdasProvider;
import com.mogo.module.adas.IAdasDataListener;
@@ -31,17 +23,7 @@ import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.adas.IMogoAdasCarDataCallback;
import com.mogo.service.adas.IMogoAdasDataCallback;
import com.mogo.service.adas.IMogoAdasOCHCallback;
import com.mogo.service.adas.IMogoAdasRouteCallBack;
import com.mogo.service.adas.IMogoAdasTrajectoryDataCallBack;
import com.mogo.service.adas.IMogoAdasWarnMessageCallback;
import com.mogo.eagle.core.data.autopilot.RemoteControlAutoPilotParameters;
import com.mogo.service.adas.entity.ADASCarStateInfo;
import com.mogo.service.adas.entity.ADASRecognizedResult;
import com.mogo.service.adas.entity.ADASTrajectoryInfo;
import com.mogo.service.adas.entity.ADASWarnMessage;
import com.mogo.eagle.core.data.autopilot.AdasOCHData;
import com.mogo.service.adas.entity.CarModelListResponse;
import com.mogo.service.datamanager.IMogoDataManager;
import com.mogo.service.impl.singleton.SingletonsHolder;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.utils.UiThreadHandler;
@@ -51,17 +33,9 @@ import com.zhidao.adasconfig.api.AdasConfigApiController;
import com.zhidao.adasconfig.common.config.EnumCarHeading;
import com.zhidao.adasconfig.common.config.EnumSkinStyle;
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarRectModel;
import com.zhidao.support.adas.high.bean.AutopilotRoute;
import com.zhidao.support.adas.high.bean.AutopilotStatus;
import com.zhidao.support.adas.high.bean.RectInfo;
import com.zhidao.support.adas.high.bean.TrajectoryInfo;
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -94,16 +68,6 @@ public class MogoADASController implements IMogoADASController {
*/
private final List<IMogoAdasWarnMessageCallback> mMogoAdasWarnMessageCallbackList = new CopyOnWriteArrayList<>();
/**
* 自动驾驶路线回调
*/
private final List<IMogoAdasRouteCallBack> mMogoAdasRouteCallBacks = new CopyOnWriteArrayList<>();
/**
* 车前引导线回调
*/
private final List<IMogoAdasTrajectoryDataCallBack> mMogoAdasTrajectoryDataCallBacks = new CopyOnWriteArrayList<>();
private IAdasDataListener mAdasDataListener;
private IMogoAdasCarDataCallback mMogoAdasCarDataCallback;
@@ -214,53 +178,6 @@ public class MogoADASController implements IMogoADASController {
}
}
@Override
public void onAutopilotTrajectory(List<TrajectoryInfo> trajectorys) {
if(trajectorys != null && trajectorys.size() > 0){
List<ADASTrajectoryInfo> trajectoryInfoArrayList = new ArrayList<>();
// TrajectoryInfo t= trajectorys.get(0);
Log.e("lianglihui","time:"+ System.currentTimeMillis());
for (TrajectoryInfo trajectory : trajectorys){
ADASTrajectoryInfo adasTrajectoryInfo = new ADASTrajectoryInfo();
adasTrajectoryInfo.setLat(trajectory.getLat());
adasTrajectoryInfo.setLon(trajectory.getLon());
adasTrajectoryInfo.setAcceleration(trajectory.getAcceleration());
adasTrajectoryInfo.setAccumulatedDis(trajectory.getAccumulatedDis());
adasTrajectoryInfo.setTime(trajectory.getTime());
adasTrajectoryInfo.setVelocity(trajectory.getVelocity());
adasTrajectoryInfo.setAlt(trajectory.getAlt());
adasTrajectoryInfo.setKappa(trajectory.getKappa());
adasTrajectoryInfo.setTheta(trajectory.getTheta());
Log.e("lianglihui","trajectory:"+ trajectory.getLat()+"-"+trajectory.getLon());
trajectoryInfoArrayList.add(adasTrajectoryInfo);
}
for (IMogoAdasTrajectoryDataCallBack callBack: mMogoAdasTrajectoryDataCallBacks){
if (callBack != null){
callBack.onAutopilotTrajectory(trajectoryInfoArrayList);
}
}
}
}
@Override
public void autopilotRoute(AutopilotRouteInfo autopilotRoute) {
if (autopilotRoute.getModels() == null || autopilotRoute.getModels().size() == 0) {
return;
}
List<MogoLatLng> latLngList = new ArrayList<>();
for (AutopilotRouteInfo.RouteModels routeModel : autopilotRoute.getModels()) {
latLngList.add(new MogoLatLng(routeModel.getLat(), routeModel.getLon()));
}
for (IMogoAdasRouteCallBack callback : mMogoAdasRouteCallBacks) {
if (callback == null) {
continue;
}
callback.routeResult(latLngList);
}
}
@Override
public void ownerCarStateInfo(String ownerCarStateInfo) {
@@ -467,24 +384,6 @@ public class MogoADASController implements IMogoADASController {
mMogoAdasWarnMessageCallbackList.remove(callback);
}
@Override
public void addAdasAutopilotRouteCallBack(IMogoAdasRouteCallBack callBack) {
if (callBack == null) {
return;
}
if (!mMogoAdasRouteCallBacks.contains(callBack)) {
mMogoAdasRouteCallBacks.add(callBack);
}
}
@Override
public void removeAdasAutopilotRouteCallBack(IMogoAdasRouteCallBack callBack) {
if (callBack == null) {
return;
}
mMogoAdasRouteCallBacks.remove(callBack);
}
@Override
public void queryAutopilotRoute() {
adasProvider.queryAutopilotRoute();
@@ -560,22 +459,6 @@ public class MogoADASController implements IMogoADASController {
adasProvider.cancelPilot();
}
@Override
public void addAdasTrajectoryDataCallBack(IMogoAdasTrajectoryDataCallBack callBack) {
if (callBack == null) {
return;
}
if (!mMogoAdasTrajectoryDataCallBacks.contains(callBack)) {
mMogoAdasTrajectoryDataCallBacks.add(callBack);
}
}
@Override
public void removeAdasTrajectoryDataCallBack(IMogoAdasTrajectoryDataCallBack callBack) {
if (callBack != null){
mMogoAdasTrajectoryDataCallBacks.remove(callBack);
}
}
}