diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusPresenter.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusPresenter.java index 893d4e46eb..3da432fb7f 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusPresenter.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/presenter/OchBusPresenter.java @@ -30,8 +30,8 @@ import com.mogo.och.bus.bean.UpdateSiteStatusRequest; import com.mogo.och.bus.fragment.OchBusFragment; import com.mogo.och.bus.net.IOchBusApiService; import com.mogo.service.adas.IMogoAdasOCHCallback; -import com.mogo.eagle.core.data.autopilot.AutoPilotControlParameters; -import com.mogo.eagle.core.data.autopilot.AutoPilotStationInfo; +import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters; +import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo; import com.mogo.utils.logger.Logger; import com.mogo.utils.network.RequestOptions; import com.mogo.utils.network.utils.GsonUtil; @@ -307,10 +307,10 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog currentStation.setIsCurrentSite( STATION_STATUS_LEAVING ); nextStation.setIsCurrentSite( STATION_STATUS_ARRIVING ); - AutoPilotControlParameters currentAutopilot = new AutoPilotControlParameters(); + AutopilotControlParameters currentAutopilot = new AutopilotControlParameters(); currentAutopilot.isSpeakVoice = !isRestart; - currentAutopilot.startLatLon = new AutoPilotControlParameters.AutoPilotLonLat( currentStation.getLat(), currentStation.getLon() ); - currentAutopilot.endLatLon = new AutoPilotControlParameters.AutoPilotLonLat( nextStation.getLat(), nextStation.getLon() ); + currentAutopilot.startLatLon = new AutopilotControlParameters.AutoPilotLonLat( currentStation.getLat(), currentStation.getLon() ); + currentAutopilot.endLatLon = new AutopilotControlParameters.AutoPilotLonLat( nextStation.getLat(), nextStation.getLon() ); currentAutopilot.vehicleType = VEHICLE_TYPE; Logger.d( TAG, "开启自动驾驶====" + currentAutopilot ); MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData( currentAutopilot ); @@ -354,7 +354,7 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog } @Override - public void onArriveAt( AutoPilotStationInfo data ) { + public void onArriveAt( AutopilotStationInfo data ) { if ( currentStationIndex >= stationList.size() - 1 ) { Logger.e( TAG, "到站异常,取消后续操作" ); return; diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/MogoOCHTaxiModel.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/MogoOCHTaxiModel.java index 7dec1a8d80..16d4174cb6 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/MogoOCHTaxiModel.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/MogoOCHTaxiModel.java @@ -15,8 +15,8 @@ import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.constants.HostConst; import com.mogo.och.taxi.ui.OCHTaxiUiController; import com.mogo.service.adas.IMogoAdasOCHCallback; -import com.mogo.eagle.core.data.autopilot.AutoPilotControlParameters; -import com.mogo.eagle.core.data.autopilot.AutoPilotStationInfo; +import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters; +import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo; import com.mogo.service.cloud.socket.IMogoLifecycleListener; import com.mogo.service.cloud.socket.IMogoOnMessageListener; import com.mogo.service.intent.IMogoIntentListener; @@ -714,7 +714,7 @@ class MogoOCHTaxiModel { */ private class OCHArriveNotifyCallback implements IMogoAdasOCHCallback { @Override - public void onArriveAt( AutoPilotStationInfo data ) { + public void onArriveAt( AutopilotStationInfo data ) { if ( data == null ) { return; } @@ -853,10 +853,10 @@ class MogoOCHTaxiModel { return; } - AutoPilotControlParameters parameters = new AutoPilotControlParameters(); + AutopilotControlParameters parameters = new AutopilotControlParameters(); parameters.vehicleType = mCurrentOCHOrder.orderType; - parameters.startLatLon = new AutoPilotControlParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 0 ).wgsLat, mCurrentOCHOrder.drivingRoutes.get( 0 ).wgsLon ); - parameters.endLatLon = new AutoPilotControlParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 1 ).wgsLat, mCurrentOCHOrder.drivingRoutes.get( 1 ).wgsLon ); + parameters.startLatLon = new AutopilotControlParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 0 ).wgsLat, mCurrentOCHOrder.drivingRoutes.get( 0 ).wgsLon ); + parameters.endLatLon = new AutopilotControlParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 1 ).wgsLat, mCurrentOCHOrder.drivingRoutes.get( 1 ).wgsLon ); MogoApisHandler.getInstance() .getApis() .getAdasControllerApi() diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/OCHTaxiFragment.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/OCHTaxiFragment.java index 5c505e764e..af01af3462 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/OCHTaxiFragment.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/OCHTaxiFragment.java @@ -26,7 +26,7 @@ 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.eagle.core.data.autopilot.AutopilotStationInfo; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.StatusDescriptor; import com.mogo.utils.logger.Logger; @@ -524,7 +524,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i } @Override - public void onArriveAt(AutoPilotStationInfo data) { + public void onArriveAt(AutopilotStationInfo data) { Logger.d( TAG, "行程结束"); MogoApisHandler.getInstance().getApis().getAdasControllerApi().cancelAutopilot(); } diff --git a/OCH/mogo-och/src/main/java/com/mogo/och/BaseOchFragment.java b/OCH/mogo-och/src/main/java/com/mogo/och/BaseOchFragment.java index e5d83b8f00..f861c7641b 100644 --- a/OCH/mogo-och/src/main/java/com/mogo/och/BaseOchFragment.java +++ b/OCH/mogo-och/src/main/java/com/mogo/och/BaseOchFragment.java @@ -17,7 +17,7 @@ import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.view.OnPreventFastClickListener; import com.mogo.och.view.SlidePanelView; import com.mogo.service.adas.IMogoAdasOCHCallback; -import com.mogo.eagle.core.data.autopilot.AutoPilotControlParameters; +import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters; import com.mogo.utils.logger.Logger; /** @@ -135,12 +135,12 @@ public abstract class BaseOchFragment> e findViewById(R.id.btnAutopilotControl).setOnClickListener(view -> { // Logger.d("lianglihui","模拟 站点下发工控"); - AutoPilotControlParameters currentAutopilot = new AutoPilotControlParameters(); + AutopilotControlParameters currentAutopilot = new AutopilotControlParameters(); currentAutopilot.isSpeakVoice = true; // 万集东门站 - currentAutopilot.startLatLon = new AutoPilotControlParameters.AutoPilotLonLat(40.194795425,116.724476409); + currentAutopilot.startLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.194795425,116.724476409); // 市政府前街18号 - currentAutopilot.endLatLon = new AutoPilotControlParameters.AutoPilotLonLat(40.1939540844,116.720067); + currentAutopilot.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.1939540844,116.720067); // 订单运营类型 (9出租车,10小巴) currentAutopilot.vehicleType = 10; Logger.d(TAG, "模拟 订单站点下发:" + currentAutopilot); diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt new file mode 100644 index 0000000000..e31c68c40d --- /dev/null +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt @@ -0,0 +1,75 @@ +package com.mogo.eagle.core.function.autopilot + +import android.content.Context +import com.alibaba.android.arouter.facade.annotation.Route +import com.mogo.eagle.core.data.autopilot.AutopilotControlCmdParameter +import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters +import com.mogo.eagle.core.data.constants.MogoServicePaths +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider +import com.mogo.eagle.core.utilcode.util.GsonUtils +import com.mogo.eagle.core.utilcode.util.LogUtils +import com.zhidao.support.adas.high.AdasManager + +/** + * @author xiaoyuzhou + * @date 2021/9/22 8:43 下午 + */ +@Route(path = MogoServicePaths.PATH_AUTO_PILOT) +class MoGoAutopilotProvider : + IMoGoAutopilotProvider { + private val TAG = "MoGoAutoPilotProvider" + + override val functionName: String + get() = TAG + + + override fun init(context: Context) { + // 初始化ADAS 域控制器 + //AdasManager.getInstance().create(context) + + } + + + override fun connectAutoPilot() { + + + } + + + override fun startAutoPilot(result: AutopilotControlParameters) { + if (AdasManager.getInstance().isSocketConnect) { + val parameter = + AutopilotControlCmdParameter( + TAG, + result + ) + AdasManager.getInstance().aiCloudToAdasData(GsonUtils.toJson(parameter)) + } else { + LogUtils.eTag(TAG, "车机与工控机链接失败,无法开启自动驾驶") + } + } + + override fun cancelAutoPilot() { + if (AdasManager.getInstance().isSocketConnect) { + AdasManager.getInstance().controlAutopilotCarHead() + } else { + LogUtils.eTag(TAG, "车机与工控机链接失败,无法断开自动驾驶") + } + } + + override fun getAutopilotStatus(): Int { +// int status = IMoGoAutoPilotStatusListener.STATUS_AUTOPILOT_DISABLE; +// try { +// status = adasProvider.autopilotStateCall().getState(); +// } catch (Exception e) { +// e.printStackTrace(); +// } + return 0 + } + + + override fun recordPackage(): Boolean { + return AdasManager.getInstance().recordPackage() + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/utils/AdasObjectConvertUtils.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/utils/AdasObjectConvertUtils.kt new file mode 100644 index 0000000000..d698761766 --- /dev/null +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/utils/AdasObjectConvertUtils.kt @@ -0,0 +1,10 @@ +package com.mogo.eagle.core.function.autopilot.utils + +/** + * @author xiaoyuzhou + * @date 2021/10/18 1:32 下午 + */ +class AdasObjectConvertUtils { + +} + diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt index 8194220039..cf5ef26e06 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt @@ -7,11 +7,11 @@ import androidx.constraintlayout.widget.ConstraintLayout import com.mogo.cloud.passport.MoGoAiCloudClient import com.mogo.commons.AbsMogoApplication import com.mogo.eagle.core.data.app.AppConfigInfo -import com.mogo.eagle.core.data.autopilot.AutoPilotStationInfo -import com.mogo.eagle.core.data.autopilot.AutoPilotStatusInfo +import com.mogo.eagle.core.data.autopilot.* import com.mogo.eagle.core.data.constants.MoGoConfig import com.mogo.eagle.core.data.obu.ObuStatusInfo -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutoPilotStatusListener +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.autopilot.CallerAutoPilotManager import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager @@ -38,7 +38,7 @@ class DebugSettingView @JvmOverloads constructor( attrs: AttributeSet? = null, defStyleAttr: Int = 0 ) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoObuStatusListener, - IMoGoAutoPilotStatusListener { + IMoGoAutopilotStatusListener { private val TAG = "DebugSettingView" @@ -107,19 +107,37 @@ class DebugSettingView @JvmOverloads constructor( tvObuInfo.text = GsonUtils.toJson(obuStatusInfo) } - /** - * 自动驾驶相关回调 - */ - override fun onAutoPilotArriveAtStation(data: AutoPilotStationInfo?) { - - } - - override fun onAutoPilotStateChanged(state: Int, reason: String?) { - - } - - override fun onAutoPilotStatusResponse(autoPilotStatusInfo: AutoPilotStatusInfo?) { + override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) { tvAutopilotInfo.text = GsonUtils.toJson(autoPilotStatusInfo) } + override fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) { + + } + + override fun onAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) { + + } + + override fun onAutopilotRoute(autopilotRoute: AutopilotRouteInfo?) { + + } + + override fun onAutopilotSNRequest() { + + } + + override fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) { + + } + + override fun onAutopilotIdentifyDataUpdate(trafficData: List?) { + + } + + override fun onAutopilotWarnMessage(autopilotWarnMessage: AutopilotWarnMessage?) { + + } + + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt index 354038d4bb..f8de47ea75 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt @@ -5,8 +5,8 @@ import android.util.AttributeSet import android.view.LayoutInflater import android.view.View import androidx.constraintlayout.widget.ConstraintLayout -import com.mogo.eagle.core.data.autopilot.AutoPilotControlParameters -import com.mogo.eagle.core.data.autopilot.AutoPilotStationInfo +import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters +import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager import com.mogo.eagle.core.function.hmi.R import com.mogo.eagle.core.utilcode.util.LogUtils @@ -68,10 +68,10 @@ class AutoPilotStatusView @JvmOverloads constructor( } private fun startAutoPilot() { val currentAutopilot = - AutoPilotControlParameters() + AutopilotControlParameters() currentAutopilot.isSpeakVoice = false - currentAutopilot.startLatLon = AutoPilotControlParameters.AutoPilotLonLat(40.199157289445921,116.73675895051454); - currentAutopilot.endLatLon = AutoPilotControlParameters.AutoPilotLonLat(40.199255159538758,116.73274535677977); + currentAutopilot.startLatLon = AutopilotControlParameters.AutoPilotLonLat(40.199157289445921,116.73675895051454); + currentAutopilot.endLatLon = AutopilotControlParameters.AutoPilotLonLat(40.199255159538758,116.73274535677977); currentAutopilot.vehicleType = 10 MogoApisHandler.getInstance().apis.adasControllerApi.aiCloudToAdasData(currentAutopilot) } @@ -103,7 +103,7 @@ class AutoPilotStatusView @JvmOverloads constructor( } } - override fun onArriveAt(data: AutoPilotStationInfo?) { + override fun onArriveAt(data: AutopilotStationInfo?) { } diff --git a/core/mogo-core-data/build.gradle b/core/mogo-core-data/build.gradle index c894e49e0c..cc2dce2943 100644 --- a/core/mogo-core-data/build.gradle +++ b/core/mogo-core-data/build.gradle @@ -45,6 +45,9 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation rootProject.ext.dependencies.kotlinstdlibjdk7 implementation rootProject.ext.dependencies.androidxappcompat + + implementation rootProject.ext.dependencies.gson + if (Boolean.valueOf(RELEASE)) { } else { diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/ADASCarStateInfo.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotCarStateInfo.java similarity index 53% rename from services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/ADASCarStateInfo.java rename to core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotCarStateInfo.java index bf1810ba71..f9997eb058 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/ADASCarStateInfo.java +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotCarStateInfo.java @@ -1,14 +1,13 @@ -package com.mogo.service.adas.entity; +package com.mogo.eagle.core.data.autopilot; import java.io.Serializable; /** - * @author nie yunlong - * @des 车辆状态 - * @date 2020/3/12 + * @author donghongyu + * @des 自车辆状态 + * @date 2021/10/18 */ -public class ADASCarStateInfo implements Serializable { - +public class AutopilotCarStateInfo implements Serializable { /** * action : “state” @@ -17,6 +16,15 @@ public class ADASCarStateInfo implements Serializable { private String action; private ValuesBean values; + private float fps; + + public float getFps() { + return fps; + } + + public void setFps(float fps) { + this.fps = fps; + } public String getAction() { return action; @@ -52,46 +60,105 @@ public class ADASCarStateInfo implements Serializable { private double yaw_rate; //惯导车速 m/s private float gnss_speed; - //gps 时间 + //车辆车速 m/s + private float vehicle_speed; + //gps时间 private String satelliteTime; - + //UTC时间差 + private long utcTimeDiffer; + //系统时间 private String systemTime; //接收到数据的时间 private String receiverDataTime; - // udp收到数据的时间 - private String startReceiverDataTime; + //接收到gps时间 private String adasSatelliteTime; + //开始接收数据时间 + private String startReceiverDataTime; + //时间延迟 + private long timeDiff=0; + private int turn_light; //转向灯状态 0是正常 1是左转 2是右转 + private int flash_light; //双闪灯状态 + private int brake_light; //刹车灯状态 + private int frame_num;//统计发包个数 + + public int getFrame_num() { + return frame_num; + } + + public void setFrame_num(int frame_num) { + this.frame_num = frame_num; + } + + public long getTimeDiff() { + return timeDiff; + } + + public void setTimeDiff(long timeDiff) { + this.timeDiff = timeDiff; + } + + public String getReceiverDataTime() { + return receiverDataTime; + } + + public void setReceiverDataTime(String receiverDataTime) { + this.receiverDataTime = receiverDataTime; + } public String getAdasSatelliteTime() { return adasSatelliteTime; } - public void setAdasSatelliteTime( String adasSatelliteTime ) { + public void setAdasSatelliteTime(String adasSatelliteTime) { this.adasSatelliteTime = adasSatelliteTime; } - public String getStartReceiverDataTime() { - return startReceiverDataTime; + public String getSystemTime() { + return systemTime; } - public void setStartReceiverDataTime( String startReceiverDataTime ) { - this.startReceiverDataTime = startReceiverDataTime; + public void setSystemTime(String systemTime) { + this.systemTime = systemTime; } public float getGnss_speed() { return gnss_speed; } - public void setGnss_speed( float gnss_speed ) { + public void setGnss_speed(float gnss_speed) { this.gnss_speed = gnss_speed; } - public String getSatelliteTime() { - return satelliteTime; + public float getVehicle_speed() { + return vehicle_speed; } - public void setSatelliteTime( String satelliteTime ) { - this.satelliteTime = satelliteTime; + public void setVehicle_speed(float vehicle_speed) { + this.vehicle_speed = vehicle_speed; + } + + public int getTurn_light() { + return turn_light; + } + + public void setTurn_light(int turn_light) { + this.turn_light = turn_light; + } + + public int getFlash_light() { + return flash_light; + } + + public void setFlash_light(int flash_light) { + this.flash_light = flash_light; + } + + public int getBrake_light() { + return brake_light; + } + + public void setBrake_light(int brake_light) { + this.brake_light = brake_light; } public double getLon() { @@ -142,22 +209,31 @@ public class ADASCarStateInfo implements Serializable { this.yaw_rate = yaw_rate; } - public String getSystemTime() { - return systemTime; + public String getSatelliteTime() { + return satelliteTime; } - public void setSystemTime( String systemTime ) { - this.systemTime = systemTime; + public void setSatelliteTime(String satelliteTime) { + this.satelliteTime = satelliteTime; } - public String getReceiverDataTime() { - return receiverDataTime; + public long getUtcTimeDiffer() { + return utcTimeDiffer; } - public void setReceiverDataTime( String receiverDataTime ) { - this.receiverDataTime = receiverDataTime; + public void setUtcTimeDiffer(long utcTimeDiffer) { + this.utcTimeDiffer = utcTimeDiffer; } + public String getStartReceiverDataTime() { + return startReceiverDataTime; + } + + public void setStartReceiverDataTime(String startReceiverDataTime) { + this.startReceiverDataTime = startReceiverDataTime; + } + + @Override public String toString() { return "ValuesBean{" + @@ -167,6 +243,18 @@ public class ADASCarStateInfo implements Serializable { ", heading=" + heading + ", acceleration=" + acceleration + ", yaw_rate=" + yaw_rate + + ", gnss_speed=" + gnss_speed + + ", vehicle_speed=" + vehicle_speed + + ", satelliteTime='" + satelliteTime + '\'' + + ", utcTimeDiffer='" + utcTimeDiffer + '\'' + + ", systemTime='" + systemTime + '\'' + + ", receiverDataTime='" + receiverDataTime + '\'' + + ", startReceiverDataTime='" + startReceiverDataTime + '\'' + + ", timeDiff=" + timeDiff + + ", turn_light=" + turn_light + + ", flash_light=" + flash_light + + ", brake_light=" + brake_light + + ", frame_num=" + frame_num + '}'; } } diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotControlCmdParameter.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotControlCmdParameter.java new file mode 100644 index 0000000000..615de1c6eb --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotControlCmdParameter.java @@ -0,0 +1,27 @@ +package com.mogo.eagle.core.data.autopilot; + +public +/** + * @author congtaowang + * @since 2020/10/22 + * + * 域控制器 控制指令发送 + */ +class AutopilotControlCmdParameter { + + public String action; + public Object result; + + public AutopilotControlCmdParameter(String action, Object result) { + this.action = action; + this.result = result; + } + + @Override + public String toString() { + return "AutoPilotControlCmdParameter{" + + "action='" + action + '\'' + + ", result=" + result + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotControlParameters.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotControlParameters.java new file mode 100644 index 0000000000..768648fb0b --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotControlParameters.java @@ -0,0 +1,54 @@ +package com.mogo.eagle.core.data.autopilot; + +import java.util.List; + +/** + * @author donghongyu + * @since 2021/09/22 + *

+ * 启动自动驾驶参数 + */ +public class AutopilotControlParameters { + + public AutoPilotLonLat startLatLon; + public List wayLatLons; + public AutoPilotLonLat endLatLon; + public float speedLimit; + public int vehicleType;// 运营类型 + /** + * 是否播放adas的 开始自动驾驶 语音 + */ + public boolean isSpeakVoice = true; + + public static class AutoPilotLonLat { + public double lat; + public double lon; + + public AutoPilotLonLat() { + } + + public AutoPilotLonLat(double lat, double lon) { + this.lat = lat; + this.lon = lon; + } + + @Override + public String toString() { + return "AutoPilotLonLat{" + + "lat=" + lat + + ", lon=" + lon + + '}'; + } + } + + @Override + public String toString() { + return "RemoteControlAutoPilotParameters{" + + "startLatLon=" + startLatLon + + ", wayLatLons=" + wayLatLons + + ", endLatLon=" + endLatLon + + ", speedLimit=" + speedLimit + + ", vehicleType=" + vehicleType + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotGuardianStatusInfo.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotGuardianStatusInfo.java new file mode 100644 index 0000000000..9e38a0be78 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotGuardianStatusInfo.java @@ -0,0 +1,164 @@ +package com.mogo.eagle.core.data.autopilot; + +import com.google.gson.annotations.SerializedName; +import com.mogo.eagle.core.data.autopilot.guardian.AutopilotCpuState; +import com.mogo.eagle.core.data.autopilot.guardian.AutopilotDiskState; +import com.mogo.eagle.core.data.autopilot.guardian.AutopilotHardwareState; +import com.mogo.eagle.core.data.autopilot.guardian.AutopilotMemState; +import com.mogo.eagle.core.data.autopilot.guardian.AutopilotNetFlowState; +import com.mogo.eagle.core.data.autopilot.guardian.AutopilotNodeState; +import com.mogo.eagle.core.data.autopilot.guardian.AutopilotProgramState; +import com.mogo.eagle.core.data.autopilot.guardian.AutopilotTopicState; + +import java.io.Serializable; +import java.util.List; + +/** + * @author xiaoyuzhou + * @date 2021/10/18 12:54 下午 + * 工控机节点状态信息 + */ +public class AutopilotGuardianStatusInfo implements Serializable { + @SerializedName("action") + private String action; + @SerializedName("value") + private AutopilotGuardianResult value; + + public static class AutopilotGuardianResult { + //车辆类型 WEY-长城 DF-东风 BYD-比亚迪 JINLV-金旅 + @SerializedName("cartype") + private String carType; + //车牌号 + @SerializedName("carnum") + private String carNum; + //ws连接状态 0-非链接 1-链接 + @SerializedName("websocket_state") + private String wsState; + //ai云长链状态 0-非链接 1-链接 + @SerializedName("aicloud_state") + private String aiCloudState; + //感知 eagle_hz + @SerializedName("eagle_hz") + private String eagleHz; + //软件节点 + @SerializedName("nodestate") + private List nodeState; + //topic + @SerializedName("topicstate") + private List topicState; + //硬件节点 + @SerializedName("hardwarestate") + private List hardwareState; + //CPU + @SerializedName("cpustate") + private AutopilotCpuState cpuState; + //内存 + @SerializedName("memstate") + private AutopilotMemState memState; + //硬盘状态 + @SerializedName("diskstate") + private List diskState; + //占CPU最多的10个程序 + @SerializedName("programcpustate") + private List programCpuState; + //占内存最多的10个程序 + @SerializedName("programmemstate") + private List programMemState; + //流量 + @SerializedName("netflowstate") + private List netFlowState; + + + public String getCarType() { + return carType; + } + + public String getCarNum() { + return carNum; + } + + public String getWsState() { + return wsState; + } + + public String getAiCloudState() { + return aiCloudState; + } + + public List getNodeState() { + return nodeState; + } + + public List getHardwareState() { + return hardwareState; + } + + public AutopilotCpuState getCpuState() { + return cpuState; + } + + public AutopilotMemState getMemState() { + return memState; + } + + public List getDiskState() { + return diskState; + } + + public String getEagleHz() { + return eagleHz; + } + + public List getProgramCpuState() { + return programCpuState; + } + + public List getProgramMemState() { + return programMemState; + } + + public List getNetFlowState() { + return netFlowState; + } + + public List getTopicState() { + return topicState; + } + + @Override + public String toString() { + return "AutopilotGuardianResult{" + + "carType='" + carType + '\'' + + ", carNum='" + carNum + '\'' + + ", wsState='" + wsState + '\'' + + ", aiCloudState='" + aiCloudState + '\'' + + ", eagleHz='" + eagleHz + '\'' + + ", nodeState=" + nodeState + + ", topicState=" + topicState + + ", hardwareState=" + hardwareState + + ", cpuState=" + cpuState + + ", memState=" + memState + + ", diskState=" + diskState + + ", programCpuState=" + programCpuState + + ", programMemState=" + programMemState + + ", netFlowState=" + netFlowState + + '}'; + } + } + + public String getAction() { + return action; + } + + public AutopilotGuardianResult getValue() { + return value; + } + + @Override + public String toString() { + return "AutopilotGuardianInfo{" + + "action='" + action + '\'' + + ", value=" + value + + '}'; + } +} \ No newline at end of file diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/dispatch/bean/AutopilotRoute.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotRouteInfo.java similarity index 83% rename from modules/mogo-module-service/src/main/java/com/mogo/module/service/dispatch/bean/AutopilotRoute.java rename to core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotRouteInfo.java index c4c4012bee..bde14bf0aa 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/dispatch/bean/AutopilotRoute.java +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotRouteInfo.java @@ -1,6 +1,5 @@ -package com.mogo.module.service.dispatch.bean; +package com.mogo.eagle.core.data.autopilot; -import com.google.gson.annotations.SerializedName; import java.util.List; @@ -10,17 +9,13 @@ import java.util.List; * @date 2021/6/21 */ -public class AutopilotRoute { +public class AutopilotRouteInfo { - @SerializedName("action") private String action; - @SerializedName("models") private List models; public static class RouteModels { - @SerializedName("lat") private Double lat; - @SerializedName("lon") private Double lon; public Double getLat() { diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStationInfo.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStationInfo.java new file mode 100644 index 0000000000..1f28b463d3 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStationInfo.java @@ -0,0 +1,53 @@ +package com.mogo.eagle.core.data.autopilot; + +/** + * @author congtaowang + * @since 2021/1/18 + *

+ * 自动驾驶网约车回调数据 + */ +public class AutopilotStationInfo { + + private int type; + private double lon; + private double lat; + + public AutopilotStationInfo(int type, double lon, double lat) { + this.type = type; + this.lon = lon; + this.lat = lat; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public double getLon() { + return lon; + } + + public void setLon(double lon) { + this.lon = lon; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + @Override + public String toString() { + return "AutoPilotStationInfo{" + + "type=" + type + + ", lon=" + lon + + ", lat=" + lat + + '}'; + } +} diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/dispatch/bean/AutopilotStatus.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStatus.java similarity index 97% rename from modules/mogo-module-service/src/main/java/com/mogo/module/service/dispatch/bean/AutopilotStatus.java rename to core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStatus.java index b732a3d8e6..a60de52967 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/dispatch/bean/AutopilotStatus.java +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStatus.java @@ -1,4 +1,4 @@ -package com.mogo.module.service.dispatch.bean; +package com.mogo.eagle.core.data.autopilot; import java.io.Serializable; diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStatusInfo.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStatusInfo.kt new file mode 100644 index 0000000000..2d6371a8cb --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotStatusInfo.kt @@ -0,0 +1,61 @@ +package com.mogo.eagle.core.data.autopilot + +import java.io.Serializable + +/** + * @author xiaoyuzhou + * @date 2021/10/12 8:16 下午 + * 域控制器状态信息 + * 不建议自己初始化此对象,建议使用 CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo(); + */ +class AutopilotStatusInfo : Serializable { + /** + * 当前链接的IP地址, 默认地址 192.168.1.102 + */ + var connectIP: String = "0.0.0.0" + var connectStatus = false + var version: String = "v0.0" + + /** + * 定位是否可用 + */ + var locationStatus = false + var locationLat = 0.0 + var locationLon = 0.0 + + /** + * 车速 m/s + */ + var speed = 0f + + /** + * 自动驾驶状态 0是不可用 1是ready 2是自动驾驶start + */ + var state = 0 + + /** + * 不可用原因 + */ + var reason: String = "" + + /** + * 摄像头状态 1代表开启,0代表关闭 + */ + var camera = 0 + + /** + * 雷达状态 1代表开启,0代表关闭 + */ + var radar = 0 + + /** + * RTK状态 1代表开启,0代表关闭 + */ + var rtk = 0 + + /** + * 自动驾驶状态 0非自动驾驶,1自动驾驶 + */ + var pilotmode = 0 + +} \ No newline at end of file diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/ADASWarnMessage.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotWarnMessage.java similarity index 79% rename from services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/ADASWarnMessage.java rename to core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotWarnMessage.java index 4c24cb413c..3231199a58 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/ADASWarnMessage.java +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotWarnMessage.java @@ -1,13 +1,13 @@ -package com.mogo.service.adas.entity; +package com.mogo.eagle.core.data.autopilot; + -public /** * @author congtaowang * @since 2020/10/25 - * + *

* 描述 */ -class ADASWarnMessage { +public class AutopilotWarnMessage { public String content; public String level; @@ -15,7 +15,7 @@ class ADASWarnMessage { /** * 警告消息类型 *

- * {@link com.mogo.service.adas.MogoADASWarnType} + * {@link MogoADASWarnType} */ public int type; public String value; diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/adas/MogoADASWarnType.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/MogoADASWarnType.java similarity index 92% rename from services/mogo-service-api/src/main/java/com/mogo/service/adas/MogoADASWarnType.java rename to core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/MogoADASWarnType.java index a75bad61da..f0d5fe26e0 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/adas/MogoADASWarnType.java +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/MogoADASWarnType.java @@ -1,13 +1,13 @@ -package com.mogo.service.adas; +package com.mogo.eagle.core.data.autopilot; + -public /** * @author congtaowang * @since 2020/10/25 - * + *

* 描述 */ -interface MogoADASWarnType { +public interface MogoADASWarnType { /** * 行人报警 diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotCpuState.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotCpuState.java new file mode 100644 index 0000000000..814bbf8689 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotCpuState.java @@ -0,0 +1,81 @@ +package com.mogo.eagle.core.data.autopilot.guardian; + +import com.google.gson.annotations.SerializedName; + +/** + * @author song kenan + * @des CPU状态 + * @date 2021/8/11 + */ +public class AutopilotCpuState { + //cup总使用率 + @SerializedName("all") + private Double all; + @SerializedName("cpu1") + private Double cpu1; + @SerializedName("cpu2") + private Double cpu2; + @SerializedName("cpu3") + private Double cpu3; + @SerializedName("cpu4") + private Double cpu4; + @SerializedName("cpu5") + private Double cpu5; + @SerializedName("cpu6") + private Double cpu6; + @SerializedName("cpu7") + private Double cpu7; + @SerializedName("cpu8") + private Double cpu8; + + public Double getAll() { + return all; + } + + public Double getCpu1() { + return cpu1; + } + + public Double getCpu2() { + return cpu2; + } + + public Double getCpu3() { + return cpu3; + } + + public Double getCpu4() { + return cpu4; + } + + public Double getCpu5() { + return cpu5; + } + + public Double getCpu6() { + return cpu6; + } + + public Double getCpu7() { + return cpu7; + } + + public Double getCpu8() { + return cpu8; + } + + @Override + public String toString() { + return "AutopilotCpuState{" + + "all=" + all + + ", cpu1=" + cpu1 + + ", cpu2=" + cpu2 + + ", cpu3=" + cpu3 + + ", cpu4=" + cpu4 + + ", cpu5=" + cpu5 + + ", cpu6=" + cpu6 + + ", cpu7=" + cpu7 + + ", cpu8=" + cpu8 + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotDiskState.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotDiskState.java new file mode 100644 index 0000000000..f6eea043f1 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotDiskState.java @@ -0,0 +1,65 @@ +package com.mogo.eagle.core.data.autopilot.guardian; + +import com.google.gson.annotations.SerializedName; + +/** + * @author song kenan + * @des 磁盘信息 + * @date 2021/8/11 + */ +public class AutopilotDiskState { + //磁盘总大小 + @SerializedName("diskall") + private String diskall; + //磁盘空闲大小 + @SerializedName("diskfree") + private String diskfree; + //磁盘挂在目录 + @SerializedName("diskmount") + private String diskmount; + //磁盘名称 + @SerializedName("diskname") + private String diskname; + //磁盘使用百分比 + @SerializedName("diskpercent") + private String diskpercent; + //磁盘已使用大小 + @SerializedName("diskuse") + private String diskuse; + + public String getDiskall() { + return diskall; + } + + public String getDiskfree() { + return diskfree; + } + + public String getDiskmount() { + return diskmount; + } + + public String getDiskname() { + return diskname; + } + + public String getDiskpercent() { + return diskpercent; + } + + public String getDiskuse() { + return diskuse; + } + + @Override + public String toString() { + return "AutopilotDiskState{" + + "diskall='" + diskall + '\'' + + ", diskfree='" + diskfree + '\'' + + ", diskmount='" + diskmount + '\'' + + ", diskname='" + diskname + '\'' + + ", diskpercent='" + diskpercent + '\'' + + ", diskuse='" + diskuse + '\'' + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotHardwareState.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotHardwareState.java new file mode 100644 index 0000000000..f8530d8b52 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotHardwareState.java @@ -0,0 +1,41 @@ +package com.mogo.eagle.core.data.autopilot.guardian; + +import com.google.gson.annotations.SerializedName; + +/** + * @author song kenan + * @des 硬件状态 + * @date 2021/7/26 + */ +public class AutopilotHardwareState { + /** + * 0不正常 + */ + @SerializedName("run_hz") + private String runHz; + @SerializedName("set_hz") + private String setHz; + @SerializedName("topic_name") + private String topicName; + + public String getRunHz() { + return runHz; + } + + public String getSetHz() { + return setHz; + } + + public String getTopicName() { + return topicName; + } + + @Override + public String toString() { + return "AutopilotHardwareState{" + + "runHz='" + runHz + '\'' + + ", setHz='" + setHz + '\'' + + ", topicName='" + topicName + '\'' + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotMemState.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotMemState.java new file mode 100644 index 0000000000..f2d36b5b91 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotMemState.java @@ -0,0 +1,49 @@ +package com.mogo.eagle.core.data.autopilot.guardian; + +import com.google.gson.annotations.SerializedName; + +/** + * @author song kenan + * @des 内存状态 + * @date 2021/8/11 + */ +public class AutopilotMemState { + //空闲内存(M) + @SerializedName("free") + private String free; + //内存使用百分比 + @SerializedName("percent_mem") + private String percentMem; + //总内存(M) + @SerializedName("total_mem") + private String totalMem; + //使用的内存(M) + @SerializedName("used_mem") + private String usedMem; + + public String getFree() { + return free; + } + + public String getPercentMem() { + return percentMem; + } + + public String getTotalMem() { + return totalMem; + } + + public String getUsedMem() { + return usedMem; + } + + @Override + public String toString() { + return "AutopilotMemState{" + + "free='" + free + '\'' + + ", percentMem='" + percentMem + '\'' + + ", totalMem='" + totalMem + '\'' + + ", usedMem='" + usedMem + '\'' + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotNetFlowState.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotNetFlowState.java new file mode 100644 index 0000000000..0db9d02cf1 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotNetFlowState.java @@ -0,0 +1,38 @@ +package com.mogo.eagle.core.data.autopilot.guardian; + +import com.google.gson.annotations.SerializedName; + +/** + * @author song kenan + * @des 占用内存的程序 + * @date 2021/8/16 + */ +public class AutopilotNetFlowState { + @SerializedName("netname") + private String netName; + @SerializedName("recv_flow") + private String recvFlow; + @SerializedName("send_flow") + private String sendFlow; + + public String getNetName() { + return netName; + } + + public String getRecvFlow() { + return recvFlow; + } + + public String getSendFlow() { + return sendFlow; + } + + @Override + public String toString() { + return "AutopilotNetFlowState{" + + "netName='" + netName + '\'' + + ", recvFlow='" + recvFlow + '\'' + + ", sendFlow='" + sendFlow + '\'' + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotNodeState.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotNodeState.java new file mode 100644 index 0000000000..f75f1ec1d3 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotNodeState.java @@ -0,0 +1,34 @@ +package com.mogo.eagle.core.data.autopilot.guardian; + +import com.google.gson.annotations.SerializedName; + +/** + * @author song kenan + * @des 工控机节点状态 + * @date 2021/7/7 + */ +public class AutopilotNodeState { + /** + * -on-开启, off-关闭 + */ + @SerializedName("node_name") + private String nodeName; + @SerializedName("node_state") + private String nodeState; + + public String getNodeName() { + return nodeName; + } + + public String getNodeState() { + return nodeState; + } + + @Override + public String toString() { + return "AutopilotNodeState{" + + "nodeName='" + nodeName + '\'' + + ", nodeState='" + nodeState + '\'' + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotProgramState.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotProgramState.java new file mode 100644 index 0000000000..a614e5b9b4 --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotProgramState.java @@ -0,0 +1,41 @@ +package com.mogo.eagle.core.data.autopilot.guardian; + +import com.google.gson.annotations.SerializedName; + +/** + * @author song kenan + * @des 占用内存的程序 + * @date 2021/8/16 + */ +public class AutopilotProgramState { + //cpu + @SerializedName("cpu_percent") + private String cpuPercent; + //内存 + @SerializedName("mem_percent") + private String memPercent; + //name + @SerializedName("prog_name") + private String progName; + + public String getCpuPercent() { + return cpuPercent; + } + + public String getMemPercent() { + return memPercent; + } + + public String getProgName() { + return progName; + } + + @Override + public String toString() { + return "AutopilotProgramState{" + + "cpuPercent='" + cpuPercent + '\'' + + ", memPercent='" + memPercent + '\'' + + ", progName='" + progName + '\'' + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotTopicState.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotTopicState.java new file mode 100644 index 0000000000..365a12f79a --- /dev/null +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/guardian/AutopilotTopicState.java @@ -0,0 +1,39 @@ +package com.mogo.eagle.core.data.autopilot.guardian; + +import com.google.gson.annotations.SerializedName; + +/** + * @author song kenan + * @des topic info + * @date 2021/8/16 + */ +public class AutopilotTopicState { + + @SerializedName("run_hz") + private String runHz; + @SerializedName("set_hz") + private String setHz; + @SerializedName("topic_name") + private String topicName; + + public String getRunHz() { + return runHz; + } + + public String getSetHz() { + return setHz; + } + + public String getTopicName() { + return topicName; + } + + @Override + public String toString() { + return "AutopilotTopicState{" + + "runHz='" + runHz + '\'' + + ", setHz='" + setHz + '\'' + + ", topicName='" + topicName + '\'' + + '}'; + } +} diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/TrafficTypeEnum.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/TrafficTypeEnum.kt index 6a3a50eb7f..790e030c72 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/TrafficTypeEnum.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/TrafficTypeEnum.kt @@ -74,6 +74,25 @@ enum class TrafficTypeEnum( "道路施工", R.raw.v2x_shigong_warning, R.raw.v2x_shigong_warning - ) + ); + + companion object { + @JvmStatic + fun getType(type: Int): TrafficTypeEnum { + return when (type) { + TYPE_TRAFFIC_ID_WEI_ZHI.type -> TYPE_TRAFFIC_ID_WEI_ZHI + TYPE_TRAFFIC_ID_PEOPLE.type -> TYPE_TRAFFIC_ID_PEOPLE + TYPE_TRAFFIC_ID_BICYCLE.type -> TYPE_TRAFFIC_ID_BICYCLE + TYPE_TRAFFIC_ID_TA_CHE.type -> TYPE_TRAFFIC_ID_TA_CHE + TYPE_TRAFFIC_ID_MOTO.type -> TYPE_TRAFFIC_ID_MOTO + TYPE_TRAFFIC_ID_BUS.type -> TYPE_TRAFFIC_ID_BUS + TYPE_TRAFFIC_ID_TRUCK.type -> TYPE_TRAFFIC_ID_TRUCK + TYPE_TRAFFIC_ID_CAMERA.type -> TYPE_TRAFFIC_ID_CAMERA + TYPE_TRAFFIC_ID_SPECIAL_VEHICLE.type -> TYPE_TRAFFIC_ID_SPECIAL_VEHICLE + TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG.type -> TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG + else -> TYPE_TRAFFIC_ID_WEI_ZHI + } + } + } } \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/traffic/TrafficData.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/traffic/TrafficData.kt index 2c6ef0b396..5f8937bfb2 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/traffic/TrafficData.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/traffic/TrafficData.kt @@ -18,6 +18,16 @@ class TrafficData { */ var uuid: String = "" + /** + * 车牌id + */ + var carId: String = "" + + /** + * 数据来源精度 0 - 普通定位、1 - 高精定位 + */ + var dataAccuracy = 1 + /** * 识别物体的纬度 */ diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutoPilotIdentifyListener.java b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutoPilotIdentifyListener.java deleted file mode 100644 index 7b90e37885..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutoPilotIdentifyListener.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.mogo.eagle.core.function.api.autopilot; - -import com.mogo.eagle.core.data.traffic.TrafficData; - -import java.util.List; - -/** - * @author xiaoyuzhou - * @date 2021/9/23 11:23 上午 - * 自动驾驶识别数据监听,回调后做数据可视化呈现 - */ -public interface IMoGoAutoPilotIdentifyListener { - - /** - * 识别交通元素数据发生更新 - * - * @param trafficData 交通元素信息列表 - */ - void onIdentifyDataUpdate(List trafficData); - - -} diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutoPilotStatusListener.java b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutoPilotStatusListener.java deleted file mode 100644 index 06aa35de13..0000000000 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutoPilotStatusListener.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.mogo.eagle.core.function.api.autopilot; - -import com.mogo.eagle.core.data.autopilot.AutoPilotStationInfo; -import com.mogo.eagle.core.data.autopilot.AutoPilotStatusInfo; - -/** - * @author xiaoyuzhou - * @date 2021/9/22 8:59 下午 - * 自动驾驶状态回调监听 - */ -public interface IMoGoAutoPilotStatusListener { - - /** - * 不可自动驾驶,目前场景是刚开机,adas还未和工控机连接 - */ - int STATUS_AUTOPILOT_DISABLE = 0; - /** - * 可自动驾驶,工控机连接正常,且处于人工干预状态 - */ - int STATUS_AUTOPILOT_ENABLE = 1; - /** - * 自动驾驶中,可能是停车,可能是行进,但是是机器在处理车的前进后退,不是人 - */ - int STATUS_AUTOPILOT_RUNNING = 2; - - - /** - * 自动驾驶到站 - * - * @param data 所到车站的简单信息 - */ - void onAutoPilotArriveAtStation(AutoPilotStationInfo data); - - /** - * 自动驾驶状态发生改变 - * - * @param state {@link #STATUS_AUTOPILOT_DISABLE} - * @param reason 不能自动驾驶的原因 - */ - void onAutoPilotStateChanged(int state, String reason); - - /** - * 自动驾驶状态信息 - * - * @param autoPilotStatusInfo 状态信息 - */ - void onAutoPilotStatusResponse(AutoPilotStatusInfo autoPilotStatusInfo); -} diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.java b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.java new file mode 100644 index 0000000000..76829ce2a0 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.java @@ -0,0 +1,44 @@ +package com.mogo.eagle.core.function.api.autopilot; + +import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters; +import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider; + +/** + * @author xiaoyuzhou + * @date 2021/9/22 8:27 下午 + * 自动驾驶节点 + */ +public interface IMoGoAutopilotProvider extends IMoGoFunctionServerProvider { + + /** + * 连接自动驾驶域控制器 + */ + void connectAutoPilot(); + + /** + * 开启自动驾驶 + * + * @param result + */ + void startAutoPilot(AutopilotControlParameters result); + + /** + * 结束自动驾驶 + */ + void cancelAutoPilot(); + + /** + * 获取车辆自动驾驶状态 + * + * @return + */ + int getAutopilotStatus(); + + /** + * 开启域控制器录制bag包 + * + * @return true-成功,false-失败 + */ + boolean recordPackage(); + +} diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt new file mode 100644 index 0000000000..3057c92488 --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotStatusListener.kt @@ -0,0 +1,83 @@ +package com.mogo.eagle.core.function.api.autopilot + +import com.mogo.eagle.core.data.autopilot.* +import com.mogo.eagle.core.data.traffic.TrafficData + +/** + * @author xiaoyuzhou + * @date 2021/9/22 8:59 下午 + * 自动驾驶状态回调监听 + */ +interface IMoGoAutopilotStatusListener { + + /** + * 自动驾驶状态信息 + * + * @param autoPilotStatusInfo 状态信息 + */ + fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) + + /** + * 自动驾驶到站 + * + * @param autopilotWayArrive 所到车站的简单信息 + */ + fun onAutopilotArriveAtStation(autopilotWayArrive: AutopilotStationInfo?) + + + /** + * 车辆状态数据 + * + * @param autoPilotCarStateInfo + */ + fun onAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) + + /** + * 自动驾驶路径 + * + * @param autopilotRoute + */ + fun onAutopilotRoute(autopilotRoute: AutopilotRouteInfo?) + + /** + * 工控机获取SN + */ + fun onAutopilotSNRequest() + + /** + * 工控机监控节点 + */ + fun onAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) + + /** + * 识别交通元素数据发生更新 + * + * @param trafficData 交通元素信息列表 + */ + fun onAutopilotIdentifyDataUpdate(trafficData: List?) + + /** + * 报警信息 + * + * @param autopilotWarnMessage 预警信息 + */ + fun onAutopilotWarnMessage(autopilotWarnMessage: AutopilotWarnMessage?) + + + companion object { + /** + * 不可自动驾驶,目前场景是刚开机,adas还未和工控机连接 + */ + const val STATUS_AUTOPILOT_DISABLE = 0 + + /** + * 可自动驾驶,工控机连接正常,且处于人工干预状态 + */ + const val STATUS_AUTOPILOT_ENABLE = 1 + + /** + * 自动驾驶中,可能是停车,可能是行进,但是是机器在处理车的前进后退,不是人 + */ + const val STATUS_AUTOPILOT_RUNNING = 2 + } +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt index 5220262ff2..16c059c7ea 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotManager.kt @@ -1,7 +1,7 @@ package com.mogo.eagle.core.function.call.autopilot import com.mogo.eagle.core.data.constants.MogoServicePaths -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutoPilotProvider +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider import com.mogo.eagle.core.function.call.base.CallerBase /** @@ -10,9 +10,9 @@ import com.mogo.eagle.core.function.call.base.CallerBase * 域控制器管理 */ object CallerAutoPilotManager { - private val providerApi: IMoGoAutoPilotProvider + private val providerApi: IMoGoAutopilotProvider get() = CallerBase.getApiInstance( - IMoGoAutoPilotProvider::class.java, + IMoGoAutopilotProvider::class.java, MogoServicePaths.PATH_AUTO_PILOT ) diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt index 88161e8e00..c30492d5eb 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotStatusListenerManager.kt @@ -1,9 +1,9 @@ package com.mogo.eagle.core.function.call.autopilot import androidx.annotation.Nullable -import com.mogo.eagle.core.data.autopilot.AutoPilotStationInfo -import com.mogo.eagle.core.data.autopilot.AutoPilotStatusInfo -import com.mogo.eagle.core.function.api.autopilot.IMoGoAutoPilotStatusListener +import com.mogo.eagle.core.data.autopilot.* +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.util.GsonUtils @@ -15,26 +15,27 @@ import com.mogo.eagle.core.utilcode.util.LogUtils * 域控制器相关的回调监听 */ object CallerAutoPilotStatusListenerManager : CallerBase() { - private val TAG = "CallerAutopilotListenerManager" + private val TAG = "CallerAutoPilotStatusListenerManager" // 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态 - private var mAutoPilotStatusInfo: AutoPilotStatusInfo = AutoPilotStatusInfo() + private var mAutopilotStatusInfo: AutopilotStatusInfo = AutopilotStatusInfo() // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 - private val mAutoPilotStatusListeners: HashMap = HashMap() + private val M_AUTOPILOT_STATUS_LISTENERS: HashMap = + HashMap() /** * 查询AutoPilot状态 */ - fun getAutoPilotStatusInfo(): AutoPilotStatusInfo { - return mAutoPilotStatusInfo + fun getAutoPilotStatusInfo(): AutopilotStatusInfo { + return mAutopilotStatusInfo } /** * 查询AutoPilot状态 */ fun getAutoPilotStatusInfoJsonString(): String { - return GsonUtils.toJson(mAutoPilotStatusInfo) + return GsonUtils.toJson(mAutopilotStatusInfo) } /** @@ -44,10 +45,10 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { */ fun addListener( @Nullable tag: String, - @Nullable listener: IMoGoAutoPilotStatusListener + @Nullable listener: IMoGoAutopilotStatusListener ) { - mAutoPilotStatusListeners[tag] = listener - listener.onAutoPilotStatusResponse(mAutoPilotStatusInfo) + M_AUTOPILOT_STATUS_LISTENERS[tag] = listener + listener.onAutopilotStatusResponse(mAutopilotStatusInfo) } /** @@ -55,7 +56,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { * @param tag 标记,用来注销监听使用 */ fun removeListener(@Nullable tag: String) { - mAutoPilotStatusListeners.remove(tag) + M_AUTOPILOT_STATUS_LISTENERS.remove(tag) } /** @@ -63,9 +64,9 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { * @param listener 要删除的监听对象 */ fun removeListener(@Nullable listener: IMoGoObuStatusListener) { - mAutoPilotStatusListeners.forEach { + M_AUTOPILOT_STATUS_LISTENERS.forEach { if (it.value == listener) { - mAutoPilotStatusListeners.remove(it.key) + M_AUTOPILOT_STATUS_LISTENERS.remove(it.key) } } } @@ -74,53 +75,125 @@ object CallerAutoPilotStatusListenerManager : CallerBase() { * 自动驾驶状态信息回调 */ @Synchronized - fun invokeAutoPilotStatusListener() { - LogUtils.dTag(TAG, "$mAutoPilotStatusInfo") - invokeAutoPilotStatusListener(mAutoPilotStatusInfo) + fun invokeAutoPilotStatus() { + LogUtils.dTag(TAG, "$mAutopilotStatusInfo") + invokeAutoPilotStatus(mAutopilotStatusInfo) } /** - * 自动驾驶状态信息回调 - * @param autoPilotStatusInfo 自动驾驶状态信息 + * 自动驾驶状态信息 回调 + * @param autopilotStatusInfo 自动驾驶状态信息 */ @Synchronized - fun invokeAutoPilotStatusListener(autoPilotStatusInfo: AutoPilotStatusInfo) { - LogUtils.dTag(TAG, "$autoPilotStatusInfo") - mAutoPilotStatusInfo = autoPilotStatusInfo - mAutoPilotStatusListeners.forEach { + fun invokeAutoPilotStatus(autopilotStatusInfo: AutopilotStatusInfo) { + LogUtils.dTag(TAG, "$autopilotStatusInfo") + mAutopilotStatusInfo = autopilotStatusInfo + M_AUTOPILOT_STATUS_LISTENERS.forEach { val tag = it.key val listener = it.value LogUtils.dTag(TAG, "tag:$tag listener:$listener") - listener.onAutoPilotStatusResponse(mAutoPilotStatusInfo) + listener.onAutopilotStatusResponse(mAutopilotStatusInfo) } } /** - * 自动驾驶网约车回调数据 回调 - * @param autoPilotStationInfo 自动驾驶网约车回调数据 + * 自动驾驶站点信息 回调 + * @param autopilotStationInfo 自动驾驶网约车回调数据 */ - fun invokeArriveAtStationListener(autoPilotStationInfo: AutoPilotStationInfo) { - LogUtils.dTag(TAG, "$autoPilotStationInfo") - mAutoPilotStatusListeners.forEach { + @Synchronized + fun invokeArriveAtStation(autopilotStationInfo: AutopilotStationInfo) { + LogUtils.dTag(TAG, "$autopilotStationInfo") + M_AUTOPILOT_STATUS_LISTENERS.forEach { val tag = it.key val listener = it.value LogUtils.dTag(TAG, "tag:$tag listener:$listener") - listener.onAutoPilotArriveAtStation(autoPilotStationInfo) + listener.onAutopilotArriveAtStation(autopilotStationInfo) } } /** - * 自动驾驶状态回调 - * @param state - * @param reason + * 车辆状态数据 回调 + * @param autoPilotCarStateInfo */ - fun invokeStateChangedListener(state: Int, reason: String) { - LogUtils.dTag(TAG, "$state $reason") - mAutoPilotStatusListeners.forEach { + @Synchronized + fun invokeAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) { + LogUtils.dTag(TAG, "$autoPilotCarStateInfo") + M_AUTOPILOT_STATUS_LISTENERS.forEach { val tag = it.key val listener = it.value LogUtils.dTag(TAG, "tag:$tag listener:$listener") - listener.onAutoPilotStateChanged(state, reason) + listener.onAutopilotCarStateData(autoPilotCarStateInfo) + } + } + + /** + * 自动驾驶路径 回调 + * @param routeInfo + */ + @Synchronized + fun invokeAutopilotRoute(routeInfo: AutopilotRouteInfo?) { + LogUtils.dTag(TAG, "$routeInfo") + M_AUTOPILOT_STATUS_LISTENERS.forEach { + val tag = it.key + val listener = it.value + LogUtils.dTag(TAG, "tag:$tag listener:$listener") + listener.onAutopilotRoute(routeInfo) + } + } + + /** + * 工控机获取SN 回调 + */ + @Synchronized + fun invokeAutopilotSNRequest() { + LogUtils.dTag(TAG, "") + M_AUTOPILOT_STATUS_LISTENERS.forEach { + val tag = it.key + val listener = it.value + LogUtils.dTag(TAG, "tag:$tag listener:$listener") + listener.onAutopilotSNRequest() + } + } + + /** + * 工控机监控节点 回调 + */ + @Synchronized + fun invokeAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) { + LogUtils.dTag(TAG, "$guardianInfo") + M_AUTOPILOT_STATUS_LISTENERS.forEach { + val tag = it.key + val listener = it.value + LogUtils.dTag(TAG, "tag:$tag listener:$listener") + listener.onAutopilotGuardian(guardianInfo) + } + } + + /** + * 识别交通元素数据发生更新 回调 + */ + @Synchronized + fun invokeIdentifyDataUpdate(trafficData: List?) { + LogUtils.dTag(TAG, "$trafficData") + M_AUTOPILOT_STATUS_LISTENERS.forEach { + val tag = it.key + val listener = it.value + LogUtils.dTag(TAG, "tag:$tag listener:$listener") + listener.onAutopilotIdentifyDataUpdate(trafficData) + } + } + + /** + * 报警信息 回调 + */ + @Synchronized + fun invokeAutopilotWarnMessage(autopilotWarnMessage: AutopilotWarnMessage?) { + LogUtils.dTag(TAG, "$autopilotWarnMessage") + M_AUTOPILOT_STATUS_LISTENERS.forEach { + val tag = it.key + val listener = it.value + LogUtils.dTag(TAG, "tag:$tag listener:$listener") + listener.onAutopilotWarnMessage(autopilotWarnMessage) } } diff --git a/gradle.properties b/gradle.properties index 9fb472d4e6..5836bd6ab3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -182,7 +182,7 @@ MOGO_TRAFFICLIVE_VERSION=1.1.46 # 定位服务 MOGO_LOCATION_VERSION=1.1.46 # 自研地图 -MAP_SDK_VERSION=1.0.1-vr-1.1.3 +MAP_SDK_VERSION=1.0.1-vr-1.1.5 #################架构升级新的版本号 MOGO_CORE_FUNCTION_HMI_VERSION=1.0.0 ## 产品库必备配置,产品库自动对versionCode和versionName版本进行升级 diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java index 64a31a3f4c..87f4bbf533 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java @@ -349,28 +349,28 @@ public class AMapViewWrapper implements IMogoMapView, Logger.d(TAG, "设置的样式 = %s", ui); if (checkAMapView()) { switch (ui) { - case CarUp_2D: - case CarUp_3D: - case NorthUP_2D: - setUIMode(ui); - break; +// case CarUp_2D: +// case CarUp_3D: +// case NorthUP_2D: +// setUIMode(ui); +// break; case Type_VR: mMapView.getMapAutoViewHelper().setScaleVRMode(true); mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_VR); return; - case Type_Light: - mMapView.getMapAutoViewHelper().setAutoSwitchStyle(false); - mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_DAY); - mIsLightStyle = true; - break; - case Type_Night: - mMapView.getMapAutoViewHelper().setAutoSwitchStyle(false); - mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_NIGHT); - mIsLightStyle = false; - break; - case Type_AUTO_LIGHT_Night: - mMapView.getMapAutoViewHelper().setAutoSwitchStyle(true); - break; +// case Type_Light: +// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(false); +// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_DAY); +// mIsLightStyle = true; +// break; +// case Type_Night: +// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(false); +// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_NIGHT); +// mIsLightStyle = false; +// break; +// case Type_AUTO_LIGHT_Night: +// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(true); +// break; } } diff --git a/modules/mogo-module-adas/build.gradle b/modules/mogo-module-adas/build.gradle index e6d26d48b9..7ef67cf156 100644 --- a/modules/mogo-module-adas/build.gradle +++ b/modules/mogo-module-adas/build.gradle @@ -1,6 +1,10 @@ -apply plugin: 'com.android.library' -apply plugin: 'com.alibaba.arouter' - +plugins { + id 'com.android.library' + id 'kotlin-android' + id 'kotlin-android-extensions' + id 'kotlin-kapt' + id 'com.alibaba.arouter' +} android { compileSdkVersion rootProject.ext.android.compileSdkVersion // buildToolsVersion rootProject.ext.android.buildToolsVersion @@ -10,14 +14,15 @@ android { versionCode Integer.valueOf(VERSION_CODE) versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION") - javaCompileOptions { - annotationProcessorOptions { - arguments = [AROUTER_MODULE_NAME: project.getName()] - } - } - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles 'consumer-rules.pro' + //ARouter apt 参数 + kapt { + useBuildCache = false + arguments { + arg("AROUTER_MODULE_NAME", project.getName()) + } + } } buildTypes { @@ -37,10 +42,10 @@ dependencies { implementation rootProject.ext.dependencies.androidxappcompat implementation rootProject.ext.dependencies.androidxconstraintlayout - implementation rootProject.ext.dependencies.arouter implementation rootProject.ext.dependencies.rxandroid - annotationProcessor rootProject.ext.dependencies.aroutercompiler + implementation rootProject.ext.dependencies.arouter + kapt rootProject.ext.dependencies.aroutercompiler // 现有的ADAS的通讯SDK,需要将里面的东西融合到我们项目中 compileOnly rootProject.ext.dependencies.adasapi @@ -61,6 +66,7 @@ dependencies { implementation project(':modules:mogo-module-common') implementation project(':core:mogo-core-data') + implementation project(':core:mogo-core-function-api') implementation project(':core:mogo-core-function-call') } } diff --git a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/AdasAutoPilotManager.java b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/AdasAutoPilotManager.java index 9953305f2b..c79e2b33c3 100644 --- a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/AdasAutoPilotManager.java +++ b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/AdasAutoPilotManager.java @@ -12,6 +12,8 @@ import android.location.Location; import android.os.Handler; import android.os.Message; +import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo; +import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.map.location.MogoLocation; import com.mogo.map.navi.IMogoCarLocationChangedListener2; @@ -129,12 +131,12 @@ public class AdasAutoPilotManager implements IMogoOnMessageListener trafficData) { + Logger.d(TAG, "onRectData " + trafficData); + try { + for (IAdasDataListener listener : iAdasEventListeners) { + if (listener != null) { + listener.onRectData(trafficData); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void onAutopilotWarnMessage(@Nullable AutopilotWarnMessage autopilotWarnMessage) { + Logger.d(TAG, "onWarnMessage " + autopilotWarnMessage); + //报警model + for (IAdasDataListener listener : iAdasEventListeners) { + if (listener != null) { + listener.onWarnMessage(autopilotWarnMessage); + } + } + } } diff --git a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/AdasObjectUtils.kt b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/AdasObjectUtils.kt new file mode 100644 index 0000000000..592222d186 --- /dev/null +++ b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/AdasObjectUtils.kt @@ -0,0 +1,110 @@ +package com.mogo.module.adas + +import android.util.Log +import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage +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.enums.TrafficTypeEnum +import com.mogo.eagle.core.data.traffic.TrafficData +import com.mogo.utils.network.utils.GsonUtil +import com.zhidao.support.adas.high.bean.AutopilotRoute +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.* +import java.util.concurrent.TimeUnit + +/** + * @author congtaowang + * @since 2020/10/25 + * + * 对象转换类 + */ +object AdasObjectUtils { + + fun fromAutopilotGuardianInfo(autopilotGuardianInfo: AutopilotGuardianInfo): AutopilotGuardianStatusInfo? { + return GsonUtil.objectFromJson( + GsonUtil.jsonFromObject(autopilotGuardianInfo), + AutopilotGuardianStatusInfo::class.java + ) + } + + fun fromAdasAutopilotRoute(carStateInfo: AutopilotRoute): AutopilotRouteInfo? { + return GsonUtil.objectFromJson( + GsonUtil.jsonFromObject(carStateInfo), + AutopilotRouteInfo::class.java + ) + } + + fun fromAdasCarStateInfoObject(carStateInfo: CarStateInfo): AutopilotCarStateInfo? { + return GsonUtil.objectFromJson( + GsonUtil.jsonFromObject(carStateInfo), + AutopilotCarStateInfo::class.java + ) + } + + fun fromAdasObject(info: WarnMessageInfo?): AutopilotWarnMessage? { + if (info == null) { + return null + } + val warnMessage = + AutopilotWarnMessage() + warnMessage.content = info.content + warnMessage.level = info.level + try { + warnMessage.type = info.type.toInt() + } catch (e: NumberFormatException) { + return null + } + warnMessage.value = info.value + return warnMessage + } + + fun regroupTrafficDataData(datums: List?): List? { + if (datums == null || datums.isEmpty()) { + return null + } + val recognizedListResults: MutableList = ArrayList() + for (model in datums) { + if (model == null) { + continue + } + val recognizedListResult = fromAdasTrafficDataObject(model) + if (recognizedListResult != null) { + recognizedListResults.add(recognizedListResult) + } + } + return recognizedListResults + } + + fun fromAdasTrafficDataObject(model: RectBean?): TrafficData? { + if (model == null) { + return null + } + val start = System.nanoTime() + val result = TrafficData() + result.uuid = model.uuid + result.lat = model.lat + result.lon = model.lon + result.type = TrafficTypeEnum.getType(model.type.toInt()) + result.heading = model.heading + result.systemTime = model.systemTime.toLong() + result.satelliteTime = model.satelliteTime.toLong() + result.alt = model.alt + result.speed = model.speed + result.carId = model.carId + result.dataAccuracy = model.dataAccuracy + result.distance = model.distance + result.threatLevel = model.drawlevel + Log.d( + "ADAS数据延时", "fromAdasObject cost : " + TimeUnit.NANOSECONDS.toMillis( + System.nanoTime() - start + ) + ) + return result + } + + +} \ No newline at end of file diff --git a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/AdasProvider.java b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/AdasProvider.java index 1df536fd16..f9f10eec9f 100644 --- a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/AdasProvider.java +++ b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/AdasProvider.java @@ -9,7 +9,9 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths; import com.mogo.utils.logger.Logger; import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel; import com.zhidao.support.adas.high.AdasManager; +import com.zhidao.support.adas.high.bean.AutopilotRoute; import com.zhidao.support.adas.high.bean.BasicInfo; +import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo; /** @@ -45,7 +47,7 @@ public class AdasProvider implements IProvider { private void initAdas(Context context, AdasEventManager adasEventManager) { AdasManager.getInstance().create(context); - AdasManager.getInstance().setOnAdasListener(adasEventManager); + AdasManager.getInstance().setOnAdasListener(new OnAdasListenerAdapter()); AdasManager.getInstance().setOnAdasConnectStatusListener(adasEventManager); adasEventManager.setProviderBizListener(this::setBasicInfo); } diff --git a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/AutonomousDriveStatusBean.java b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/AutonomousDriveStatusBean.java deleted file mode 100644 index 686ae78eb0..0000000000 --- a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/AutonomousDriveStatusBean.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.mogo.module.adas; - -/** - * Created by XuYong on 2021/5/28 16:12 - */ -public class AutonomousDriveStatusBean { - - private String sn; - private int status; - private float vehicleSpeed; - - public AutonomousDriveStatusBean(String sn, int status, float vehicleSpeed) { - this.sn = sn; - this.status = status; - this.vehicleSpeed = vehicleSpeed; - } - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public float getVehicleSpeed() { - return vehicleSpeed; - } - - public void setVehicleSpeed(float vehicleSpeed) { - this.vehicleSpeed = vehicleSpeed; - } -} diff --git a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/IAdasDataListener.java b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/IAdasDataListener.java index 30555b8b3e..6865de8633 100644 --- a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/IAdasDataListener.java +++ b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/IAdasDataListener.java @@ -1,11 +1,18 @@ package com.mogo.module.adas; +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.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel; 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.WarnMessageInfo; +import java.util.List; + public interface IAdasDataListener { @@ -13,11 +20,11 @@ public interface IAdasDataListener { } - default void onRectData(RectInfo rectInfo) { + default void onRectData(List trafficData) { } - default void onWarnMessage(WarnMessageInfo warnMessageInfo) { + default void onWarnMessage(AutopilotWarnMessage autopilotWarnMessage) { } @@ -25,17 +32,17 @@ public interface IAdasDataListener { /** * 自动驾驶到达站点回调接口 * - * @param autopilotArriveModel + * @param autopilotWayArrive */ - default void autopilotArrive(AdasAIDLAutopilotArriveModel autopilotArriveModel) { + default void autopilotArrive(AutopilotStationInfo autopilotWayArrive) { } /** * 自动驾驶路线回调 * - * @param autopilotRoute {@link AutopilotRoute} + * @param autopilotRoute {@link AutopilotRouteInfo} */ - default void autopilotRoute(AutopilotRoute autopilotRoute) { + default void autopilotRoute(AutopilotRouteInfo autopilotRoute) { } @@ -50,9 +57,9 @@ public interface IAdasDataListener { /** * 自动驾驶状态信息 * - * @param autopilotStatus {@link AutopilotStatus} + * @param autopilotStatus {@link AutopilotStatusInfo} */ - default void notifyAutopilotState(AutopilotStatus autopilotStatus) { + default void notifyAutopilotState(AutopilotStatusInfo autopilotStatus) { } } diff --git a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/OnAdasListenerAdapter.java b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/OnAdasListenerAdapter.java new file mode 100644 index 0000000000..9931b3e9e6 --- /dev/null +++ b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/OnAdasListenerAdapter.java @@ -0,0 +1,141 @@ +package com.mogo.module.adas; + +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.call.autopilot.CallerAutoPilotStatusListenerManager; +import com.mogo.utils.logger.Logger; +import com.zhidao.support.adas.high.AdasManager; +import com.zhidao.support.adas.high.OnAdasListener; +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.WarnMessageInfo; +import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo; +import com.zhidao.support.obu.ami.AmiClientManager; + +import java.util.List; + +/** + * @author congtaowang + * @since 2020/10/22 + *

+ * 适配ADAS 回调监听分发 + */ +public class OnAdasListenerAdapter implements OnAdasListener { + private final String TAG = "OnAdasListenerAdapter"; + + @Override + public void onRectData(RectInfo rectInfo) { + List recognizedListResults = AdasObjectUtils.INSTANCE.regroupTrafficDataData(rectInfo.getModels()); + CallerAutoPilotStatusListenerManager.INSTANCE.invokeIdentifyDataUpdate(recognizedListResults); + } + + @Override + public void onCarStateData(CarStateInfo carStateInfo) { + AutopilotCarStateInfo autopilotCarStateInfo = AdasObjectUtils.INSTANCE.fromAdasCarStateInfoObject(carStateInfo); + CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo); + + //can数据转发 + CarStateInfo.ValuesBean bean = carStateInfo.getValues(); + if (bean != null) { + int turn_light = bean.getTurn_light(); //转向灯状态 0是正常 1是左转 2是右转 + AmiClientManager.getInstance().setTurnLightState(turn_light); + } + } + + @Override + public void autopilotStatus(AutopilotStatus autopilotStatus) { + AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues(); + + if (autopilotStatusValues != null) { + // 初始化自动驾驶状态信息 + AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo(); + autopilotStatusInfo.setState(autopilotStatusValues.getState()); + autopilotStatusInfo.setPilotmode(autopilotStatusValues.getPilotmode()); + autopilotStatusInfo.setReason(autopilotStatusValues.getReason()); + autopilotStatusInfo.setCamera(autopilotStatusValues.getCamera()); + autopilotStatusInfo.setRtk(autopilotStatusValues.getRtk()); + autopilotStatusInfo.setRadar(autopilotStatusValues.getRadar()); + autopilotStatusInfo.setSpeed(autopilotStatusValues.getSpeed()); + // 初始化自动驾驶状态信息 + autopilotStatusInfo.setVersion(AdasManager.getInstance().getAdasConfig().getVersion()); + autopilotStatusInfo.setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress()); + + CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus(); + } + } + + @Override + public void autopilotArrive(AutopilotWayArrive autopilotWayArrive) { + if (autopilotWayArrive != null) { + AutopilotWayArrive.ResultBean result = autopilotWayArrive.getResult(); + if (result != null) { + AutopilotWayArrive.ResultBean.EndLatLonBean endLatLon = result.getEndLatLon(); + if (endLatLon != null) { + AutopilotStationInfo stationInfo = new AutopilotStationInfo(result.getCarType(), endLatLon.getLon(), endLatLon.getLat()); + + CallerAutoPilotStatusListenerManager.INSTANCE.invokeArriveAtStation(stationInfo); + } + } + } + } + + @Override + public void onAutopilotRoute(AutopilotRoute route) { + Logger.d(TAG, "onAutopilotRoute : " + route.toString()); + AutopilotRouteInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAdasAutopilotRoute(route); + CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotRoute(autopilotRoute); + } + + @Override + public void onAutopilotSNRequest() { + CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotSNRequest(); + } + + @Override + public void onAutopilotGuardian(AutopilotGuardianInfo guardianInfo) { + AutopilotGuardianStatusInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAutopilotGuardianInfo(guardianInfo); + CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotGuardian(autopilotRoute); + } + + + @Override + public void onLightStateData(LightStatueInfo lightStatueInfo) { + + } + + @Override + public void onObstaclesInfo(ObstaclesInfo obstaclesInfo) { + + } + + @Override + public void onCarLaneInfo(CarLaneInfo carLaneInfo) { + + } + + + @Override + public void onWarnMessage(WarnMessageInfo warnMessageInfo) { + final AutopilotWarnMessage warnMessage = AdasObjectUtils.INSTANCE.fromAdasObject(warnMessageInfo); + CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotWarnMessage(warnMessage); + + } + + @Override + public void onVideoSize(int width, int height) { + + } + + +} diff --git a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/ReportSiteBean.java b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/ReportSiteBean.java deleted file mode 100644 index 76677e00ba..0000000000 --- a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/ReportSiteBean.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mogo.module.adas; - -/** - * Created by XuYong on 2021/5/31 16:24 - */ -public class ReportSiteBean { - private String sn; - private double lon; - private double lat; - - public ReportSiteBean(String sn, double lon, double lat) { - this.sn = sn; - this.lon = lon; - this.lat = lat; - } - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public double getLon() { - return lon; - } - - public void setLon(double lon) { - this.lon = lon; - } - - public double getLat() { - return lat; - } - - public void setLat(double lat) { - this.lat = lat; - } -} diff --git a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/entity/ReportedRoute.java b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/entity/ReportedRoute.java index 850473685e..8fc5663dce 100644 --- a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/entity/ReportedRoute.java +++ b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/entity/ReportedRoute.java @@ -1,17 +1,17 @@ package com.mogo.module.adas.entity; -import com.zhidao.support.adas.high.bean.AutopilotStatus; +import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; /** * 上报自动驾驶规划的路径 */ public class ReportedRoute { private String sn; - private AutopilotStatus.ValuesBean bean; + private AutopilotStatusInfo bean; private String siteList; - public ReportedRoute(String sn, AutopilotStatus.ValuesBean bean) { + public ReportedRoute(String sn, AutopilotStatusInfo bean) { this.sn = sn; this.bean = bean; } diff --git a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/entity/WarnMessageModel.java b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/entity/WarnMessageModel.java deleted file mode 100644 index ae6a6d8cab..0000000000 --- a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/entity/WarnMessageModel.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.mogo.module.adas.entity; - -import com.zhidao.support.adas.high.bean.WarnMessageInfo; - -/** - * @author nie yunlong - * @des - * @date 2020/10/22 - */ -public class WarnMessageModel { - - private String action; - - private WarnMessageInfo values; - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public WarnMessageInfo getValues() { - return values; - } - - public void setValues(WarnMessageInfo values) { - this.values = values; - } -} diff --git a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/model/AdasServiceModel.java b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/model/AdasServiceModel.java index 6f9a2e9f2f..b5d733503d 100644 --- a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/model/AdasServiceModel.java +++ b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/model/AdasServiceModel.java @@ -3,6 +3,7 @@ package com.mogo.module.adas.model; import com.mogo.cloud.passport.MoGoAiCloudClientConfig; import com.mogo.commons.data.BaseData; import com.mogo.commons.network.SubscribeImpl; +import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; import com.mogo.module.adas.entity.AutonomousDriveStatusBean; import com.mogo.module.adas.entity.ReportDispatchResult; import com.mogo.module.adas.entity.ReportSiteBean; @@ -59,9 +60,9 @@ public class AdasServiceModel { * * @param autopilotStatus {@link AutopilotStatus} */ - public void uploadAutopilotStatus(AutopilotStatus autopilotStatus) { + public void uploadAutopilotStatus(AutopilotStatusInfo autopilotStatus) { String sn = MoGoAiCloudClientConfig.getInstance().getSn(); - ReportedRoute reportedRoute = new ReportedRoute(sn, autopilotStatus.getValues()); + ReportedRoute reportedRoute = new ReportedRoute(sn, autopilotStatus); Map map = new HashMap<>(); map.put("sn", sn); map.put("data", GsonUtil.jsonFromObject(reportedRoute)); diff --git a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/receiver/test b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/receiver/test deleted file mode 100644 index cd012b0554..0000000000 --- a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/receiver/test +++ /dev/null @@ -1,216 +0,0 @@ -原数据 -26.820175208327566,112.57748204198309 -26.82009891465042,112.57735739748664 -26.820022750763542,112.57723266155585 -26.81994655656347,112.57710795477944 -26.81987031666393,112.57698328267305 -26.819793988171348,112.57685866945901 -26.819717530408877,112.57673414980971 -26.819635079638967,112.57661462149986 -26.819532022659132,112.5765234581422 -26.819488197195188,112.5764835085963 -26.81947053563866,112.57645743645142 -26.81945285740347,112.5764313389555 -26.81941584428336,112.57637074918446 -26.819355855639404,112.57626774620917 -26.8193352833325,112.57623094969783 -26.819315738575742,112.57619587959701 -26.81929619389902,112.5761608096667 -26.819276064037396,112.5761245744324 -26.819221654527443,112.5760208132482 -26.819153675938914,112.5758903945585 -26.8190859083974,112.57576035026403 -26.81904791926707,112.57568644394968 -26.819047477540156,112.57568591545105 -26.819047035811135,112.57568538694994 -26.819046594080046,112.57568485844635 -26.81902999052958,112.57568137976324 -26.818966668056316,112.57572279587626 -26.81896660310204,112.57572518130716 -26.81896683258833,112.57572606581252 -26.81896706207354,112.57572695031374 -26.818971211272444,112.57573544393973 -26.819027657144368,112.57584589447032 -26.819095546341085,112.57597644303986 -26.8191650468231,112.57610591408428 -26.819236806047,112.5762338575302 -26.819310184480436,112.57636063880027 -26.819384451187933,112.5764867800095 -26.819460642360763,112.57661149583805 -26.819536878267925,112.57673619431976 -26.819613220428206,112.57686079387894 -26.819689146973122,112.57698570087358 -26.819765257290772,112.57711047564952 -26.81984156841068,112.57723510283108 -26.819916608456698,112.57735767331373 -26.819990868286688,112.57747918205983 -26.82006704845146,112.57760363217366 -26.820142688927376,112.57772676391022 -26.820220480866162,112.57784947830805 -26.82029609426984,112.57797111160743 -26.820372540342063,112.57809575812311 -26.820449035279513,112.57822036992494 -26.82052479395364,112.5783432083879 -26.820600741070034,112.57846626552721 -26.820676451505513,112.57858892597905 -26.820750627333855,112.57870908764811 -26.820788099971104,112.57876896886103 -26.82079340880141,112.57877600898784 -26.82079871765643,112.57878304914836 -26.820804096213536,112.57879017489086 -26.820866626548845,112.5788587003478 -26.820983640738305,112.57893123552938 -26.82111632395692,112.57893777257203 -26.82117204164965,112.57891747212024 -26.821184743761496,112.57890962148315 -26.821197445813166,112.57890177088103 -26.821210607045213,112.57889357476125 -26.821290516628242,112.57883467623317 -26.82140278979742,112.57875048180252 -26.821515292745254,112.57866667791178 -26.821628395747688,112.5785838835907 -26.82174189376551,112.57850175198458 -26.82185566968843,112.57842010282002 -26.82196987298559,112.57833919555353 -26.822083935682734,112.5782580474171 -26.822198178890964,112.57817722472228 -26.82231299206679,112.5780973993899 -26.822427661696032,112.57801732090307 -26.82254293064344,112.57793832470455 -26.822658717481524,112.57786026718888 -26.822774624402133,112.57778243034805 -26.82289066838358,112.57770484656757 -26.823007036027615,112.57762787191734 -26.823123797760537,112.57755163699323 -26.82324089700492,112.57747604255579 -26.823355874237176,112.57740187937155 -26.823470001455,112.57732986163221 -26.82358841433288,112.57725688653507 -26.823706827172103,112.5771839112856 -26.82382523997266,112.57711093588388 -26.823943652734542,112.57703796032986 -26.824062065457753,112.57696498462354 -26.824180478142292,112.57689200876496 -26.82429889078817,112.57681903275407 -26.824416715403633,112.5767464980989 -26.824533859020413,112.57667699873441 -26.824651399274774,112.57660868246823 -26.824762900762973,112.57658692553045 -26.824968687097577,112.57656763804074 -26.825104150528567,112.57650684107888 -26.82522465989416,112.57643823074989 -26.825345659446693,112.57637072881484 -26.8255763298452,112.57624421893341 - - -排序数据: -26.81896660310204,112.57568137976324 -26.818966668056316,112.57568485844635 -26.81896683258833,112.57568538694994 -26.81896706207354,112.57568591545105 -26.818971211272444,112.57568644394968 -26.819027657144368,112.57572279587626 -26.81902999052958,112.57572518130716 -26.819046594080046,112.57572606581252 -26.819047035811135,112.57572695031374 -26.819047477540156,112.57573544393973 -26.81904791926707,112.57576035026403 -26.8190859083974,112.57584589447032 -26.819095546341085,112.5758903945585 -26.819153675938914,112.57597644303986 -26.8191650468231,112.5760208132482 -26.819221654527443,112.57610591408428 -26.819236806047,112.5761245744324 -26.819276064037396,112.5761608096667 -26.81929619389902,112.57619587959701 -26.819310184480436,112.57623094969783 -26.819315738575742,112.5762338575302 -26.8193352833325,112.57624421893341 -26.819355855639404,112.57626774620917 -26.819384451187933,112.57636063880027 -26.81941584428336,112.57637072881484 -26.81945285740347,112.57637074918446 -26.819460642360763,112.5764313389555 -26.81947053563866,112.57643823074989 -26.819488197195188,112.57645743645142 -26.819532022659132,112.5764835085963 -26.819536878267925,112.5764867800095 -26.819613220428206,112.57650684107888 -26.819635079638967,112.5765234581422 -26.819689146973122,112.57656763804074 -26.819717530408877,112.57658692553045 -26.819765257290772,112.57660868246823 -26.819793988171348,112.57661149583805 -26.81984156841068,112.57661462149986 -26.81987031666393,112.57667699873441 -26.819916608456698,112.57673414980971 -26.81994655656347,112.57673619431976 -26.819990868286688,112.5767464980989 -26.820022750763542,112.57681903275407 -26.82006704845146,112.57685866945901 -26.82009891465042,112.57686079387894 -26.820142688927376,112.57689200876496 -26.820175208327566,112.57696498462354 -26.820220480866162,112.57698328267305 -26.82029609426984,112.57698570087358 -26.820372540342063,112.57703796032986 -26.820449035279513,112.57710795477944 -26.82052479395364,112.57711047564952 -26.820600741070034,112.57711093588388 -26.820676451505513,112.5771839112856 -26.820750627333855,112.57723266155585 -26.820788099971104,112.57723510283108 -26.82079340880141,112.57725688653507 -26.82079871765643,112.57732986163221 -26.820804096213536,112.57735739748664 -26.820866626548845,112.57735767331373 -26.820983640738305,112.57740187937155 -26.82111632395692,112.57747604255579 -26.82117204164965,112.57747918205983 -26.821184743761496,112.57748204198309 -26.821197445813166,112.57755163699323 -26.821210607045213,112.57760363217366 -26.821290516628242,112.57762787191734 -26.82140278979742,112.57770484656757 -26.821515292745254,112.57772676391022 -26.821628395747688,112.57778243034805 -26.82174189376551,112.57784947830805 -26.82185566968843,112.57786026718888 -26.82196987298559,112.57793832470455 -26.822083935682734,112.57797111160743 -26.822198178890964,112.57801732090307 -26.82231299206679,112.57809575812311 -26.822427661696032,112.5780973993899 -26.82254293064344,112.57817722472228 -26.822658717481524,112.57822036992494 -26.822774624402133,112.5782580474171 -26.82289066838358,112.57833919555353 -26.823007036027615,112.5783432083879 -26.823123797760537,112.57842010282002 -26.82324089700492,112.57846626552721 -26.823355874237176,112.57850175198458 -26.823470001455,112.5785838835907 -26.82358841433288,112.57858892597905 -26.823706827172103,112.57866667791178 -26.82382523997266,112.57870908764811 -26.823943652734542,112.57875048180252 -26.824062065457753,112.57876896886103 -26.824180478142292,112.57877600898784 -26.82429889078817,112.57878304914836 -26.824416715403633,112.57879017489086 -26.824533859020413,112.57883467623317 -26.824651399274774,112.5788587003478 -26.824762900762973,112.57889357476125 -26.824968687097577,112.57890177088103 -26.825104150528567,112.57890962148315 -26.82522465989416,112.57891747212024 -26.825345659446693,112.57893123552938 -26.8255763298452,112.57893777257203 - - - - - - - - diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/datacenter/SnapshotLocationDataCenter.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/datacenter/SnapshotLocationDataCenter.java index 081c2f2a4e..10ca090421 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/datacenter/SnapshotLocationDataCenter.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/datacenter/SnapshotLocationDataCenter.java @@ -2,7 +2,7 @@ package com.mogo.module.common.datacenter; import com.mogo.commons.FunctionBuildConfig; import com.mogo.commons.debug.DebugConfig; -import com.mogo.eagle.core.data.autopilot.AutoPilotStatusInfo; +import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; import com.mogo.module.common.MogoApisHandler; import com.mogo.service.cloud.location.CloudLocationInfo; @@ -94,10 +94,10 @@ public class SnapshotLocationDataCenter { // 使用与渠道配置一样的gps提供者提供的数据 if (gpsProvider == FunctionBuildConfig.gpsProvider) { //测试面板状态同步 - AutoPilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo(); + AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo(); autopilotStatusInfo.setLocationLat(lat); autopilotStatusInfo.setLocationLon(lon); - CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatusListener(); + CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus(); DebugConfig.setStatusData(DebugConfig.sLon, lon); DebugConfig.setStatusData(DebugConfig.sLat, lat); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/AdasRecognizedResultDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/AdasRecognizedResultDrawer.java index bc4cb1ac7e..550b60c44c 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/AdasRecognizedResultDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/AdasRecognizedResultDrawer.java @@ -1,5 +1,7 @@ package com.mogo.module.common.drawer; +import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS; + import android.os.Build; import android.text.TextUtils; import android.util.Log; @@ -7,12 +9,12 @@ import android.util.Log; import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.commons.debug.DebugConfig; import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.data.traffic.TrafficData; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.MogoMarkerOptions; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.constants.DataTypes; import com.mogo.module.common.utils.Trigonometric; -import com.mogo.service.adas.entity.ADASRecognizedResult; import java.util.ArrayList; import java.util.Iterator; @@ -21,16 +23,13 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; -import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS; - -public /** * @author congtaowang * @since 2020/10/28 - * + *

* 绘制adas近景识别到的车辆 */ -class AdasRecognizedResultDrawer extends BaseDrawer { +public class AdasRecognizedResultDrawer extends BaseDrawer { private static final String TAG = "RecognizedResultDrawer"; @@ -45,7 +44,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer { super(); } - private final Map mLastPositions = new ConcurrentHashMap<>(); + private final Map mLastPositions = new ConcurrentHashMap<>(); public static AdasRecognizedResultDrawer getInstance() { if (sInstance == null) { @@ -76,7 +75,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer { * * @param resultList adas感知融合数据 */ - public void renderAdasRecognizedResult(List resultList) { + public void renderAdasRecognizedResult(List resultList) { final long start = System.nanoTime(); if (resultList == null || resultList.isEmpty() || !DebugConfig.isUseAdasRecognize()) { @@ -91,18 +90,18 @@ class AdasRecognizedResultDrawer extends BaseDrawer { return; } -// List allDatumsList = new ArrayList<>(); +// List allDatumsList = new ArrayList<>(); // prepareData(resultList, allDatumsList); Map newAdasRecognizedMarkersCaches = new ConcurrentHashMap<>(); - List newDiffSet = new ArrayList<>(); - for (ADASRecognizedResult recognizedListResult : resultList) { + List newDiffSet = new ArrayList<>(); + for (TrafficData recognizedListResult : resultList) { if (isUselessValue(recognizedListResult)) { continue; } // 复用之前存在的 marker - String uniqueKey = recognizedListResult.uuid; + String uniqueKey = recognizedListResult.getUuid(); IMogoMarker marker = mMarkersCaches.remove(uniqueKey); if (marker != null && !marker.isDestroyed()) { // Log.d(TAG, "发现缓存marker id : " + uniqueKey); @@ -120,8 +119,8 @@ class AdasRecognizedResultDrawer extends BaseDrawer { // 复用过期 marker if (newDiffSetSize > 0) { for (int i = 0; i < newDiffSetSize; i++) { - ADASRecognizedResult recognizedListResult = newDiffSet.get(i); - String uniqueKey = recognizedListResult.uuid; + TrafficData recognizedListResult = newDiffSet.get(i); + String uniqueKey = recognizedListResult.getUuid(); IMogoMarker marker = drawAdasRecognizedDataMarker(recognizedListResult); if (marker == null) { continue; @@ -142,7 +141,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer { * @param in * @param out */ - private void prepareData(List in, List out) { + private void prepareData(List in, List out) { // foreCastPoint(in); out.addAll(in); } @@ -154,22 +153,22 @@ class AdasRecognizedResultDrawer extends BaseDrawer { * * @param in 数据源 */ - private void foreCastPoint(List in) { + private void foreCastPoint(List in) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - for (ADASRecognizedResult adasResult : in) { - Log.d(FORECAST, "ready to foreCast current uuid : " + adasResult.uuid); - long internal = getCurSatelliteTime() - adasResult.satelliteTime; + for (TrafficData adasResult : in) { + Log.d(FORECAST, "ready to foreCast current uuid : " + adasResult.getUuid()); + long internal = getCurSatelliteTime() - adasResult.getSatelliteTime(); if (internal <= 0) { - Log.d(FORECAST, "time internal less than 0 , uuid : " + adasResult.uuid); + Log.d(FORECAST, "time internal less than 0 , uuid : " + adasResult.getUuid()); continue; } long startTime = System.currentTimeMillis(); // 预测点 - Log.d(FORECAST, "time internal : " + internal + " speed : " + adasResult.speed); - double foreCastDistance = adasResult.speed * internal / 1000; + Log.d(FORECAST, "time internal : " + internal + " speed : " + adasResult.getSpeed()); + double foreCastDistance = adasResult.getSpeed() * internal / 1000; Log.d(FORECAST, "foreCastDistance : " + foreCastDistance); - MogoLatLng mogoLatLng = new MogoLatLng(adasResult.lat, adasResult.lon); - MogoLatLng foreCastMogoLatLon = Trigonometric.getNewLocation(mogoLatLng, foreCastDistance, adasResult.heading); + MogoLatLng mogoLatLng = new MogoLatLng(adasResult.getLat(), adasResult.getLon()); + MogoLatLng foreCastMogoLatLon = Trigonometric.getNewLocation(mogoLatLng, foreCastDistance, adasResult.getHeading()); // 计算与自车距离 float distanceFromSelf = CoordinateUtils.calculateLineDistance(getCurCoordinates()[0], getCurCoordinates()[1] @@ -178,10 +177,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer { long foreCastInternal = System.currentTimeMillis() - startTime; Log.d(FORECAST, "foreCastInternal :" + foreCastInternal); //todo 耗时1~2毫秒 需要测试是否由于补点算法造成 - adasResult.lat = foreCastMogoLatLon.getLat(); - adasResult.lon = foreCastMogoLatLon.getLon(); - adasResult.satelliteTime = (getCurSatelliteTime() - foreCastInternal); - adasResult.distance = distanceFromSelf; + adasResult.setLat(foreCastMogoLatLon.getLat()); + adasResult.setLon(foreCastMogoLatLon.getLon()); + adasResult.setSatelliteTime((getCurSatelliteTime() - foreCastInternal)); + adasResult.setDistance(distanceFromSelf); } } } @@ -192,9 +191,9 @@ class AdasRecognizedResultDrawer extends BaseDrawer { * @param marker * @param recognizedListResult */ - private void updateCacheMarkerRes(IMogoMarker marker, ADASRecognizedResult recognizedListResult) { + private void updateCacheMarkerRes(IMogoMarker marker, TrafficData recognizedListResult) { String resIdVal; - int resId = getModelRes(recognizedListResult.type); + int resId = getModelRes(recognizedListResult.getType().getType()); resIdVal = resId + ""; String resName = mMarkerCachesResMd5Values.get(resIdVal); if (!TextUtils.isEmpty(resName)) { @@ -211,11 +210,11 @@ class AdasRecognizedResultDrawer extends BaseDrawer { if (mLastPositions.isEmpty()) { return; } - Iterator iterator = mLastPositions.values().iterator(); + Iterator iterator = mLastPositions.values().iterator(); Log.d("EmArrow", "removeUselessLastRecord size : " + mLastPositions.size()); while (iterator.hasNext()) { - ADASRecognizedResult result = iterator.next(); - long internal = result.satelliteTime - getCurSatelliteTime(); + TrafficData result = iterator.next(); + long internal = result.getSatelliteTime() - getCurSatelliteTime(); if (internal > 3000) { //防止帧率过低导致误删除上一个节点对象,从而出现跳跃现象 iterator.remove(); } @@ -225,33 +224,33 @@ class AdasRecognizedResultDrawer extends BaseDrawer { /** * 过滤无用数据 * - * @param recognizedListResult {@link ADASRecognizedResult} + * @param recognizedListResult {@link TrafficData} * @return useless */ - private boolean isUselessValue(ADASRecognizedResult recognizedListResult) { + private boolean isUselessValue(TrafficData recognizedListResult) { if (recognizedListResult == null) { return true; } - if (nonRenderType(recognizedListResult.type)) { + if (nonRenderType(recognizedListResult.getType().getType())) { return true; } - String uniqueKey = recognizedListResult.uuid; + String uniqueKey = recognizedListResult.getUuid(); return TextUtils.isEmpty(uniqueKey); } /** * 绘制某个物体的一个数据 * - * @param recognizedListResult {@link ADASRecognizedResult} + * @param recognizedListResult {@link TrafficData} * @param newAdasRecognizedMarkersCaches 缓存集合 */ private void renderAdasOneFrame(IMogoMarker marker, String uniqueKey, - ADASRecognizedResult recognizedListResult, + TrafficData recognizedListResult, Map newAdasRecognizedMarkersCaches) { final long start = System.nanoTime(); // Log.d(TAG, "renderAdasOneFrame uuid : " + uniqueKey + " type : " + recognizedListResult.type + " heading : " + recognizedListResult.heading); - ADASRecognizedResult lastPosition = mLastPositions.remove(uniqueKey); + TrafficData lastPosition = mLastPositions.remove(uniqueKey); // 道路吸附 // double lastLon = -1; // double lastLat = -1; @@ -269,18 +268,15 @@ class AdasRecognizedResultDrawer extends BaseDrawer { // Log.d(TAG, "使用缓存 id : " + uniqueKey); long interval = 45; if (lastPosition != null) { - interval = computeAnimDuration(lastPosition.satelliteTime, recognizedListResult.satelliteTime); + interval = computeAnimDuration(lastPosition.getSatelliteTime(), recognizedListResult.getSatelliteTime()); } - final MogoLatLng renderLoc = new MogoLatLng(recognizedListResult.lat, recognizedListResult.lon); + final MogoLatLng renderLoc = new MogoLatLng(recognizedListResult.getLat(), recognizedListResult.getLon()); long cost = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start); - Log.d("ADAS动画数据","cost : " + cost); + Log.d("ADAS动画数据", "cost : " + cost); final long intervalRef = interval - cost; - Log.d("ADAS动画数据", "最终赋值 : " + intervalRef + " 两帧间隔 : " + interval + " uuid : " + recognizedListResult.uuid); - marker.addDynamicAnchorPosition(renderLoc, (float) recognizedListResult.heading, intervalRef); - String carColor = recognizedListResult.color; - if (TextUtils.isEmpty(carColor)) { - carColor = getModelRenderColor(recognizedListResult.type, FROM_ADAS, recognizedListResult.drawlevel); - } + Log.d("ADAS动画数据", "最终赋值 : " + intervalRef + " 两帧间隔 : " + interval + " uuid : " + recognizedListResult.getUuid()); + marker.addDynamicAnchorPosition(renderLoc, (float) recognizedListResult.getHeading(), intervalRef); + String carColor = getModelRenderColor(recognizedListResult.getType().getType(), FROM_ADAS, recognizedListResult.getThreatLevel()); marker.setAnchorColor(carColor); newAdasRecognizedMarkersCaches.put(uniqueKey, marker); @@ -302,22 +298,19 @@ class AdasRecognizedResultDrawer extends BaseDrawer { /** * 绘制 marker * - * @param recognizedListResult {@link ADASRecognizedResult} + * @param recognizedListResult {@link TrafficData} * @return {@link IMogoMarker} */ - private IMogoMarker drawAdasRecognizedDataMarker(ADASRecognizedResult recognizedListResult) { + private IMogoMarker drawAdasRecognizedDataMarker(TrafficData recognizedListResult) { long start = System.nanoTime(); if (recognizedListResult == null) { return null; } - int resId = getModelRes(recognizedListResult.type); + int resId = getModelRes(recognizedListResult.getType().getType()); String resIdVal = resId + ""; - String carColor = recognizedListResult.color; - if (TextUtils.isEmpty(carColor)) { - carColor = getModelRenderColor(recognizedListResult.type, FROM_ADAS, recognizedListResult.drawlevel); - } + String carColor = getModelRenderColor(recognizedListResult.getType().getType(), FROM_ADAS, recognizedListResult.getThreatLevel()); MogoMarkerOptions options = new MogoMarkerOptions() .owner(DataTypes.TYPE_MARKER_ADAS) .anchor(0.5f, 0.5f) @@ -327,8 +320,8 @@ class AdasRecognizedResultDrawer extends BaseDrawer { .controlAngle(true) .resName(mMarkerCachesResMd5Values.get(resIdVal)) .icon3DRes(resId) - .rotate((float) recognizedListResult.heading) - .position(new MogoLatLng(recognizedListResult.lat, recognizedListResult.lon)); + .rotate((float) recognizedListResult.getHeading()) + .position(new MogoLatLng(recognizedListResult.getLat(), recognizedListResult.getLon())); IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(DataTypes.TYPE_MARKER_ADAS, options); cacheMarkerIconResMd5Val(resIdVal, marker); Log.d("ADAS数据延时", "创建一个新 marker cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start))); diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java index 33ef9c90fe..5033726c1d 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/AdasNoticeHelper.java @@ -14,8 +14,8 @@ import com.mogo.module.common.MogoApisHandler; import com.mogo.module.extensions.navi.VrModeNavInfoView; import com.mogo.realtime.socket.IMogoCloudOnMsgListener; import com.mogo.service.adas.IMogoAdasWarnMessageCallback; -import com.mogo.service.adas.MogoADASWarnType; -import com.mogo.service.adas.entity.ADASWarnMessage; +import com.mogo.eagle.core.data.autopilot.MogoADASWarnType; +import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage; import com.mogo.utils.logger.Logger; import org.json.JSONArray; @@ -92,7 +92,7 @@ public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback, IMogoLoca } @Override - public void onReceiveData(ADASWarnMessage msg) { + public void onReceiveData(AutopilotWarnMessage msg) { Logger.d(TAG, "收到adas warn message, isVrMode: " + isVrMode + " msg: " + msg); if (!isVrMode) { return; diff --git a/modules/mogo-module-service/consumer-rules.pro b/modules/mogo-module-service/consumer-rules.pro index 0d1241abed..599bf003e2 100644 --- a/modules/mogo-module-service/consumer-rules.pro +++ b/modules/mogo-module-service/consumer-rules.pro @@ -1,5 +1,5 @@ #-----ServiceModule----- --keep class com.mogo.module.service.carinfo.CarStateInfo{*;} +-keep class com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo{*;} -keep class com.mogo.module.service.launchercard.LauncherCardRefreshType{*;} -keep class com.mogo.module.service.network.bean.*{*;} -keep class com.mogo.module.service.network.RefreshBody{*;} diff --git a/modules/mogo-module-service/proguard-rules.pro b/modules/mogo-module-service/proguard-rules.pro index 02a339ca47..e486a97ecb 100644 --- a/modules/mogo-module-service/proguard-rules.pro +++ b/modules/mogo-module-service/proguard-rules.pro @@ -21,7 +21,7 @@ #-renamesourcefileattribute SourceFile #-----ServiceModule----- --keep class com.mogo.module.service.carinfo.CarStateInfo.*{*;} +-keep class com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo.*{*;} -keep class com.mogo.module.service.network.RefreshBody.*{*;} -keep class com.mogo.module.service.network.bean.DemoUserInfoEntity.*{*;} -keep interface com.mogo.module.service.intent.IntentHandler diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java index 040203ec18..dfe873e36a 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java @@ -53,7 +53,7 @@ import com.mogo.module.service.ttsConfig.TtsConfigModleData; import com.mogo.realtime.api.MoGoAiCloudRealTime; import com.mogo.service.adas.IMogoADASController; import com.mogo.service.adas.IMogoAdasCarDataCallback; -import com.mogo.service.adas.entity.ADASCarStateInfo; +import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo; import com.mogo.service.fragmentmanager.FragmentStackTransactionListener; import com.mogo.service.fragmentmanager.IMogoFragmentManager; import com.mogo.service.intent.IMogoIntentListener; @@ -970,7 +970,7 @@ public class MogoServices implements IMogoMapListener, } @Override - public void onAdasCarDataCallback( ADASCarStateInfo stateInfo ) { + public void onAdasCarDataCallback( AutopilotCarStateInfo stateInfo ) { if(TimeDelayUploadManager.getInstance().isMock()){ //模拟数据时,不更新由工控机传输的自车位置 return; diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/autopilot/AutoPilotRemoteController.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/autopilot/AutoPilotRemoteController.java index 1ad2fd1597..254ccfb2c9 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/autopilot/AutoPilotRemoteController.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/autopilot/AutoPilotRemoteController.java @@ -2,7 +2,7 @@ package com.mogo.module.service.autopilot; import com.mogo.commons.AbsMogoApplication; import com.mogo.module.common.MogoApisHandler; -import com.mogo.eagle.core.data.autopilot.AutoPilotControlParameters; +import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters; import com.mogo.service.cloud.socket.IMogoOnMessageListener; import com.mogo.service.cloud.socket.IMogoSocketManager; import com.mogo.utils.logger.Logger; @@ -23,14 +23,14 @@ class AutoPilotRemoteController { private IMogoSocketManager mMogoSocketManager; - private IMogoOnMessageListener mParametersListener = new IMogoOnMessageListener() { + private IMogoOnMessageListener mParametersListener = new IMogoOnMessageListener() { @Override - public Class target() { - return AutoPilotControlParameters.class; + public Class target() { + return AutopilotControlParameters.class; } @Override - public void onMsgReceived( AutoPilotControlParameters obj ) { + public void onMsgReceived( AutopilotControlParameters obj ) { if ( obj == null ) { Logger.e( TAG, "远端控制参数为null", new NullPointerException() ); return; diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/carinfo/CarStateInfo.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/carinfo/CarStateInfo.java deleted file mode 100644 index 6d25e50caf..0000000000 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/carinfo/CarStateInfo.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.mogo.module.service.carinfo; - -import java.io.Serializable; - -/** - * @author nie yunlong - * @des 车辆状态 - * @date 2020/3/12 - */ -public class CarStateInfo implements Serializable { - - - /** - * action : “state” - * values : {"lon":116.8,"lat":39.4,"alt":22.3,"heading":87.5,"acceleration":0.5,"yaw_rate":0.3} - */ - - private String action; - private ValuesBean values; - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public ValuesBean getValues() { - return values; - } - - public void setValues(ValuesBean values) { - this.values = values; - } - - public static class ValuesBean { - /** - * lon : 116.8 - * lat : 39.4 - * alt : 22.3 - * heading : 87.5 - * acceleration : 0.5 - * yaw_rate : 0.3 - */ - - private double lon; - private double lat; - private double alt; - private double heading; - private double acceleration; - private double yaw_rate; - //惯导车速 m/s - private float gnss_speed; - //gps 时间 - private String satelliteTime; - - public float getGnss_speed() { - return gnss_speed; - } - - public void setGnss_speed( float gnss_speed ) { - this.gnss_speed = gnss_speed; - } - - public String getSatelliteTime() { - return satelliteTime; - } - - public void setSatelliteTime( String satelliteTime ) { - this.satelliteTime = satelliteTime; - } - - public double getLon() { - return lon; - } - - public void setLon(double lon) { - this.lon = lon; - } - - public double getLat() { - return lat; - } - - public void setLat(double lat) { - this.lat = lat; - } - - public double getAlt() { - return alt; - } - - public void setAlt(double alt) { - this.alt = alt; - } - - public double getHeading() { - return heading; - } - - public void setHeading(double heading) { - this.heading = heading; - } - - public double getAcceleration() { - return acceleration; - } - - public void setAcceleration(double acceleration) { - this.acceleration = acceleration; - } - - public double getYaw_rate() { - return yaw_rate; - } - - public void setYaw_rate(double yaw_rate) { - this.yaw_rate = yaw_rate; - } - - @Override - public String toString() { - return "ValuesBean{" + - "lon=" + lon + - ", lat=" + lat + - ", alt=" + alt + - ", heading=" + heading + - ", acceleration=" + acceleration + - ", yaw_rate=" + yaw_rate + - '}'; - } - } - - @Override - public String toString() { - return "CarStateInfo{" + - "action='" + action + '\'' + - ", values=" + values + - '}'; - } -} diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/dispatch/DispatchAutoPilotManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/dispatch/DispatchAutoPilotManager.java index 084de993db..2c85cce12b 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/dispatch/DispatchAutoPilotManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/dispatch/DispatchAutoPilotManager.java @@ -10,8 +10,8 @@ import android.os.Handler; import android.os.Message; import com.mogo.cloud.commons.utils.CoordinateUtils; -import com.mogo.eagle.core.data.autopilot.AutoPilotStationInfo; -import com.mogo.eagle.core.data.autopilot.AutoPilotControlParameters; +import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo; +import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters; import com.mogo.eagle.core.data.map.MogoLatLng; import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener; import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager; @@ -137,17 +137,17 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener wayLatLon = new ArrayList<>(); + List wayLatLon = new ArrayList<>(); if (receiverBean!=null && receiverBean.getStopsList()!= null){ for (MogoLatLng mogoLatLng : receiverBean.getStopsList()) { - wayLatLon.add(new AutoPilotControlParameters.AutoPilotLonLat(mogoLatLng.lat, mogoLatLng.lon)); + wayLatLon.add(new AutopilotControlParameters.AutoPilotLonLat(mogoLatLng.lat, mogoLatLng.lon)); } } currentAutopilot.wayLatLons = wayLatLon; - currentAutopilot.startLatLon = new AutoPilotControlParameters.AutoPilotLonLat(receiverBean.getStartLat(), receiverBean.getStartLon()); - currentAutopilot.endLatLon = new AutoPilotControlParameters.AutoPilotLonLat(receiverBean.getEndLat(), receiverBean.getEndLon()); + currentAutopilot.startLatLon = new AutopilotControlParameters.AutoPilotLonLat(receiverBean.getStartLat(), receiverBean.getStartLon()); + currentAutopilot.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(receiverBean.getEndLat(), receiverBean.getEndLon()); currentAutopilot.vehicleType = 10; Logger.d(TAG, "开启自动驾驶====" + currentAutopilot); mApis.getAdasControllerApi().aiCloudToAdasData(currentAutopilot); @@ -191,10 +191,10 @@ public class DispatchAutoPilotManager implements IMogoOnMessageListener vals = new ArrayList<>(); + List vals = new ArrayList<>(); while ((line = br.readLine()) != null) { String[] json = line.split(" - "); long time = Long.parseLong(json[0]); - ADASCarStateInfo si = GsonUtil.objectFromJson(json[1], ADASCarStateInfo.class); + AutopilotCarStateInfo si = GsonUtil.objectFromJson(json[1], AutopilotCarStateInfo.class); // si.getValues().setSatelliteTime( time + "" ); vals.add(si); } long interval = -1; - ADASCarStateInfo last = null; - for (ADASCarStateInfo val : vals) { + AutopilotCarStateInfo last = null; + for (AutopilotCarStateInfo val : vals) { if (last == null) { interval = 0; } else { @@ -523,10 +523,10 @@ public class MockIntentHandler implements IntentHandler { .onAutopilotArriveLike(intent.getIntExtra("type", 8)); break; case 44:// 控制自动驾驶 - AutoPilotControlParameters parameters = new AutoPilotControlParameters(); + AutopilotControlParameters parameters = new AutopilotControlParameters(); parameters.vehicleType = 9; - parameters.startLatLon = new AutoPilotControlParameters.AutoPilotLonLat(40.1690522746, 116.567374558); - parameters.endLatLon = new AutoPilotControlParameters.AutoPilotLonLat(40.1651999405, 116.567217441); + parameters.startLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.1690522746, 116.567374558); + parameters.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.1651999405, 116.567217441); MogoApisHandler.getInstance() .getApis() .getAdasControllerApi() @@ -664,7 +664,7 @@ public class MockIntentHandler implements IntentHandler { } - public void onAdasCarDataCallback(ADASCarStateInfo stateInfo) { + public void onAdasCarDataCallback(AutopilotCarStateInfo stateInfo) { if (stateInfo != null && stateInfo.getValues() != null) { JSONObject data = new JSONObject(); try { @@ -905,10 +905,10 @@ public class MockIntentHandler implements IntentHandler { } } - List allList = new ArrayList<>(); + List allList = new ArrayList<>(); for (BufferedReader reader : readers) { String line = reader.readLine(); - ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson(line, ADASRecognizedResult.class); + TrafficData adasRecognizedResult = GsonUtil.objectFromJson(line, TrafficData.class); if (adasRecognizedResult != null) { allList.add(adasRecognizedResult); } @@ -932,10 +932,10 @@ public class MockIntentHandler implements IntentHandler { } } - List allList = new ArrayList<>(); + List allList = new ArrayList<>(); for (BufferedReader reader : readers2) { String line = reader.readLine(); - ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson(line, ADASRecognizedResult.class); + TrafficData adasRecognizedResult = GsonUtil.objectFromJson(line, TrafficData.class); if (adasRecognizedResult != null) { allList.add(adasRecognizedResult); } diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoADASController.java b/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoADASController.java index 8676708622..6aff8eef3c 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoADASController.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoADASController.java @@ -1,9 +1,9 @@ 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.autopilot.AutopilotControlParameters; +import com.mogo.eagle.core.data.traffic.TrafficData; import com.mogo.map.uicontroller.EnumMapUI; -import com.mogo.service.adas.entity.ADASRecognizedResult; import java.util.List; @@ -57,7 +57,7 @@ public interface IMogoADASController extends IProvider { * * @param result */ - void aiCloudToAdasData(AutoPilotControlParameters result); + void aiCloudToAdasData(AutopilotControlParameters result); /** * 添加adas数据回调接口 @@ -183,6 +183,6 @@ public interface IMogoADASController extends IProvider { */ void cancelAutopilot(); - void mockAdasRecognized(List recognizedResults); + void mockAdasRecognized(List recognizedResults); } diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasCarDataCallback.java b/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasCarDataCallback.java index cfdf4d9b20..3f5f9a90d2 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasCarDataCallback.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasCarDataCallback.java @@ -1,6 +1,6 @@ package com.mogo.service.adas; -import com.mogo.service.adas.entity.ADASCarStateInfo; +import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo; /** * adas 自车位置数据回调 @@ -13,5 +13,5 @@ public interface IMogoAdasCarDataCallback { * * @param msg 具体数据 */ - void onAdasCarDataCallback( ADASCarStateInfo msg ); + void onAdasCarDataCallback( AutopilotCarStateInfo msg ); } diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasOCHCallback.java b/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasOCHCallback.java index a4f99fa1e7..0a16fc0848 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasOCHCallback.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasOCHCallback.java @@ -1,6 +1,6 @@ package com.mogo.service.adas; -import com.mogo.eagle.core.data.autopilot.AutoPilotStationInfo; +import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo; public /** @@ -29,7 +29,7 @@ interface IMogoAdasOCHCallback { * 到站 * @param data 所到车站的简单信息 */ - void onArriveAt( AutoPilotStationInfo data ); + void onArriveAt( AutopilotStationInfo data ); /** * 自动驾驶状态发生改变 diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasRecognizedDataCallback.java b/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasRecognizedDataCallback.java index b4154fd354..740b3c80cb 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasRecognizedDataCallback.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasRecognizedDataCallback.java @@ -1,7 +1,7 @@ package com.mogo.service.adas; -import com.mogo.service.adas.entity.ADASRecognizedResult; +import com.mogo.eagle.core.data.traffic.TrafficData; import java.util.List; @@ -16,5 +16,5 @@ public interface IMogoAdasRecognizedDataCallback { * * @param resultList 具体识别的物体数据 */ - void onAdasDataCallback(List resultList); + void onAdasDataCallback(List resultList); } \ No newline at end of file diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasWarnMessageCallback.java b/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasWarnMessageCallback.java index 2106b7ab11..b593381b48 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasWarnMessageCallback.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/adas/IMogoAdasWarnMessageCallback.java @@ -1,6 +1,6 @@ package com.mogo.service.adas; -import com.mogo.service.adas.entity.ADASWarnMessage; +import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage; /** * adas 数据回调接口 @@ -12,5 +12,5 @@ public interface IMogoAdasWarnMessageCallback { * adas 数据回调 * @param msg 具体数据 */ - void onReceiveData( ADASWarnMessage msg ); + void onReceiveData( AutopilotWarnMessage msg ); } \ No newline at end of file diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/ADASRecognizedResult.java b/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/ADASRecognizedResult.java deleted file mode 100644 index eceb47b2dc..0000000000 --- a/services/mogo-service-api/src/main/java/com/mogo/service/adas/entity/ADASRecognizedResult.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.mogo.service.adas.entity; - -/* - * adas 识别物体参数 - */ -public class ADASRecognizedResult { - - /** - * 识别物体类型 - */ - public int type; - - /** - * 识别物体唯一标识 - */ - public String uuid; - - /** - * 红绿灯颜色 - */ - public String color; - - /** - * 车ID - */ - public String carId; - - /** - * 识别物体的纬度 - */ - public double lat; - - /** - * 识别物体的经度 - */ - public double lon; - - /** - * 车头朝向 - */ - public double heading; - - /** - * 系统时间 - */ - public long systemTime; - - /** - * 定位卫星时间 - */ - public long satelliteTime; - - /** - * 海拔 - */ - public double alt; - - /** - * 速度 - */ - public double speed; - - /** - * 莫顿码 - */ - public long mortonCode; - - /** - * 实际距离 - * 使用distanceX和distanceY计算 - */ - public double distance; - - /** - * 数据来源精度 - * 0:普通定位 - * 1:高精定位 - */ - public int dataAccuracy; - - /** - * 道路ID - */ - public String roadId; - - /** - * 车道ID-2D路段 - */ - public String laneId; - - /** - * 车道号:中心线编号为0,中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3 - */ - public int laneNum; - - /** - * 限速 - */ - public double rateLimiting; - - /** - * 瓦片id - */ - public String tileId; - - /** - * 车道宽度 - */ - public double roadWidth; - - /** - * 1 绿, 2 黄, 3 红 - */ - public int drawlevel; -} diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/AdasObjectUtils.java b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/AdasObjectUtils.java deleted file mode 100644 index bb26ebf9e4..0000000000 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/AdasObjectUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.mogo.service.impl.adas; - -import android.util.Log; - -import com.alibaba.android.arouter.launcher.ARouter; -import com.mogo.commons.utils.MortonCode; -import com.mogo.map.uicontroller.IMogoMapUIController; -import com.mogo.service.IMogoServiceApis; -import com.mogo.service.adas.entity.ADASRecognizedResult; -import com.mogo.service.adas.entity.ADASWarnMessage; -import com.zhidao.support.adas.high.bean.RectInfo; -import com.zhidao.support.adas.high.bean.WarnMessageInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - - -/* - * @author congtaowang - * @since 2020/10/25 - * - * 对象转换类 - */ -public class AdasObjectUtils { - - public static ADASWarnMessage fromAdasObject(WarnMessageInfo info) { - if (info == null) { - return null; - } - ADASWarnMessage warnMessage = new ADASWarnMessage(); - warnMessage.content = info.getContent(); - warnMessage.level = info.getLevel(); - try { - warnMessage.type = Integer.parseInt(info.getType()); - } catch (NumberFormatException e) { - return null; - } - warnMessage.value = info.getValue(); - return warnMessage; - } - - public static List regroupData(List datums) { - if (datums == null || datums.isEmpty()) { - return null; - } - List recognizedListResults = new ArrayList<>(); - for (RectInfo.RectBean model : datums) { - if (model == null) { - continue; - } - ADASRecognizedResult recognizedListResult = fromAdasObject(model); - if (recognizedListResult != null) { - recognizedListResults.add(recognizedListResult); - } - } - return recognizedListResults; - } - - public static ADASRecognizedResult fromAdasObject(RectInfo.RectBean model) { - if (model == null) { - return null; - } - long start = System.nanoTime(); - ADASRecognizedResult result = new ADASRecognizedResult(); - result.uuid = model.getUuid(); - result.lat = model.getLat(); - result.lon = model.getLon(); - result.type = Integer.parseInt(model.getType()); - result.heading = model.getHeading(); - result.systemTime = Long.parseLong(model.getSystemTime()); - result.satelliteTime = Long.parseLong(model.getSatelliteTime()); - result.alt = model.getAlt(); - result.color = model.getColor(); - result.speed = model.getSpeed(); - result.carId = model.getCarId(); - result.dataAccuracy = model.dataAccuracy; - result.distance = model.distance; - result.drawlevel = model.getDrawlevel(); -// result.mortonCode = MortonCode.wrapEncodeMorton(result.lon, result.lat); - Log.d("ADAS数据延时","fromAdasObject cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start))); -// IMogoMapUIController mogoMapUIController = ARouter.getInstance().navigation(IMogoServiceApis.class).getMapServiceApi().getMapUIController(); -// if (mogoMapUIController != null) { -// long start = System.currentTimeMillis(); -// result.tileId = String.valueOf(mogoMapUIController.getTileId(result.lon, result.lat)); -// Log.d("ADAS数据延时", "getTileId 耗时 : " + (System.currentTimeMillis() - start) + "ms"); -// } - return result; - } -} diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java index 79e6546233..d9252806d5 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java @@ -5,18 +5,22 @@ import android.content.Context; import android.content.Intent; import android.os.Handler; import android.os.Message; -import android.text.TextUtils; import android.util.Log; import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.debug.DebugConfig; -import com.mogo.eagle.core.data.autopilot.AutoPilotControlCmdParameter; -import com.mogo.eagle.core.data.autopilot.AutoPilotControlParameters; -import com.mogo.eagle.core.data.autopilot.AutoPilotStationInfo; +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; @@ -28,9 +32,6 @@ import com.mogo.service.adas.IMogoAdasOCHCallback; import com.mogo.service.adas.IMogoAdasRecognizedDataCallback; import com.mogo.service.adas.IMogoAdasRouteCallBack; import com.mogo.service.adas.IMogoAdasWarnMessageCallback; -import com.mogo.service.adas.entity.ADASCarStateInfo; -import com.mogo.service.adas.entity.ADASRecognizedResult; -import com.mogo.service.adas.entity.ADASWarnMessage; import com.mogo.service.impl.singleton.SingletonsHolder; import com.mogo.service.statusmanager.IMogoStatusManager; import com.mogo.utils.UiThreadHandler; @@ -41,11 +42,6 @@ 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.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.WarnMessageInfo; import org.json.JSONObject; @@ -71,8 +67,6 @@ public class MogoADASController implements IMogoADASController { private final IMogoStatusManager mStatusManager = SingletonsHolder.get(IMogoStatusManager.class); - private boolean mIsReleased = true; - private AdasProvider adasProvider; /** @@ -131,7 +125,7 @@ public class MogoADASController implements IMogoADASController { public void handleMessage(Message msg) { super.handleMessage(msg); if (msg.obj instanceof List) { - handleAdasRecognizedData((List) msg.obj); + handleAdasRecognizedData((List) msg.obj); } else if (msg.obj == null) { handleAdasRecognizedData(null); } @@ -147,7 +141,7 @@ public class MogoADASController implements IMogoADASController { super.handleMessage(msg); final long start = System.currentTimeMillis(); - ADASCarStateInfo stateInfo = GsonUtil.objectFromJson(((String) msg.obj), ADASCarStateInfo.class); + AutopilotCarStateInfo stateInfo = GsonUtil.objectFromJson(((String) msg.obj), AutopilotCarStateInfo.class); if (stateInfo == null || stateInfo.getValues() == null) { // Logger.d(TAG, "ADAS-LOC-timer", "upd 到 aidl 传输数据 stateInfo or stateInfo.getValues() is null"); return; @@ -174,7 +168,7 @@ public class MogoADASController implements IMogoADASController { * * @param models */ - private void handleAdasRecognizedData(List models) { + private void handleAdasRecognizedData(List models) { if (models == null || models.isEmpty()) { invokeCallbackPerSecond(null); @@ -183,14 +177,13 @@ public class MogoADASController implements IMogoADASController { invokeCallbackPerSecond(models); } - private void invokeCallbackPerSecond(List models) { - List recognizedListResults = AdasObjectUtils.regroupData(models); + private void invokeCallbackPerSecond(List models) { if (!mMogoAdasRecognizedDataCallbacks.isEmpty()) { for (IMogoAdasRecognizedDataCallback callback : mMogoAdasRecognizedDataCallbacks) { if (callback == null) { continue; } - callback.onAdasDataCallback(recognizedListResults); + callback.onAdasDataCallback(models); } } } @@ -243,7 +236,7 @@ public class MogoADASController implements IMogoADASController { } @Override - public void onRectData(RectInfo rectInfo) { + public void onRectData(List trafficData) { // 仅在 vr 模式下显示 adas 识别车辆 if (!SingletonsHolder.get(IMogoStatusManager.class).isVrMode()) { return; @@ -251,50 +244,43 @@ public class MogoADASController implements IMogoADASController { if (!SingletonsHolder.get(IMogoStatusManager.class).isMainPageLaunched()) { return; } - if (rectInfo == null || TextUtils.isEmpty(rectInfo.getAction())) { + if (trafficData == null) { Logger.w(TAG, "--->action is null"); return; } final long start = System.nanoTime(); - if (rectInfo.getModels() != null && !rectInfo.getModels().isEmpty()) { - List beans = rectInfo.getModels(); - try { - Message message = mAdasRecognizedRecHandler.obtainMessage(); - message.obj = beans; - message.sendToTarget(); - Log.i("ADAS数据延时", "接收数据 -> 发出 cost :" + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms"); - } catch (Exception e) { - e.printStackTrace(); - } + try { + Message message = mAdasRecognizedRecHandler.obtainMessage(); + message.obj = trafficData; + message.sendToTarget(); + Log.i("ADAS数据延时", "接收数据 -> 发出 cost :" + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms"); + } catch (Exception e) { + e.printStackTrace(); } DebugConfig.setStatus(DebugConfig.sAdasRecognized, true); } @Override - public void onWarnMessage(WarnMessageInfo warnMessageInfo) { - if (warnMessageInfo == null) { + public void onWarnMessage(AutopilotWarnMessage autopilotWarnMessage) { + if (autopilotWarnMessage == null) { return; } // 警告消息 - Logger.d(TAG, "onWarnMessage = %s", warnMessageInfo.toString()); + Logger.d(TAG, "onWarnMessage = %s", autopilotWarnMessage.toString()); if (mMogoAdasWarnMessageCallbackList.isEmpty()) { return; } - final ADASWarnMessage warnMessage = AdasObjectUtils.fromAdasObject(warnMessageInfo); - if (warnMessage == null) { - return; - } UiThreadHandler.post(() -> { for (IMogoAdasWarnMessageCallback callback : mMogoAdasWarnMessageCallbackList) { if (callback != null) { - callback.onReceiveData(warnMessage); + callback.onReceiveData(autopilotWarnMessage); } } }); } @Override - public void autopilotArrive(AdasAIDLAutopilotArriveModel autopilotArriveModel) { + public void autopilotArrive(AutopilotStationInfo autopilotArriveModel) { Logger.d(TAG, "autopilotArriveModel " + autopilotArriveModel); if (autopilotArriveModel == null) { Logger.d(TAG, "autopilotArrive autopilotArriveModel is null"); @@ -303,8 +289,8 @@ public class MogoADASController implements IMogoADASController { Logger.d(TAG, "autopilotArrive : " + autopilotArriveModel.toString()); if (!mAdasOCHCallback.isEmpty()) { for (IMogoAdasOCHCallback cb : mAdasOCHCallback) { - cb.onArriveAt(new AutoPilotStationInfo( - autopilotArriveModel.getCarType(), + cb.onArriveAt(new AutopilotStationInfo( + autopilotArriveModel.getType(), autopilotArriveModel.getLon(), autopilotArriveModel.getLat()) ); @@ -313,12 +299,12 @@ public class MogoADASController implements IMogoADASController { } @Override - public void autopilotRoute(AutopilotRoute autopilotRoute) { + public void autopilotRoute(AutopilotRouteInfo autopilotRoute) { if (autopilotRoute.getModels() == null || autopilotRoute.getModels().size() == 0) { return; } List latLngList = new ArrayList<>(); - for (AutopilotRoute.RouteModels routeModel : autopilotRoute.getModels()) { + for (AutopilotRouteInfo.RouteModels routeModel : autopilotRoute.getModels()) { latLngList.add(new MogoLatLng(routeModel.getLat(), routeModel.getLon())); } for (IMogoAdasRouteCallBack callback : mMogoAdasRouteCallBacks) { @@ -338,13 +324,13 @@ public class MogoADASController implements IMogoADASController { } @Override - public void notifyAutopilotState(AutopilotStatus autopilotStatus) { + public void notifyAutopilotState(AutopilotStatusInfo autopilotStatus) { Logger.d(TAG, "notifyAutopilotState: " + GsonUtil.jsonFromObject(autopilotStatus)); - DebugConfig.setAutoPilotStatus(autopilotStatus.getValues().getState() + ""); + DebugConfig.setAutoPilotStatus(autopilotStatus.getState() + ""); if (!mAdasOCHCallback.isEmpty()) { for (IMogoAdasOCHCallback cb : mAdasOCHCallback) { - cb.onStateChanged(autopilotStatus.getValues().getState(), autopilotStatus.getValues().getReason()); + cb.onStateChanged(autopilotStatus.getState(), autopilotStatus.getReason()); } } } @@ -422,7 +408,6 @@ public class MogoADASController implements IMogoADASController { @Override public void init(Context context) { - mIsReleased = false; adasProvider = ARouter.getInstance().navigation(AdasProvider.class); } @@ -464,7 +449,7 @@ public class MogoADASController implements IMogoADASController { } @Override - public void aiCloudToAdasData(AutoPilotControlParameters result) { + public void aiCloudToAdasData(AutopilotControlParameters result) { try { syncControlCmdToADAS("aiCloudToStartAutopilot", result); } catch (Exception e) { @@ -477,7 +462,7 @@ public class MogoADASController implements IMogoADASController { * @param result */ private void syncControlCmdToADAS(String action, Object result) { - AutoPilotControlCmdParameter parameter = new AutoPilotControlCmdParameter(action, result); + AutopilotControlCmdParameter parameter = new AutopilotControlCmdParameter(action, result); //位置信息 action是aiCloudToStartAutopilot try { adasProvider.sendWsMessage(GsonUtil.jsonFromObject(parameter)); @@ -488,7 +473,6 @@ public class MogoADASController implements IMogoADASController { @Override public void release() { - mIsReleased = true; adasProvider.removeAdasEventListener(mAdasDataListener); adasProvider.removeAdasStatusListener(); AutopilotServiceManage.getInstance().release(); @@ -593,7 +577,7 @@ public class MogoADASController implements IMogoADASController { public void onAutopilotArriveLike(int carType) { if (!mAdasOCHCallback.isEmpty()) { for (IMogoAdasOCHCallback cb : mAdasOCHCallback) { - cb.onArriveAt(new AutoPilotStationInfo( + cb.onArriveAt(new AutopilotStationInfo( carType, 116.09888888, 39.999999) @@ -623,7 +607,7 @@ public class MogoADASController implements IMogoADASController { if (state == -1) { if (!mAdasOCHCallback.isEmpty()) { for (IMogoAdasOCHCallback cb : mAdasOCHCallback) { - cb.onArriveAt(new AutoPilotStationInfo(1, 1d, 1d)); + cb.onArriveAt(new AutopilotStationInfo(1, 1d, 1d)); } } } else { @@ -642,7 +626,7 @@ public class MogoADASController implements IMogoADASController { } @Override - public void mockAdasRecognized(List recognizedResults) { + public void mockAdasRecognized(List recognizedResults) { if (!mMogoAdasRecognizedDataCallbacks.isEmpty()) { for (IMogoAdasRecognizedDataCallback callback : mMogoAdasRecognizedDataCallbacks) { if (callback == null) { diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/OnAdasListenerAdapter.java b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/OnAdasListenerAdapter.java deleted file mode 100644 index 9c968e8a39..0000000000 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/OnAdasListenerAdapter.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.mogo.service.impl.adas; - -import com.zhidao.support.adas.high.OnAdasListener; -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.WarnMessageInfo; - -public -/** - * @author congtaowang - * @since 2020/10/22 - * - * 适配ADAS 回调监听分发 - */ -abstract class OnAdasListenerAdapter implements OnAdasListener { - - @Override - public void onWarnMessage(WarnMessageInfo warnMessageInfo) { - - } - - @Override - public void onVideoSize(int width, int height) { - - } - - @Override - public void onRectData(RectInfo rectInfo) { - - } - - @Override - public void onCarStateData(CarStateInfo carStateInfo) { - - } - - @Override - public void onLightStateData(LightStatueInfo lightStatueInfo) { - - } - - @Override - public void onObstaclesInfo(ObstaclesInfo obstaclesInfo) { - - } - - @Override - public void onCarLaneInfo(CarLaneInfo carLaneInfo) { - - } - - @Override - public void autopilotStatus(AutopilotStatus autopilotStatus) { - - } - - @Override - public void autopilotArrive(AutopilotWayArrive autopilotWayArrive) { - - } -}