完成新架构的域控制器的监听及数据改造

Signed-off-by: 董宏宇 <martindhy@gmail.com>
This commit is contained in:
董宏宇
2021-10-18 19:35:58 +08:00
parent f7c3686ddb
commit 3bb1f8aa84
12 changed files with 79 additions and 349 deletions

View File

@@ -2,10 +2,10 @@ 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.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.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
@@ -13,9 +13,11 @@ import com.zhidao.support.adas.high.AdasManager
/**
* @author xiaoyuzhou
* @date 2021/9/22 8:43 下午
* 域控制器
*/
@Route(path = MogoServicePaths.PATH_AUTO_PILOT)
class MoGoAutoPilotProvider : IMoGoAutoPilotProvider {
class MoGoAutopilotProvider :
IMoGoAutopilotProvider {
private val TAG = "MoGoAutoPilotProvider"
override val functionName: String
@@ -24,7 +26,7 @@ class MoGoAutoPilotProvider : IMoGoAutoPilotProvider {
override fun init(context: Context) {
// 初始化ADAS 域控制器
AdasManager.getInstance().create(context)
//AdasManager.getInstance().create(context)
}
@@ -35,10 +37,10 @@ class MoGoAutoPilotProvider : IMoGoAutoPilotProvider {
}
override fun startAutoPilot(result: AutoPilotControlParameters) {
override fun startAutoPilot(result: AutopilotControlParameters) {
if (AdasManager.getInstance().isSocketConnect) {
val parameter =
AutoPilotControlCmdParameter(
AutopilotControlCmdParameter(
TAG,
result
)

View File

@@ -1,76 +0,0 @@
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()
}
}

View File

@@ -1,19 +1,28 @@
package com.mogo.eagle.core.data.autopilot;
public
/**
* @author congtaowang
* @since 2020/10/22
*
* 域控制器 控制指令发送
*
*/
class AutoPilotControlCmdParameter {
public class AutopilotControlCmdParameter {
public String action;
public Object result;
public AutoPilotControlCmdParameter(String action, Object result ) {
public AutopilotControlCmdParameter(String action, Object result) {
this.action = action;
this.result = result;
}
@Override
public String toString() {
return "AutoPilotControlCmdParameter{" +
"action='" + action + '\'' +
", result=" + result +
'}';
}
}

View File

@@ -7,8 +7,9 @@ import java.util.List;
* @since 2021/09/22
* <p>
* 启动自动驾驶参数
*
*/
public class AutoPilotControlParameters {
public class AutopilotControlParameters {
public AutoPilotLonLat startLatLon;
public List<AutoPilotLonLat> wayLatLons;

View File

@@ -1,21 +1,54 @@
package com.mogo.eagle.core.data.autopilot;
public
/**
* @author congtaowang
* @since 2021/1/18
*
* <p>
* 自动驾驶网约车回调数据
*
*/
class AutoPilotStationInfo {
public class AutopilotStationInfo {
public int type;
public double lon;
public double lat;
private int type;
private double lon;
private double lat;
public AutoPilotStationInfo(int type, double lon, 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 +
'}';
}
}

View File

@@ -1,12 +1,15 @@
package com.mogo.eagle.core.data.autopilot
import java.io.Serializable
/**
* @author xiaoyuzhou
* @date 2021/10/12 8:16 下午
* 域控制器状态信息
* 不建议自己初始化此对象,建议使用 CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
*
*/
class AutoPilotStatusInfo {
class AutopilotStatusInfo : Serializable {
/**
* 当前链接的IP地址, 默认地址 192.168.1.102
*/
@@ -29,17 +32,12 @@ class AutoPilotStatusInfo {
/**
* 自动驾驶状态 0是不可用 1是ready 2是自动驾驶start
*/
var autopilotStatus = 0
/**
* 自动驾驶状态 0非自动驾驶1自动驾驶
*/
var autoDriveStatus = 0
var state = 0
/**
* 不可用原因
*/
var errorReason: String = ""
var reason: String = ""
/**
* 摄像头状态 1代表开启0代表关闭
@@ -55,4 +53,10 @@ class AutoPilotStatusInfo {
* RTK状态 1代表开启0代表关闭
*/
var rtk = 0
/**
* 自动驾驶状态 0非自动驾驶1自动驾驶
*/
var pilotmode = 0
}

View File

@@ -1,28 +0,0 @@
package com.mogo.eagle.core.data.autopilot;
/**
* @author congtaowang
* @since 2020/10/22
*
* 域控制器 控制指令发送
*
*/
public 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 +
'}';
}
}

View File

@@ -1,55 +0,0 @@
package com.mogo.eagle.core.data.autopilot;
import java.util.List;
/**
* @author donghongyu
* @since 2021/09/22
* <p>
* 启动自动驾驶参数
*
*/
public class AutopilotControlParameters {
public AutoPilotLonLat startLatLon;
public List<AutoPilotLonLat> 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 +
'}';
}
}

View File

@@ -1,54 +0,0 @@
package com.mogo.eagle.core.data.autopilot;
/**
* @author congtaowang
* @since 2021/1/18
* <p>
* 自动驾驶网约车回调数据
*
*/
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 +
'}';
}
}

View File

@@ -1,62 +0,0 @@
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
}

View File

@@ -1,14 +1,15 @@
package com.mogo.eagle.core.function.api.autopilot;
import com.mogo.eagle.core.data.autopilot.AutoPilotControlParameters;
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 {
public interface IMoGoAutopilotProvider extends IMoGoFunctionServerProvider {
/**
* 连接自动驾驶域控制器
@@ -20,7 +21,7 @@ public interface IMoGoAutoPilotProvider extends IMoGoFunctionServerProvider {
*
* @param result
*/
void startAutoPilot(AutoPilotControlParameters result);
void startAutoPilot(AutopilotControlParameters result);
/**
* 结束自动驾驶

View File

@@ -1,45 +0,0 @@
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();
}