[15米计算算法、启动自驾判断轨迹url是否为空]
This commit is contained in:
yangyakun
2024-04-25 19:42:37 +08:00
parent 89b0d07afd
commit 541fbff590
11 changed files with 152 additions and 57 deletions

View File

@@ -622,8 +622,10 @@ public class OrderModel {
//  自驾状态---->启动自驾 ---> 自驾启动成功
//根据开关和后台是否发布轨迹启动自驾
if (FunctionBuildConfig.isPassStartAutopilotCommand && TextUtils.isEmpty(busRoutesResult.csvFileUrl)
&& TextUtils.isEmpty(busRoutesResult.csvFileUrlDPQP)){
if (FunctionBuildConfig.isPassStartAutopilotCommand
&& TextUtils.isEmpty(busRoutesResult.csvFileUrl)
&& TextUtils.isEmpty(busRoutesResult.csvFileUrlDPQP)
){
ToastUtils.showLong("无发布轨迹, 请发布后重试");
CallerLogger.e(M_BUS + TAG, "isPassStartAutopilotCommand = " +
FunctionBuildConfig.isPassStartAutopilotCommand
@@ -648,6 +650,20 @@ public class OrderModel {
}
String resion = TrajectoryAndDistanceManager.INSTANCE.canStartAutopilot((long)busRoutesResult.getLineId());
if(TrajectoryAndDistanceManager.errorTypeNoneLineId.equals(resion)){
MogoLocation nextStationPoint = new MogoLocation();
if (backgroundCurrentStationIndex < stationList.size() - 1) {
BusStationBean nextStation = stationList.get(backgroundCurrentStationIndex + 1);
nextStationPoint.setLongitude(nextStation.getGcjLon());
nextStationPoint.setLatitude(nextStation.getGcjLat());
}
BusStationBean busStationBean = stationList.get(backgroundCurrentStationIndex);
MogoLocation currentStationPoint = new MogoLocation();
currentStationPoint.setLongitude(busStationBean.getGcjLon());
currentStationPoint.setLatitude(busStationBean.getGcjLat());
setTrajectoryStation(currentStationPoint,nextStationPoint, (long) currentLineId);
resion = TrajectoryAndDistanceManager.INSTANCE.canStartAutopilot((long)busRoutesResult.getLineId());
}
if(!StringUtils.isEmpty(resion)){
ToastUtils.showShort(resion);
return;

View File

@@ -20,6 +20,7 @@ import com.mogo.commons.module.intent.IntentManager
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
@@ -486,6 +487,21 @@ class DriverM1Model {
triggerUnableStartAPReasonEvent()
return
}
mCurrentRoute?.let {
//根据开关和后台是否发布轨迹启动自驾
if (FunctionBuildConfig.isPassStartAutopilotCommand
&& TextUtils.isEmpty(it.csvFileUrl)
&& TextUtils.isEmpty(it.csvFileUrlDPQP)
) {
ToastUtils.showLong("无发布轨迹, 请发布后重试")
CallerLogger.e(
TAG, "isPassStartAutopilotCommand = " +
FunctionBuildConfig.isPassStartAutopilotCommand
+ "busRoutesResult.csvFileUrl = " + it.csvFileUrl
)
return
}
}
if (!CallerAutoPilotControlManager.isCanStartAutopilot(true)) {
return
}

View File

@@ -3,6 +3,7 @@ package com.mogo.och.charter.passenger.model
import android.annotation.SuppressLint
import android.content.Context
import android.net.ConnectivityManager
import com.alibaba.android.arouter.utils.TextUtils
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.module.intent.IMogoIntentListener
import com.mogo.commons.module.intent.IntentManager
@@ -20,6 +21,8 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.och.charter.passenger.R
import com.mogo.och.common.module.manager.loop.LoopInfo
@@ -1129,6 +1132,21 @@ object CharterPassengerModel {
ToastCharterUtils.showToastLong("已到达目的地请重新选择线路")
return
}
locusInfo?.let {
//根据开关和后台是否发布轨迹启动自驾
if (FunctionBuildConfig.isPassStartAutopilotCommand
&& TextUtils.isEmpty(it.csvFileUrl)
&& TextUtils.isEmpty(it.csvFileUrlDPQP)
) {
ToastUtils.showLong("无发布轨迹, 请发布后重试")
CallerLogger.e(
TAG, "isPassStartAutopilotCommand = " +
FunctionBuildConfig.isPassStartAutopilotCommand
+ "busRoutesResult.csvFileUrl = " + it.csvFileUrl
)
return
}
}
if (!CallerAutoPilotControlManager.isCanStartAutopilot(true)) {
return
}

View File

@@ -36,6 +36,8 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener {
private const val TAG = "DistanceManager"
private const val DISTANCE = "BusPassengerModelDistance"
const val errorTypeNoneLineId = "起始站点值异常,请重新选择此任务执行并上报问题"
fun addDistanceListener(tag: String, listener: IDistanceListener) {
if (distanceListeners.containsKey(tag)) {
@@ -703,7 +705,7 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener {
*/
private fun distanceWithStartStation(): String {
if (startStationInfo.stationPoint == null) {
return "起始站点值异常,请重新选择此任务执行并上报问题"
return errorTypeNoneLineId
}
val currentPoint = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
val distance = CoordinateUtils.calculateLineDistance(
@@ -723,54 +725,23 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener {
* 距离轨迹的距离
*/
fun distanceWithTrajectory(redCatche: MutableList<MogoLocation>,currentPoint:MogoLocation): String {
// 判断距离轨迹的距离
val carLocationInfo: Triple<Int, Boolean?, Float> =
CoordinateCalculateRouteUtil.getNearestPointInfo(
0,
redCatche.size - 1,
redCatche,
currentPoint,
2
)
if (carLocationInfo.third <= OchCommonConst.AUTOMATIC_PLANNING_MAX_DISTANCE) {
return ""// 可以启动自驾
} else {
// 判断距离线段的距离 垂足的距离
val nextPoint: MogoLocation
val prePoint: MogoLocation
// isNext true 最近的点是在下一个
// isNext false 最近的点是在上一个
if (carLocationInfo.second == true) {
if (carLocationInfo.first > 0) {
nextPoint = redCatche[carLocationInfo.first]
prePoint = redCatche[carLocationInfo.first - 1]
} else {
// 距离第一个点大于15m 过远
return "距离轨迹线超过15m${carLocationInfo.first}米,无法启动自驾"
redCatche.forEachIndexed { index, mogoLocation ->
if(index!=0){
val prePoint = redCatche.get(index - 1)
val pointToLine = LocationUtils.pointToLine(
prePoint.longitude,
prePoint.latitude,
mogoLocation.longitude,
mogoLocation.latitude,
currentPoint.longitude,
currentPoint.latitude
)
if(pointToLine<=OchCommonConst.AUTOMATIC_PLANNING_MAX_DISTANCE){
return ""
}
} else {
if (carLocationInfo.first + 1 < redCatche.size) {
nextPoint = redCatche[carLocationInfo.first + 1]
prePoint = redCatche[carLocationInfo.first]
} else {
nextPoint = redCatche[carLocationInfo.first]
prePoint = redCatche[carLocationInfo.first - 1]
}
}
val pointToLine = LocationUtils.pointToLine(
prePoint.longitude,
prePoint.latitude,
nextPoint.longitude,
nextPoint.latitude,
currentPoint.longitude,
currentPoint.latitude
)
return if (pointToLine <= OchCommonConst.AUTOMATIC_PLANNING_MAX_DISTANCE) {
""
} else {
"距离轨迹线超过15m,无法启动自驾"
}
}
return "距离轨迹线超过15m,无法启动自驾"
}
}

View File

@@ -6,6 +6,7 @@ import static com.mogo.och.shuttle.constant.BusConst.STATION_STATUS_ARRIVING;
import static com.mogo.och.shuttle.constant.BusConst.STATION_STATUS_STOPPED;
import android.content.Context;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -618,6 +619,22 @@ public class OrderModel {
*/
private void startAutopilot(boolean isRestart, int leaveIndex) {
if(busRoutesResult!=null){
//根据开关和后台是否发布轨迹启动自驾
if (FunctionBuildConfig.isPassStartAutopilotCommand
&& TextUtils.isEmpty(busRoutesResult.csvFileUrl)
&& TextUtils.isEmpty(busRoutesResult.csvFileUrlDPQP)
) {
ToastUtils.showLong("无发布轨迹, 请发布后重试");
CallerLogger.e(
TAG, "isPassStartAutopilotCommand = " +
FunctionBuildConfig.isPassStartAutopilotCommand
+ "busRoutesResult.csvFileUrl = " + busRoutesResult.csvFileUrl
);
return;
}
}
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()) {
ToastUtils.showLong(OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason() +
", 请稍候重试");

View File

@@ -5,6 +5,7 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_SWE
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
@@ -416,6 +417,21 @@ public class SweeperOperateTaskModel {
*/
private void startAutopilot(boolean isRestart) {
DebugView.Companion.printInfoMsg("[启自驾] startAutoPilot");
if(mCurrentSubTaskDetail!=null){
//根据开关和后台是否发布轨迹启动自驾
if (FunctionBuildConfig.isPassStartAutopilotCommand
&& TextUtils.isEmpty(mCurrentSubTaskDetail.getCsvFileUrl())
&& TextUtils.isEmpty(mCurrentSubTaskDetail.getCsvFileUrlDPQP())
) {
ToastUtils.showLong("无发布轨迹, 请发布后重试");
CallerLogger.e(
TAG, "isPassStartAutopilotCommand = " +
FunctionBuildConfig.isPassStartAutopilotCommand
+ "busRoutesResult.csvFileUrl = " + mCurrentSubTaskDetail.getCsvFileUrl()
);
return;
}
}
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().getAutopilotAbilityStatus()) {
ToastUtils.showLong(OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason() +
", 请稍候重试");

View File

@@ -926,8 +926,10 @@ public class TaxiModel {
}
//根据开关和后台是否发布轨迹启动自驾
if (FunctionBuildConfig.isPassStartAutopilotCommand && TextUtils.isEmpty(mCurrentOCHOrder.csvFileUrl)
&& TextUtils.isEmpty(mCurrentOCHOrder.csvFileUrlDPQP)) {
if (FunctionBuildConfig.isPassStartAutopilotCommand
&& TextUtils.isEmpty(mCurrentOCHOrder.csvFileUrl)
&& TextUtils.isEmpty(mCurrentOCHOrder.csvFileUrlDPQP)
) {
ToastUtils.showLong("无发布轨迹, 请发布后重试");
CallerLogger.e(M_TAXI + TAG, "isPassStartAutopilotCommand = " +
FunctionBuildConfig.isPassStartAutopilotCommand
@@ -948,6 +950,10 @@ public class TaxiModel {
String resion = TrajectoryAndDistanceManager.INSTANCE.canStartAutopilot(mCurrentOCHOrder.lineId);
if(TrajectoryAndDistanceManager.errorTypeNoneLineId.equals(resion)){
setStation();
resion = TrajectoryAndDistanceManager.INSTANCE.canStartAutopilot(mCurrentOCHOrder.lineId);
}
if(!StringUtils.isEmpty(resion)){
ToastUtils.showShort(resion);
return;

View File

@@ -1,5 +1,6 @@
package com.mogo.och.taxi.passenger.model
import com.alibaba.android.arouter.utils.TextUtils
import com.elegant.network.utils.GsonUtil
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
@@ -57,12 +58,31 @@ object AutopilotManager : IOchAutopilotStatusListener {
if (!CallerAutoPilotControlManager.isCanStartAutopilot(false)) {
return "启动自动驾驶不满足条件"
}
TaxiPassengerModel.currentOCHOrder?.let {
//根据开关和后台是否发布轨迹启动自驾
if (FunctionBuildConfig.isPassStartAutopilotCommand
&& TextUtils.isEmpty(it.csvFileUrl)
&& TextUtils.isEmpty(it.csvFileUrlDPQP)
) {
ToastUtils.showLong("无发布轨迹, 请发布后重试")
CallerLogger.e(
TAG, "isPassStartAutopilotCommand = " +
FunctionBuildConfig.isPassStartAutopilotCommand
+ "busRoutesResult.csvFileUrl = " + it.csvFileUrl
)
return "无发布轨迹, 请发布后重试"
}
}
if(CallerAutoPilotStatusListenerManager.getState()
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
ToastUtils.showShort("自驾中、请勿重复启动");
return "自驾中、请勿重复启动";
}
val resion = TrajectoryAndDistanceManager.canStartAutopilot(TaxiPassengerModel.currentOCHOrder!!.lineId)
var resion = TrajectoryAndDistanceManager.canStartAutopilot(TaxiPassengerModel.currentOCHOrder!!.lineId)
if(TrajectoryAndDistanceManager.errorTypeNoneLineId.equals(resion)){
TaxiPassengerModel.setStation();
resion = TrajectoryAndDistanceManager.canStartAutopilot(TaxiPassengerModel.currentOCHOrder!!.lineId);
}
if (!StringUtils.isEmpty(resion)) {
ToastUtils.showShort(resion)
return resion

View File

@@ -462,9 +462,9 @@ object TaxiRoutingModel {
return
}
//根据开关和后台是否发布轨迹启动自驾
if (FunctionBuildConfig.isPassStartAutopilotCommand && TextUtils.isEmpty(
contrailBean.csvFileUrl
)
if (FunctionBuildConfig.isPassStartAutopilotCommand
&& TextUtils.isEmpty(contrailBean.csvFileUrl)
&& TextUtils.isEmpty(contrailBean.csvFileUrlDPQP)
) {
ToastUtils.showLong("无发布轨迹, 请发布后重试")
DebugView.printErrorMsg("[启自驾] 无发布轨迹, 请发布后重试")

View File

@@ -1220,9 +1220,8 @@ object TaxiTaskModel {
}
//根据开关和后台是否发布轨迹启动自驾
if (FunctionBuildConfig.isPassStartAutopilotCommand && mCurrentTaskTrajectory != null && TextUtils.isEmpty(
mCurrentTaskTrajectory!!.csvFileUrl
)
if (FunctionBuildConfig.isPassStartAutopilotCommand && mCurrentTaskTrajectory != null
&& TextUtils.isEmpty(mCurrentTaskTrajectory!!.csvFileUrl)
&& TextUtils.isEmpty(mCurrentTaskTrajectory!!.csvFileUrlDPQP)
) {
ToastUtils.showLong("无发布轨迹, 请发布后重试")

View File

@@ -1,5 +1,6 @@
package com.mogo.och.taxi.passenger.model
import com.alibaba.android.arouter.utils.TextUtils
import com.elegant.network.utils.GsonUtil
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
@@ -53,6 +54,21 @@ object AutopilotManager : IOchAutopilotStatusListener {
if (TaxiPassengerModel.currentOCHOrder!!.orderStatus == TaxiPassengerOrderStatusEnum.UserArriveAtStart.code) {
startAutoPilotServiceByPassenger()
}
TaxiPassengerModel.currentTrajectoryInfo?.let {
//根据开关和后台是否发布轨迹启动自驾
if (FunctionBuildConfig.isPassStartAutopilotCommand
&& TextUtils.isEmpty(it.csvFileUrl)
&& TextUtils.isEmpty(it.csvFileUrlDPQP)
) {
ToastUtils.showLong("无发布轨迹, 请发布后重试")
CallerLogger.e(
TAG, "isPassStartAutopilotCommand = " +
FunctionBuildConfig.isPassStartAutopilotCommand
+ "busRoutesResult.csvFileUrl = " + it.csvFileUrl
)
return "无发布轨迹, 请发布后重试"
}
}
// 0831 目前无人化taxi中间不会取消自驾一直处于自动驾驶状态中所以这个判断先去掉
// if (CallerAutoPilotStatusListenerManager.getState()
// == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING