Merge remote-tracking branch 'origin/dev_robobus-m1-p-app-module_1.1.0_230112_1.1.0' into dev_robobus-m1-p-app-module_1.1.0_230112_1.1.0

This commit is contained in:
wangmingjun
2023-03-15 13:59:30 +08:00
7 changed files with 128 additions and 26 deletions

View File

@@ -7,7 +7,6 @@ import android.os.Build
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.module.intent.IMogoIntentListener
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.autopilot.AutopilotControlParameters.AutoPilotLine
@@ -49,8 +48,6 @@ import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import system_master.SystemStatusInfo
import io.reactivex.Observable
import io.reactivex.Observer
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import java.util.TreeMap
@@ -365,6 +362,12 @@ object CharterPassengerModel {
val siteGCJ = CoordinateTransform.WGS84ToGCJ02(order.wgs84Lon, order.wgs84Lat)
this.carTypeChageListener?.setEndStationCallBack(order.siteId,order.siteName,siteGCJ[0],siteGCJ[1])
}
this.orderInfo?.orderNo?.let {
if(it!=orderData.orderNo){
// orderNo 变后清理
SharedPrefs.getInstance(mContext).remove("${it}$min5Speak")
}
}
if (order.lineId == null || order.lineId == 0L || order.siteId == null || order.siteId == 0L) {
// 去选线路和站点
setOrderStatus(OrderStatusEnum.OrderNoLine)
@@ -523,9 +526,9 @@ object CharterPassengerModel {
.subscribe{millisUntilFinished->
if (millisUntilFinished <= 360L) {
orderInfo?.let {
if (broadcastList.get("${it}$min5Speak") == null
|| broadcastList.get("${it}$min5Speak") == false
) {
val isPlayed = SharedPrefs.getInstance(mContext)
.getBoolean("${it.orderNo}$min5Speak", false)
if (!isPlayed) {
//发送 通知
OCHSocketMessageManager.pushAppOperationalMsgBox(
DateTimeUtil.getCurrentTimeStamp(),
@@ -537,7 +540,8 @@ object CharterPassengerModel {
}else{
VoiceManager.surplus5min()
}
broadcastList["${it}$min5Speak"] = true
CallerLogger.d(M_BUS_P+ TAG,"倒计时5分钟${it.orderNo}")
SharedPrefs.getInstance(mContext).putBoolean("${it.orderNo}$min5Speak",true)
}
}
}
@@ -699,19 +703,58 @@ object CharterPassengerModel {
for (mutableEntry in distanceMap) {
CallerLogger.d(M_BUS_P+ TAG,"距离:${mutableEntry.key}-----第几个站点${mutableEntry.value}")
}
var first = -1
var middle = -1
if (distanceMap.size >= 2) {
for (mutableEntry in distanceMap) {
if (first >= 0) {
// <可用站点标,是否靠近>
var max = Math.max(first, mutableEntry.value)//正常点位
if(max==data.size-1){// 车辆在终点和起点中间时
max = Math.min(first, mutableEntry.value)
}
return Pair(max, false)
}
first = mutableEntry.value
middle = mutableEntry.value
break
}
if(middle==0){
return Pair(1, false)
}
mLocation?.let {
if(middle-1>=0) {
val degree = CoordinateCalculateRouteUtil.getDegree(
it.longitude, it.latitude,
data.get(middle).GcjLon!!, data.get(middle).GcjLat!!,
data.get(middle - 1).GcjLon!!, data.get(middle - 1).GcjLat!!,
)
if (degree > 90) {
return Pair(middle - 1, false)
}
}
if(middle+1<data.size) {
val degree = CoordinateCalculateRouteUtil.getDegree(
it.longitude, it.latitude,
data.get(middle + 1).GcjLon!!, data.get(middle + 1).GcjLat!!,
data.get(middle).GcjLon!!, data.get(middle).GcjLat!!,
)
if (degree > 90) {
return Pair(middle, false)
}
}
if(middle-2>=0) {
val degree = CoordinateCalculateRouteUtil.getDegree(
it.longitude, it.latitude,
data.get(middle - 1).GcjLon!!, data.get(middle - 1).GcjLat!!,
data.get(middle - 2).GcjLon!!, data.get(middle - 2).GcjLat!!,
)
if (degree > 90) {
return Pair(middle - 2, false)
}
}
if(middle+2<data.size) {
val degree = CoordinateCalculateRouteUtil.getDegree(
it.longitude, it.latitude,
data.get(middle + 2).GcjLon!!, data.get(middle + 2).GcjLat!!,
data.get(middle+1).GcjLon!!, data.get(middle+1).GcjLat!!,
)
if (degree > 90) {
return Pair(middle + 1, false)
}
}
}
}
return Pair(0, false)

View File

@@ -155,6 +155,7 @@ class BusPassengerPresenter(view: MainFragment?) :
override fun setOrderTimeCallBack(timeInSecond: Long) {
if(timeInSecond<0){
setDistanceAndTime("0", "KM")
setOrderTime("--","--")
return
}

View File

@@ -64,8 +64,7 @@ public class CharterAnalyticsManager {
}
private void removeWaitingCallback() {
if (startAutopilotRunnable != null &&
UiThreadHandler.getsUiHandler().hasCallbacks(startAutopilotRunnable)) {
if (startAutopilotRunnable != null) {
UiThreadHandler.removeCallbacks(startAutopilotRunnable);
}
}

View File

@@ -326,4 +326,18 @@ public class CoordinateCalculateRouteUtil {
Logger.d("calculateRouteSumLength", "点:" + currentIndex + "-------是最近的点------ ");
return currentIndex;
}
public static int getDegree(double vertexPointX, double vertexPointY, double point0X, double point0Y, double point1X, double point1Y) {
//向量的点乘
double vector = (point0X - vertexPointX) * (point1X - vertexPointX) + (point0Y - vertexPointY) * (point1Y - vertexPointY);
//向量的模乘
double sqrt = Math.sqrt(
(Math.abs((point0X - vertexPointX) * (point0X - vertexPointX)) + Math.abs((point0Y - vertexPointY) * (point0Y - vertexPointY)))
* (Math.abs((point1X - vertexPointX) * (point1X - vertexPointX)) + Math.abs((point1Y - vertexPointY) * (point1Y - vertexPointY)))
);
//反余弦计算弧度
double radian = Math.acos(vector / sqrt);
//弧度转角度制
return (int) (180 * radian / Math.PI);
}
}

View File

@@ -0,0 +1 @@
全局路径规划的GSON格式的轨迹点数据放这里然后使用PlanningDataUtils工具类解析一下

View File

@@ -0,0 +1,50 @@
package com.mogo.eagle.core.function.utils
import android.content.Context
import mogo.telematics.pad.MessagePad
import org.json.JSONArray
import org.json.JSONException
import java.io.IOException
import java.io.InputStream
object PlanningDataUtils {
@JvmStatic
fun test(context: Context?): List<MessagePad.Location> {
if (context == null) return emptyList()
val list: MutableList<MessagePad.Location> = ArrayList()
val jsonStr = getAssetsString(context, "planningDataTest.txt")
try {
val jsonElements = JSONArray(jsonStr)
for (i in 0 until jsonElements.length()) {
val s = jsonElements.getJSONObject(i)
val builder = MessagePad.Location.newBuilder()
builder.latitude = s.getDouble("latitude")
builder.longitude = s.getDouble("longitude")
list.add(builder.build())
}
} catch (e: JSONException) {
e.printStackTrace()
}
return list
}
private fun getAssetsString(context: Context, fileName: String): String {
var buffer: ByteArray? = null
var istream: InputStream? = null
try {
istream = context.resources.assets.open(fileName)
buffer = ByteArray(istream.available())
istream.read(buffer)
} catch (e: IOException) {
e.printStackTrace()
} finally {
try {
istream?.close()
} catch (e: IOException) {
e.printStackTrace()
}
}
return String(buffer!!)
}
}

View File

@@ -112,13 +112,7 @@ object CallerChassisLocationGCJ02ListenerManager : CallerBase<IMoGoChassisLocati
// 记录最后一次回调时间
M_LISTENERS_HZ_LAST_SEND_TIME[tag] = TimeUtils.getNowMills()
val listener = it.value
if (DebugConfig.isDebug()) {
val timeStampTemp = TimeUtils.getNowMills()
listener.onChassisLocationGCJ02(mogoLocation)
Logger.e(TAG, "Tag:${tag},其处理定位的时间为:${TimeUtils.getNowMills() - timeStampTemp}")
} else {
listener.onChassisLocationGCJ02(mogoLocation)
}
listener.onChassisLocationGCJ02(mogoLocation)
// FileUtils.writeToFile(
// "/sdcard/Download/",
// "location_gcj02.txt",