Merge branch 'dev_robotaxi-d_250417_8.0.0_routing' into dev_robotaxi-d_250709_8.2.0_advideo

# Conflicts:
#	OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/model/MusicModel.kt
#	OCH/common/common/src/main/java/com/mogo/och/common/module/constant/OchCommonConst.kt
This commit is contained in:
yangyakun
2025-07-29 16:43:30 +08:00
145 changed files with 4302 additions and 1389 deletions

View File

@@ -16,6 +16,7 @@ import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.map.CallerMapGlobalTrajectoryDrawManager
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
@@ -42,7 +43,7 @@ import kotlin.properties.Delegates
* 订单中
*/
object LineManager : CallerBase<ILineCallback>() {
const val TAG = M_OCHCOMMON+"LineManager"
const val TAG = M_OCHCOMMON + "LineManager"
const val firstStationFirstStartAutopilotFlag = 0
const val middleStationFirstStartAutopilotFlag = 1
@@ -54,7 +55,7 @@ object LineManager : CallerBase<ILineCallback>() {
@JvmStatic
private var _lineInfos: LineInfo? = null
val lineInfos:LineInfo?
val lineInfos: LineInfo?
@JvmStatic
get() = _lineInfos
@@ -63,7 +64,7 @@ object LineManager : CallerBase<ILineCallback>() {
*/
@JvmStatic
private var _contraiInfo: ContraiInfo? = null
val contraiInfo:ContraiInfo?
val contraiInfo: ContraiInfo?
@JvmStatic
get() = _contraiInfo
@@ -96,9 +97,9 @@ object LineManager : CallerBase<ILineCallback>() {
* 2 中间站点触发
* 3 新的站点第一次启动自驾成功后
*/
var autopilotFlag : Int by Delegates.observable(firstStationFirstStartAutopilotFlag) { _, oldValue, newValue ->
if(oldValue!=newValue){
d(TAG,"autopilotFlag old=$oldValue new=$newValue")
var autopilotFlag: Int by Delegates.observable(firstStationFirstStartAutopilotFlag) { _, oldValue, newValue ->
if (oldValue != newValue) {
d(TAG, "autopilotFlag old=$oldValue new=$newValue")
}
}
@@ -113,23 +114,24 @@ object LineManager : CallerBase<ILineCallback>() {
CallerEagleBaseFunctionCall4OchManager.setOchAutopilotOrderId(newValue)
isFirstStartAutopilot = true
M_LISTENERS.forEach {
it.value.onAutopilotIdChange(oldValue,newValue)
it.value.onAutopilotIdChange(oldValue, newValue)
}
if(!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)&&
!AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)&&
if (!AppIdentityModeUtils.isBus(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()))
if (start != null && end != null) {
val ochInfo =
OchInfo(0, mutableListOf(start.toMogoLocation(), end.toMogoLocation()))
CallerDataCenterBizListener.invokeOchInfo(ochInfo)
OchChainLogManager.writeChainLogMap("向地图传参数", "参数信息:${ochInfo}")
d(TAG,"向地图传参数_参数信息:${ochInfo}")
}else{
d(TAG, "向地图传参数_参数信息:${ochInfo}")
} else {
val ochInfo = OchInfo(0, mutableListOf())
CallerDataCenterBizListener.invokeOchInfo(ochInfo)
OchChainLogManager.writeChainLogMap("向地图传参数", "参数信息:${ochInfo}")
d(TAG,"向地图传参数_参数信息:${ochInfo}")
d(TAG, "向地图传参数_参数信息:${ochInfo}")
}
}
}
@@ -165,9 +167,13 @@ object LineManager : CallerBase<ILineCallback>() {
* 在终点10m 范围内向地盘查询是否到站
* [com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager.onAutoPilotStation]
*/
val token = CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotStation(teleOrderId)
OchChainLogManager.writeChainLogAutopilot("到站逻辑","距离站点:$distance 请求token$token")
d(TAG,"到站逻辑_距离站点$distance 请求token$token")
val token =
CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotStation(teleOrderId)
OchChainLogManager.writeChainLogAutopilot(
"到站逻辑",
"距离站点:$distance 请求token$token"
)
d(TAG, "到站逻辑_距离站点$distance 请求token$token")
}
}
}
@@ -186,7 +192,7 @@ object LineManager : CallerBase<ILineCallback>() {
}
}
fun searchAutopilotState(){
fun searchAutopilotState() {
CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotInfo()
}
@@ -194,10 +200,10 @@ object LineManager : CallerBase<ILineCallback>() {
* [searchAutopilotState] 方法请求的返回值
*/
fun invokeSetIsFirstAutopilot(orderId: String?, firstAutopilotFlag: Boolean, count: Int) {
if (this.teleOrderId==orderId){
if(count>=1){
if (this.teleOrderId == orderId) {
if (count >= 1) {
teleIsFirstStartAutopilot = false
}else{
} else {
teleIsFirstStartAutopilot = true
}
}
@@ -209,20 +215,23 @@ object LineManager : CallerBase<ILineCallback>() {
fun setStartAndEndStation(startStation: BusStationBean?, endStation: BusStationBean?) {
this.startStation = startStation
this.endStation = endStation
if(startStation==null||endStation==null){
if (startStation == null || endStation == null) {
clearAutopilotControlParameters()
}else {
} else {
setAutopilotControlParameters()
}
OchChainLogManager.writeChainLogAutopilot("自驾参数", "站点信息:${startStation}---${endStation}")
d(TAG,"自驾参数 设置站点_站点信息:${startStation}---${endStation}")
OchChainLogManager.writeChainLogAutopilot(
"自驾参数",
"站点信息:${startStation}---${endStation}"
)
d(TAG, "自驾参数 设置站点_站点信息:${startStation}---${endStation}")
}
fun setContraiInfo(contraiInfo: ContraiInfo?){
fun setContraiInfo(contraiInfo: ContraiInfo?) {
this._contraiInfo = contraiInfo
setAutopilotControlParameters()
OchChainLogManager.writeChainLogAutopilot("自驾参数", "轨迹信息:${contraiInfo}")
d(TAG,"自驾参数 设置轨迹_轨迹信息:${contraiInfo}")
d(TAG, "自驾参数 设置轨迹_轨迹信息:${contraiInfo}")
}
@JvmStatic
@@ -242,12 +251,12 @@ object LineManager : CallerBase<ILineCallback>() {
sb.append(it.value)
}
OchChainLogManager.writeChainLogAutopilot("设置线路", "$sb")
d(TAG,"自驾参数 设置线路_线路信息:${_lineInfos}_${sb}")
d(TAG, "自驾参数 设置线路_线路信息:${_lineInfos}_${sb}")
CallerEagleBaseFunctionCall4OchManager.updateOrderLine(sb.toString())
}
}
OchChainLogManager.writeChainLogAutopilot("设置线路", "线路信息:$_lineInfos")
d(TAG,"自驾参数 设置线路_线路信息:${_lineInfos}")
d(TAG, "自驾参数 设置线路_线路信息:${_lineInfos}")
}
fun getStations(): Pair<BusStationBean?, BusStationBean?> {
@@ -294,8 +303,8 @@ object LineManager : CallerBase<ILineCallback>() {
}
}
fun getLineInfo(function: (lineInfo: LineInfo) -> Unit){
_lineInfos?.let { line->
fun getLineInfo(function: (lineInfo: LineInfo) -> Unit) {
_lineInfos?.let { line ->
function.invoke(line)
return
}
@@ -311,7 +320,7 @@ object LineManager : CallerBase<ILineCallback>() {
}
}
private fun setAutopilotControlParameters(){
private fun setAutopilotControlParameters() {
getStationsWithLine { start, end, lineInfo ->
val parameters = initAutopilotControlParameters()
if (null == parameters) {
@@ -321,7 +330,7 @@ object LineManager : CallerBase<ILineCallback>() {
d(TAG, "AutopilotControlParameters is update.")
if (lineInfo.isFirstStation(start)) {
autopilotFlag = firstStationFirstStartAutopilotFlag
}else{
} else {
autopilotFlag = middleStationFirstStartAutopilotFlag
}
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
@@ -332,14 +341,18 @@ object LineManager : CallerBase<ILineCallback>() {
val endStationLocation = MogoLocation()
endStationLocation.latitude = end.gcjLat
endStationLocation.longitude = end.gcjLon
TrajectoryAndDistanceManager.setStationPoint(startStationLocation, endStationLocation, lineInfo.lineId)
OchLocationManager.addGCJ02Listener(TAG,1, mMapLocationListener)
TrajectoryAndDistanceManager.setStationPoint(
startStationLocation,
endStationLocation,
lineInfo.lineId
)
OchLocationManager.addGCJ02Listener(TAG, 1, mMapLocationListener)
// 恢复启动自驾信息
searchAutopilotState()
}
}
private fun clearAutopilotControlParameters(){
private fun clearAutopilotControlParameters() {
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
TrajectoryAndDistanceManager.setStationPoint(null, null, null)
autopilotId = ""
@@ -380,20 +393,21 @@ object LineManager : CallerBase<ILineCallback>() {
fun initAutopilotControlParameters(): AutopilotControlParameters? {
var parameters: AutopilotControlParameters? = null
getStationsWithLine { start, end, lineInfo ->
this.autopilotId = "${lineInfo.lineId}_${start.siteId}_${end.siteId}_${lineInfo.orderId}"
this.autopilotId =
"${lineInfo.lineId}_${start.siteId}_${end.siteId}_${lineInfo.orderId}"
this.teleOrderId = lineInfo.genAutopilotId()
}
getStationsWithLineAndContrai { start, end, lineInfo, contrai ->
parameters = AutopilotControlParameters()
parameters?.routeID = lineInfo.lineId.toInt()
parameters?.routeName = lineInfo.lineName
parameters?.startName = start.name
parameters?.endName = end.name
parameters?.startLatLon = AutoPilotLonLat(start.lat, start.lon)
parameters?.endLatLon = AutoPilotLonLat(end.lat, end.lon)
if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
parameters?.startName = start.name ?: ""
parameters?.endName = end.name ?: ""
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{
} else {
parameters?.vehicleType = 10
}
parameters?.orderId = this.teleOrderId
@@ -418,95 +432,105 @@ object LineManager : CallerBase<ILineCallback>() {
)
}
val (wayLatLons, blackLatLons) = contrai.getWayBlackLatLons()
parameters?.wayLatLons = wayLatLons
parameters?.blackLatLons = blackLatLons
if (endStation?.passPoints?.isNotEmpty() == true ||
endStation?.blackPoints?.isNotEmpty() == true
) {
val (wayLatLons, blackLatLons) = endStation!!.getWayBlackLatLons()
parameters?.wayLatLons = wayLatLons
parameters?.blackLatLons = blackLatLons
CallerLogger.d(TAG, "从站点获取经停点和禁行点")
} else {
val (wayLatLons, blackLatLons) = contrai.getWayBlackLatLons()
parameters?.wayLatLons = wayLatLons
parameters?.blackLatLons = blackLatLons
CallerLogger.d(TAG, "从轨迹获取经停点和禁行点")
}
}
CallerLogger.d(TAG, "${parameters?.wayLatLons}\n${parameters?.blackLatLons}")
if (parameters == null) {
ToastUtils.showShort("未设置起始或终点站点")
}
return parameters
}
fun getWayBlackLatLons(
passPoints: MutableList<BusStationBean>?,
blackPoints: MutableList<BusStationBean>?
): Pair<MutableList<AutoPilotLonLat>, MutableList<AutoPilotLonLat>> {
fun initAutopilotControlParametersFromContrai(): AutopilotControlParameters? {
var parameters: AutopilotControlParameters? = null
this.autopilotId = "${lineInfos?.lineId}_${startStation?.siteId}_${endStation?.siteId}_${lineInfos?.orderId}"
this.teleOrderId = lineInfos?.genAutopilotId() ?: ""
parameters = AutopilotControlParameters()
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)
parameters.startName = it.first().name ?: ""
parameters.endName = it.last().name ?: ""
}
}
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
parameters.vehicleType = 9
} else {
parameters.vehicleType = 10
}
parameters.orderId = this.teleOrderId
parameters.firstStationFlag = autopilotFlag
parameters.firstAutopilotFlag = teleIsFirstStartAutopilot
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
)
}
val wayLatLons = mutableListOf<AutoPilotLonLat>()
// 途经点
if (!passPoints.isNullOrEmpty()) {
for (mogoLatLng in passPoints) {
wayLatLons.add(
AutoPilotLonLat(
mogoLatLng.lat,
mogoLatLng.lon,
when (mogoLatLng.pointType) {
1 -> {//途径点
false
}
2 -> {//禁行点
false
}
3 -> {//站点
true
}
else -> {
false
}
}
)
)
}
}
val blackLatLons = mutableListOf<AutoPilotLonLat>()
// 黑名单点
if (!blackPoints.isNullOrEmpty()) {
for (mogoLatLng in blackPoints) {
blackLatLons.add(
AutoPilotLonLat(
mogoLatLng.lat,
mogoLatLng.lat,
when (mogoLatLng.pointType) {
1 -> {//途径点
false
}
2 -> {//禁行点
false
}
3 -> {//站点
true
}
else -> {
false
}
}
)
)
lineInfos?.siteInfos?.forEachIndexed { index, site ->
if(index>0){
val (wayLatLonsSite, blackLatLonsSite) = site.getWayBlackLatLons()
wayLatLons.addAll(wayLatLonsSite)
blackLatLons.addAll(blackLatLonsSite)
if(index!=lineInfos!!.siteInfos.size-1) {
wayLatLons.add(AutoPilotLonLat(site.lat, site.lon, true))
}
}
}
return Pair(wayLatLons,blackLatLons)
}
}
parameters.wayLatLons = wayLatLons
parameters.blackLatLons = blackLatLons
CallerLogger.d(TAG, "从轨迹获取经停点和禁行点")
return parameters
}
// 启动自动驾驶
fun startAutopilot() {
if(startStation ==null|| endStation ==null){
if (startStation == null || endStation == null) {
ToastUtils.showShort("未设置起始或终点站点")
return
}
startStation?.let {
if(!it.isLeaving){
if (!it.isLeaving) {
ToastUtils.showShort("请滑动出发后再启动自驾")
return
}
@@ -522,10 +546,10 @@ object LineManager : CallerBase<ILineCallback>() {
OchAutopilotAnalytics.triggerClickStartAutopilotTime(System.currentTimeMillis())
//1、判断轨迹url是否可用
if(_contraiInfo ==null){
if (_contraiInfo == null) {
ToastUtils.showLong("无发布轨迹, 请发布后重试")
return
}else{
} else {
if (FunctionBuildConfig.isPassStartAutopilotCommand
&& TextUtils.isEmpty(_contraiInfo!!.csvFileUrl)
&& TextUtils.isEmpty(_contraiInfo!!.csvFileMd5)
@@ -558,7 +582,7 @@ object LineManager : CallerBase<ILineCallback>() {
return
}
triggerStartServiceEvent(false,0,"")
triggerStartServiceEvent(false, 0, "")
val parameters = initAutopilotControlParameters()
if (null == parameters) {
@@ -566,10 +590,11 @@ object LineManager : CallerBase<ILineCallback>() {
return
}
val sessionId = startAutoPilot(parameters)
val sessionId = startAutoPilot(parameters)
OchAutopilotAnalytics.triggerUpdateStartAutoPilotSessionId(sessionId)
d(TAG,
d(
TAG,
"行程日志-开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
+ " startLatLon=" + parameters.startName + "endLatLon=" + parameters.endName +
"isRestart = " + isFirstStartAutopilot
@@ -583,7 +608,7 @@ object LineManager : CallerBase<ILineCallback>() {
private fun triggerUnableStartAPReasonEvent() {
getStationsWithLine { start, end, line ->
OchAutopilotAnalytics.triggerUnableStartAPReasonEvent(
start.name, end.name,line.lineId.toString() , "",
start.name ?: "", end.name ?: "", line.lineId.toString(), "",
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason
)
}
@@ -594,32 +619,32 @@ object LineManager : CallerBase<ILineCallback>() {
* 1: 通过can消息发送自驾状态确定启动自驾成功
* 2通过FSM 反馈确定启动自驾成功
*/
fun triggerStartServiceEvent(send: Boolean,source:Int,type:String) {
fun triggerStartServiceEvent(send: Boolean, source: Int, type: String) {
getStationsWithLine { start, end, lineInfo ->
OchAutopilotAnalytics.triggerStartAutopilotEvent(
isFirstStartAutopilot,
send,
start.name,
end.name,
start.name ?: "",
end.name ?: "",
lineInfo.lineId.toInt(),
"",
System.currentTimeMillis(),
type,
source
)
if(send){// 启动自驾成功回调
if (send) {// 启动自驾成功回调
teleIsFirstStartAutopilot = false
isFirstStartAutopilot = false
autopilotFlag = norFirstStartAutopilotFlag
M_LISTENERS.forEach {
it.value.startAutopilotSuccess(source,autopilotId)
it.value.startAutopilotSuccess(source, autopilotId)
}
}
}
}
@JvmStatic
fun invokeStartAutopilotTimeOut(){
fun invokeStartAutopilotTimeOut() {
M_LISTENERS.forEach {
it.value.startAutopilotTimeOut()
}
@@ -627,9 +652,13 @@ object LineManager : CallerBase<ILineCallback>() {
@JvmStatic
fun invokeStartAutopilotFailure(startFailedCode: String, startFailedMessage: String) {
OchAutopilotAnalytics.triggerStartAutopilotFailureEventByAdas(startFailedCode,startFailedMessage,System.currentTimeMillis())
OchAutopilotAnalytics.triggerStartAutopilotFailureEventByAdas(
startFailedCode,
startFailedMessage,
System.currentTimeMillis()
)
M_LISTENERS.forEach {
it.value.startAutopilotFailure(startFailedCode,startFailedMessage)
it.value.startAutopilotFailure(startFailedCode, startFailedMessage)
}
}
@@ -640,16 +669,19 @@ object LineManager : CallerBase<ILineCallback>() {
}
fun compareFSMAndOchOrderId(autopilotIdFromFsm: String?) {
if(autopilotIdFromFsm == teleOrderId){
if (autopilotIdFromFsm == teleOrderId) {
// 地盘有和上层一样 不用操作
}else{
if(autopilotIdFromFsm.isNullOrEmpty()){
} else {
if (autopilotIdFromFsm.isNullOrEmpty()) {
// 地盘没有 不做操作
}else{
} else {
// 地盘有但是和och出不一样
// todo 需要och 重新出发轨迹下载操作
ToastUtils.showShort("${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查")
OchChainLogManager.writeChainLogAutopilot("自驾Id","${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查")
OchChainLogManager.writeChainLogAutopilot(
"自驾Id",
"${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查"
)
// val initAutopilotControlParameters = initAutopilotControlParameters()
// if (initAutopilotControlParameters!==null&&initAutopilotControlParameters.autoPilotLine!=null
// && contraiInfo!=null

View File

@@ -17,6 +17,7 @@ import com.mogo.och.bridge.trajectory.TrajectoryCache
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.manager.loop.LoopInfo
import com.mogo.och.bridge.utils.CoordinateCalculateRouteUtil
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import io.reactivex.schedulers.Schedulers
import mogo.telematics.pad.MessagePad
import java.util.concurrent.ConcurrentHashMap
@@ -127,6 +128,7 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener {
d(M_OCHCOMMON + TAG, "onAutopilotRotting: 收到轨迹")
globalPathResp?.wayPointsList?.let {
if (it.size > 0) {
OchChainLogManager.writeChainLogTrajectory("轨迹监控","收到轨迹信息轨迹个数${it.size}第一个点${it[0]}最后一个点:${it.last()} 轨迹id:${globalPathResp.lineId}")
d(
M_OCHCOMMON + TAG,
"收到轨迹:轨迹个数${it.size}第一个点${it[0]}最后一个点:${it.last()} 轨迹id:${globalPathResp.lineId}"
@@ -192,6 +194,7 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener {
M_OCHCOMMON + TAG,
"线路id:${lineId}设置站点:开始站点${startStationInfo}、结束站点:${endStationInfo}"
)
OchChainLogManager.writeChainLogTrajectory("轨迹监控","设置站点:线路id:${lineId}设置站点:开始站点${startStationInfo}、结束站点:${endStationInfo}")
if (startStationInfo == null || endStationInfo == null || lineId == -1L) {
this.endStationInfo.index = null
this.endStationInfo.distance = null