[fea]
[Vlm 接入]
This commit is contained in:
yangyakun
2025-06-20 11:24:27 +08:00
parent 05582f4415
commit 981d2e7f24
29 changed files with 514 additions and 179 deletions

View File

@@ -1,6 +1,8 @@
package com.mogo.och.common.module.debug
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.os.Environment
import android.os.SystemClock
import chassis.Chassis
@@ -8,6 +10,7 @@ import chassis.Chassis.DoorNumber
import chassis.VehicleStateOuterClass
import com.amap.api.maps.model.LatLng
import com.google.gson.reflect.TypeToken
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.map.MogoLocation
@@ -24,6 +27,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02Lis
import com.mogo.eagle.core.function.call.autopilot.CallerChassisStatesListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerVlmManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapRomaListener
@@ -34,24 +38,25 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.ActivityUtils
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.och.common.module.R
import com.mogo.och.common.module.biz.birdge.BridgeManager
import com.mogo.och.common.module.biz.order.OrderManager
import com.mogo.och.common.module.debug.location.MogoLocationExit
import com.mogo.och.common.module.manager.loop.BizLoopManager
//import com.mogo.och.bridge.distance.TrajectoryAndDistanceManager
//import com.mogo.och.bridge.utils.CoordinateCalculateRouteUtil
//import com.mogo.och.bridge.utils.CoordinateCalculateRouteUtil
import com.mogo.och.common.module.view.DebugFloatWindow
import com.mogo.och.common.module.wigets.media.MediaBeanManager
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import vllm.Vlm
import java.io.BufferedReader
import java.io.ByteArrayOutputStream
import java.io.File
import java.io.FileInputStream
import java.io.IOException
import java.io.InputStreamReader
object DebugDataDispatch {
const val TAG = "DebugDataDispatch"
@@ -73,6 +78,8 @@ object DebugDataDispatch {
const val ota = "ota"
const val video = "video"
const val mediaMusic = "mediaAndMusic"
const val vlmMessage = "vlmMessage"
const val vlmImage = "vlmImage"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "location" --es path "1111/11111"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "globalPath" --es path "sy73.json"
@@ -89,7 +96,8 @@ object DebugDataDispatch {
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "showDebugView"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "scanner" --es qrInfo ""
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "ota" --ei "ota" 1
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "video" --ei "video" 1 --es url "rtmp://video.zhidaozhixing.com/live/861130041693196C_2"
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "vlmMessage" --es message "前方100米有道路施工施工长度100米影响第1、2车道通行。" --ei id 128 --ef time 1880.0
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "vlmImage" --ef time 1880.0
val ROOT_PATH =
@@ -102,6 +110,25 @@ object DebugDataDispatch {
}
when (type) {
vlmMessage -> {
val time = intent.getFloatExtra("time",0f)
val id = intent.getIntExtra("id",0)
val message = intent.getStringExtra("message")
val newBuilder = Vlm.VLLMObject.newBuilder()
val build = newBuilder.workZoneBuilder.setId(id).setSceneExplantion(message).build()
newBuilder.workZone = build
CallerVlmManager.invokeVllm(time.toDouble(),newBuilder.build())
}
vlmImage -> {
val time = intent.getFloatExtra("time",0f)
BizLoopManager.runInIoThread{
val bitmap = BitmapFactory.decodeResource(AbsMogoApplication.getApp().resources, R.drawable.common_debug)
val stream = ByteArrayOutputStream()
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream)
val byteArray = stream.toByteArray()
CallerVlmManager.invokeVllmImage(time.toDouble(),byteArray)
}
}
mediaMusic -> {
val musicList = MediaBeanManager.getMusicList()
val mediaList = MediaBeanManager.getMediaList()

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

View File

@@ -1,6 +1,8 @@
package com.mogo.och.common.module.biz.birdge
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.och.common.module.biz.birdge.data.RoadMsg
import com.mogo.och.common.module.biz.birdge.data.VlmData
interface BridgeListener {
/**
@@ -15,4 +17,9 @@ interface BridgeListener {
fun onTrajectoryDistanceListener(distance: Double){}
fun onTrajectoryPointsAndDistanceListener(trajectoryList: MutableList<MogoLocation>,distance: Double){}
fun onVlmDataListener(vlmData: VlmData){}
fun onNdeDataListener(title: String, desc: String, sortedList: List<RoadMsg>) {}
}

View File

@@ -0,0 +1,8 @@
package com.mogo.och.common.module.biz.birdge.data
data class RoadMsg(
var arrowType: Int, // 车道类型如直行201(详情参考文件message_pad.proto)
var laneNum: Int,// 车道号
var isRecommend: Boolean,// 是否是推荐车道
var isCheLong: Boolean// 是否有车龙,代表拥堵、行驶缓慢
)

View File

@@ -0,0 +1,28 @@
package com.mogo.och.common.module.biz.birdge.data
data class VlmData(val id:Int?,val message:String?,var image: ByteArray?) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as VlmData
if (id != other.id) return false
if (message != other.message) return false
if (image != null) {
if (other.image == null) return false
if (!image.contentEquals(other.image)) return false
} else if (other.image != null) return false
return true
}
override fun hashCode(): Int {
return id ?: 0
}
override fun toString(): String {
return "VlmData(id=$id, message=$message)"
}
}

View File

@@ -0,0 +1,45 @@
package com.mogo.och.common.module.manager
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
object EnvManager {
fun isB1(): Boolean {
return AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)
}
fun isB1Driver(): Boolean {
return isB1() && AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
}
fun isB1Passenger(): Boolean {
return isB1() && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
}
fun isB2(): Boolean {
return AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)
}
fun isB2Driver(): Boolean {
return isB2() && AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
}
fun isB2Passenger(): Boolean {
return isB2() && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
}
fun isT1T2(): Boolean {
return AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)
}
fun isT1T2Driver(): Boolean {
return isT1T2() && AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
}
fun isT1T2Passenger(): Boolean {
return isT1T2() && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
}
}