[8.4.0][司机屏] 无人化,任务管理相关逻辑

This commit is contained in:
xinfengkun
2026-03-05 14:14:25 +08:00
parent 42d72654bd
commit 13c8808659
49 changed files with 2506 additions and 429 deletions

View File

@@ -15,6 +15,7 @@ import com.mogo.och.bridge.autopilot.autopilot.bean.SessionWithTime
import com.mogo.och.bridge.autopilot.line.LineManager
import com.mogo.och.bridge.distance.TrajectoryAndDistanceManager
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.Trajectory
import java.util.concurrent.atomic.AtomicReference
object OchAutoPilotManager {
@@ -104,10 +105,27 @@ object OchAutoPilotManager {
val sessionId = CallerAutoPilotControlManager.startAutoPilot(controlParameters)
globalSessionId.set(SessionWithTime(sessionId,System.currentTimeMillis(),-1L))
OchAutoPilotStatusListenerManager.fsmBackSessionId.set(-1L)
OchAutopilotAnalytics.triggerStartAutopilotParameters(controlParameters, sessionId)
OchAutopilotAnalytics.triggerStartAutopilotParameters(null, controlParameters, sessionId)
return sessionId
}
@JvmStatic
fun unmannedStartAutoPilot(taskId: Long, traj: Trajectory, parameters: AutopilotControlParameters): Long {
val sessionId = CallerAutoPilotControlManager.unmannedStartAutoPilot(taskId, traj, parameters)
globalSessionId.set(SessionWithTime(sessionId, System.currentTimeMillis(), -1L))
OchAutoPilotStatusListenerManager.fsmBackSessionId.set(-1L)
OchAutopilotAnalytics.triggerStartAutopilotParameters(traj, parameters, sessionId)
return sessionId
}
//TODO 任务管理继续
// @JvmStatic
// fun unmannedAutoPilotContinue(taskId: Long, traj: Trajectory, parameters: AutopilotControlParameters): Long {
// val sessionId = CallerAutoPilotControlManager.unmannedAutoPilotContinue(taskId, traj, parameters)
// globalSessionId.set(SessionWithTime(sessionId, System.currentTimeMillis(), -1L))
// OchAutoPilotStatusListenerManager.fsmBackSessionId.set(-1L)
// OchAutopilotAnalytics.triggerStartAutopilotParameters(traj, parameters, sessionId)
// return sessionId
// }
/**
* 启动自驾失败切 FSM返回的Session和启动SessionId 不同
*/

View File

@@ -18,6 +18,7 @@ import com.mogo.och.bridge.autopilot.line.LineManager
import com.mogo.och.common.module.exception.InitException
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.utils.RxUtils
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.Trajectory
import io.reactivex.disposables.Disposable
object OchAutopilotAnalytics {
@@ -44,9 +45,11 @@ object OchAutopilotAnalytics {
private const val EVENT_PARAM_START_FAILURE_CODE = "start_autopilot_failure_code" // 启动自驾失败code
private const val EVENT_PARAM_START_FAILURE_MSG = "start_autopilot_failure_msg" // 启动自驾失败原因
private const val EVENT_PARAM_START_AUTOPILOT_SESSION_ID = "start_autopilot_cmd_session_id" //启动自驾命令请求的sessionId
private const val EVENT_PARAM_START_AUTOPILOT_UNMANNED = "start_autopilot_cmd_unmanned" //启动自驾命令请求是否是无人化操作的
private const val EVENT_KEY_START_AUTOPILOT_PARAMETERS = "event_key_och_start_autopilot_parameters"
private const val EVENT_PARAM_START_AUTOPILOT_PARAMETERS= "start_autopilot_parameters" // 启动自驾参数
private const val EVENT_PARAM_START_AUTOPILOT_UNMANNED_PARAMETERS= "start_autopilot_unmanned_parameters" // 启动自驾参数
private const val EVENT_KEY_START_AUTOPILOT_ACK = "event_key_och_start_autopilot_ack"
private const val EVENT_PARAM_START_AUTOPILOT_ACK= "start_autopilot_parameters_ack" // 启动自驾参数
@@ -72,15 +75,19 @@ object OchAutopilotAnalytics {
/**
* 正式启动自驾把参数传给底层
*/
fun triggerStartAutopilotParameters(controlParameters: AutopilotControlParameters?, sessionId: Long){
fun triggerStartAutopilotParameters(traj: Trajectory?, controlParameters: AutopilotControlParameters?, sessionId: Long) {
val params = HashMap<String, Any>()
params[EVENT_PARAM_ENV_ONLINE] = DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE
params[EVENT_PARAM_START_AUTOPILOT_SESSION_ID] = sessionId
params[EVENT_PARAM_START_AUTOPILOT_UNMANNED] = traj != null
if (traj != null) {
params[EVENT_PARAM_START_AUTOPILOT_UNMANNED_PARAMETERS] = traj.toString()
}
params[EVENT_PARAM_START_AUTOPILOT_PARAMETERS] = "${controlParameters.toString()}_${controlParameters?.autoPilotLine}_routeID:${controlParameters?.routeID}_routeName:${controlParameters?.routeName}"
params[EVENT_PARAM_AUTOPILOTANALYTICS_GROUP] = EVENT_PARAM_AUTOPILOTANALYTICS_GROUP
OchChainLogManager.addCommonParams(params)
MogoAnalyticUtils.track(EVENT_KEY_START_AUTOPILOT_PARAMETERS, params)
OchChainLogManager.writeChainLogAutopilot("正式启动自驾把参数传给底层",params.toString(),false)
OchChainLogManager.writeChainLogAutopilot("正式启动自驾把参数传给底层", params.toString(), false)
}
/**
@@ -250,7 +257,7 @@ object OchAutopilotAnalytics {
/**
* 触发更新 启动自驾命令 发送的sessionId
*/
fun triggerUpdateStartAutoPilotSessionId(sessionId: Long) {
fun triggerUpdateStartAutoPilotSessionId(sessionId: Long, isUnmanned: Boolean = false) {
if (TextUtils.isEmpty(mStartAutopilotKey)) {
CallerLogger.e(SceneConstant.M_OCHCOMMON + "triggerUpdateStartAutoPilotSessionId but mStartAutopilotKey is null [sessionId = $sessionId] ")
return
@@ -260,6 +267,7 @@ object OchAutopilotAnalytics {
return
}
mStartAutopilotParams[EVENT_PARAM_START_AUTOPILOT_SESSION_ID] = sessionId
mStartAutopilotParams[EVENT_PARAM_START_AUTOPILOT_UNMANNED] = isUnmanned
}
/**

View File

@@ -25,20 +25,26 @@ import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.eagle.core.utilcode.util.StringUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.bridge.R
import com.mogo.och.common.module.constant.OchCommonConst
import com.mogo.och.bridge.autopilot.OCHAdasAbilityManager
import com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotManager
import com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotManager.startAutoPilot
import com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotManager.unmannedStartAutoPilot
import com.mogo.och.bridge.autopilot.autopilot.OchAutopilotAnalytics
import com.mogo.och.bridge.autopilot.location.OchLocationManager
import com.mogo.och.bridge.distance.TrajectoryAndDistanceManager
import com.mogo.och.common.module.biz.media.VoiceNotice
import com.mogo.och.common.module.constant.OchCommonConst
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.utils.CallerBase
import com.mogo.och.common.module.biz.media.VoiceNotice
import com.mogo.och.data.bean.BusStationBean
import com.mogo.och.data.bean.ContraiInfo
import com.mogo.och.data.bean.LineInfo
import com.zhjt.mogo.adas.data.bean.ReceivedAck
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.AutopilotPoint
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.Trajectory
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.VehicleSite
import com.zhjt.mogo.adas.unmanned.task.enums.AutopilotCoordinateTypeEnum
import com.zhjt.mogo.adas.unmanned.task.enums.StationEnum
import kotlin.properties.Delegates
/**
@@ -126,13 +132,13 @@ object LineManager : CallerBase<ILineCallback>() {
it.value.onAutopilotIdChange(oldValue, newValue)
}
if (!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) &&
!AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode) &&
!AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)
!AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode) &&
!AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)
) {
val (start, end) = getStations()
if (start != null && end != null) {
val ochInfo =
OchInfo(0, mutableListOf(start.toMogoLocation(), end.toMogoLocation()))
OchInfo(0, mutableListOf(start.toMogoLocation(), end.toMogoLocation()))
CallerDataCenterBizListener.invokeOchInfo(ochInfo)
OchChainLogManager.writeChainLogMap("向地图传参数", "参数信息:${ochInfo}")
d(TAG, "向地图传参数_参数信息:${ochInfo}")
@@ -169,8 +175,8 @@ object LineManager : CallerBase<ILineCallback>() {
val startLon = end.gcjLon
val startLat = end.gcjLat
val distance = CoordinateUtils.calculateLineDistance(
startLon, startLat,
mogoLocation.longitude, mogoLocation.latitude
startLon, startLat,
mogoLocation.longitude, mogoLocation.latitude
)
if (distance <= OchCommonConst.ARRIVE_AT_END_STATION_DISTANCE) {
/**
@@ -178,10 +184,10 @@ object LineManager : CallerBase<ILineCallback>() {
* [com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager.onAutoPilotStation]
*/
val token =
CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotStation(teleOrderId)
CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotStation(teleOrderId)
OchChainLogManager.writeChainLogAutopilot(
"到站逻辑",
"距离站点:$distance 请求token$token"
"到站逻辑",
"距离站点:$distance 请求token$token"
)
d(TAG, "到站逻辑_距离站点$distance 请求token$token")
}
@@ -231,8 +237,8 @@ object LineManager : CallerBase<ILineCallback>() {
setAutopilotControlParameters()
}
OchChainLogManager.writeChainLogAutopilot(
"自驾参数",
"站点信息:${startStation}---${endStation}"
"自驾参数",
"站点信息:${startStation}---${endStation}"
)
d(TAG, "自驾参数 设置站点_站点信息:${startStation}---${endStation}")
}
@@ -352,9 +358,9 @@ object LineManager : CallerBase<ILineCallback>() {
endStationLocation.latitude = end.gcjLat
endStationLocation.longitude = end.gcjLon
TrajectoryAndDistanceManager.setStationPoint(
startStationLocation,
endStationLocation,
lineInfo.lineId
startStationLocation,
endStationLocation,
lineInfo.lineId
)
OchLocationManager.addGCJ02Listener(TAG, 1, mMapLocationListener)
// 恢复启动自驾信息
@@ -405,7 +411,7 @@ object LineManager : CallerBase<ILineCallback>() {
var parameters: AutopilotControlParameters? = null
getStationsWithLine { start, end, lineInfo ->
this.autopilotId =
"${lineInfo.lineId}_${start.siteId}_${end.siteId}_${lineInfo.orderId}"
"${lineInfo.lineId}_${start.siteId}_${end.siteId}_${lineInfo.orderId}"
this.teleOrderId = lineInfo.genAutopilotId()
}
getStationsWithLineAndContrai { start, end, lineInfo, contrai ->
@@ -414,8 +420,8 @@ object LineManager : CallerBase<ILineCallback>() {
parameters?.routeName = lineInfo.lineName
parameters?.startName = start.name ?: ""
parameters?.endName = end.name ?: ""
parameters?.startLatLon = AutoPilotLonLat(start.lat, start.lon,true)
parameters?.endLatLon = AutoPilotLonLat(end.lat, end.lon,true)
parameters?.startLatLon = AutoPilotLonLat(start.lat, start.lon, true)
parameters?.endLatLon = AutoPilotLonLat(end.lat, end.lon, true)
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
parameters?.vehicleType = 9
} else {
@@ -427,24 +433,24 @@ object LineManager : CallerBase<ILineCallback>() {
if (parameters?.autoPilotLine == null) {
parameters?.autoPilotLine = AutoPilotLine(
lineInfo.lineId,
lineInfo.lineName,
contrai.csvFileUrl,
contrai.csvFileMd5,
contrai.txtFileUrl,
contrai.txtFileMd5,
contrai.contrailSaveTime,
"",
"",
"",
"",
"",
0L
lineInfo.lineId,
lineInfo.lineName,
contrai.csvFileUrl,
contrai.csvFileMd5,
contrai.txtFileUrl,
contrai.txtFileMd5,
contrai.contrailSaveTime,
"",
"",
"",
"",
"",
0L
)
}
if (endStation?.passPoints?.isNotEmpty() == true ||
endStation?.blackPoints?.isNotEmpty() == true
endStation?.blackPoints?.isNotEmpty() == true
) {
val (wayLatLons, blackLatLons) = endStation!!.getWayBlackLatLons()
parameters?.wayLatLons = wayLatLons
@@ -474,12 +480,12 @@ object LineManager : CallerBase<ILineCallback>() {
parameters = AutopilotControlParameters()
parameters.routeID = lineInfos?.lineId?.toInt()?:0
parameters.routeName = lineInfos?.lineName?:""
parameters.routeID = lineInfos?.lineId?.toInt() ?: 0
parameters.routeName = lineInfos?.lineName ?: ""
lineInfos?.siteInfos?.let {
if(it.size>=0){
parameters.startLatLon = AutoPilotLonLat(it.first().lat, it.first().lon,true)
parameters.endLatLon = AutoPilotLonLat(it.last().lat, it.last().lon,true)
if (it.size >= 0) {
parameters.startLatLon = AutoPilotLonLat(it.first().lat, it.first().lon, true)
parameters.endLatLon = AutoPilotLonLat(it.last().lat, it.last().lon, true)
parameters.startName = it.first().name ?: ""
parameters.endName = it.last().name ?: ""
}
@@ -495,30 +501,30 @@ object LineManager : CallerBase<ILineCallback>() {
if (parameters.autoPilotLine == null) {
parameters.autoPilotLine = AutoPilotLine(
lineInfos?.lineId?:0L,
lineInfos?.lineName?:"",
contraiInfo?.csvFileUrl?:"",
contraiInfo?.csvFileMd5?:"",
contraiInfo?.txtFileUrl?:"",
contraiInfo?.txtFileMd5?:"",
contraiInfo?.contrailSaveTime?:System.currentTimeMillis(),
"",
"",
"",
"",
"",
0L
lineInfos?.lineId ?: 0L,
lineInfos?.lineName ?: "",
contraiInfo?.csvFileUrl ?: "",
contraiInfo?.csvFileMd5 ?: "",
contraiInfo?.txtFileUrl ?: "",
contraiInfo?.txtFileMd5 ?: "",
contraiInfo?.contrailSaveTime ?: System.currentTimeMillis(),
"",
"",
"",
"",
"",
0L
)
}
val wayLatLons = mutableListOf<AutoPilotLonLat>()
val blackLatLons = mutableListOf<AutoPilotLonLat>()
lineInfos?.siteInfos?.forEachIndexed { index, site ->
if(index>0){
if (index > 0) {
val (wayLatLonsSite, blackLatLonsSite) = site.getWayBlackLatLons()
wayLatLons.addAll(wayLatLonsSite)
blackLatLons.addAll(blackLatLonsSite)
if(index!=lineInfos!!.siteInfos.size-1) {
if (index != lineInfos!!.siteInfos.size - 1) {
wayLatLons.add(AutoPilotLonLat(site.lat, site.lon, true))
}
}
@@ -568,15 +574,15 @@ object LineManager : CallerBase<ILineCallback>() {
return
} else {
if (FunctionBuildConfig.isPassStartAutopilotCommand
&& TextUtils.isEmpty(_contraiInfo!!.csvFileUrl)
&& TextUtils.isEmpty(_contraiInfo!!.csvFileMd5)
&& TextUtils.isEmpty(_contraiInfo!!.csvFileUrl)
&& TextUtils.isEmpty(_contraiInfo!!.csvFileMd5)
) {
// ToastUtils.showLong("无发布轨迹, 请发布后重试")
// ToastUtils.showLong(R.string.module_taxi_no_publication_trajectory)
e(
TAG, "isPassStartAutopilotCommand = " +
FunctionBuildConfig.isPassStartAutopilotCommand
+ "busRoutesResult.csvFileUrl = " + _contraiInfo!!.csvFileUrl
TAG, "isPassStartAutopilotCommand = " +
FunctionBuildConfig.isPassStartAutopilotCommand
+ "busRoutesResult.csvFileUrl = " + _contraiInfo!!.csvFileUrl
)
return
}
@@ -600,7 +606,7 @@ object LineManager : CallerBase<ILineCallback>() {
return
}
triggerStartServiceEvent(false, 0, "" ,isSlideAutoStart)
triggerStartServiceEvent(false, 0, "", isSlideAutoStart)
val parameters = initAutopilotControlParameters()
if (null == parameters) {
@@ -612,10 +618,10 @@ object LineManager : CallerBase<ILineCallback>() {
OchAutopilotAnalytics.triggerUpdateStartAutoPilotSessionId(sessionId)
d(
TAG,
"行程日志-开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
+ " startLatLon=" + parameters.startName + "endLatLon=" + parameters.endName +
"isRestart = " + isFirstStartAutopilot
TAG,
"行程日志-开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
+ " startLatLon=" + parameters.startName + "endLatLon=" + parameters.endName +
"isRestart = " + isFirstStartAutopilot
)
M_LISTENERS.forEach {
@@ -623,11 +629,183 @@ object LineManager : CallerBase<ILineCallback>() {
}
}
fun unmannedStartAutopilot(taskId: Long, isSlideAutoStart: Boolean = false) {
if (startStation == null || endStation == null) {
// ToastUtils.showShort("未设置起始或终点站点")
ToastUtils.showShort(R.string.module_och_not_stat_and_end_point)
return
}
startStation?.let {
if (!it.isLeaving) {
// ToastUtils.showShort("请滑动出发后再启动自驾")
ToastUtils.showShort(R.string.module_och_please_slide_hint)
return
}
}
/**
* 存在Session
*/
if (!OchAutoPilotManager.canStartAutopilotBySessionId()) {
return
}
OchAutopilotAnalytics.triggerClickStartAutopilotTime(System.currentTimeMillis())
//1、判断轨迹url是否可用
if (_contraiInfo == null) {
// ToastUtils.showLong("无发布轨迹, 请发布后重试")
ToastUtils.showLong(R.string.module_taxi_no_publication_trajectory)
return
} else {
if (FunctionBuildConfig.isPassStartAutopilotCommand
&& TextUtils.isEmpty(_contraiInfo!!.csvFileUrl)
&& TextUtils.isEmpty(_contraiInfo!!.csvFileMd5)
) {
// ToastUtils.showLong("无发布轨迹, 请发布后重试")
ToastUtils.showLong(R.string.module_taxi_no_publication_trajectory)
e(
TAG, "isPassStartAutopilotCommand = " +
FunctionBuildConfig.isPassStartAutopilotCommand
+ "busRoutesResult.csvFileUrl = " + _contraiInfo!!.csvFileUrl
)
return
}
}
triggerStartServiceEvent(false, 0, "", isSlideAutoStart)
val parameters = initAutopilotControlParameters()
if (null == parameters) {
e(TAG, "无人化 行程日志-AutopilotControlParameters is empty.")
return
}
_lineInfos?.let { i ->
val wayPoints = ArrayList<VehicleSite>()
val blackPoints = ArrayList<VehicleSite>()
i.siteInfos.forEach { site ->
wayPoints.add(VehicleSite.builder()
.coordinateType(AutopilotCoordinateTypeEnum.WGS84.code)
.point(AutopilotPoint.builder().x(site.lon).y(site.lat).build())
.station(StationEnum.SITE.code)
.stationId(site.siteId.toLong())
.stationName(site.name)
.stationSeq(site.seq)
.tag(site.tag)
.build())
site.passPoints?.forEach { p ->
wayPoints.add(VehicleSite.builder()
.coordinateType(AutopilotCoordinateTypeEnum.WGS84.code)
.point(AutopilotPoint.builder().x(p.lon).y(p.lat).build())
.station(StationEnum.SITE.code)
.stationId(p.siteId.toLong())
.stationName(p.name)
.stationSeq(p.seq)
.tag(p.tag)
.build())
}
site.blackPoints?.forEach { b ->
blackPoints.add(VehicleSite.builder()
.coordinateType(AutopilotCoordinateTypeEnum.WGS84.code)
.point(AutopilotPoint.builder().x(b.lon).y(b.lat).build())
.station(StationEnum.SITE.code)
.stationId(b.siteId.toLong())
.stationName(b.name)
.stationSeq(b.seq)
.tag(b.tag)
.build())
}
}
val traj = Trajectory.builder()
.id(i.lineId)
.name(i.lineName)
.trajUrl(_contraiInfo!!.csvFileUrl)
.trajMd5(_contraiInfo!!.csvFileMd5)
.stopUrl(_contraiInfo!!.txtFileUrl)
.stopMd5(_contraiInfo!!.txtFileMd5)
.timestamp(_contraiInfo!!.contrailSaveTime)
.wayPoints(wayPoints)
.blackPoints(blackPoints)
.build()
val sessionId = unmannedStartAutoPilot(taskId, traj, parameters)
OchAutopilotAnalytics.triggerUpdateStartAutoPilotSessionId(sessionId, true)
d(
TAG,
"无人化 行程日志-开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
+ " startLatLon=" + parameters.startName + "endLatLon=" + parameters.endName +
"isRestart = " + isFirstStartAutopilot
)
M_LISTENERS.forEach {
it.value.sendStartAutopilotSuccess()
}
}
}
//TODO 任务管理继续
fun unmanneAutopilotContinue(taskId: Long, isSlideAutoStart: Boolean = false) {
if (startStation == null || endStation == null) {
// ToastUtils.showShort("未设置起始或终点站点")
ToastUtils.showShort(R.string.module_och_not_stat_and_end_point)
return
}
startStation?.let {
if (!it.isLeaving) {
// ToastUtils.showShort("请滑动出发后再启动自驾")
ToastUtils.showShort(R.string.module_och_please_slide_hint)
return
}
}
/**
* 存在Session
*/
if (!OchAutoPilotManager.canStartAutopilotBySessionId()) {
return
}
OchAutopilotAnalytics.triggerClickStartAutopilotTime(System.currentTimeMillis())
//1、判断轨迹url是否可用
if (_contraiInfo == null) {
// ToastUtils.showLong("无发布轨迹, 请发布后重试")
ToastUtils.showLong(R.string.module_taxi_no_publication_trajectory)
return
} else {
if (FunctionBuildConfig.isPassStartAutopilotCommand
&& TextUtils.isEmpty(_contraiInfo!!.csvFileUrl)
&& TextUtils.isEmpty(_contraiInfo!!.csvFileMd5)
) {
// ToastUtils.showLong("无发布轨迹, 请发布后重试")
ToastUtils.showLong(R.string.module_taxi_no_publication_trajectory)
e(
TAG, "isPassStartAutopilotCommand = " +
FunctionBuildConfig.isPassStartAutopilotCommand
+ "busRoutesResult.csvFileUrl = " + _contraiInfo!!.csvFileUrl
)
return
}
}
triggerStartServiceEvent(false, 0, "", isSlideAutoStart)
val parameters = initAutopilotControlParameters()
if (null == parameters) {
e(TAG, "无人化 行程日志-AutopilotControlParameters is empty.")
return
}
_lineInfos?.let { i ->
//TODO 任务管理继续
// val sessionId = unmannedAutoPilotContinue(taskId, traj, parameters)
// OchAutopilotAnalytics.triggerUpdateStartAutoPilotSessionId(sessionId, true)
d(
TAG,
"无人化 行程日志-开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
+ " startLatLon=" + parameters.startName + "endLatLon=" + parameters.endName +
"isRestart = " + isFirstStartAutopilot
)
M_LISTENERS.forEach {
it.value.sendStartAutopilotSuccess()
}
}
}
private fun triggerUnableStartAPReasonEvent() {
getStationsWithLine { start, end, line ->
OchAutopilotAnalytics.triggerUnableStartAPReasonEvent(
start.name ?: "", end.name ?: "", line.lineId.toString(), "",
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason
start.name ?: "", end.name ?: "", line.lineId.toString(), "",
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason
)
}
}
@@ -640,16 +818,16 @@ object LineManager : CallerBase<ILineCallback>() {
fun triggerStartServiceEvent(send: Boolean, source: Int, type: String, isSlideAutoStart: Boolean = false) {
getStationsWithLine { start, end, lineInfo ->
OchAutopilotAnalytics.triggerStartAutopilotEvent(
isFirstStartAutopilot,
send,
start.name ?: "",
end.name ?: "",
lineInfo.lineId.toInt(),
"",
System.currentTimeMillis(),
type,
source,
isSlideAutoStart
isFirstStartAutopilot,
send,
start.name ?: "",
end.name ?: "",
lineInfo.lineId.toInt(),
"",
System.currentTimeMillis(),
type,
source,
isSlideAutoStart
)
if (send) {// 启动自驾成功回调
teleIsFirstStartAutopilot = false
@@ -661,6 +839,7 @@ object LineManager : CallerBase<ILineCallback>() {
}
}
}
fun triggerCompleteTask(isSlideStop: Boolean) {
getStationsWithLine { start, end, lineInfo ->
OchAutopilotAnalytics.triggerCompleteTask(System.currentTimeMillis(), isSlideStop, lineInfo.lineId.toInt())
@@ -677,9 +856,9 @@ object LineManager : CallerBase<ILineCallback>() {
@JvmStatic
fun invokeStartAutopilotFailure(startFailedCode: String, startFailedMessage: String) {
OchAutopilotAnalytics.triggerStartAutopilotFailureEventByAdas(
startFailedCode,
startFailedMessage,
System.currentTimeMillis()
startFailedCode,
startFailedMessage,
System.currentTimeMillis()
)
M_LISTENERS.forEach {
it.value.startAutopilotFailure(startFailedCode, startFailedMessage)
@@ -704,8 +883,8 @@ object LineManager : CallerBase<ILineCallback>() {
// ToastUtils.showShort("${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查")
// ToastUtils.showShort(R.string.module_och_autopilot_id_diff, autopilotIdFromFsm, teleOrderId)
OchChainLogManager.writeChainLogAutopilot(
"自驾Id",
"${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查"
"自驾Id",
"${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查"
)
// val initAutopilotControlParameters = initAutopilotControlParameters()
// if (initAutopilotControlParameters!==null&&initAutopilotControlParameters.autoPilotLine!=null

View File

@@ -72,7 +72,6 @@ dependencies {
implementation project(":OCH:common:common")
implementation project(":OCH:common:data")
compileOnly project(":libraries:mogo-map")
}

View File

@@ -4,7 +4,6 @@ import android.content.Context
import android.view.View
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
import com.mogo.eagle.core.utilcode.util.ThreadUtils
@@ -21,7 +20,6 @@ import com.mogo.och.unmanned.repository.db.repository.TaskSiteDb
import com.mogo.och.unmanned.repository.db.repository.WriteOffDb
import com.mogo.och.unmanned.ui.fragment.ShuttleFragment
import com.mogo.och.unmanned.util.BusAnalyticsManager
import com.mogo.och.unmanned.util.BusTrajectoryManager
/**
* 网约车小巴业务实现入口
@@ -53,7 +51,7 @@ class ShuttleDriverUnmannedProvider : CommonServiceImpl() {
OchAutopilotAnalytics.ochEventKey = BusAnalyticsManager
LineModel.init()
// ScannerManager.load()
BusTrajectoryManager.load()
// BusTrajectoryManager.load()
return busFragment!!
}
@@ -63,7 +61,7 @@ class ShuttleDriverUnmannedProvider : CommonServiceImpl() {
OchAutopilotAnalytics.ochEventKey = null
LineModel.release()
// ScannerManager.release()
BusTrajectoryManager.release()
// BusTrajectoryManager.release()
RepositoryManager.release()
}

View File

@@ -260,7 +260,7 @@ object LineModel {
ThirdDeviceData.sendTaskDetailsToClients()
ShuttleVoiceManager.endOrderBus()
// 取消自驾
CallerAutoPilotControlManager.cancelAutoPilot()
CallerAutoPilotControlManager.cancelAutoPilot(taskId)
currentTask = null
LineManager.setLineInfo(null)
LineManager.setStartAndEndStation(null, null)
@@ -299,7 +299,7 @@ object LineModel {
ThirdDeviceData.sendTaskDetailsToClients()
ShuttleVoiceManager.endOrderBus()
// 取消自驾
CallerAutoPilotControlManager.cancelAutoPilot()
CallerAutoPilotControlManager.cancelAutoPilot(taskId)
currentTask = null
LineManager.setLineInfo(null)
LineManager.setStartAndEndStation(null, null)

View File

@@ -16,7 +16,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.eagle.core.utilcode.util.StringUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.bridge.autopilot.autopilot.IOchAutopilotStatusListener
import com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager
@@ -44,7 +43,6 @@ import com.mogo.och.unmanned.constant.BusConst
import com.mogo.och.unmanned.repository.RepositoryManager
import com.mogo.och.unmanned.repository.db.bean.TaskSiteDataBean
import com.mogo.och.unmanned.repository.exception.DataException
import com.mogo.och.unmanned.util.BusTrajectoryManager
import com.mogo.och.unmanned.util.ShuttleVoiceManager
import io.reactivex.Observer
import io.reactivex.android.schedulers.AndroidSchedulers
@@ -243,12 +241,12 @@ object OrderModel {
}
}
private fun onStartAutopilot() {
private fun onStartAutopilot(taskId: Long?) {
//开启自动驾驶 2.10.0: 如果自动驾驶状态下开启, 非自动驾驶状态下不开启,需手动点击自动驾驶按钮开启
isGoingToNextStation = true
if (CallerAutoPilotStatusListenerManager.getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
if (CallerAutoPilotStatusListenerManager.getState() != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
) {
LineManager.startAutopilot(true)
LineManager.unmannedStartAutopilot(taskId ?: 0L, true)
}
}
@@ -311,7 +309,7 @@ object OrderModel {
}
LineModel.leaveStationSuccess()
isArrivedStation = false
onStartAutopilot()
onStartAutopilot(task.taskId)
ThirdDeviceData.leaveStation()
@@ -329,7 +327,7 @@ object OrderModel {
if (data) {
LineModel.leaveStationSuccess()
isArrivedStation = false
onStartAutopilot()
onStartAutopilot(task.taskId)
ThirdDeviceData.leaveStation()
@@ -354,17 +352,17 @@ object OrderModel {
* onArriveAt
*/
private fun updateBusStatus() {
val (startStation, endStation) = LineManager.getStations()
if (startStation != null && endStation != null) {
if (startStation.isLeaving) {// 出发需要移除
MapMakerManager.removeMapMaker(BusConst.BUS_START_MAP_MAKER, startStation.lat, startStation.lon)
} else {// 为出发展示
MapMakerManager.addMapMaker(TAG, BusConst.BUS_START_MAP_MAKER, startStation.lat, startStation.lon, R.raw.star_marker)
}
MapMakerManager.addMapMaker(TAG, BusConst.BUS_END_MAP_MAKER, endStation.lat, endStation.lon, R.raw.end_marker)
} else {
MapMakerManager.removeAllMapMarkerByOwner(TAG)
}
// val (startStation, endStation) = LineManager.getStations()
// if (startStation != null && endStation != null) {
// if (startStation.isLeaving) {// 出发需要移除
// MapMakerManager.removeMapMaker(BusConst.BUS_START_MAP_MAKER, startStation.lat, startStation.lon)
// } else {// 为出发展示
// MapMakerManager.addMapMaker(TAG, BusConst.BUS_START_MAP_MAKER, startStation.lat, startStation.lon, R.raw.star_marker)
// }
// MapMakerManager.addMapMaker(TAG, BusConst.BUS_END_MAP_MAKER, endStation.lat, endStation.lon, R.raw.end_marker)
// } else {
// MapMakerManager.removeAllMapMarkerByOwner(TAG)
// }
LineModel.stationList?.let {
if (LineModel.startTaskMessage()) { //默认是第一站到站查询
@@ -390,7 +388,7 @@ object OrderModel {
ThirdDeviceData.sendTaskDetailsToClients()
//需放在currentStationIndex赋值之后
BusTrajectoryManager.syncTrajectoryInfo()
// BusTrajectoryManager.syncTrajectoryInfo()
}
}
@@ -563,7 +561,7 @@ object OrderModel {
CallerSopSettingManager.invokeRoutingListener(false)
MapMakerManager.removeAllMapMarkerByOwner(TAG)
LineManager.lastArrivedSiteId = -1
BusTrajectoryManager.stopTrajReqLoop()
// BusTrajectoryManager.stopTrajReqLoop()
LoginStatusManager.loginOut()
}
}

View File

@@ -11,7 +11,6 @@ import com.mogo.och.common.module.biz.login.ILoginCallback
import com.mogo.och.common.module.biz.login.LoginStatusManager
import com.mogo.och.common.module.biz.login.LoginStatusManager.isLogin
import com.mogo.och.unmanned.model.OrderModel
import com.mogo.och.unmanned.util.BusTrajectoryManager
/**
* 网约车小巴
@@ -46,7 +45,7 @@ class BusPresenter(view: ShuttleFragment?) : Presenter<ShuttleFragment?>(view),
override fun onLoginStatusChange(currentStatus: EnumLoginStatus) {
d(TAG, " loginStatus =" + isLogin())
if (!isLogin()) {
BusTrajectoryManager.stopTrajReqLoop()
// BusTrajectoryManager.stopTrajReqLoop()
OrderModel.closeBeautificationMode()
}
}

View File

@@ -6,6 +6,8 @@ import android.view.LayoutInflater
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.findViewTreeViewModelStoreOwner
import androidx.recyclerview.widget.GridLayoutManager
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.function.call.autopilot.CallerFsm2024ListenerManager
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
@@ -86,7 +88,15 @@ class SwitchTaskView : WindowRelativeLayout, SwtichTaskModel.SwtichLineViewCallb
ToastUtils.showShort(R.string.module_och_this_task_not_use1, reason)
}
} else {
viewModel?.changeLineStart(tempCheckTask)
if (AppConfigInfo.isConnectAutopilot) {
if (CallerFsm2024ListenerManager.getPlaceOrderStandby()) {
viewModel?.changeLineStart(tempCheckTask)
} else {
ToastUtils.showShort(R.string.unmanned_place_order_standby_false)
}
} else {
ToastUtils.showShort(R.string.unmanned_not_connected_ipc)
}
}
}
}

View File

@@ -1,6 +1,6 @@
<resources>
<string name="unmanned_bus_switch_line_title">Please select task</string>
<string name="unmanned_bus_running_task_arrive_station">Arrived at Station</string>
<string name="unmanned_bus_running_task_arrive_station">Skip a Stop</string>
<string name="unmanned_bus_running_task_complete">Complete</string>
<string name="unmanned_bus_switch_task_submit">Confirm Schedule</string>
<string name="unmanned_bus_switch_task_cancle">Return</string>
@@ -23,7 +23,6 @@
<string name="unmanned_bus_vehicle_emergency">Vehicle encountered an emergency and is processing it safely</string>
<string name="unmanned_shuttle_logout_error">Please log out after completing task information synchronization in an area with good network</string>
<string name="unmanned_shuttle_logout_error_running">Please end the task before logging out</string>
@@ -36,13 +35,14 @@
<string name="unmanned_bus_running_task_uploading">Uploading</string>
<string name="unmanned_bus_before_tips_s">The departure time is in %1$s minutes</string>
<string name="unmanned_bus_running_tasked_gateway">Local Cache Task</string>
<string name="unmanned_bus_leave_for">→ %s</string>
<string name="unmanned_bus_empty_inform">No notifications</string>
<string name="unmanned_more">More</string>
<string name="unmanned_place_order_standby_false">Vehicle temporarily unavailable. Please check the operation status of each node.</string>
<string name="unmanned_not_connected_ipc">IPC not connected yet; autonomous driving unavailable temporarily.</string>
<!-- region tts -->
<string name="unmanned_bus_arrived_station_tip">Arrived at %1$s. Please take your belongings and be aware of oncoming vehicles when getting off.</string>

View File

@@ -1,6 +1,6 @@
<resources>
<string name="unmanned_bus_switch_line_title">请选择任务</string>
<string name="unmanned_bus_running_task_arrive_station"></string>
<string name="unmanned_bus_running_task_arrive_station"></string>
<string name="unmanned_bus_running_task_complete">结束</string>
<string name="unmanned_bus_switch_task_submit">确认班次</string>
<string name="unmanned_bus_switch_task_cancle">返回</string>
@@ -23,7 +23,6 @@
<string name="unmanned_bus_vehicle_emergency">车辆遇到紧急情况,正在安全处理</string>
<string name="unmanned_shuttle_logout_error">请在网络良好的区域完成任务信息同步后退出</string>
<string name="unmanned_shuttle_logout_error_running">请结束任务后再退出登录</string>
@@ -36,13 +35,14 @@
<string name="unmanned_bus_running_task_uploading">上传中</string>
<string name="unmanned_bus_before_tips_s">距离发车时间还有%1$s分钟</string>
<string name="unmanned_bus_running_tasked_gateway">本地缓存任务</string>
<string name="unmanned_bus_leave_for">→ %s</string>
<string name="unmanned_bus_empty_inform">暂无通知</string>
<string name="unmanned_more">更多</string>
<string name="unmanned_place_order_standby_false">车辆暂不可用,请检查各节点运行状态</string>
<string name="unmanned_not_connected_ipc">尚未连接工控机,自动驾驶暂不可用</string>
<!-- region tts -->
<string name="unmanned_bus_arrived_station_tip">已到达%1$s请带好随身物品下车时注意后方来车。</string>

View File

@@ -83,6 +83,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendRes
import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm
import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.Trajectory
import com.zhjt.service.chain.ChainLog
import io.netty.channel.Channel
import mogo.telematics.pad.MessagePad
@@ -99,9 +100,9 @@ import java.util.concurrent.TimeUnit
*/
@Route(path = MogoServicePaths.PATH_AUTO_PILOT)
class MoGoAutopilotControlProvider :
IMoGoAutopilotControlProvider,
IMoGoMapDataCollectProvider.OnMapCollectCmdListener,
IMoGoAutopilotCarConfigListener {
IMoGoAutopilotControlProvider,
IMoGoMapDataCollectProvider.OnMapCollectCmdListener,
IMoGoAutopilotCarConfigListener {
private val TAG = "MoGoAutoPilotProvider"
private var mContext: Context? = null
private lateinit var msgHandler: IMsgHandler
@@ -109,6 +110,7 @@ class MoGoAutopilotControlProvider :
@Volatile
private var isInit = false
@Volatile
private var isRainModeInit = false
@@ -137,22 +139,22 @@ class MoGoAutopilotControlProvider :
// "192.168.1.102"
val options = AdasOptions.newBuilder()
.setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.PING)
.setPingAddressList(AdasManager.getInstance().pingAddressList)
.setPassenger(false)
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtFDecode())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtFDecode())
.setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.PING)
.setPingAddressList(AdasManager.getInstance().pingAddressList)
.setPassenger(false)
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtFDecode())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtFDecode())
// .setLaunchAutopilotGear(FunctionBuildConfig.launchAutopilotGear)
// .setSubscribeInterfaceOptions(subscribeInterfaceOptions)//
.build()
.build()
AdasManager.getInstance().create(AbsMogoApplication.getApp(), options, MoGoAdasMsgConnectStatusListenerImpl())
//////////////////////////////////注意先后顺序AdasManager.getInstance().create后才可以设置监听/////////////////////////////////////////////
// 监听ADAS-SDK获取到的工控机数据
AdasManager.getInstance().setOnAdasListener(MoGoAdasListenerImpl())
NSDNettyManager.getInstance().startNSDNettyServerWithSN(context, object :
NettyServerListener<MogoProtocolMsg> {
NettyServerListener<MogoProtocolMsg> {
override fun onMessageResponseServer(msg: MogoProtocolMsg?, channel: Channel?) {
msgHandler.handleMsgFromClient(msg, channel)
}
@@ -205,26 +207,26 @@ class MoGoAutopilotControlProvider :
}, SharedPrefsMgr.getInstance().sn)
} else {
NSDNettyManager.getInstance()
.searchAndConnectServer(context, SharedPrefsMgr.getInstance().sn,
DeviceUtils.isLeOrEb5Model(),
object : NettyClientListener<MogoProtocolMsg> {
override fun onMessageResponseClient(
msg: MogoProtocolMsg?,
sign: String?,
channel: Channel
) {
// 乘客端收到adas数据直接解析后续分发解析后的数据流程同司机端
msgHandler.handleMsgFromServer(msg, channel)
}
.searchAndConnectServer(context, SharedPrefsMgr.getInstance().sn,
DeviceUtils.isLeOrEb5Model(),
object : NettyClientListener<MogoProtocolMsg> {
override fun onMessageResponseClient(
msg: MogoProtocolMsg?,
sign: String?,
channel: Channel
) {
// 乘客端收到adas数据直接解析后续分发解析后的数据流程同司机端
msgHandler.handleMsgFromServer(msg, channel)
}
override fun onClientStatusConnectChanged(
statusCode: Int,
sign: String?,
channel: Channel
) {
msgHandler.handleClientConnStatus(statusCode, sign, channel)
}
})
override fun onClientStatusConnectChanged(
statusCode: Int,
sign: String?,
channel: Channel
) {
msgHandler.handleClientConnStatus(statusCode, sign, channel)
}
})
}
msgHandler.setListener(object : EventListener {
override fun connectDevice(isSupportMulti: Boolean) {
@@ -243,12 +245,12 @@ class MoGoAutopilotControlProvider :
directConnect(context)
} else {
val options = AdasOptions
.newBuilder()
.setPassenger(true)
.newBuilder()
.setPassenger(true)
// .setLaunchAutopilotGear(FunctionBuildConfig.launchAutopilotGear)
.build()
.build()
AdasManager.getInstance()
.create(AbsMogoApplication.getApp(), options, MoGoAdasMsgConnectStatusListenerImpl())
.create(AbsMogoApplication.getApp(), options, MoGoAdasMsgConnectStatusListenerImpl())
// 监听ADAS-SDK获取到的工控机数据
AdasManager.getInstance().setOnAdasListener(MoGoAdasListenerImpl())
// 接收司机屏发过来的感知、定位等数据
@@ -274,15 +276,15 @@ class MoGoAutopilotControlProvider :
private fun directConnect(context: Context) {
val options = AdasOptions
.newBuilder()
.setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.PING)
.setPingAddressList(AdasManager.getInstance().pingAddressList)
.setPassenger(false)// 乘客端直连工控机改为false
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtFDecode())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtFDecode())
.newBuilder()
.setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.PING)
.setPingAddressList(AdasManager.getInstance().pingAddressList)
.setPassenger(false)// 乘客端直连工控机改为false
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtFDecode())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtFDecode())
// .setLaunchAutopilotGear(FunctionBuildConfig.launchAutopilotGear)
.build()
.build()
AdasManager.getInstance().create(AbsMogoApplication.getApp(), options, MoGoAdasMsgConnectStatusListenerImpl())
//////////////////////////////////注意先后顺序AdasManager.getInstance().create后才可以设置监听/////////////////////////////////////////////
// 监听ADAS-SDK获取到的工控机数据
@@ -301,7 +303,7 @@ class MoGoAutopilotControlProvider :
if (NSDNettyManager.getInstance().isServerStart) {
msgHandler.synWriteTime()
NSDNettyManager.getInstance()
.sendMsgToAllClients(MogoProtocolMsg(NORMAL_DATA, bytes.size, bytes))
.sendMsgToAllClients(MogoProtocolMsg(NORMAL_DATA, bytes.size, bytes))
} else {
CallerLogger.d("$M_D_C$TAG", "司机端Server未启动")
}
@@ -311,10 +313,10 @@ class MoGoAutopilotControlProvider :
if (bytes == null)
return
NSDNettyManager.getInstance()
.sendMogoProtocolMsgToServer(
MogoProtocolMsg(NORMAL_DATA, bytes.size, bytes),
null
)
.sendMogoProtocolMsgToServer(
MogoProtocolMsg(NORMAL_DATA, bytes.size, bytes),
null
)
}
})
@@ -338,13 +340,13 @@ class MoGoAutopilotControlProvider :
}
// 设置IP地址
val options = AdasOptions.newBuilder()
.setPassenger(false)
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtFDecode())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtFDecode())
.setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.SPECIFIED)
.setSpecifiedAddress(autoPilotIp)
.build()
.setPassenger(false)
.setEnableCertification(SharedPrefsMgr.getInstance().getBoolean("${MoGoConfig.AUTOPILOT_CERTIFICATION}-${DebugConfig.getNetMode()}", MoGoConfig.AUTOPILOT_CERTIFICATION_DEFAULT_VALUE))
.setRootCrt(CallerCloudCertManager.getRootCrtFDecode())
.setDeviceCrt(CallerCloudCertManager.getDeviceCrtFDecode())
.setConnectionMode(AdasOptions.IPC_CONNECTION_MODE.SPECIFIED)
.setSpecifiedAddress(autoPilotIp)
.build()
AdasManager.getInstance().create(AbsMogoApplication.getApp(), options, MoGoAdasMsgConnectStatusListenerImpl())
AdasManager.getInstance().setOnAdasListener(MoGoAdasListenerImpl())
// AdasManager.getInstance().adasOptions.isClient = false
@@ -381,10 +383,10 @@ class MoGoAutopilotControlProvider :
@ChainLog(
linkChainLog = AdasChain.CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = AdasChain.CHAIN_SOURCE_ADAS,
nodeAliasCode = AdasChain.CHAIN_CODE_ADAS_START_AUTOPILOT,
paramIndexes = [0]
linkChainLog = AdasChain.CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = AdasChain.CHAIN_SOURCE_ADAS,
nodeAliasCode = AdasChain.CHAIN_CODE_ADAS_START_AUTOPILOT,
paramIndexes = [0]
)
override fun startAutoPilot(controlParameters: AutopilotControlParameters): Long {
return startAutoPilot(controlParameters, Constants.AUTOPILOT_SOURCE.PAD)
@@ -392,9 +394,9 @@ class MoGoAutopilotControlProvider :
//todo emArrow chainlog
override fun startAutoPilotByMoFang(controlParameters: AutopilotControlParameters?) {
if (controlParameters==null){
if (controlParameters == null) {
startAutoPilotWithNoParameter(Constants.AUTOPILOT_SOURCE.MO_FANG)
}else{
} else {
startAutoPilot(controlParameters, Constants.AUTOPILOT_SOURCE.MO_FANG)
}
}
@@ -406,12 +408,12 @@ class MoGoAutopilotControlProvider :
private fun startAutoPilotWithNoParameter(source: Int) {
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
val invokeResult = AdasManager.getInstance()
.sendAutoPilotModeReq(1, source, null, null, null)
.sendAutoPilotModeReq(1, source, null, null, null)
invokeAutoPilotResult(if (invokeResult > -1) "无参自动驾驶调用成功:${invokeResult}" else "自动驾驶调用失败, socket 或者 rawPack 可能为空")
} else {
if (AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) {
val invokeResult = AdasManager.getInstance()
.sendAutoPilotModeReq(1, source, null, null, null)
.sendAutoPilotModeReq(1, source, null, null, null)
invokeAutoPilotResult(if (invokeResult > -1) "无参自动驾驶调用成功:${invokeResult}" else "自动驾驶调用失败, socket 或者 rawPack 可能为空")
} else {
invokeAutoPilotResult("车机与工控机链接失败,无法开启自动驾驶 无参")
@@ -420,20 +422,20 @@ class MoGoAutopilotControlProvider :
}
private fun startAutoPilot(controlParameters: AutopilotControlParameters, source: Int): Long {
val startPosType = if(controlParameters.firstStationFlag==null){
val startPosType = if (controlParameters.firstStationFlag == null) {
null
}else{
} else {
MessagePad.StartPosType.forNumber(controlParameters.firstStationFlag!!)
}
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
val invokeResult = AdasManager.getInstance()
.sendAutoPilotModeReq(1, source, controlParameters.toRouteInfo(), controlParameters.toAutoPilotCmdInfo(), startPosType)
.sendAutoPilotModeReq(1, source, controlParameters.toRouteInfo(), controlParameters.toAutoPilotCmdInfo(), startPosType)
invokeAutoPilotResult(if (invokeResult > -1) "自动驾驶调用成功:${invokeResult}" else "自动驾驶调用失败, socket 或者 rawPack 可能为空")
return invokeResult
} else {
if (AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) {
val invokeResult = AdasManager.getInstance()
.sendAutoPilotModeReq(1, source, controlParameters.toRouteInfo(), controlParameters.toAutoPilotCmdInfo(), startPosType)
.sendAutoPilotModeReq(1, source, controlParameters.toRouteInfo(), controlParameters.toAutoPilotCmdInfo(), startPosType)
invokeAutoPilotResult(if (invokeResult > -1) "自动驾驶调用成功:${invokeResult}" else "自动驾驶调用失败, socket 或者 rawPack 可能为空")
return invokeResult
} else {
@@ -443,12 +445,35 @@ class MoGoAutopilotControlProvider :
}
}
override fun sendTaskManagerAutopilotStart(taskId: Long, traj: Trajectory): Long {
return if (AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) {
val invokeResult = AdasManager.getInstance().sendTaskManagerAutopilotStart(taskId, traj)
invokeAutoPilotResult(if (invokeResult > -1) "无人化 自动驾驶调用成功:${invokeResult}" else "无人化 自动驾驶调用失败, socket 或者 rawPack 可能为空")
invokeResult
} else {
invokeAutoPilotResult("无人化 车机与工控机链接失败,无法开启自动驾驶")
-1L
}
}
override fun sendTaskManagerAutopilotContinue(trackId: Long, taskId: Long, stationId: Long, stationName: String, stationSeq: Int, lon: Double, lat: Double): Long {
return if (AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) {
val invokeResult = AdasManager.getInstance().sendTaskManagerAutopilotContinue(trackId, taskId, stationId, stationName, stationSeq, lon, lat)
invokeAutoPilotResult(if (invokeResult > -1) "无人化 取消自动驾驶调用成功:${invokeResult}" else "无人化 取消自动驾驶调用失败, socket 或者 rawPack 可能为空")
invokeResult
} else {
invokeAutoPilotResult("无人化 车机与工控机链接失败,无法取消自动驾驶")
-1L
}
}
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
parentNodeAliasCode = ChainConstant.CHAIN_CODE_EAGLE_START_AUTOPILOT,
nodeAliasCode = ChainConstant.CHAIN_CODE_EAGLE_START_AUTOPILOT_RESULT,
paramIndexes = [0]
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
parentNodeAliasCode = ChainConstant.CHAIN_CODE_EAGLE_START_AUTOPILOT,
nodeAliasCode = ChainConstant.CHAIN_CODE_EAGLE_START_AUTOPILOT_RESULT,
paramIndexes = [0]
)
private fun invokeAutoPilotResult(status: String) {
CallerLogger.e("$M_D_C$TAG", status)
@@ -456,46 +481,50 @@ class MoGoAutopilotControlProvider :
override fun sendTrafficLightData(trafficLightResult: TrafficLightResult) {
AdasManager.getInstance().sendTrafficLightData(
trafficLightResult.crossId,
trafficLightResult.lat,
trafficLightResult.lon,
trafficLightResult.heading,
trafficLightResult.direction,
trafficLightResult.lightId,
trafficLightResult.laneNo,
trafficLightResult.arrowNo,
trafficLightResult.flashYellow,
trafficLightResult.toTrafficLightDetail(),
trafficLightResult.timeStamp
trafficLightResult.crossId,
trafficLightResult.lat,
trafficLightResult.lon,
trafficLightResult.heading,
trafficLightResult.direction,
trafficLightResult.lightId,
trafficLightResult.laneNo,
trafficLightResult.arrowNo,
trafficLightResult.flashYellow,
trafficLightResult.toTrafficLightDetail(),
trafficLightResult.timeStamp
)
}
override fun sendTrajectoryDownloadReq(
autoPilotLine: AutopilotControlParameters.AutoPilotLine,
routeInfo: MessagePad.RouteInfo?,
orderId: String?
autoPilotLine: AutopilotControlParameters.AutoPilotLine,
routeInfo: MessagePad.RouteInfo?,
orderId: String?
): Long {
return AdasManager.getInstance()
.sendTrajectoryDownloadReq(autoPilotLine.toAutoPilotLine(), routeInfo, orderId)
.sendTrajectoryDownloadReq(autoPilotLine.toAutoPilotLine(), routeInfo, orderId)
}
override fun sendTrajectoryDownloadReq(
autoPilotLine: AutopilotControlParameters.AutoPilotLine,
downloadType: Int,
routeInfo: MessagePad.RouteInfo?,
orderId: String?
autoPilotLine: AutopilotControlParameters.AutoPilotLine,
downloadType: Int,
routeInfo: MessagePad.RouteInfo?,
orderId: String?
): Long {
return AdasManager.getInstance().sendTrajectoryDownloadReq(
autoPilotLine.toAutoPilotLine(),
downloadType,
routeInfo,
orderId
autoPilotLine.toAutoPilotLine(),
downloadType,
routeInfo,
orderId
)
}
override fun cancelAutoPilot() {
override fun cancelAutoPilot(taskId: Long) {
if (AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) {
val invokeResult = AdasManager.getInstance().sendAutoPilotModeReq(0, 1, null, null, null)
val invokeResult = if (taskId == (-1).toLong()) {
AdasManager.getInstance().sendAutoPilotModeReq(0, 1, null, null, null)
} else {
AdasManager.getInstance().sendTaskManagerAutopilotCancel(taskId)
}
invokeAutoPilotResult(if (invokeResult > -1) "取消自动驾驶调用成功:${invokeResult}" else "取消自动驾驶调用失败, socket 或者 rawPack 可能为空")
} else {
invokeAutoPilotResult("车机与工控机链接失败,无法取消自动驾驶")
@@ -504,7 +533,7 @@ class MoGoAutopilotControlProvider :
override fun recordPackage(): Boolean {
return AdasManager.getInstance()
.startRecordPackage((System.currentTimeMillis() / 1000).toInt(), 1) > -1
.startRecordPackage((System.currentTimeMillis() / 1000).toInt(), 1) > -1
}
override fun recordPackage(type: Int, id: Int): Boolean {
@@ -520,11 +549,11 @@ class MoGoAutopilotControlProvider :
}
override fun recordPackage(
type: Int,
id: Int,
duration: Int,
bduration: Int,
topics: List<String>
type: Int,
id: Int,
duration: Int,
bduration: Int,
topics: List<String>
): Boolean {
return AdasManager.getInstance().startRecordPackage(id, duration, type, bduration, topics) > -1
}
@@ -555,7 +584,7 @@ class MoGoAutopilotControlProvider :
override fun recordCause(key: String?, name: String?, id: String?, reason: String?) {
key?.let {
AdasManager.getInstance()
.sendRecordCause(it.toLong(), name ?: "", id ?: "", reason ?: "")
.sendRecordCause(it.toLong(), name ?: "", id ?: "", reason ?: "")
}
}
@@ -576,13 +605,13 @@ class MoGoAutopilotControlProvider :
// val byteArray = if (isEnable) byteArrayOf(1) else byteArrayOf(0)
if (NSDNettyManager.getInstance().isServerStart) {
NSDNettyManager.getInstance()
.sendMsgToAllClients(
MogoProtocolMsg(
SYNC_MODE_STATUS,
byteArray.size,
byteArray
.sendMsgToAllClients(
MogoProtocolMsg(
SYNC_MODE_STATUS,
byteArray.size,
byteArray
)
)
)
} else {
CallerLogger.d("$M_D_C$TAG", "同步美化模式状态时司机端Server未启动")
}
@@ -602,13 +631,13 @@ class MoGoAutopilotControlProvider :
}
if (NSDNettyManager.getInstance().isServerStart) {
NSDNettyManager.getInstance()
.sendMsgToAllClients(
MogoProtocolMsg(
SYNC_FUSION_COLOR_STATUS,
byteArray.size,
byteArray
.sendMsgToAllClients(
MogoProtocolMsg(
SYNC_FUSION_COLOR_STATUS,
byteArray.size,
byteArray
)
)
)
} else {
CallerLogger.d("$M_D_C$TAG", "同步感知颜色绘制时司机端Server未启动")
}
@@ -625,13 +654,13 @@ class MoGoAutopilotControlProvider :
}
if (NSDNettyManager.getInstance().isServerStart) {
NSDNettyManager.getInstance()
.sendMsgToAllClients(
MogoProtocolMsg(
11,
byteArray.size,
byteArray
.sendMsgToAllClients(
MogoProtocolMsg(
11,
byteArray.size,
byteArray
)
)
)
} else {
CallerLogger.d("$M_D_C$TAG", "同步美化模式状态时司机端Server未启动")
}
@@ -644,10 +673,10 @@ class MoGoAutopilotControlProvider :
* isEnable = false 关闭
*/
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_SEND,
paramIndexes = [0]
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_SEND,
paramIndexes = [0]
)
override fun setIPCDemoMode(isEnable: Boolean) {
if (isEnable) {
@@ -658,10 +687,10 @@ class MoGoAutopilotControlProvider :
}
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_SEND,
paramIndexes = [0]
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_SEND,
paramIndexes = [0]
)
override fun setRainMode(isEnable: Boolean) {
if (isEnable) {
@@ -678,10 +707,10 @@ class MoGoAutopilotControlProvider :
* @return boolean
*/
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_SEND,
paramIndexes = [0]
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_SEND,
paramIndexes = [0]
)
override fun sendDetouring(isEnable: Boolean): Boolean {
return if (isEnable) {
@@ -735,9 +764,9 @@ class MoGoAutopilotControlProvider :
* @return boolean
*/
override fun sendAebCmd(isEnable: Boolean): Boolean {
return if(isEnable){
return if (isEnable) {
AdasManager.getInstance().sendAebCmd(1) > -1
}else{
} else {
AdasManager.getInstance().sendAebCmd(0) > -1
}
}
@@ -749,9 +778,9 @@ class MoGoAutopilotControlProvider :
* @return boolean
*/
override fun sendLaneChangeRestrainValid(isEnable: Boolean): Boolean {
return if(isEnable){
return if (isEnable) {
AdasManager.getInstance().sendLaneChangeRestrainValid(1) > -1
}else{
} else {
AdasManager.getInstance().sendLaneChangeRestrainValid(0) > -1
}
}
@@ -763,9 +792,9 @@ class MoGoAutopilotControlProvider :
* @return boolean
*/
override fun sendStopYieldValid(isEnable: Boolean): Boolean {
return if(isEnable){
return if (isEnable) {
AdasManager.getInstance().sendStopYieldValid(1) > -1
}else{
} else {
AdasManager.getInstance().sendStopYieldValid(0) > -1
}
}
@@ -777,9 +806,9 @@ class MoGoAutopilotControlProvider :
* @return boolean
*/
override fun sendHadmapSpeedLimitValid(isEnable: Boolean): Boolean {
return if(isEnable){
return if (isEnable) {
AdasManager.getInstance().sendHadmapSpeedLimitValid(1) > -1
}else{
} else {
AdasManager.getInstance().sendHadmapSpeedLimitValid(0) > -1
}
}
@@ -791,9 +820,9 @@ class MoGoAutopilotControlProvider :
* @return boolean
*/
override fun sendRampThetaValid(isEnable: Boolean): Boolean {
return if(isEnable){
return if (isEnable) {
AdasManager.getInstance().sendRampThetaValid(1) > -1
}else{
} else {
AdasManager.getInstance().sendRampThetaValid(0) > -1
}
}
@@ -878,8 +907,8 @@ class MoGoAutopilotControlProvider :
* @param topicsNeedToCache
* @return boolean
*/
override fun getBadCaseConfig(reqType: Int,recordType: Int,topicsNeedToCache: List<String>): Boolean{
return AdasManager.getInstance().sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache) > -1
override fun getBadCaseConfig(reqType: Int, recordType: Int, topicsNeedToCache: List<String>): Boolean {
return AdasManager.getInstance().sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache) > -1
}
/**
@@ -887,13 +916,13 @@ class MoGoAutopilotControlProvider :
*/
override fun sendBagManagerCmd(bagManagerEntity: BagManagerEntity): Boolean {
val bagManager = BagManagerOuterClass.BagManager
.newBuilder()
.setReqType(bagManagerEntity.reqType)
.setKeyReq(bagManagerEntity.keyReq)
.newBuilder()
.setReqType(bagManagerEntity.reqType)
.setKeyReq(bagManagerEntity.keyReq)
// 更新包附加信息,发送请求且reqType=5时有效
val descReq = BagManagerOuterClass.BagDescription
.newBuilder()
.newBuilder()
bagManagerEntity.descReq?.let {
descReq.description = it.description
descReq.hasAudio = it.hasAudio
@@ -905,24 +934,24 @@ class MoGoAutopilotControlProvider :
// 空间使用信息,获取响应且reqType=1时有效
for (diskSpaceInfoEntity in bagManagerEntity.spaceInfoResp) {
val spaceInfoResp = BagManagerOuterClass.BagSpaceInfo
.newBuilder()
.newBuilder()
val diskSpaceInfo = BagManagerOuterClass.SpaceInfo
.newBuilder()
.setDirectory(diskSpaceInfoEntity.diskSpaceInfo.directory)
.setTotal(diskSpaceInfoEntity.diskSpaceInfo.total)
.setFree(diskSpaceInfoEntity.diskSpaceInfo.free)
.setUsed(diskSpaceInfoEntity.diskSpaceInfo.used)
.build()
.newBuilder()
.setDirectory(diskSpaceInfoEntity.diskSpaceInfo.directory)
.setTotal(diskSpaceInfoEntity.diskSpaceInfo.total)
.setFree(diskSpaceInfoEntity.diskSpaceInfo.free)
.setUsed(diskSpaceInfoEntity.diskSpaceInfo.used)
.build()
spaceInfoResp
.setHost(diskSpaceInfoEntity.host).diskSpaceInfo = diskSpaceInfo
.setHost(diskSpaceInfoEntity.host).diskSpaceInfo = diskSpaceInfo
for (entity in diskSpaceInfoEntity.BagDirsSpaceInfo) {
val bagDirsSpaceInfo = BagManagerOuterClass.SpaceInfo
.newBuilder()
.setDirectory(entity.directory)
.setTotal(entity.total)
.setFree(entity.free)
.setUsed(entity.used)
.build()
.newBuilder()
.setDirectory(entity.directory)
.setTotal(entity.total)
.setFree(entity.free)
.setUsed(entity.used)
.build()
spaceInfoResp.addBagDirsSpaceInfo(bagDirsSpaceInfo)
}
bagManager.addSpaceInfoResp(spaceInfoResp.build())
@@ -933,7 +962,7 @@ class MoGoAutopilotControlProvider :
if (bagsInfoRespEntity.itemType == 0) {
// 包描述信息
val bagDescription = BagManagerOuterClass.BagDescription
.newBuilder()
.newBuilder()
bagsInfoRespEntity.description?.let {
bagDescription.description = it.description
bagDescription.hasAudio = it.hasAudio
@@ -942,23 +971,23 @@ class MoGoAutopilotControlProvider :
}
val bagsInfoResp = BagManagerOuterClass.BagInfo
.newBuilder()
.setKey(bagsInfoRespEntity.key)
.setTotalSize(bagsInfoRespEntity.totalSize)
.setTimestamp(bagsInfoRespEntity.timestamp)
.setBagPath(bagsInfoRespEntity.bagPath)
.setMergeStat(bagsInfoRespEntity.mergeStat)
.setUploadStat(bagsInfoRespEntity.uploadStat)
.setDescription(bagDescription.build())
.newBuilder()
.setKey(bagsInfoRespEntity.key)
.setTotalSize(bagsInfoRespEntity.totalSize)
.setTimestamp(bagsInfoRespEntity.timestamp)
.setBagPath(bagsInfoRespEntity.bagPath)
.setMergeStat(bagsInfoRespEntity.mergeStat)
.setUploadStat(bagsInfoRespEntity.uploadStat)
.setDescription(bagDescription.build())
// 子包信息
for (subBagEntity in bagsInfoRespEntity.subBags) {
val subBag = BagManagerOuterClass.SubBag
.newBuilder()
.setKey(subBagEntity.key)
.setHost(subBagEntity.host)
.setSize(subBagEntity.size)
.build()
.newBuilder()
.setKey(subBagEntity.key)
.setHost(subBagEntity.host)
.setSize(subBagEntity.size)
.build()
bagsInfoResp.addSubBags(subBag)
}
bagManager.addBagsInfoResp(bagsInfoResp)
@@ -967,7 +996,7 @@ class MoGoAutopilotControlProvider :
//反馈上传cos桶结果,获取响应且reqType=3时有效
val uploadCosResp = BagManagerOuterClass.UploadCosStat
.newBuilder()
.newBuilder()
bagManagerEntity.uploadCosResp?.let {
uploadCosResp.key = it.key
@@ -1009,6 +1038,7 @@ class MoGoAutopilotControlProvider :
override fun sendBlindAreaCmd(switchCmd: Boolean) {
AdasManager.getInstance().sendBlindAreaCmd(switchCmd)
}
/**
* 向左变道
*/
@@ -1050,14 +1080,14 @@ class MoGoAutopilotControlProvider :
* @param isLastStop 是否最终站
* @return boolean
*/
override fun sendTripInfo(type: Int, lineName: String, departureStopName: String,arrivalStopName: String, isLastStop: Boolean) {
AdasManager.getInstance().sendTripInfoReq(type, lineName, departureStopName,arrivalStopName, isLastStop)
override fun sendTripInfo(type: Int, lineName: String, departureStopName: String, arrivalStopName: String, isLastStop: Boolean) {
AdasManager.getInstance().sendTripInfoReq(type, lineName, departureStopName, arrivalStopName, isLastStop)
LedSourceManager.updateTripInfoData(
type,
lineName,
departureStopName,
arrivalStopName,
isLastStop
type,
lineName,
departureStopName,
arrivalStopName,
isLastStop
)
}
@@ -1066,10 +1096,10 @@ class MoGoAutopilotControlProvider :
* 命令下发存在回执
*/
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_IPC_REBOOT,
paramIndexes = [-1]
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_IPC_REBOOT,
paramIndexes = [-1]
)
override fun sendIpcReboot() {
//重启所有节点
@@ -1081,10 +1111,10 @@ class MoGoAutopilotControlProvider :
* 命令下发存在回执
*/
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_POWER_OFF,
paramIndexes = [-1]
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_ADAS_POWER_OFF,
paramIndexes = [-1]
)
override fun sendIpcPowerOff(): Long {
val id = AdasManager.getInstance().sendIpcPowerOff()
@@ -1138,9 +1168,9 @@ class MoGoAutopilotControlProvider :
override fun getVIN(): String {
val carConfig = AdasManager.getInstance().carConfig
return if(carConfig != null){
return if (carConfig != null) {
carConfig.vinCode
}else{
} else {
""
}
}
@@ -1148,26 +1178,26 @@ class MoGoAutopilotControlProvider :
override fun connectSpecifiedServer(ip: String) {
ThreadUtils.getIoPool().submit {
NSDNettyManager.getInstance().connectSpecifiedServer(
ip,
NettyTcpServer.SERVER_PORT,
SharedPrefsMgr.getInstance().sn,
object : NettyClientListener<MogoProtocolMsg> {
override fun onMessageResponseClient(
msg: MogoProtocolMsg?,
sign: String?,
channel: Channel
) {
msgHandler.handleMsgFromServer(msg, channel)
}
ip,
NettyTcpServer.SERVER_PORT,
SharedPrefsMgr.getInstance().sn,
object : NettyClientListener<MogoProtocolMsg> {
override fun onMessageResponseClient(
msg: MogoProtocolMsg?,
sign: String?,
channel: Channel
) {
msgHandler.handleMsgFromServer(msg, channel)
}
override fun onClientStatusConnectChanged(
statusCode: Int,
sign: String?,
channel: Channel
) {
msgHandler.handleClientConnStatus(statusCode, sign, channel)
}
})
override fun onClientStatusConnectChanged(
statusCode: Int,
sign: String?,
channel: Channel
) {
msgHandler.handleClientConnStatus(statusCode, sign, channel)
}
})
}
}
@@ -1199,8 +1229,8 @@ class MoGoAutopilotControlProvider :
msgHandler.synMsgToAllClients()
} else {// 乘客屏
CallerDevaToolsManager.getBindingCarInfo(
carConfigResp.macAddress,
SharedPrefsMgr.getInstance().sn
carConfigResp.macAddress,
SharedPrefsMgr.getInstance().sn
)
// invokeNettyConnResult("乘客屏车牌号:${carConfigResp.plateNumber},Mac地址为${carConfigResp.macAddress}")
invokeNettyConnResult("${StringUtils.getString(R.string.module_core_passenger_plate)}${carConfigResp.plateNumber},${StringUtils.getString(R.string.module_core_mac_address)}${carConfigResp.macAddress}")
@@ -1223,10 +1253,10 @@ class MoGoAutopilotControlProvider :
}
@ChainLog(
linkChainLog = CHAIN_TYPE_STATUS,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_MULTI_CONNECT,
paramIndexes = [0]
linkChainLog = CHAIN_TYPE_STATUS,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = CHAIN_CODE_MULTI_CONNECT,
paramIndexes = [0]
)
private fun invokeNettyConnResult(status: String) {
CallerLogger.d("$M_D_C$TAG", status)
@@ -1297,7 +1327,7 @@ class MoGoAutopilotControlProvider :
* @return boolean
*/
override fun sendSweeperSuspendResumeTaskReq(isSuspend: Boolean, reqNo: String, suspendResumeTaskReq: SweeperTaskSuspendResume.SuspendResumeTaskReq): Boolean {
return AdasManager.getInstance().sendSweeperSuspendResumeTaskReq(isSuspend,reqNo, suspendResumeTaskReq) > -1
return AdasManager.getInstance().sendSweeperSuspendResumeTaskReq(isSuspend, reqNo, suspendResumeTaskReq) > -1
}
/**
@@ -1359,7 +1389,7 @@ class MoGoAutopilotControlProvider :
* * -1L添加到WS发送消息队列失败
*/
override fun sendPowerUnitSingleChannelControl(channel: PowerUnitChannel, cmd: Int): Long {
return AdasManager.getInstance().sendPowerUnitSingleChannelControl(channel,cmd)
return AdasManager.getInstance().sendPowerUnitSingleChannelControl(channel, cmd)
}
/**
@@ -1413,8 +1443,8 @@ class MoGoAutopilotControlProvider :
}
override fun sendParallelDrivingReq(
reqNo: String,
parallelRequest: ParallelDrivingRequest.ParallelRequest
reqNo: String,
parallelRequest: ParallelDrivingRequest.ParallelRequest
): Boolean {
return AdasManager.getInstance().sendParallelDrivingReq(reqNo, parallelRequest) > -1
}
@@ -1422,38 +1452,38 @@ class MoGoAutopilotControlProvider :
override fun setIsDrawPointCloud(isDrawPointCloud: Boolean) {
if (isDrawPointCloud) {
AdasManager.getInstance().subscribeInterface(
Constants.TERMINAL_ROLE.DRIVER,
Constants.SUBSCRIBE_TYPE.SUBSCRIBE,
MessageType.TYPE_RECEIVE_POINT_CLOUD)
Constants.TERMINAL_ROLE.DRIVER,
Constants.SUBSCRIBE_TYPE.SUBSCRIBE,
MessageType.TYPE_RECEIVE_POINT_CLOUD)
} else {
AdasManager.getInstance().subscribeInterface(
Constants.TERMINAL_ROLE.DRIVER,
Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE,
MessageType.TYPE_RECEIVE_POINT_CLOUD)
Constants.TERMINAL_ROLE.DRIVER,
Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE,
MessageType.TYPE_RECEIVE_POINT_CLOUD)
}
}
override fun setIsSubscribeM1StitchedVideo(isSubscribe: Boolean) {
if (isSubscribe) {
AdasManager.getInstance().subscribeInterface(
Constants.TERMINAL_ROLE.DRIVER,
Constants.SUBSCRIBE_TYPE.SUBSCRIBE,
MessageType.TYPE_RECEIVE_M1_STITCHED_VIDEO
Constants.TERMINAL_ROLE.DRIVER,
Constants.SUBSCRIBE_TYPE.SUBSCRIBE,
MessageType.TYPE_RECEIVE_M1_STITCHED_VIDEO
)
} else {
AdasManager.getInstance().subscribeInterface(
Constants.TERMINAL_ROLE.DRIVER,
Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE,
MessageType.TYPE_RECEIVE_M1_STITCHED_VIDEO
Constants.TERMINAL_ROLE.DRIVER,
Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE,
MessageType.TYPE_RECEIVE_M1_STITCHED_VIDEO
)
}
}
override fun setIsSubscribeBackCameraVideoVideo(role: Int, isSubscribe: Boolean) {
val type =
if (isSubscribe) Constants.SUBSCRIBE_TYPE.SUBSCRIBE else Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE
if (isSubscribe) Constants.SUBSCRIBE_TYPE.SUBSCRIBE else Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE
AdasManager.getInstance().subscribeInterface(
role, type, MessageType.TYPE_RECEIVE_BACK_CAMERA_VIDEO
role, type, MessageType.TYPE_RECEIVE_BACK_CAMERA_VIDEO
)
}
@@ -1462,10 +1492,10 @@ class MoGoAutopilotControlProvider :
}
override fun sendRoboBusJinlvM1AirConditionerCmd(
switchCmd: Int,
modeCmd: Int,
windSpeedCmd: Int,
temperatureCmd: Int
switchCmd: Int,
modeCmd: Int,
windSpeedCmd: Int,
temperatureCmd: Int
): Boolean {
return AdasManager.getInstance().sendRoboBusJinlvM1AirConditionerCmd(switchCmd, modeCmd, windSpeedCmd, temperatureCmd) > -1
}
@@ -1491,20 +1521,20 @@ class MoGoAutopilotControlProvider :
}
@ChainLog(
linkChainLog = AdasChain.CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = AdasChain.CHAIN_SOURCE_ADAS,
nodeAliasCode = AdasChain.CHAIN_CODE_ADAS_SEND_PLANNING_CMD,
paramIndexes = [0]
linkChainLog = AdasChain.CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = AdasChain.CHAIN_SOURCE_ADAS,
nodeAliasCode = AdasChain.CHAIN_CODE_ADAS_SEND_PLANNING_CMD,
paramIndexes = [0]
)
override fun sendPlanningCmd(cmd: Int): Boolean {
return AdasManager.getInstance().sendPlanningCmd(cmd) > -1
}
@ChainLog(
linkChainLog = AdasChain.CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = AdasChain.CHAIN_SOURCE_ADAS,
nodeAliasCode = AdasChain.CHAIN_CODE_ADAS_SEND_PLANNING_CMD,
paramIndexes = [0]
linkChainLog = AdasChain.CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = AdasChain.CHAIN_SOURCE_ADAS,
nodeAliasCode = AdasChain.CHAIN_CODE_ADAS_SEND_PLANNING_CMD,
paramIndexes = [0]
)
override fun sendPlanningLineChangeCmd(cmd: Int): Boolean {
return AdasManager.getInstance().sendPlanningLaneChangeCmd(cmd) > -1
@@ -1529,19 +1559,19 @@ class MoGoAutopilotControlProvider :
}
override fun sendFrontCamera30Cmd(isStart: Boolean): Boolean {
return AdasManager.getInstance().sendFrontCamera30Cmd(isStart)>-1
return AdasManager.getInstance().sendFrontCamera30Cmd(isStart) > -1
}
override fun sendLidarCmd(isStart: Boolean): Boolean {
return AdasManager.getInstance().sendLidarCmd(isStart)> -1
return AdasManager.getInstance().sendLidarCmd(isStart) > -1
}
override fun sendLeftFrontRadarCmd(isStart: Boolean): Boolean {
return AdasManager.getInstance().sendLeftFrontRadarCmd(isStart)>-1
return AdasManager.getInstance().sendLeftFrontRadarCmd(isStart) > -1
}
override fun sendSimulationWireFailure(isTrigger: Boolean): Boolean {
return AdasManager.getInstance().sendSimulationWireFailure(isTrigger)>-1
return AdasManager.getInstance().sendSimulationWireFailure(isTrigger) > -1
}
/**
@@ -1551,10 +1581,10 @@ class MoGoAutopilotControlProvider :
* {@link SsmInfo.IfUpgrade#DELAY}:推迟
*/
override fun sendSsmFuncOtaDownloadResponse(
token: String,
ifUpgrade: SsmInfo.IfUpgrade
token: String,
ifUpgrade: SsmInfo.IfUpgrade
): Boolean {
return AdasManager.getInstance().sendSsmFuncOtaDownloadResponse(token, ifUpgrade)>-1
return AdasManager.getInstance().sendSsmFuncOtaDownloadResponse(token, ifUpgrade) > -1
}
/**
@@ -1563,7 +1593,7 @@ class MoGoAutopilotControlProvider :
* 如果没有可以传null或""
*/
override fun sendSsmFuncOtaStatusQuery(token: String): Boolean {
return AdasManager.getInstance().sendSsmFuncOtaStatusQuery(token)>-1
return AdasManager.getInstance().sendSsmFuncOtaStatusQuery(token) > -1
}
/**
@@ -1581,7 +1611,7 @@ class MoGoAutopilotControlProvider :
* 域控响应接口{@link OnAdasListener#onCaptureImgOnTakeOver(MessagePad.Header, boolean, MessagePad.CaptureImgOnTakeOver)}
*/
override fun sendCaptureImgReqOnTakeOver(uuid: Long): Boolean {
return AdasManager.getInstance().sendCaptureImgReqOnTakeOver(uuid)>-1
return AdasManager.getInstance().sendCaptureImgReqOnTakeOver(uuid) > -1
}
/**

View File

@@ -155,6 +155,8 @@ import system_master.SystemStatusInfo
import vllm.Vlm
import java.io.PrintWriter
import java.io.StringWriter
import java.math.BigDecimal
import java.util.Date
import kotlin.math.roundToInt
/**
@@ -1674,6 +1676,28 @@ class MoGoAdasListenerImpl : OnAdasListener {
*/
override fun onPlanningStopLine(header: MessagePad.Header, mapMsg: Hadmap.MapMsg) {
}
override fun onAdasTaskManagerOriginal(header: MessagePad.Header, data: ByteArray) {
taskManagerOriginal(header, ByteUtil.byteArrToHex(data, false))
}
@ChainLog(
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
linkCode = CHAIN_SOURCE_ADAS,
nodeAliasCode = ChainConstant.CHAIN_CODE_ADAS_TASK_MANAGER_ORIGINAL,
paramIndexes = [0, 1]
)
private fun taskManagerOriginal(header: MessagePad.Header, data: String) {
CallerLogger.i("$M_D_C$TAG", "任务管理数据:$data")
}
override fun onAdasTaskManagerDeparture(taskId: Long?, siteId: Long?, sequence: Int?, ack: Boolean, reason: String?, stationTimeLeft: Double) {
}
override fun onAdasTaskManagerArrival(taskId: Long?, siteId: Long?, sequence: Int?, mileage: BigDecimal?) {
}
override fun onAdasTaskManagerComplete(taskId: Long?, userId: Long?, status: Int?, reason: String?, completedTime: Date?, mileage: BigDecimal?) {
}
/**

View File

@@ -80,6 +80,7 @@ class ChainConstant {
const val CHAIN_CODE_ADAS_COLD_START_STATE = "CHAIN_CODE_ADAS_COLD_START_STATE"
const val CHAIN_CODE_ADAS_LOST_FRAME = "CHAIN_CODE_ADAS_LOST_FRAME"
const val CHAIN_CODE_ADAS_ALL_ERROR = "CHAIN_CODE_ADAS_ALL_ERROR"//ADAS LIB中进行的异常捕获包括解析异常和数据使用异常UI层
const val CHAIN_CODE_ADAS_TASK_MANAGER_ORIGINAL = "CHAIN_CODE_ADAS_TASK_MANAGER_ORIGINAL"
const val CHAIN_CODE_RECORD_NATIVE_LEAK = "CHAIN_CODE_RECORD_NATIVE_LEAK"

View File

@@ -15,6 +15,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendRes
import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm.TaskConfirmResp
import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume.SuspendResumeTaskReq
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop.StopTaskResp
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.Trajectory
import mogo.telematics.pad.MessagePad
import mogo.yycp.paralleldriving.protocol.ParallelDrivingRequest
import system_master.SsmInfo
@@ -44,6 +45,10 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider {
*/
fun startAutoPilot(controlParameters: AutopilotControlParameters): Long
fun sendTaskManagerAutopilotStart(taskId: Long, traj: Trajectory): Long
fun sendTaskManagerAutopilotContinue(trackId: Long, taskId: Long, stationId: Long, stationName: String, stationSeq: Int, lon: Double, lat: Double): Long
/**
* 开启自动驾驶(魔方)
*
@@ -75,7 +80,7 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider {
/**
* 结束自动驾驶
*/
fun cancelAutoPilot()
fun cancelAutoPilot(taskId: Long)
/**
* 开启域控制器录制bag包

View File

@@ -35,6 +35,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop.StopTaskResp
import com.zhjt.mogo.adas.data.AdasConstants
import com.zhjt.mogo.adas.data.bean.NodeStateInfo
import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendResume.BigTaskActionResp
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.Trajectory
import com.zhjt.service.chain.ChainLog
import com.zhjt.service_biz.BizConfig
import kotlinx.coroutines.launch
@@ -90,6 +91,32 @@ object CallerAutoPilotControlManager {
return sessionId
}
/**
* 开启自动驾驶
*
* @param controlParameters 开启自动驾驶的控制参数
*/
fun unmannedStartAutoPilot(taskId: Long, traj: Trajectory?, controlParameters: AutopilotControlParameters): Long {
if (traj == null) {
//LogUtils.eTag(TAG, "自动驾驶控制参数异常,请检查参数信息")
return -1L
}
val sessionId = providerApi?.sendTaskManagerAutopilotStart(taskId, traj) ?: -1L
// 更新记录在全局的控制参数
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(controlParameters)
return sessionId
}
//TODO 任务管理继续
// fun unmannedAutoPilotContinue(trackId: Long, taskId: Long, stationId: Long, stationName: String, stationSeq: Int, lon: Double, lat: Double): Long {
// if (traj == null) {
// //LogUtils.eTag(TAG, "自动驾驶控制参数异常,请检查参数信息")
// return -1L
// }
// val sessionId = providerApi?.sendTaskManagerAutopilotContinue(trackId, taskId, stationId, stationName, stationSeq, lon, lat) ?: -1L
// // 更新记录在全局的控制参数
// CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(controlParameters)
// return sessionId
// }
/**
* 启自驾前,是否要拦截
* @param isShowTip true: 展示Toast+语音提示; false:不展示Toast+语音提示
@@ -253,6 +280,15 @@ object CallerAutoPilotControlManager {
}
return result
}
/**
* 结束自动驾驶
*/
fun cancelAutoPilot(taskId: Long) {
// 司机屏才能取消自动驾驶
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
cancelAutoPilotInner(taskId)
}
}
/**
* 结束自动驾驶
@@ -273,8 +309,8 @@ object CallerAutoPilotControlManager {
}
}
private fun cancelAutoPilotInner() {
providerApi?.cancelAutoPilot()
private fun cancelAutoPilotInner(taskId: Long = (-1).toLong()) {
providerApi?.cancelAutoPilot(taskId)
// 更新记录在全局的控制参数
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
}

View File

@@ -18,6 +18,7 @@ import java.util.Locale
*/
object CallerFsm2024ListenerManager : CallerBase<IMoGoFsm2024Listener>() {
var fsmLocaleLanguage = "chs"
private var placeOrderStandby = false //车端走任务管理时用于判断是否能下发订单
init {
val locale = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
@@ -36,7 +37,12 @@ object CallerFsm2024ListenerManager : CallerBase<IMoGoFsm2024Listener>() {
}
}
fun getPlaceOrderStandby(): Boolean {
return placeOrderStandby
}
fun invokeFSM2024State(fsmState: Fsm2024.FSMStateMsg) {
placeOrderStandby = fsmState.placeOrderStandbyFlag
M_LISTENERS.forEach {
val listener = it.value
listener.onFSM2024State(fsmState)
@@ -54,7 +60,7 @@ object CallerFsm2024ListenerManager : CallerBase<IMoGoFsm2024Listener>() {
if (fsmEvent.activeMode == Fsm2024.ActiveMode.PILOT_ACTIVE) {
if (fsmEvent.event == Fsm2024.Event.FAIL_TO_ENTER_ACTIVE || fsmEvent.event == Fsm2024.Event.ABNORMAL_EXIT_ACTIVE) {
val title =
StringUtils.getString(if (fsmEvent.event == Fsm2024.Event.FAIL_TO_ENTER_ACTIVE) R.string.module_mogo_core_fail_to_enter_active else R.string.module_mogo_core_abnormal_exit_active)
StringUtils.getString(if (fsmEvent.event == Fsm2024.Event.FAIL_TO_ENTER_ACTIVE) R.string.module_mogo_core_fail_to_enter_active else R.string.module_mogo_core_abnormal_exit_active)
var content = StringUtils.getString(R.string.module_mogo_core_unknown_cause_fault)
var summaryContent = ""
if (fsmEvent.transitionReasonsMultiLangCount > 0) {
@@ -89,10 +95,10 @@ object CallerFsm2024ListenerManager : CallerBase<IMoGoFsm2024Listener>() {
System.currentTimeMillis()
}
CallerMsgBoxManager.saveMsgBoxNoTrace(
MsgBoxBean(
MsgBoxType.FSM_EVENT,
FSMEventMsg(title, summaryContent, content, time)
)
MsgBoxBean(
MsgBoxType.FSM_EVENT,
FSMEventMsg(title, summaryContent, content, time)
)
)
}
}

View File

@@ -119,6 +119,8 @@ public enum MessageType {
TYPE_RECEIVE_OBU_UPLOAD_STATUS(MessagePad.MessageType.MsgTypeObuUploadStatus, R.string.adas_data_MsgTypeObuUploadStatus_RECEIVE),
TYPE_RECEIVE_PLANNING_STOP_LINE(MessagePad.MessageType.MsgTypePlanningStopLine, R.string.adas_data_MsgTypePlanningStopLine),
TYPE_RECEIVE_FSM_EVENT(MessagePad.MessageType.MsgTypeFsmEvent, R.string.adas_data_MsgTypeFsmEvent),
TYPE_SEND_TASK_MANAGER(MessagePad.MessageType.MsgTypeTaskMgrAndPad, R.string.adas_data_MsgTypeTaskMgrAndPad_SEND),
TYPE_RECEIVE_TASK_MANAGER(MessagePad.MessageType.MsgTypeTaskMgrAndPad, R.string.adas_data_MsgTypeTaskMgrAndPad_RECEIVE),
//TODO 透传原始pb文件中不存在以下type。由于Java中无法强转,所以在mogo-adas-data/message_pad.proto中放开注释
TYPE_RECEIVE_PLANNING_DECISION_STATE(MessagePad.MessageType.MsgTypePlanningDecisionState, R.string.adas_data_MsgTypePlanningDecisionState),

View File

@@ -0,0 +1,70 @@
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
/**
* 自动驾驶坐标点
*/
public class AutopilotPoint {
/**
* X坐标
*/
private double x;
/**
* Y坐标
*/
private double y;
public AutopilotPoint() {
}
public AutopilotPoint(double x, double y) {
this.x = x;
this.y = y;
}
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
@Override
public String toString() {
return "AutopilotPoint{" +
"x=" + x +
", y=" + y +
'}';
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private double x;
private double y;
public Builder x(double x) {
this.x = x;
return this;
}
public Builder y(double y) {
this.y = y;
return this;
}
public AutopilotPoint build() {
return new AutopilotPoint(x, y);
}
}
}

View File

@@ -0,0 +1,112 @@
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
/**
* app发送给车端
* 开启任务
*/
public class AutopilotStartRequest {
/**
* 任务ID
*/
private Long taskId;
/**
* 来源
*/
private Integer source;
/**
* 轨迹
*/
private Trajectory traj;
/**
* 任务类型
* 0: 多站点模式 1:固定路线
*/
private Integer taskType;
public AutopilotStartRequest() {
}
public AutopilotStartRequest(Long taskId, Integer source, Trajectory traj, Integer taskType) {
this.taskId = taskId;
this.source = source;
this.traj = traj;
this.taskType = taskType;
}
public Long getTaskId() {
return taskId;
}
public void setTaskId(Long taskId) {
this.taskId = taskId;
}
public Integer getSource() {
return source;
}
public void setSource(Integer source) {
this.source = source;
}
public Trajectory getTraj() {
return traj;
}
public void setTraj(Trajectory traj) {
this.traj = traj;
}
public Integer getTaskType() {
return taskType;
}
public void setTaskType(Integer taskType) {
this.taskType = taskType;
}
@Override
public String toString() {
return "AutopilotStartRequest{" +
"taskId=" + taskId +
", source=" + source +
", traj=" + traj +
", taskType=" + taskType +
'}';
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Long taskId;
private Integer source;
private Trajectory traj;
private Integer taskType;
public Builder taskId(Long taskId) {
this.taskId = taskId;
return this;
}
public Builder source(Integer source) {
this.source = source;
return this;
}
public Builder traj(Trajectory traj) {
this.traj = traj;
return this;
}
public Builder taskType(Integer taskType) {
this.taskType = taskType;
return this;
}
public AutopilotStartRequest build() {
return new AutopilotStartRequest(taskId, source, traj, taskType);
}
}
}

View File

@@ -0,0 +1,131 @@
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
/**
* 命令数据传输对象
* @param <T> 数据类型
*/
public class CmdDto<T> {
/**
* 命令类型
*/
private String cmdType;
/**
* 任务ID
*/
private Long taskId;
/**
* 轨迹ID
*/
private Long lineId;
/**
* 时间戳
*/
private Long timestamp;
/**
* 数据
*/
private T data;
public CmdDto() {
}
public CmdDto(String cmdType, Long taskId, Long lineId, Long timestamp, T data) {
this.cmdType = cmdType;
this.taskId = taskId;
this.lineId = lineId;
this.timestamp = timestamp;
this.data = data;
}
public String getCmdType() {
return cmdType;
}
public void setCmdType(String cmdType) {
this.cmdType = cmdType;
}
public Long getTaskId() {
return taskId;
}
public void setTaskId(Long taskId) {
this.taskId = taskId;
}
public Long getLineId() {
return lineId;
}
public void setLineId(Long lineId) {
this.lineId = lineId;
}
public Long getTimestamp() {
return timestamp;
}
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
@Override
public String toString() {
return "CmdDto{" +
"cmdType='" + cmdType + '\'' +
", taskId=" + taskId +
", lineId=" + lineId +
", timestamp=" + timestamp +
", data=" + data +
'}';
}
public static <T> Builder<T> builder() {
return new Builder<>();
}
public static class Builder<T> {
private String cmdType;
private Long taskId;
private Long lineId;
private Long timestamp;
private T data;
public Builder<T> cmdType(String cmdType) {
this.cmdType = cmdType;
return this;
}
public Builder<T> taskId(Long taskId) {
this.taskId = taskId;
return this;
}
public Builder<T> lineId(Long lineId) {
this.lineId = lineId;
return this;
}
public Builder<T> timestamp(Long timestamp) {
this.timestamp = timestamp;
return this;
}
public Builder<T> data(T data) {
this.data = data;
return this;
}
public CmdDto<T> build() {
return new CmdDto<>(cmdType, taskId, lineId, timestamp, data);
}
}
}

View File

@@ -0,0 +1,76 @@
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
/**
* 车端主动发送
* 车端终止上报消息
*/
public class TaskAbortNotification {
/**
* 当前位置
*/
private VehicleSite curLocation;
/**
* 任务累计行驶距离
*/
private double accumulatedTaskDis;
/**
* 解决方案
*/
private String solution;
/**
* 错误消息
*/
private String errMsg;
public TaskAbortNotification() {
}
public TaskAbortNotification(VehicleSite curLocation, double accumulatedTaskDis, String solution, String errMsg) {
this.curLocation = curLocation;
this.accumulatedTaskDis = accumulatedTaskDis;
this.solution = solution;
this.errMsg = errMsg;
}
public VehicleSite getCurLocation() {
return curLocation;
}
public void setCurLocation(VehicleSite curLocation) {
this.curLocation = curLocation;
}
public double getAccumulatedTaskDis() {
return accumulatedTaskDis;
}
public void setAccumulatedTaskDis(double accumulatedTaskDis) {
this.accumulatedTaskDis = accumulatedTaskDis;
}
public String getSolution() {
return solution;
}
public void setSolution(String solution) {
this.solution = solution;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
@Override
public String toString() {
return "TaskAbortNotification{" +
"curLocation=" + curLocation +
", accumulatedTaskDis=" + accumulatedTaskDis +
", solution='" + solution + '\'' +
", errMsg='" + errMsg + '\'' +
'}';
}
}

View File

@@ -0,0 +1,62 @@
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
/**
* 车端主动发送
* 车端到站消息
*/
public class TaskArrivalNotification {
/**
* 当前位置
*/
private VehicleSite curLocation;
/**
* 站点
*/
private VehicleSite station;
/**
* 任务累计行驶距离
*/
private double accumulatedTaskDis;
public TaskArrivalNotification() {
}
public TaskArrivalNotification(VehicleSite curLocation, VehicleSite station, double accumulatedTaskDis) {
this.curLocation = curLocation;
this.station = station;
this.accumulatedTaskDis = accumulatedTaskDis;
}
public VehicleSite getCurLocation() {
return curLocation;
}
public void setCurLocation(VehicleSite curLocation) {
this.curLocation = curLocation;
}
public VehicleSite getStation() {
return station;
}
public void setStation(VehicleSite station) {
this.station = station;
}
public double getAccumulatedTaskDis() {
return accumulatedTaskDis;
}
public void setAccumulatedTaskDis(double accumulatedTaskDis) {
this.accumulatedTaskDis = accumulatedTaskDis;
}
@Override
public String toString() {
return "TaskArrivalNotification{" +
"curLocation=" + curLocation +
", station=" + station +
", accumulatedTaskDis=" + accumulatedTaskDis +
'}';
}
}

View File

@@ -0,0 +1,61 @@
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
/**
* 任务取消响应
*/
public class TaskCancelResponse {
/**
* 任务累计行驶距离
*/
private double accumulatedTaskDis;
/**
* 任务取消结果true:成功 false:失败
*/
private boolean result;
/**
* 任务取消失败原因 目前仅超时5秒未退出自驾
*/
private String errMsg;
public TaskCancelResponse() {
}
public TaskCancelResponse(double accumulatedTaskDis, boolean result, String errMsg) {
this.accumulatedTaskDis = accumulatedTaskDis;
this.result = result;
this.errMsg = errMsg;
}
public double getAccumulatedTaskDis() {
return accumulatedTaskDis;
}
public void setAccumulatedTaskDis(double accumulatedTaskDis) {
this.accumulatedTaskDis = accumulatedTaskDis;
}
public boolean isResult() {
return result;
}
public void setResult(boolean result) {
this.result = result;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
@Override
public String toString() {
return "TaskCancelResponse{" +
"accumulatedTaskDis=" + accumulatedTaskDis +
", result=" + result +
", errMsg='" + errMsg + '\'' +
'}';
}
}

View File

@@ -0,0 +1,51 @@
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
/**
* App发送给车端
* 离开站点
*/
public class TaskContinueNotification {
/**
* 当前站点
*/
private VehicleSite curStation;
public TaskContinueNotification() {
}
public TaskContinueNotification(VehicleSite curStation) {
this.curStation = curStation;
}
public VehicleSite getCurStation() {
return curStation;
}
public void setCurStation(VehicleSite curStation) {
this.curStation = curStation;
}
@Override
public String toString() {
return "TaskContinueNotification{" +
"curStation=" + curStation +
'}';
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private VehicleSite curStation;
public Builder curStation(VehicleSite curStation) {
this.curStation = curStation;
return this;
}
public TaskContinueNotification build() {
return new TaskContinueNotification(curStation);
}
}
}

View File

@@ -0,0 +1,14 @@
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
/**
* 任务完成通知
*/
public class TaskFinishNotification {
public TaskFinishNotification() {
}
@Override
public String toString() {
return "TaskFinishNotification{}";
}
}

View File

@@ -0,0 +1,14 @@
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
/**
* 剩余里程查询参数-暂时未使用
*/
public class TaskLocationQueryRequest {
public TaskLocationQueryRequest() {
}
@Override
public String toString() {
return "TaskLocationQueryRequest{}";
}
}

View File

@@ -0,0 +1,203 @@
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
/**
* 车端响应
* 车辆预估全程剩余里程、剩余时间
* 预估到下站预估里程、预估时间
*/
public class TaskLocationQueryResponse {
/**
* 当前位置
*/
private VehicleSite curLocation;
/**
* 上一个站点
*/
private VehicleSite preStation;
/**
* 下一个站点
*/
private VehicleSite nextStation;
/**
* 从前一站点到目前的总距离单位m
*/
private double accumulatedStationDis;
/**
* 从当前到下一站点的距离单位m
*/
private double reversedAccumulatedStationDis;
/**
* 到达下一站需要的时间单位s
*/
private double stationTimeLeft;
/**
* 速度
*/
private double velocity;
/**
* 加速度
*/
private double acceleration;
/**
* 航向角
*/
private double theta;
/**
* 曲率
*/
private double kappa;
/**
* 任务全程的行进里程(单位米)
*/
private double accumulatedTaskDis;
/**
* 任务全程的剩余里程(单位米)
*/
private double reversedAccumulatedTaskDis;
/**
* 到达终点需要的时间单位s
*/
private double taskTimeLeft;
public TaskLocationQueryResponse() {
}
public TaskLocationQueryResponse(VehicleSite curLocation, VehicleSite preStation, VehicleSite nextStation, double accumulatedStationDis, double reversedAccumulatedStationDis, double stationTimeLeft, double velocity, double acceleration, double theta, double kappa, double accumulatedTaskDis, double reversedAccumulatedTaskDis, double taskTimeLeft) {
this.curLocation = curLocation;
this.preStation = preStation;
this.nextStation = nextStation;
this.accumulatedStationDis = accumulatedStationDis;
this.reversedAccumulatedStationDis = reversedAccumulatedStationDis;
this.stationTimeLeft = stationTimeLeft;
this.velocity = velocity;
this.acceleration = acceleration;
this.theta = theta;
this.kappa = kappa;
this.accumulatedTaskDis = accumulatedTaskDis;
this.reversedAccumulatedTaskDis = reversedAccumulatedTaskDis;
this.taskTimeLeft = taskTimeLeft;
}
public VehicleSite getCurLocation() {
return curLocation;
}
public void setCurLocation(VehicleSite curLocation) {
this.curLocation = curLocation;
}
public VehicleSite getPreStation() {
return preStation;
}
public void setPreStation(VehicleSite preStation) {
this.preStation = preStation;
}
public VehicleSite getNextStation() {
return nextStation;
}
public void setNextStation(VehicleSite nextStation) {
this.nextStation = nextStation;
}
public double getAccumulatedStationDis() {
return accumulatedStationDis;
}
public void setAccumulatedStationDis(double accumulatedStationDis) {
this.accumulatedStationDis = accumulatedStationDis;
}
public double getReversedAccumulatedStationDis() {
return reversedAccumulatedStationDis;
}
public void setReversedAccumulatedStationDis(double reversedAccumulatedStationDis) {
this.reversedAccumulatedStationDis = reversedAccumulatedStationDis;
}
public double getStationTimeLeft() {
return stationTimeLeft;
}
public void setStationTimeLeft(double stationTimeLeft) {
this.stationTimeLeft = stationTimeLeft;
}
public double getVelocity() {
return velocity;
}
public void setVelocity(double velocity) {
this.velocity = velocity;
}
public double getAcceleration() {
return acceleration;
}
public void setAcceleration(double acceleration) {
this.acceleration = acceleration;
}
public double getTheta() {
return theta;
}
public void setTheta(double theta) {
this.theta = theta;
}
public double getKappa() {
return kappa;
}
public void setKappa(double kappa) {
this.kappa = kappa;
}
public double getAccumulatedTaskDis() {
return accumulatedTaskDis;
}
public void setAccumulatedTaskDis(double accumulatedTaskDis) {
this.accumulatedTaskDis = accumulatedTaskDis;
}
public double getReversedAccumulatedTaskDis() {
return reversedAccumulatedTaskDis;
}
public void setReversedAccumulatedTaskDis(double reversedAccumulatedTaskDis) {
this.reversedAccumulatedTaskDis = reversedAccumulatedTaskDis;
}
public double getTaskTimeLeft() {
return taskTimeLeft;
}
public void setTaskTimeLeft(double taskTimeLeft) {
this.taskTimeLeft = taskTimeLeft;
}
@Override
public String toString() {
return "TaskLocationQueryResponse{" +
"curLocation=" + curLocation +
", preStation=" + preStation +
", nextStation=" + nextStation +
", accumulatedStationDis=" + accumulatedStationDis +
", reversedAccumulatedStationDis=" + reversedAccumulatedStationDis +
", stationTimeLeft=" + stationTimeLeft +
", velocity=" + velocity +
", acceleration=" + acceleration +
", theta=" + theta +
", kappa=" + kappa +
", accumulatedTaskDis=" + accumulatedTaskDis +
", reversedAccumulatedTaskDis=" + reversedAccumulatedTaskDis +
", taskTimeLeft=" + taskTimeLeft +
'}';
}
}

View File

@@ -0,0 +1,91 @@
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
import java.util.List;
/**
* 车端发送车辆启动结果
*/
public class TaskStartNotification {
/**
* 当前位置
*/
private VehicleSite curLocation;
/**
* 自动驾驶结果
*/
private boolean autopilotResult;
/**
* 站点剩余时间
*/
private double stationTimeLeft;
/**
* 错误消息
*/
private String errMsg;
/**
* 错误码
*/
private List<Integer> errCodes;
public TaskStartNotification() {
}
public TaskStartNotification(VehicleSite curLocation, boolean autopilotResult, double stationTimeLeft, String errMsg, List<Integer> errCodes) {
this.curLocation = curLocation;
this.autopilotResult = autopilotResult;
this.stationTimeLeft = stationTimeLeft;
this.errMsg = errMsg;
this.errCodes = errCodes;
}
public VehicleSite getCurLocation() {
return curLocation;
}
public void setCurLocation(VehicleSite curLocation) {
this.curLocation = curLocation;
}
public boolean isAutopilotResult() {
return autopilotResult;
}
public void setAutopilotResult(boolean autopilotResult) {
this.autopilotResult = autopilotResult;
}
public double getStationTimeLeft() {
return stationTimeLeft;
}
public void setStationTimeLeft(double stationTimeLeft) {
this.stationTimeLeft = stationTimeLeft;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
public List<Integer> getErrCodes() {
return errCodes;
}
public void setErrCodes(List<Integer> errCodes) {
this.errCodes = errCodes;
}
@Override
public String toString() {
return "TaskStartNotification{" +
"curLocation=" + curLocation +
", autopilotResult=" + autopilotResult +
", stationTimeLeft=" + stationTimeLeft +
", errMsg='" + errMsg + '\'' +
", errCodes=" + errCodes +
'}';
}
}

View File

@@ -0,0 +1,252 @@
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
import java.util.List;
/**
* 轨迹
*/
public class Trajectory {
/**
* 路线ID
*/
private Long id;
/**
* 名称
*/
private String name;
/**
* 轨迹URL
*/
private String trajUrl;
/**
* 轨迹MD5
*/
private String trajMd5;
/**
* 轨迹版本
*/
private String trajVer;
/**
* 停止点URL
*/
private String stopUrl;
/**
* 停止点MD5
*/
private String stopMd5;
/**
* 停止点版本
*/
private String stopVer;
/**
* 时间戳
*/
private Long timestamp;
/**
* 途经点
*/
private List<VehicleSite> wayPoints;
/**
* 黑名单点
*/
private List<VehicleSite> blackPoints;
public Trajectory() {
}
public Trajectory(Long id, String name, String trajUrl, String trajMd5, String trajVer, String stopUrl, String stopMd5, String stopVer, Long timestamp, List<VehicleSite> wayPoints, List<VehicleSite> blackPoints) {
this.id = id;
this.name = name;
this.trajUrl = trajUrl;
this.trajMd5 = trajMd5;
this.trajVer = trajVer;
this.stopUrl = stopUrl;
this.stopMd5 = stopMd5;
this.stopVer = stopVer;
this.timestamp = timestamp;
this.wayPoints = wayPoints;
this.blackPoints = blackPoints;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTrajUrl() {
return trajUrl;
}
public void setTrajUrl(String trajUrl) {
this.trajUrl = trajUrl;
}
public String getTrajMd5() {
return trajMd5;
}
public void setTrajMd5(String trajMd5) {
this.trajMd5 = trajMd5;
}
public String getTrajVer() {
return trajVer;
}
public void setTrajVer(String trajVer) {
this.trajVer = trajVer;
}
public String getStopUrl() {
return stopUrl;
}
public void setStopUrl(String stopUrl) {
this.stopUrl = stopUrl;
}
public String getStopMd5() {
return stopMd5;
}
public void setStopMd5(String stopMd5) {
this.stopMd5 = stopMd5;
}
public String getStopVer() {
return stopVer;
}
public void setStopVer(String stopVer) {
this.stopVer = stopVer;
}
public Long getTimestamp() {
return timestamp;
}
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
public List<VehicleSite> getWayPoints() {
return wayPoints;
}
public void setWayPoints(List<VehicleSite> wayPoints) {
this.wayPoints = wayPoints;
}
public List<VehicleSite> getBlackPoints() {
return blackPoints;
}
public void setBlackPoints(List<VehicleSite> blackPoints) {
this.blackPoints = blackPoints;
}
@Override
public String toString() {
return "Trajectory{" +
"id=" + id +
", name='" + name + '\'' +
", trajUrl='" + trajUrl + '\'' +
", trajMd5='" + trajMd5 + '\'' +
", trajVer='" + trajVer + '\'' +
", stopUrl='" + stopUrl + '\'' +
", stopMd5='" + stopMd5 + '\'' +
", stopVer='" + stopVer + '\'' +
", timestamp=" + timestamp +
", wayPoints=" + wayPoints +
", blackPoints=" + blackPoints +
'}';
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Long id;
private String name;
private String trajUrl;
private String trajMd5;
private String trajVer;
private String stopUrl;
private String stopMd5;
private String stopVer;
private Long timestamp;
private List<VehicleSite> wayPoints;
private List<VehicleSite> blackPoints;
public Builder id(Long id) {
this.id = id;
return this;
}
public Builder name(String name) {
this.name = name;
return this;
}
public Builder trajUrl(String trajUrl) {
this.trajUrl = trajUrl;
return this;
}
public Builder trajMd5(String trajMd5) {
this.trajMd5 = trajMd5;
return this;
}
public Builder trajVer(String trajVer) {
this.trajVer = trajVer;
return this;
}
public Builder stopUrl(String stopUrl) {
this.stopUrl = stopUrl;
return this;
}
public Builder stopMd5(String stopMd5) {
this.stopMd5 = stopMd5;
return this;
}
public Builder stopVer(String stopVer) {
this.stopVer = stopVer;
return this;
}
public Builder timestamp(Long timestamp) {
this.timestamp = timestamp;
return this;
}
public Builder wayPoints(List<VehicleSite> wayPoints) {
this.wayPoints = wayPoints;
return this;
}
public Builder blackPoints(List<VehicleSite> blackPoints) {
this.blackPoints = blackPoints;
return this;
}
public Trajectory build() {
return new Trajectory(id, name, trajUrl, trajMd5, trajVer, stopUrl, stopMd5, stopVer, timestamp, wayPoints, blackPoints);
}
}
}

View File

@@ -0,0 +1,173 @@
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
/**
* 车辆站点
*/
public class VehicleSite {
/**
* 坐标类型
*/
private Integer coordinateType;
/**
* 坐标点
*/
private AutopilotPoint point;
/**
* 站点类型
*/
private Integer station;
/**
* 站点ID
*/
private Long stationId;
/**
* 站点名称
*/
private String stationName;
/**
* 站点序号
*/
private Integer stationSeq;
/**
* 是否临时不停靠
* 1正常停靠 2临时不停靠
*/
private Integer tag = 1;
public VehicleSite() {
}
public VehicleSite(Integer coordinateType, AutopilotPoint point, Integer station, Long stationId, String stationName, Integer stationSeq, Integer tag) {
this.coordinateType = coordinateType;
this.point = point;
this.station = station;
this.stationId = stationId;
this.stationName = stationName;
this.stationSeq = stationSeq;
this.tag = tag;
}
public Integer getCoordinateType() {
return coordinateType;
}
public void setCoordinateType(Integer coordinateType) {
this.coordinateType = coordinateType;
}
public AutopilotPoint getPoint() {
return point;
}
public void setPoint(AutopilotPoint point) {
this.point = point;
}
public Integer getStation() {
return station;
}
public void setStation(Integer station) {
this.station = station;
}
public Long getStationId() {
return stationId;
}
public void setStationId(Long stationId) {
this.stationId = stationId;
}
public String getStationName() {
return stationName;
}
public void setStationName(String stationName) {
this.stationName = stationName;
}
public Integer getStationSeq() {
return stationSeq;
}
public void setStationSeq(Integer stationSeq) {
this.stationSeq = stationSeq;
}
public Integer getTag() {
return tag;
}
public void setTag(Integer tag) {
this.tag = tag;
}
@Override
public String toString() {
return "VehicleSite{" +
"coordinateType=" + coordinateType +
", point=" + point +
", station=" + station +
", stationId=" + stationId +
", stationName='" + stationName + '\'' +
", stationSeq=" + stationSeq +
", tag=" + tag +
'}';
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private Integer coordinateType;
private AutopilotPoint point;
private Integer station;
private Long stationId;
private String stationName;
private Integer stationSeq;
private Integer tag = 1;
public Builder coordinateType(Integer coordinateType) {
this.coordinateType = coordinateType;
return this;
}
public Builder point(AutopilotPoint point) {
this.point = point;
return this;
}
public Builder station(Integer station) {
this.station = station;
return this;
}
public Builder stationId(Long stationId) {
this.stationId = stationId;
return this;
}
public Builder stationName(String stationName) {
this.stationName = stationName;
return this;
}
public Builder stationSeq(Integer stationSeq) {
this.stationSeq = stationSeq;
return this;
}
public Builder tag(Integer tag) {
this.tag = tag;
return this;
}
public VehicleSite build() {
return new VehicleSite(coordinateType, point, station, stationId, stationName, stationSeq, tag);
}
}
}

View File

@@ -0,0 +1,25 @@
package com.zhjt.mogo.adas.unmanned.task.enums;
public enum AutopilotCoordinateTypeEnum {
WGS84(0,"WGS84"),GCJ02(1,"GCJ02"),UTM(2,"UTM");
private int code;
private String desc;
private AutopilotCoordinateTypeEnum(int code, String desc) {
this.code = code;
this.desc = desc;
}
public int getCode() {
return code;
}
public static AutopilotCoordinateTypeEnum codeOf(Integer code) {
for(AutopilotCoordinateTypeEnum typeEnum : AutopilotCoordinateTypeEnum.values()) {
if (code == typeEnum.code){
return typeEnum;
}
}
return null;
}
}

View File

@@ -0,0 +1,49 @@
package com.zhjt.mogo.adas.unmanned.task.enums;
import android.text.TextUtils;
import androidx.annotation.Nullable;
public enum MessageCmdEnum {
AutopilotStartRequest("AutopilotStartRequest", "APP开始任务"),
TaskContinueNotification("TaskContinueNotification", "站点出发"),
TaskFinishNotification("TaskFinishNotification", "任务完成"),
TaskLocationQueryRequest("TaskLocationQueryRequest", "任务查询"),
TaskStartNotification("TaskStartNotification", "自驾/离站结果回执"),
TaskArrivalNotification("TaskArrivalNotification", "到站通知"),
TaskAbortNotification("TaskAbortNotification", "任务终止"),
TaskLocationQueryResponse("TaskLocationQueryResponse", "任务查询结果"),
TaskCancelRequest("TaskCancelRequest", "任务取消请求"),
TaskCancelResponse("TaskCancelResponse", "任务取消请求"),
TaskQueryStateRequest("TaskQueryStateRequest", "任务状态查询"),
TaskQueryStateResponse("TaskQueryStateResponse", "任务状态查询响应"),
;
private final String code;
private final String desc;
private MessageCmdEnum(String code, String desc) {
this.code = code;
this.desc = desc;
}
public String getCode() {
return code;
}
public String getDesc() {
return desc;
}
public static MessageCmdEnum codeOf(@Nullable String code) {
if (TextUtils.isEmpty(code)) return null;
for (MessageCmdEnum typeEnum : MessageCmdEnum.values()) {
if (code.equals(typeEnum.code)) {
return typeEnum;
}
}
return null;
}
}

View File

@@ -0,0 +1,33 @@
package com.zhjt.mogo.adas.unmanned.task.enums;
public enum RouteTypeEnum {
SiteRoute(0, "多站点模式"),
LineRoute(1, "路线模式");
private int code;
private String desc;
private RouteTypeEnum(int code, String desc) {
this.code = code;
this.desc = desc;
}
public int getCode() {
return code;
}
public String getDesc() {
return desc;
}
public static RouteTypeEnum codeOf(Integer code) {
for (RouteTypeEnum typeEnum : RouteTypeEnum.values()) {
if (code == typeEnum.code) {
return typeEnum;
}
}
return null;
}
}

View File

@@ -0,0 +1,25 @@
package com.zhjt.mogo.adas.unmanned.task.enums;
public enum StationEnum {
SITE(0,"业务站点"),WAY(1,"途径点");
private int code;
private String desc;
private StationEnum(int code, String desc) {
this.code = code;
this.desc = desc;
}
public int getCode() {
return code;
}
public static StationEnum codeOf(Integer code) {
for(StationEnum typeEnum : StationEnum.values()) {
if (code == typeEnum.code){
return typeEnum;
}
}
return null;
}
}

View File

@@ -0,0 +1,26 @@
package com.zhjt.mogo.adas.unmanned.task.enums;
public enum TaskStatusEnum {
INIT(0), START(10), CANCEL_ING(90), COMPLETE(100), FAIL(110), CANCEL(120);
private int code;
private TaskStatusEnum(int code) {
this.code = code;
}
public int getCode() {
return code;
}
public static TaskStatusEnum codeOf(Integer code) {
for (TaskStatusEnum typeEnum : TaskStatusEnum.values()) {
if (code == typeEnum.code) {
return typeEnum;
}
}
return null;
}
}

View File

@@ -2,6 +2,7 @@ syntax = "proto3";
package mogo.telematics.pad;
import "geometry.proto";
import "header.proto";
enum ProtocolVersion
{
@@ -114,6 +115,7 @@ enum MessageType
MsgTypeObuUploadStatus = 0x1013A;//obu上报状态查询以结果(上下行)
MsgTypePlanningStopLine = 0x1013B;//决策停止线(自动驾驶决策呈现使用) 定频理论是10hz实际会有不同
MsgTypeFsmEvent = 0x1013C;//fsm event msg
MsgTypeTaskMgrAndPad = 0x10142; //鹰眼和任务管理之间的消息透传
}
message Header
@@ -1068,3 +1070,6 @@ message SetEnableReq
{
uint32 enable = 1; //1: enable, 0: disable
}
// message definition for MessageType: MsgTypeTaskMgrAndPad
//bytes

View File

@@ -94,6 +94,8 @@
<string name="adas_data_MsgTypeObuUploadStatus_RECEIVE">Domain control OBU upload status response</string>
<string name="adas_data_MsgTypePlanningStopLine">Planning Stop Line</string>
<string name="adas_data_MsgTypeFsmEvent">FSM Event</string>
<string name="adas_data_MsgTypeTaskMgrAndPad_SEND">Send Task Management Message</string>
<string name="adas_data_MsgTypeTaskMgrAndPad_RECEIVE">Receive Task Management Message</string>
<string name="adas_data_MsgTypePlanningDecisionState">Planning decision state</string>
<string name="adas_data_MsgTypeSweeperTaskIndexData">Sweeper index data</string>
<string name="adas_data_MsgTypeObuWarningData">OBU warning event</string>

View File

@@ -94,6 +94,8 @@
<string name="adas_data_MsgTypeObuUploadStatus_RECEIVE">域控上报OBU开关状态响应</string>
<string name="adas_data_MsgTypePlanningStopLine">决策停止线</string>
<string name="adas_data_MsgTypeFsmEvent">FSM事件</string>
<string name="adas_data_MsgTypeTaskMgrAndPad_SEND">发送任任务管理消息</string>
<string name="adas_data_MsgTypeTaskMgrAndPad_RECEIVE">接收任务管理消息</string>
<string name="adas_data_MsgTypePlanningDecisionState">Planning决策状态</string>
<string name="adas_data_MsgTypeSweeperTaskIndexData">清扫车指标数据</string>
<string name="adas_data_MsgTypeObuWarningData">OBU预警事件</string>

View File

@@ -24,6 +24,7 @@ import com.zhidao.support.adas.high.common.CertificateUtils;
import com.zhidao.support.adas.high.common.Constants;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.common.Define;
import com.zhidao.support.adas.high.common.JsonUtil;
import com.zhidao.support.adas.high.common.ParallelDrivingManager;
import com.zhidao.support.adas.high.common.PingAddressHelper;
import com.zhidao.support.adas.high.common.ProtocolStatus;
@@ -60,9 +61,22 @@ import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendRes
import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm;
import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume;
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.AutopilotPoint;
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.AutopilotStartRequest;
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.CmdDto;
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskContinueNotification;
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.Trajectory;
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.VehicleSite;
import com.zhjt.mogo.adas.unmanned.task.enums.AutopilotCoordinateTypeEnum;
import com.zhjt.mogo.adas.unmanned.task.enums.MessageCmdEnum;
import com.zhjt.mogo.adas.unmanned.task.enums.RouteTypeEnum;
import com.zhjt.mogo.adas.unmanned.task.enums.StationEnum;
import com.zhjt.mogo.adas.utils.ByteUtil;
import com.zhjt.service.chain.ChainLog;
import org.json.JSONObject;
import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -3143,6 +3157,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
/**
* 查询OTA2.0状态
*
* @param queryStr 域控发送OTA升级请求中的 {"cmd":"PAD_QUERY_UPGRADE_STATUS","token":"123"}
* @return 消息是否添加到WS消息发送队列返回值为非0的正整数时表示下发消息的消息ID
* * >=0表示添加到WS发送消息队列
@@ -3375,5 +3390,65 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
public long sendImgUploadCloudStatusQuery() {
return sendPBMessage(MessageType.TYPE_SEND_IMG_UPLOAD_CLOUD_STATUS_QUERY, null);
}
private <T> long sendTaskManager(T data) {
// MessagePad.TaskManager.Builder builder = MessagePad.TaskManager
// .newBuilder()
// .setTaskData(com.google.protobuf.ByteString.copyFrom(JsonUtil.toJsonBase64(data).getBytes(StandardCharsets.UTF_8)));
// return sendPBMessage(MessageType.TYPE_SEND_TASK_MANAGER, builder.build().toByteArray());
return sendPBMessage(MessageType.TYPE_SEND_TASK_MANAGER, JsonUtil.toJsonBase64(data).getBytes(StandardCharsets.UTF_8));
}
/**
* 向任务管理发送启动自驾命令
*
* @param taskId 任务ID, 同原接口的orderid 首次和头部校验
* @param traj 轨迹信息
* @return
*/
@Override
public long sendTaskManagerAutopilotStart(Long taskId, Trajectory traj) {
AutopilotStartRequest autopilotStartRequest = AutopilotStartRequest.builder()
.taskId(taskId).source(1).traj(traj).taskType(RouteTypeEnum.LineRoute.getCode()).build();
CmdDto<AutopilotStartRequest> cmdDto = CmdDto.<AutopilotStartRequest>builder().cmdType(MessageCmdEnum.AutopilotStartRequest.getCode()).taskId(taskId)
.lineId(traj.getId()).timestamp(System.currentTimeMillis()).data(autopilotStartRequest).build();
return sendTaskManager(cmdDto);
}
/**
* 向任务管理发送继续自驾命令
*
* @param trackId
* @param taskId
* @param stationId
* @param stationName
* @param stationSeq
* @param lon
* @param lat
* @return
*/
@Override
public long sendTaskManagerAutopilotContinue(Long trackId, Long taskId, Long stationId, String stationName, Integer stationSeq, double lon, double lat) {
VehicleSite vehicleSite = VehicleSite.builder().stationId(stationId).stationName(stationName)
.station(StationEnum.SITE.getCode()).stationSeq(stationSeq)
.point(AutopilotPoint.builder().x(lon).y(lat).build()).coordinateType(AutopilotCoordinateTypeEnum.WGS84.getCode()).build();
TaskContinueNotification taskContinueNotification = TaskContinueNotification.builder().curStation(vehicleSite).build();
CmdDto<TaskContinueNotification> cmdDto = CmdDto.<TaskContinueNotification>builder().cmdType(MessageCmdEnum.TaskContinueNotification.getCode()).taskId(taskId).lineId(trackId).timestamp(System.currentTimeMillis()).data(taskContinueNotification).build();
return sendTaskManager(cmdDto);
}
/**
* 向任务管理发送取消自驾命令
*
* @param taskId
* @return
*/
@Override
public long sendTaskManagerAutopilotCancel(Long taskId) {
CmdDto<JSONObject> cmdDto = CmdDto.<JSONObject>builder().cmdType(MessageCmdEnum.TaskCancelRequest.getCode()).taskId(taskId)
.lineId(0L).timestamp(System.currentTimeMillis()).data(new JSONObject()).build();
return sendTaskManager(cmdDto);
}
}

View File

@@ -28,6 +28,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendRes
import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm;
import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume;
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.Trajectory;
import java.util.HashSet;
import java.util.List;
@@ -1883,6 +1884,7 @@ public class AdasManager implements IAdasNetCommApi {
/**
* OTA2.0 请求命令下发
*
* @param queryStr {"cmd":"PAD_QUERY_UPGRADE_STATUS","token":"123"} JSON
* @return
*/
@@ -2085,6 +2087,21 @@ public class AdasManager implements IAdasNetCommApi {
return mChannel == null ? -1L : mChannel.sendImgUploadCloudStatusQuery();
}
@Override
public long sendTaskManagerAutopilotStart(Long taskId, Trajectory traj) {
return mChannel == null ? -1L : mChannel.sendTaskManagerAutopilotStart(taskId, traj);
}
@Override
public long sendTaskManagerAutopilotContinue(Long trackId, Long taskId, Long stationId, String stationName, Integer stationSeq, double lon, double lat) {
return mChannel == null ? -1L : mChannel.sendTaskManagerAutopilotContinue(trackId, taskId, stationId, stationName, stationSeq, lon, lat);
}
@Override
public long sendTaskManagerAutopilotCancel(Long taskId) {
return mChannel == null ? -1L : mChannel.sendTaskManagerAutopilotCancel(taskId);
}
/**
* 查询节点状态
*

View File

@@ -16,6 +16,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendRes
import com.zhjt.mogo.adas.data.sweeper.task.confirm.SweeperTaskConfirm;
import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume;
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.Trajectory;
import java.util.List;
import java.util.Map;
@@ -1375,6 +1376,7 @@ public interface IAdasNetCommApi {
/**
* OTA2.0查询
*
* @param queryStr {"cmd":"PAD_QUERY_UPGRADE_STATUS","token":"123"} JSON
*/
long sendOtaPadMsgQuery(@Nullable String queryStr);
@@ -1534,6 +1536,12 @@ public interface IAdasNetCommApi {
*/
long sendImgUploadCloudStatusQuery();
long sendTaskManagerAutopilotStart(Long taskId, Trajectory traj);
long sendTaskManagerAutopilotContinue(Long trackId, Long taskId, Long stationId, String stationName, Integer stationSeq, double lon, double lat);
long sendTaskManagerAutopilotCancel(Long taskId);
/**
* 向工控机发送数据
*

View File

@@ -34,7 +34,9 @@ import com.zhjt.mogo.adas.data.sweeper.task.s_r.SweeperTaskSuspendResume;
import com.zhjt.mogo.adas.data.sweeper.task.status.SweeperTaskStatus;
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import bag_manager.BagManagerOuterClass;
import chassis.Chassis;
@@ -795,6 +797,48 @@ public interface OnAdasListener {
*/
void onPlanningStopLine(@NonNull MessagePad.Header header, @NonNull Hadmap.MapMsg mapMsg);
/**
* 域控任务管理原始数据
*
* @param header 头
* @param data 数据
*/
void onAdasTaskManagerOriginal(@NonNull MessagePad.Header header, @NonNull byte[] data);
/**
* 域控任务管理离站通知
*
* @param taskId
* @param siteId
* @param sequence
* @param ack
* @param reason
* @param stationTimeLeft
*/
void onAdasTaskManagerDeparture(Long taskId, Long siteId, Integer sequence, boolean ack, String reason, double stationTimeLeft);
/**
* 域控任务管理到站通知
*
* @param taskId 任务ID, 同原接口的orderid 首次和头部校验
* @param siteId 站点编号,对应云平台固定值
* @param sequence 站点序号对应顺序列表里站点流程从1开始1为起始点最大值为终点。 途径点填写0
* @param mileage 任务全程的已经行进的里程
*/
void onAdasTaskManagerArrival(Long taskId, Long siteId, Integer sequence, BigDecimal mileage);
/**
* 域控任务管理终止任务
*
* @param taskId
* @param userId
* @param status
* @param reason
* @param completedTime
* @param mileage
*/
void onAdasTaskManagerComplete(Long taskId, Long userId, Integer status, String reason, Date completedTime, BigDecimal mileage);
/**
* 是否有能力启动自动驾驶
*

View File

@@ -0,0 +1,35 @@
package com.zhidao.support.adas.high.common;
import android.util.Base64;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
public class ByteArrayToBase64TypeAdapter extends TypeAdapter<byte[]> {
@Override
public void write(JsonWriter writer, byte[] value) throws IOException {
if (value == null) {
writer.nullValue();
return;
}
// 将 byte[] 编码为 Base64 字符串并写入JSON
String base64 = Base64.encodeToString(value, Base64.NO_WRAP);
writer.value(base64);
}
@Override
public byte[] read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull();
return null;
}
// 从JSON中读取字符串并将其从 Base64 解码回 byte[]
String base64 = reader.nextString();
return Base64.decode(base64, Base64.NO_WRAP);
}
}

View File

@@ -1,66 +1,62 @@
package com.zhidao.support.adas.high.common;
import android.util.Base64;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
/**
* Java对象和JSON字符串相互转化工具类
* 格式化
*
* @author xfk
*/
public final class JsonUtil {
// 1. 预先创建单例,避免重复 new 对象带来的开销
private static final Gson COMMON_GSON = new GsonBuilder()
.setDateFormat("yyyy-MM-dd HH:mm:ss")
.create();
private static final Gson NULL_SERIALIZE_GSON = new GsonBuilder()
.setDateFormat("yyyy-MM-dd HH:mm:ss")
.serializeNulls()
.create();
private JsonUtil() {
// 私有构造函数,防止被实例化
}
/**
* 对象转换成json字符串
*
* @param obj
* @return
*/
public static String toJson(Object obj) {
return toJson(false, obj);
}
public static String toJsonBase64(Object obj) {
String value = toJson(false, obj);
return Base64.encodeToString(value.getBytes(StandardCharsets.UTF_8), Base64.NO_WRAP);
}
public static String toJson(boolean isSerializeNulls, Object obj) {
Gson gson;
if (isSerializeNulls) {
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.serializeNulls(); //重点
gson = gsonBuilder.create();
} else {
gson = new Gson();
}
return gson.toJson(obj);
if (obj == null) return null;
return isSerializeNulls ? NULL_SERIALIZE_GSON.toJson(obj) : COMMON_GSON.toJson(obj);
}
/**
* json字符串转成对象
*
* @param str
* @param type
* @return
*/
public static <T> T fromJson(String str, Type type) {
Gson gson = new Gson();
return gson.fromJson(str, type);
if (isEmpty(str)) return null;
return COMMON_GSON.fromJson(str, type);
}
/**
* json字符串转成对象
*
* @param str
* @param type
* @return
*/
public static <T> T fromJson(String str, Class<T> type) {
Gson gson = new Gson();
return gson.fromJson(str, type);
if (isEmpty(str)) return null;
return COMMON_GSON.fromJson(str, type);
}
public static <T> T fromJson(JsonElement object, Class<T> type) {
if (object == null) return null;
return COMMON_GSON.fromJson(object, type);
}
}
private static boolean isEmpty(String str) {
return str == null || str.trim().isEmpty();
}
}

View File

@@ -65,6 +65,7 @@ public class MyMessageFactory implements IMyMessageFactory {
private IMsg obuUploadStatusMessage;//域控上报OBU开关状态响应
private IMsg planningStopLineMessage;//决策停止线
private IMsg fSMEventMessage;//FSM事件
private IMsg taskMgrAndPadMessage;//任务管理消息
private final AutopilotReview autopilotReview;
private final TurnLightState lightLeft = new TurnLightState();
@@ -382,11 +383,17 @@ public class MyMessageFactory implements IMyMessageFactory {
}
return planningStopLineMessage;
} else if (messageType == MessageType.TYPE_RECEIVE_FSM_EVENT.typeCode) {
//决策停止线
//FSM事件
if (fSMEventMessage == null) {
fSMEventMessage = new FSMEventMessage();
}
return fSMEventMessage;
} else if (messageType == MessageType.TYPE_RECEIVE_TASK_MANAGER.typeCode) {
//任务管理消息
if (taskMgrAndPadMessage == null) {
taskMgrAndPadMessage = new TaskManagerMessage();
}
return taskMgrAndPadMessage;
} else {
//MessageType.TYPE_DEFAULT.typeCode
return null;

View File

@@ -0,0 +1,105 @@
package com.zhidao.support.adas.high.msg;
import android.os.SystemClock;
import android.util.Log;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
import com.google.protobuf.InvalidProtocolBufferException;
import com.zhidao.support.adas.high.AdasChannel;
import com.zhidao.support.adas.high.OnAdasListener;
import com.zhidao.support.adas.high.common.CupidLogUtils;
import com.zhidao.support.adas.high.common.JsonUtil;
import com.zhidao.support.adas.high.protocol.RawData;
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.CmdDto;
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskAbortNotification;
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskArrivalNotification;
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskLocationQueryResponse;
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskStartNotification;
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.VehicleSite;
import com.zhjt.mogo.adas.unmanned.task.enums.MessageCmdEnum;
import com.zhjt.mogo.adas.unmanned.task.enums.TaskStatusEnum;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.Date;
/**
* 任务管理消息
*/
public class TaskManagerMessage extends MyAbstractMessageHandler {
private static final String TAG = TaskManagerMessage.class.getSimpleName();
public TaskManagerMessage() {
}
@Override
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
int len = raw.getPackageLengthValue() - raw.getOffsetValue();
byte[] data = new byte[len];
System.arraycopy(raw.originalData.toByteArray(), raw.getOffsetValue(), data, 0, len);
AdasChannel.calculateTimeConsumingOnDispatchRaw("任务管理消息", raw.receiveTime);
long nowTime = 0;
if (CupidLogUtils.isEnableLog())
nowTime = SystemClock.elapsedRealtime();
if (adasListener != null) {
adasListener.onAdasTaskManagerOriginal(raw.getHeader(), data);
parse(adasListener, new String(data, StandardCharsets.UTF_8));
}
AdasChannel.calculateTimeConsumingBusiness("任务管理消息", nowTime);
}
private void parse(OnAdasListener adasListener, String data) {
Log.i(TAG, "任务管理接收原始数据=" + data);
JsonObject jsonObject = JsonParser.parseString(data).getAsJsonObject();
String cmdType = jsonObject.get("cmdType").getAsString();
MessageCmdEnum messageCmdEnum = MessageCmdEnum.codeOf(cmdType);
if (messageCmdEnum == MessageCmdEnum.TaskStartNotification) {//自驾/离站结果回执
CmdDto<TaskStartNotification> cmdDto = JsonUtil.fromJson(data, new TypeToken<CmdDto<TaskStartNotification>>() {
}.getType());
if (cmdDto != null) {
Log.i(TAG, "onAdasTaskManagerDeparture=" + cmdDto);
TaskStartNotification taskStartNotification = cmdDto.getData();
VehicleSite vehicleSite = taskStartNotification.getCurLocation();
adasListener.onAdasTaskManagerDeparture(cmdDto.getTaskId(), vehicleSite.getStationId(), vehicleSite.getStationSeq(), taskStartNotification.isAutopilotResult(), taskStartNotification.getErrMsg(), taskStartNotification.getStationTimeLeft());
}
} else if (messageCmdEnum == MessageCmdEnum.TaskArrivalNotification) {//到站通知
CmdDto<TaskArrivalNotification> cmdDto = JsonUtil.fromJson(data, new TypeToken<CmdDto<TaskArrivalNotification>>() {
}.getType());
if (cmdDto != null) {
Log.i(TAG, "onAdasTaskManagerArrival=" + cmdDto);
TaskArrivalNotification taskArrivalNotification = cmdDto.getData();
VehicleSite vehicleSite = taskArrivalNotification.getCurLocation();
adasListener.onAdasTaskManagerArrival(cmdDto.getTaskId(), vehicleSite.getStationId(), vehicleSite.getStationSeq(), BigDecimal.valueOf(taskArrivalNotification.getAccumulatedTaskDis()));
}
} else if (messageCmdEnum == MessageCmdEnum.TaskAbortNotification) {//终止任务
CmdDto<TaskAbortNotification> cmdDto = JsonUtil.fromJson(data, new TypeToken<CmdDto<TaskAbortNotification>>() {
}.getType());
if (cmdDto != null) {
Log.i(TAG, "onAdasTaskManagerComplete=" + cmdDto);
TaskAbortNotification taskAbortNotification = cmdDto.getData();
Log.i(TAG, "onAdasTaskManagerComplete=" + taskAbortNotification);
VehicleSite vehicleSite = taskAbortNotification.getCurLocation();
adasListener.onAdasTaskManagerComplete(cmdDto.getTaskId(), null, TaskStatusEnum.CANCEL.getCode(), taskAbortNotification.getErrMsg(), new Date(), BigDecimal.valueOf(taskAbortNotification.getAccumulatedTaskDis()));
}
} else if (messageCmdEnum == MessageCmdEnum.TaskLocationQueryResponse) {//任务查询结果
CmdDto<TaskLocationQueryResponse> cmdDto = JsonUtil.fromJson(data, new TypeToken<CmdDto<TaskLocationQueryResponse>>() {
}.getType());
if (cmdDto != null) {
Log.i(TAG, "onAdasTaskLocationQueryResponse=" + cmdDto);
TaskLocationQueryResponse taskLocationQueryResponse = cmdDto.getData();
}
}
}
}