[fea]
[all]
[first_autopilot_flag 和线路相关、下载轨迹order_id 规则变更]
This commit is contained in:
yangyakun
2024-12-26 15:07:57 +08:00
parent 8ac498006d
commit 81a302e474
12 changed files with 135 additions and 57 deletions

View File

@@ -234,6 +234,10 @@ object OchAutoPilotStatusListenerManager : CallerBase<IOchAutopilotStatusListene
}
}
/**
* 距离终点10m 向地盘查询是否到站地盘的返回值
* [LineManager.mMapLocationListener]
*/
override fun onAutoPilotStation(
token: Long,
timestamp: Long,

View File

@@ -54,7 +54,7 @@ public interface ILineCallback {
default void startAutopilotSuccess(int source, String autopilotId){}
/**
* 距离站点小于15m后向底盘查询是否到站底盘反馈 已到站
* 距离站点小于10m后向底盘查询是否到站底盘反馈 已到站
*/
default void arrivedStationSuccessBySearch(){}
}

View File

@@ -74,9 +74,10 @@ object LineManager : CallerBase<ILineCallback>() {
private var endStation: BusStationBean? = null
var isFirstStartAutopilot = true
var teleIsFirstStartAutopilot = true
/**
* 线路、轨迹、站点 三者确定的id
* 线路、och业务id、站点 三者确定的id
*/
private var autopilotId: String by Delegates.observable("") { _, oldValue, newValue ->
if (oldValue != newValue) {
@@ -103,8 +104,18 @@ object LineManager : CallerBase<ILineCallback>() {
}
}
/**
* 线路、och业务id、当前线路的所有站点 三者确定的id
*/
private var teleOrderId: String by Delegates.observable("") { _, oldValue, newValue ->
if (oldValue != newValue) {
teleIsFirstStartAutopilot = true
}
}
// 自车定位
/**
* 当前车辆经纬度
*/
private val mMapLocationListener = object : IMoGoChassisLocationGCJ02Listener {
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
if (null == mogoLocation) return
@@ -116,28 +127,43 @@ object LineManager : CallerBase<ILineCallback>() {
mogoLocation.longitude, mogoLocation.latitude
)
if (distance <= OchCommonConst.ARRIVE_AT_END_STATION_DISTANCE) {
val token = CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotStation(autopilotId)
/**
* 在终点10m 范围内向地盘查询是否到站
* [com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager.onAutoPilotStation]
*/
val token = CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotStation(teleOrderId)
OchChainLogManager.writeChainLogAutopilot("到站逻辑","距离站点:$distance 请求token$token")
}
}
}
}
/**
* [mMapLocationListener] 距离终点小于[OchCommonConst.ARRIVE_AT_END_STATION_DISTANCE]后向底盘请求的返回值调用
* @param orderId 和线路相关的值
* @param arrivedStationFlag 是否到站 true 到站 false 没有到站
*/
fun invokeArrivedStation(orderId: String, arrivedStationFlag: Boolean) {
if (this.autopilotId==orderId&&arrivedStationFlag){
if (this.teleOrderId == orderId && arrivedStationFlag) {
M_LISTENERS.forEach {
it.value.arrivedStationSuccessBySearch()
}
}
}
fun searchAutopilotState(){
CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotInfo()
}
/**
* [searchAutopilotState] 方法请求的返回值
*/
fun invokeSetIsFirstAutopilot(orderId: String?, firstAutopilotFlag: Boolean, count: Int) {
if (this.autopilotId==orderId){
if (this.teleOrderId==orderId){
if(count>=1){
isFirstStartAutopilot = false
teleIsFirstStartAutopilot = false
}else{
isFirstStartAutopilot = true
teleIsFirstStartAutopilot = true
}
}
}
@@ -146,9 +172,6 @@ object LineManager : CallerBase<ILineCallback>() {
* 设置站点信息
*/
fun setStartAndEndStation(startStation: BusStationBean?, endStation: BusStationBean?) {
if(this.startStation!=startStation||this.endStation!=endStation){
isFirstStartAutopilot = true
}
this.startStation = startStation
this.endStation = endStation
if(startStation==null||endStation==null){
@@ -168,6 +191,7 @@ object LineManager : CallerBase<ILineCallback>() {
@JvmStatic
fun setLineInfo(lineInfo: LineInfo?) {
if (lineInfo == null) {
teleOrderId = ""
clearGlobalTrajectory(true)
CallerEagleBaseFunctionCall4OchManager.updateOrderLine("")
}
@@ -180,10 +204,11 @@ object LineManager : CallerBase<ILineCallback>() {
line.multiMap?.forEach {
sb.append(it.value)
}
OchChainLogManager.writeChainLogAutopilot("设置线路", "$sb")
CallerEagleBaseFunctionCall4OchManager.updateOrderLine(sb.toString())
}
}
OchChainLogManager.writeChainLogAutopilot("自驾参数", "线路信息:$contraiInfo")
OchChainLogManager.writeChainLogAutopilot("设置线路", "线路信息:$_lineInfos")
}
fun getStations(): Pair<BusStationBean?, BusStationBean?> {
@@ -280,9 +305,7 @@ object LineManager : CallerBase<ILineCallback>() {
searchAutopilotState()
}
}
fun searchAutopilotState(){
CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotInfo()
}
private fun clearAutopilotControlParameters(){
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
TrajectoryAndDistanceManager.setStationPoint(null, null, null)
@@ -324,6 +347,7 @@ object LineManager : CallerBase<ILineCallback>() {
var parameters: AutopilotControlParameters? = null
getStationsWithLine { start, end, lineInfo ->
this.autopilotId = "${lineInfo.lineId}_${start.siteId}_${end.siteId}_${lineInfo.orderId}"
this.teleOrderId = lineInfo.genAutopilotId()
}
getStationsWithLineAndContrai { start, end, lineInfo, contrai ->
parameters = AutopilotControlParameters()
@@ -334,8 +358,8 @@ object LineManager : CallerBase<ILineCallback>() {
parameters?.startLatLon = AutoPilotLonLat(start.lat, start.lon)
parameters?.endLatLon = AutoPilotLonLat(end.lat, end.lon)
parameters?.vehicleType = 10
parameters?.orderId = this.autopilotId
parameters?.firstAutopilotFlag = isFirstStartAutopilot
parameters?.orderId = this.teleOrderId
parameters?.firstAutopilotFlag = teleIsFirstStartAutopilot
if (parameters?.autoPilotLine == null) {
parameters?.autoPilotLine = AutoPilotLine(
@@ -355,7 +379,7 @@ object LineManager : CallerBase<ILineCallback>() {
)
}
val (wayLatLons, blackLatLons) = getWayBlackLatLons(contrai.passPoints, contrai.blackPoints)
val (wayLatLons, blackLatLons) = contrai.getWayBlackLatLons()
parameters?.wayLatLons = wayLatLons
parameters?.blackLatLons = blackLatLons
@@ -545,7 +569,9 @@ object LineManager : CallerBase<ILineCallback>() {
type,
source
)
if(send){
if(send){// 启动自驾成功回调
teleIsFirstStartAutopilot = false
isFirstStartAutopilot = false
M_LISTENERS.forEach {
it.value.startAutopilotSuccess(source,autopilotId)
}
@@ -575,7 +601,7 @@ object LineManager : CallerBase<ILineCallback>() {
}
fun compareFSMAndOchOrderId(autopilotIdFromFsm: String?) {
if(autopilotIdFromFsm == autopilotId){
if(autopilotIdFromFsm == teleOrderId){
// 地盘有和上层一样 不用操作
}else{
if(autopilotIdFromFsm.isNullOrEmpty()){
@@ -583,8 +609,8 @@ object LineManager : CallerBase<ILineCallback>() {
}else{
// 地盘有但是和och出不一样
// todo 需要och 重新出发轨迹下载操作
ToastUtils.showShort("${autopilotIdFromFsm}_${autopilotId}_自动驾驶id不同请排查")
OchChainLogManager.writeChainLogAutopilot("自驾Id","${autopilotIdFromFsm}_${autopilotId}_自动驾驶id不同请排查")
ToastUtils.showShort("${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查")
OchChainLogManager.writeChainLogAutopilot("自驾Id","${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查")
// val initAutopilotControlParameters = initAutopilotControlParameters()
// if (initAutopilotControlParameters!==null&&initAutopilotControlParameters.autoPilotLine!=null
// && contraiInfo!=null

View File

@@ -1,5 +1,7 @@
package com.mogo.och.data.bean
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLonLat
data class ContraiInfo(
/**
* 线路id
@@ -34,4 +36,67 @@ data class ContraiInfo(
var passPoints: MutableList<BusStationBean>?=null, // 用于算路的经停点
var blackPoints: MutableList<BusStationBean>?=null, // 用于算路的黑名單點
val source:Int = 1, //轨迹来源1 录制2 自主计算
)
){
fun getWayBlackLatLons(
): Pair<MutableList<AutoPilotLonLat>, MutableList<AutoPilotLonLat>> {
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
}
}
)
)
}
}
return Pair(wayLatLons,blackLatLons)
}
}

View File

@@ -35,4 +35,19 @@ data class LineInfo(
tempAutopilotId.append(orderId)
return tempAutopilotId.toString()
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as LineInfo
return lineId == other.lineId
}
override fun hashCode(): Int {
return lineId.hashCode()
}
}

View File

@@ -176,10 +176,7 @@ object TaxiTrajectoryManager : ITrajectoryListListener {
preloadContrail.contrailSaveTimeDPQP
val toCommonContraiInfo = preloadContrail.toCommonContraiInfo()
val (wayLatLons, blackLatLons) = LineManager.getWayBlackLatLons(
toCommonContraiInfo.passPoints,
toCommonContraiInfo.blackPoints
)
val (wayLatLons, blackLatLons) = toCommonContraiInfo.getWayBlackLatLons()
mPreAutopilotControlParameters?.wayLatLons = wayLatLons
mPreAutopilotControlParameters?.blackLatLons = blackLatLons
}

View File

@@ -49,10 +49,6 @@ class DataCenterBizProvider:IDataCenterBizProvider {
CallerDataCenterBizListener.invokeLoginStatus(isLogin)
}
override fun notifyOrderID(orderID: String) {
CallerDataCenterBizListener.invokeOrderID(orderID)
}
override fun onDestroy() {
}

View File

@@ -25,7 +25,6 @@ interface IDataCenterBizListener {
return false
}
fun invokeAutopilotOrderId(orderID:String){}
fun invokeOchInfo(ochInfo: OchInfo) {}
}

View File

@@ -35,5 +35,4 @@ interface IOchFunctionCallNotify {
// 登录状态变化
fun notifyLoginStatus(isLogin: Boolean)
fun notifyOrderID(orderID:String)
}

View File

@@ -24,9 +24,6 @@ object CallerDataCenterBizListener : CallerBase<IDataCenterBizListener>() {
@Volatile
private var inOrder: Boolean = false
@Volatile
private var orderId: String = ""
private val isLoginStatus by lazy { AtomicBoolean(false) }
override fun doSomeAfterAddListener(tag: String, listener: IDataCenterBizListener) {
@@ -35,7 +32,6 @@ object CallerDataCenterBizListener : CallerBase<IDataCenterBizListener>() {
listener.invokeLoginNo(loginNo)
listener.invokeCarNo(no)
listener.invokeOrderStatus(inOrder)
listener.invokeAutopilotOrderId(orderId)
}
fun invokeLoginNo(loginNo: String?) {
@@ -96,23 +92,12 @@ object CallerDataCenterBizListener : CallerBase<IDataCenterBizListener>() {
return isLoginStatus.get()
}
fun invokeOrderID(orderId: String) {
this.orderId = orderId
M_LISTENERS.forEach {
it.value.invokeAutopilotOrderId(orderId)
}
}
fun invokeOchInfo(ochInfo: OchInfo) {
M_LISTENERS.forEach {
it.value.invokeOchInfo(ochInfo)
}
}
fun getOrderId(): String {
return orderId
}
fun getCarModel(): Carmodel? {
return carModel
}

View File

@@ -48,8 +48,4 @@ object CallerDataCenterBizManager: IOchFunctionCallNotify {
dataCenterBizProviderApi?.notifyLoginStatus(isLogin)
}
override fun notifyOrderID(orderID: String) {
dataCenterBizProviderApi?.notifyOrderID(orderID)
}
}

View File

@@ -130,8 +130,4 @@ object CallerEagleBaseFunctionCall4OchManager : IEagleBaseFunctionCall4Och {
override fun onOrderRemoval() {
CallerDataCenterBizManager.notifyOrderRemoval()
}
override fun setOchAutopilotOrderId(orderId: String) {
CallerDataCenterBizManager.notifyOrderID(orderId)
}
}