Merge branch 'dev_robotaxi-d_240705_6.5.0' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_robotaxi-d_240705_6.5.0

# Conflicts:
#	core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/v2n/pnc/V2NIdentifyDrawer.kt
This commit is contained in:
aibingbing
2024-07-10 09:57:21 +08:00
71 changed files with 1668 additions and 598 deletions

View File

@@ -6,6 +6,8 @@ import android.os.Message
import android.text.TextUtils
import android.util.Log
import androidx.core.util.Pair
import com.google.gson.JsonArray
import com.google.gson.JsonObject
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.CommunicationType
@@ -82,12 +84,6 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
private const val MSG_WHAT_DRAW_GREEN_WAVE = 0x1014 // 绿波通行
private const val MSG_WHAT_DRAW_PEOPLE_CROSS = 0x1015 // 行人横穿
private val builder_people_cross by lazy {
Point.Options.Builder(V2XConst.V2X_MARKER_OWNER, MAP_MARKER).isUseGps(true).anchorColor("#D65D5AFF").set3DMode(true).icon3DRes(TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE.traffic3DIconId)
}
private val markers by lazy { ConcurrentHashMap<String, MarkerWrapper>() }
private val callback = Handler.Callback { msg ->
if (msg.what == MSG_WHAT_DRAW_SHIGONE || msg.what == MSG_WHAT_DRAW_SHIGU) {
val events = msg.obj as? List<*>
@@ -133,8 +129,8 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
val polygon = itx.polygonList.map { Pair.create(it.longitude, it.latitude) }
marker(Marker(id,
poiType,
itx.latitude,
itx.longitude,
itx.latitude,
itx.heading,
polygon,
null,
@@ -203,7 +199,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
}
}
val alert = sb.toString()
CallerRoadV2NEventWindowListenerManager.showLiveVideo("${itx.longitude}-${itx.latitude}", itx.systemTime.toLong(), EventTypeEnumNew.getUpdateIconRes(poiType), alert, isDriver, alert, itx.cameraIp, itx.longitude, itx.latitude)
CallerRoadV2NEventWindowListenerManager.showLiveVideo("${itx.longitude}-${itx.latitude}", itx.detectStartTime, EventTypeEnumNew.getUpdateIconRes(poiType), alert, isDriver, itx.cameraIp, itx.longitude, itx.latitude)
}
}
//消息埋点
@@ -216,7 +212,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
}
} else if (msg.what == MSG_WHAT_DRAW_YONGDU) {
Log.d("V2NIdentifyDrawer", "---callback -- drawYongDu --- 1 ---")
val events = msg.obj as? List<*>
/* val events = msg.obj as? List<*>
if (events == null || events.isEmpty()) {
Log.d("V2NIdentifyDrawer", "---callback -- drawYongDu --- 1 filter is empty ---")
V2XBizTrace.onAck(TAG, mapOf("yongDu" to ""), true)
@@ -254,7 +250,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
AiRoadMarker.aiMakers.getOrPut(id) {
AiRoadMarker().apply {
val poiType = getPoiType(itx.eventType).poiType
marker(Marker(id, poiType, lat, lon, car.heading, null, null,
marker(Marker(id, poiType, lon, lat, car.heading, null, null,
V2XRoadEventEntity().also { e ->
e.poiType = poiType
e.location = MarkerLocation().also { l ->
@@ -319,7 +315,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
)
}
}.receive()
}
}*/
} else if (msg.what == MSG_WHAT_DRAW_OTHER_RETROGRADE_VEHICLE) {
val event = msg.obj as? MessagePad.Event
if (event == null) {
@@ -327,6 +323,24 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
V2XBizTrace.onAck(TAG, mapOf("other_retrograde_vehicle" to "event == null"), true)
return@Callback true
}
val body = runCatching { GsonUtils.fromJson(event.exts, Map::class.java) }.getOrNull()
val cameraIp = body?.get("cameraIp") as? String ?: ""
val array = (body?.get("eventExtUnits") as? JsonArray)
var heading = 0.0
var uuid = ""
if (array != null && array.size() > 0) {
for (e in array) {
if (e is JsonObject) {
if (e.has("heading")) {
heading = runCatching { e.asDouble }.getOrNull() ?: 0.0
}
if (e.has("uuid")) {
uuid = runCatching { e.asString }.getOrNull() ?: ""
}
}
}
}
Logger.d(TAG, "cameraIp: $cameraIp, heading:$heading, uuid: $uuid")
val newEventId = "other_retrograde_vehicle_${event.eventId}"
AiRoadMarker.aiMakers.getOrPut(newEventId) {
val eventLocation = when (event.gnssType) {
@@ -341,8 +355,6 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
return@Callback true
}
val isDriver = AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
val cameraIp = if(TextUtils.isEmpty(event.exts)) ""
else (GsonUtils.fromJson(event.exts, Map::class.java)["cameraIp"])?:""
// 弹事件框
CallerRoadV2NEventWindowListenerManager.showLiveVideo(
newEventId,
@@ -392,9 +404,29 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
}
}
} else if (msg.what == MSG_WHAT_DRAW_PEOPLE_CROSS) {
Logger.i(TAG, "people cross -- 1 --")
val data = msg.obj as? MessagePad.Event ?: return@Callback true
val body = runCatching { GsonUtils.fromJson(data.exts, Map::class.java) }.getOrNull()
val cameraIp = body?.get("cameraIp") as? String ?: ""
val array = (body?.get("eventExtUnits") as? JsonArray)
var heading = 0.0
var uuid = ""
if (array != null && array.size() > 0) {
for (e in array) {
if (e is JsonObject) {
if (e.has("heading")) {
heading = runCatching { e.asDouble }.getOrNull() ?: 0.0
}
if (e.has("uuid")) {
uuid = runCatching { e.asString }.getOrNull() ?: ""
}
}
}
}
Logger.d(TAG, "cameraIp: $cameraIp, heading:$heading, uuid: $uuid")
AiRoadMarker.aiMakers.getOrPut(data.eventId) {
val isDriver = AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
Logger.i(TAG, "people cross -- 2 --")
val isDriver = AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
val carLocation = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
val distance = CoordinateUtils.calculateLineDistance(carLocation.longitude, carLocation.latitude, data.longitude, data.latitude)
if (distance > 150) {
@@ -402,8 +434,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
V2XBizTrace.onAck(TAG, mapOf("people cross" to "distance > 150"), true)
return@Callback true
}
val cameraIp = if(TextUtils.isEmpty(data.exts)) ""
else (GsonUtils.fromJson(data.exts, Map::class.java)["cameraIp"])?:""
Logger.i(TAG, "people cross -- 3 --")
// 弹事件框
CallerRoadV2NEventWindowListenerManager.showLiveVideo(
data.eventId,
@@ -417,7 +448,8 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
data.latitude)
AiRoadMarker()
}.also {
it.marker(Marker(data.eventId, EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType, data.longitude, data.latitude, 0.0), drawMarker = true, false, isHighFrequency = true)
Logger.i(TAG, "people cross -- 4 --")
it.marker(Marker(data.eventId, EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType, data.longitude, data.latitude, heading), drawMarker = true, false, isHighFrequency = true)
}.receive()
}
true
@@ -461,7 +493,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
var best = Int.MIN_VALUE
var delta = Int.MAX_VALUE
for (lane in freeLanes) {
val abs = kotlin.math.abs(lane.id - laneId)
val abs = abs(lane.id - laneId)
if (abs < delta && lane.id != laneId) {
best = lane.id
delta = abs
@@ -489,10 +521,10 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
}
}
private fun computeCrossCountBetween(start: kotlin.Triple<Double, Double, Double>, end: kotlin.Pair<Double, Double>): Int {
private fun computeCrossCountBetween(start: Triple<Double, Double, Double>, end: kotlin.Pair<Double, Double>): Int {
val points = V2NUtils.generateIntermediatePoints(kotlin.Pair(start.first, start.second), end, 50.0 * 1e-7)
V2XBizTrace.onAck(points, "computeCrossCountBetween", true)
var crossId = MapDataWrapper.getCrossRoad(start.first, start.second, start.third)?.cross_id_end
var crossId = MapDataWrapper.getCrossRoad(start.first, start.second, start.third)?.cross_id
val angle = start.third
var count = 1
for (p in points) {

View File

@@ -11,8 +11,10 @@ import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.hmi.CallerRoadV2NEventWindowListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
import com.mogo.eagle.function.biz.v2x.V2XBizTrace
@@ -100,12 +102,17 @@ class AiRoadMarker {
fun marker(marker: Marker, drawMarker: Boolean, drawRoadLine: Boolean = false, isHighFrequency:Boolean = false) {
val markerId = marker.id
if (isHighFrequency && drawMarker) {
this.marker.set(marker)
Logger.d(TAG, "marker --->poiType: $marker, ${EventTypeEnumNew.getMarker3DRes(marker.poiType)}")
val builder = getOrPutPointOptionBuilder(markerId, V2XConst.V2X_MARKER_OWNER, MAP_MARKER)
builder
.set3DMode(true)
.isUseGps(true)
.icon3DRes(EventTypeEnumNew.getMarker3DRes(marker.poiType))
.anchorColor("#D65D5AFF")
.controlAngle(true)
.anchor(0.5f, 0.5f)
.rotate(marker.poi_angle.toFloat())
.longitude(marker.poi_lon)
.latitude(marker.poi_lat)
CallerMapUIServiceManager.getOverlayManager()?.showOrUpdatePoint(builder.build())?.let { p ->
@@ -117,9 +124,13 @@ class AiRoadMarker {
}
val wrapper = MarkerWrapper(markerId, marker.poi_lon, marker.poi_lat, 1, elapsedDistance = distance)
wrapper.onRemoved = {
CallerRoadV2NEventWindowListenerManager.dismiss(markerId)
builders.remove(markerId)
markerIds.remove(p.id)
if (marker.poiType == EventTypeEnumNew.TYPE_SOCKET_ROAD_GREE_WAVE.poiType) {
CallerHmiManager.dismissGreenWave()
} else {
CallerRoadV2NEventWindowListenerManager.dismiss(marker.id)
}
}
wrapper.addPoint(p)
MarkerRemoveManager.addMarker(wrapper)
@@ -219,22 +230,7 @@ class AiRoadMarker {
V2XBizTrace.onAck("$TAG -marker-4-l2:", l2)
val points = LinkedList<MogoLatLng>()
if (l2.points.isNotEmpty()) {
points.addAll(l2.points.reversed()/*.filter {
val location = V2XEventManager.getFirstLocationInCross()
Log.d(TAG, "l2: location -> $location")
if (location != null) {
val carLocation = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
if (DrivingDirectionUtils.getDegreeOfCar2Poi2(carLocation.longitude, carLocation.latitude, location.longitude, location.latitude, carLocation.heading) > 90) {
//处理同一个路口不同车道调头,这种极端情况
true
} else {
val angle = DrivingDirectionUtils.getDegreeOfCar2Poi2(location.longitude, location.latitude, it.longitude, it.latitude, location.heading)
angle <= 90
}
} else {
true
}
}.*/.map {
points.addAll(l2.points.reversed().map {
MogoLatLng(it.latitude, it.longitude)
})
}
@@ -327,7 +323,11 @@ class AiRoadMarker {
roadMarker.removeMarkers()
handler.removeCallbacks(checkExpiredTask)
aiMakers.remove(marker.id)
CallerRoadV2NEventWindowListenerManager.dismiss("${marker.poi_lon}-${marker.poi_lat}")
if (marker.poiType == EventTypeEnumNew.TYPE_SOCKET_ROAD_GREE_WAVE.poiType) {
CallerHmiManager.dismissGreenWave()
} else {
CallerRoadV2NEventWindowListenerManager.dismiss(marker.id)
}
}
}
@@ -365,12 +365,12 @@ class AiRoadMarker {
data class Marker(
val id: String,
val poiType: String,
val poi_lat: Double,
val poi_lon: Double,
val poi_lat: Double,
val poi_angle: Double,
val polygon: List<Pair<Double, Double>>? = null,
var farthestPoint: Pair<Double, Double>? = null,
var entity: V2XRoadEventEntity? = null
var entity: V2XRoadEventEntity? = null,
) {
override fun equals(other: Any?): Boolean {

View File

@@ -142,11 +142,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
if (gnssInfo != null) {
if (1 == FunctionBuildConfig.gpsProvider) {
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
CallerAutoPilotStatusListenerManager.updateAutoPilotLocAndTime(
gnssInfo.satelliteTime,
gnssInfo.longitude,
gnssInfo.latitude
)
CallerAutoPilotStatusListenerManager.updateAutoPilotLocAndTime(gnssInfo.satelliteTime, gnssInfo.longitude, gnssInfo.latitude, gnssInfo.heading)
}
}
}

View File

@@ -16,6 +16,7 @@ import com.mogo.eagle.core.data.v2x.V2XEvent.RoadEventX
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setDemoMode
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIgnoreConditionDraw
import com.mogo.eagle.core.function.call.autopilot.CallerV2nNioEventListenerManager
import com.mogo.eagle.core.function.call.cloud.CallerCloudListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
@@ -78,6 +79,30 @@ class TeleMsgHandler : IMsgHandler {
return
}
if (it.protocolType == TelematicConstant.V2N_AI_ROAD_PEOPLE_CROSS) {
runCatching {
Log.d(TAG, "乘客屏收到司机屏转发云端下发的行人/非机动车横穿事件 --- 1 ---")
CallerV2nNioEventListenerManager.invokeV2nNioCrossoverEvent(MessagePad.Event.parseFrom(msg.body))
Log.d(TAG, "乘客屏收到司机屏转发云端下发的行人/非机动车横穿事件 --- 2 ---")
}
return
}
if (it.protocolType == TelematicConstant.V2N_AI_ROAD_GREEN_WAVE) {
runCatching {
Log.d(TAG, "乘客屏收到司机屏转发云端下发的绿波通行 --- 1 ---")
CallerV2nNioEventListenerManager.invokeV2nNioGreenWavePassageEvent(MessagePad.V2nCrossSpeed.parseFrom(msg.body))
Log.d(TAG, "乘客屏收到司机屏转发云端下发的绿波通行 --- 2 ---")
}
return
}
if (it.protocolType == TelematicConstant.V2N_AI_ROAD_OTHER_RETROGRADE_VEHICLE) {
runCatching {
Log.d(TAG, "乘客屏收到司机屏转发云端下发的他车逆行 --- 1 ---")
CallerV2nNioEventListenerManager.invokeV2nNioOtherRetrogradeEvent(MessagePad.Event.parseFrom(msg.body))
Log.d(TAG, "乘客屏收到司机屏转发云端下发的他车逆行 --- 2 ---")
}
return
}
if (it.protocolType == TelematicConstant.V2N_NEW_LINK_SWITCH) {
try {
Log.d(TAG, "乘客屏收到司机屏转发的新链路开关 --- 1 ---")

View File

@@ -287,11 +287,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
// 同步给MAP地图
CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(gnssInfo)
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
CallerAutoPilotStatusListenerManager.updateAutoPilotLocAndTime(
System.currentTimeMillis() / 1000.0,
gnssInfo.longitude,
gnssInfo.latitude
)
CallerAutoPilotStatusListenerManager.updateAutoPilotLocAndTime(System.currentTimeMillis() / 1000.0, gnssInfo.longitude, gnssInfo.latitude, gnssInfo.heading)
}
}
}

View File

@@ -18,10 +18,14 @@ import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.enums.TrafficLightEnum
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.data.multidisplay.TelematicConstant
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
@@ -31,6 +35,7 @@ import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.zhjt.service.chain.ChainLog
import perception.FusionTrafficLightOuterClass
import kotlin.math.abs
fun TrafficLightStatus.convert(): TrafficLightEnum {
return when {
@@ -57,7 +62,8 @@ fun convert(state: FusionTrafficLightOuterClass.FusionLightState): TrafficLightE
* @优先级OBU,云,工控
* @since: 2022/4/28
*/
class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLightListener {
class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLightListener,
IMoGoChassisLocationGCJ02Listener {
companion object {
const val TAG = "TrafficLightDispatcher"
@@ -89,12 +95,17 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
private var lightCountDownTimer: CountDownTimer? = null
private var lastLightTime: Long = System.currentTimeMillis()
private var currentSpeed: Float = 0f
private var isPrompted: Boolean = false //是否提示过起步提醒/提前减速,每个路口仅提示一次
fun initServer(context: Context) {
mContext = context
//注册监听AI云.OBU路侧获取红绿灯状态
CallerTrafficLightListenerManager.addListener(TAG, this)
//注册监听工控机感知红绿灯
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
//注册获取当前车速
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 1, this)
}
/**
@@ -114,7 +125,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
}
if (!hasObuLightStatus) {
if (!hasAiLightStatus) {
trafficLights?.let {
trafficLights?.let { it ->
var light: FusionTrafficLightOuterClass.FusionTrafficLight? = null
if (it.hasStraight()) {
light = it.straight
@@ -161,6 +172,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
if(convert(light.state) == TrafficLightEnum.BLACK){
//隐藏当前红绿灯以及额外提示框
CallerTrafficLightListenerManager.disableTrafficLight()
isPrompted = false
}else{
//有下一和下二灯态则为融合V2N红绿灯数据
onFusionTrafficLight(convert(light.state),light.duration.toInt(),
@@ -180,16 +192,44 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
* 车辆行驶中若判断当前绿灯自车基于当前速度需提速10%以上才可通过时,提示“蘑菇提醒您及时减速,避免路口急刹”
* 车辆行驶中若判断当前红灯自车基于当前速度需降低60%以上才可通过时,提示“蘑菇提醒您及时减速,避免路口急刹”
*/
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) && !isPrompted){
//车辆等红灯,在红/黄灯剩余5s且下一灯态为绿灯时提示“红灯即将变绿”并在变为绿灯时有提示起步的动效
if((light.state == FusionTrafficLightOuterClass.FusionLightState.STATE_YELLOW_FUSION || light.state ==FusionTrafficLightOuterClass.FusionLightState.STATE_RED_FUSION)
&& light.duration < 5 && light.nextState == FusionTrafficLightOuterClass.FusionLightState.STATE_GREEN_FUSION){
//语音播放
//语音播放:红灯即将变绿
AIAssist.getInstance(mContext).speakTTSVoice("红灯即将变绿")
isPrompted = true
}
//车辆行驶中若判断当前绿灯自车无法通过在绿灯剩余5s且下一灯态为红/黄灯时,提示“蘑菇提醒您及时减速,避免路口急刹”
if(light.state == FusionTrafficLightOuterClass.FusionLightState.STATE_GREEN_FUSION && light.duration < 5){
CallerMapRoadListenerManager.getStopLineDistance()?.let { dis->
if(currentSpeed*light.duration < dis){
//语音播放:蘑菇提醒您及时减速,避免路口急刹
AIAssist.getInstance(mContext).speakTTSVoice("蘑菇提醒您及时减速,避免路口急刹")
isPrompted = true
}
}
}
//车辆行驶中若判断当前绿灯自车基于当前速度需提速10%以上才可通过时,提示“蘑菇提醒您及时减速,避免路口急刹”
if(light.state == FusionTrafficLightOuterClass.FusionLightState.STATE_GREEN_FUSION){
CallerMapRoadListenerManager.getStopLineDistance()?.let{distance->
if(currentSpeed*light.duration*1.1 < distance){
//语音播放:蘑菇提醒您及时减速,避免路口急刹
AIAssist.getInstance(mContext).speakTTSVoice("蘑菇提醒您及时减速,避免路口急刹")
isPrompted = true
}
}
}
//车辆行驶中若判断当前红灯自车基于当前速度需降低60%以上才可通过时,提示“蘑菇提醒您及时减速,避免路口急刹”
if(light.state ==FusionTrafficLightOuterClass.FusionLightState.STATE_RED_FUSION){
CallerMapRoadListenerManager.getStopLineDistance()?.let{distance->
if(currentSpeed*0.4*light.duration > distance){
//语音播放:蘑菇提醒您及时减速,避免路口急刹
AIAssist.getInstance(mContext).speakTTSVoice("蘑菇提醒您及时减速,避免路口急刹")
isPrompted = true
}
}
}
//TODO 需要知道当前车速和当前位置距离路口的距离
// if(light.state == FusionTrafficLightOuterClass.FusionLightState.STATE_GREEN_FUSION && light.duration < 5){
//
// }
}
@@ -464,6 +504,15 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
CallerTrafficLightListenerManager.removeListener(TAG)
//取消注册监听工控机感知红绿灯
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
//取消注册获取当前车速
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
}
/**
* 当前车速
*/
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
currentSpeed = abs(mogoLocation?.gnssSpeed ?: 0f)
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.hmi.ui
import android.content.Context
import android.telecom.Call
import android.text.TextUtils
import android.view.Gravity
import android.view.ViewGroup
@@ -86,9 +87,6 @@ class MoGoHmiProvider : IMoGoHmiProvider {
private val xiaozhi by lazy { XiaoZhiStateManager() }
private val greenWave by lazy { AtomicReference<MoGoPopWindow>() }
override fun init(context: Context?) {
this.context = context
}
@@ -410,39 +408,10 @@ class MoGoHmiProvider : IMoGoHmiProvider {
}
override fun showGreenWave(min: Int, max: Int, cross: Int) {
val activity = AppStateManager.currentActivity() ?: return
activity.lifeCycleScope.launch {
greenWave.get()?.hide()
val content = GreenWaveView(activity)
MoGoPopWindow.Builder()
.contentView(content)
.width(WindowManager.LayoutParams.WRAP_CONTENT)
.height(WindowManager.LayoutParams.WRAP_CONTENT)
.attachToActivity(activity)
.draggable(true)
.gravityInActivity(Gravity.CENTER)
.also {
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
it.offsetX(960)
it.offsetY(445)
} else {
it.offsetX(980)
it.offsetY(-324)
}
}
.onDismissed {
greenWave.set(null)
}
.onShowed {
content.bind(min, max, cross)
}
.build().also {
greenWave.set(it)
}.show()
}
CallerHmiViewControlListenerManager.invokeGreenWaveVisible(min, max, cross)
}
override fun dismissGreenWave() {
greenWave.get()?.hide()
CallerHmiViewControlListenerManager.invokeGreenWaveDismiss()
}
}

View File

@@ -141,7 +141,8 @@ class RoadCrossLiveView @JvmOverloads constructor(
}
}
private fun gsyVideoPlay(img: String, live: String) {
private fun gsyVideoPlay(img: String?, live: String?) {
if (live.isNullOrEmpty()) return
resetView()
gsyVideoOptionBuilder.setUrl(live)
.setCacheWithPlay(false)

View File

@@ -4,6 +4,7 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.LinearLayout
@@ -13,7 +14,9 @@ import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.kotlin.scope
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
@@ -32,7 +35,7 @@ import kotlinx.android.synthetic.main.view_green_wave_driver_layout.view.recomme
import kotlinx.android.synthetic.main.view_green_wave_passenger_layout.view.recommend_cross as passenger_recommend_cross
import kotlinx.android.synthetic.main.view_green_wave_driver_layout.view.recommend_cross as driver_recommend_cross
class GreenWaveView: LinearLayout, IMoGoChassisLocationGCJ02Listener, RecyclerView.OnItemTouchListener, Runnable {
class GreenWaveView: LinearLayout, IMoGoChassisLocationGCJ02Listener, RecyclerView.OnItemTouchListener, Runnable, IViewControlListener {
companion object {
private const val TAG = "GreenWaveView"
@@ -86,15 +89,7 @@ class GreenWaveView: LinearLayout, IMoGoChassisLocationGCJ02Listener, RecyclerVi
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 5, this)
val rv: RecyclerView? = if (isDriver) driver_wave_rv else passenger_wave_rv
rv?.addItemDecoration(CommonDividerItemDecoration.Builder()
.spanCountTBCare(false)
.horizontalInnerSpace(SizeUtils.dp2px(10f))
.build())
rv?.addOnItemTouchListener(this)
rv?.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, true)
rv?.adapter = WaveAdapter()
startAutoScroll()
CallerHmiViewControlListenerManager.addListener(TAG, this)
}
private fun startAutoScroll() {
@@ -123,6 +118,7 @@ class GreenWaveView: LinearLayout, IMoGoChassisLocationGCJ02Listener, RecyclerVi
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
CallerHmiViewControlListenerManager.removeListener(this)
val rv: RecyclerView? = if (isDriver) driver_wave_rv else passenger_wave_rv
rv?.removeOnItemTouchListener(this)
stopAutoScroll()
@@ -146,8 +142,18 @@ class GreenWaveView: LinearLayout, IMoGoChassisLocationGCJ02Listener, RecyclerVi
}
}
fun bind(minSpeed: Int, maxSpeed: Int, cross: Int) {
private fun show(minSpeed: Int, maxSpeed: Int, cross: Int) {
scope.launch {
this@GreenWaveView.visibility = View.VISIBLE
val rv: RecyclerView? = if (isDriver) driver_wave_rv else passenger_wave_rv
rv?.addItemDecoration(CommonDividerItemDecoration.Builder()
.spanCountTBCare(false)
.horizontalInnerSpace(SizeUtils.dp2px(10f))
.build())
rv?.addOnItemTouchListener(this@GreenWaveView)
rv?.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, true)
rv?.adapter = WaveAdapter()
startAutoScroll()
if (isDriver) {
driver_recommend_speed?.text = "建议车速${minSpeed}-${maxSpeed}km/h"
driver_recommend_cross?.text = "可丝滑通过${cross}个路口"
@@ -157,4 +163,19 @@ class GreenWaveView: LinearLayout, IMoGoChassisLocationGCJ02Listener, RecyclerVi
}
}
}
private fun hide() {
scope.launch {
visibility = View.GONE
}
}
override fun onGreenWaveViewDismiss() {
hide()
}
override fun onGreenWaveViewVisible(min: Int, max: Int, cross: Int) {
super.onGreenWaveViewVisible(min, max, cross)
show(min, max, cross)
}
}

View File

@@ -8,10 +8,8 @@ import android.net.wifi.WifiManager
import android.os.Handler
import android.os.Message
import android.util.AttributeSet
import android.util.Log
import android.util.TypedValue
import android.view.LayoutInflater
import android.widget.ImageView
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
@@ -90,7 +88,6 @@ class WifiStateView @JvmOverloads constructor(
wifiHandler = WifiHandler(this)
val wifiInfo = wifiManager!!.connectionInfo
wifiName = wifiInfo.ssid.replace("\"","")
// Log.i("emArrow", "init wifiName: $wifiName")
}
private val wifiStateReceiver: BroadcastReceiver = object : BroadcastReceiver() {
@@ -105,7 +102,6 @@ class WifiStateView @JvmOverloads constructor(
}
val wifiInfo = wifiManager!!.connectionInfo
wifiName = wifiInfo.ssid.replace("\"","")
// Log.i("emArrow", "wifiName: $wifiName")
level = WifiManager.calculateSignalLevel(wifiInfo.rssi, 5)
wifiHandler?.sendEmptyMessage(level)
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -3,8 +3,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_15"
>
<ImageView

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_500"
android:layout_height="@dimen/dp_421"
android:layout_width="@dimen/dp_600"
android:layout_height="@dimen/dp_520"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg_auto_exploration">

View File

@@ -3,13 +3,14 @@ package com.mogo.eagle.core.function.angle.scenes
import com.mogo.eagle.core.function.api.map.angle.Scene
import com.mogo.map.uicontroller.VisualAngleMode
import com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_CROSS
import com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_CROSS_NEW
/**
* 十字路口
*/
class CrossRoad(private val delayTime: Long): Scene {
override val angle: VisualAngleMode
get() = MAP_STYLE_VR_ANGLE_CROSS
get() = MAP_STYLE_VR_ANGLE_CROSS_NEW
override val priority: Int = 0
override val displayThreshold: Long

View File

@@ -3,7 +3,6 @@ package com.mogo.eagle.core.function.business.ai
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.util.Log
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.data.config.FunctionBuildConfig
@@ -18,6 +17,7 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_RO
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ROMA_MAP_READY_START
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ROMA_MAP_START
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ROMA_RANGE
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ROMA_REJECT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ROMA_REQUEST
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ROMA_REQUEST_DELAY
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_CODE_ROMA_REQUEST_ERROR
@@ -122,7 +122,12 @@ class RomaManager() : IMoGoPlanningRottingListener,
&& CallerMapIdentifyManager.roam.first!= TAG
&& CallerMapIdentifyManager.roam.second) {
ToastUtils.showLong("正在展示路口漫游,请稍后重试")
Log.e("emArrow", "正在展示路口漫游,请稍后重试")
MapRomaTrace.log(
"",
CHAIN_CODE_ROMA_REJECT,
TAG,
mutableMapOf("reject" to "正在展示路口,点触漫游按钮")
)
CallerMapRomaListener.invokeMapRoma(false)
return
}

View File

@@ -1,8 +1,12 @@
package com.mogo.eagle.core.function.business.identify
import android.annotation.SuppressLint
import android.os.Handler
import android.os.Looper
import android.util.Log
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.map.identify.MogoIdentifyManager
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.TrackedObject
@@ -38,6 +42,7 @@ class IdentifyBeautifyDataDrawer : Identify {
//清除缓存
TrackManager.getInstance().clearCache(resultList)
val filterList = TrackManager.getInstance().filterTrafficData(resultList)
if (filterList.size > 0) {
// 绘制新数据

View File

@@ -12,15 +12,16 @@ import com.mogo.eagle.core.function.call.obu.CallerObuWarningListenerManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isTaxi
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
import com.mogo.eagle.core.utilcode.util.ParseVersionUtils
import com.mogo.map.MogoMap
import com.zhjt.service.chain.ChainLog
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.TrackedObject
import mogo.yycp.api.proto.SocketDownData
import java.util.concurrent.TimeUnit
object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConfigListener {
private const val TAG = "IdentifyFactory"
private const val MSG_CHECK = 999
object DriverIdentify {
internal val originDataDrawer = IdentifyOriginDataDrawer()
@@ -36,13 +37,15 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
private var identify: Identify? = null
private var aiCloudIdentify: Identify? = null
private var startTime: Long = 0L
fun initType(){
fun initType() {
drawType("默认开启感知优化等待docker版本")
identify = UserIdentify.beautifyDataDrawer
aiCloudIdentify = AiIdentify.aiCloudDataDrawer
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
CallerObuWarningListenerManager.addListener(TAG, this)
mDrawerHandler.sendEmptyMessageDelayed(MSG_CHECK, 1000L)
}
override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {
@@ -105,34 +108,57 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
}
}
when (msg.what) {
MSG_CHECK -> {
if(startTime == 0L){
sendEmptyMessageDelayed(MSG_CHECK, 1000L)
return
}
val endTime = System.nanoTime()
val internal = TimeUnit.NANOSECONDS.toMillis(endTime - startTime)
if(internal >= 1000){
identify!!.clearOldMarker()
}
sendEmptyMessageDelayed(MSG_CHECK, 1000L)
}
MSG_DATA_TRACK -> {
if (msg.obj is List<*>) {
identify!!.renderAdasRecognizedResult(msg.obj as List<TrackedObject>?)
startTime = System.nanoTime()
}
}
MSG_DATA_AI_TRACK -> {
if (msg.obj is List<*>) {
aiCloudIdentify!!.renderAiCloudResult(msg.obj as List<SocketDownData.CloudRoadDataProto>, msg.data.getString("mapInstance")!!)
aiCloudIdentify!!.renderAiCloudResult(
msg.obj as List<SocketDownData.CloudRoadDataProto>,
msg.data.getString("mapInstance")!!
)
}
}
MSG_DATA_WARNING -> {
if (msg.obj is List<*>) {
identify!!.renderPlanningWarningObj(msg.obj as List<MessagePad.PlanningObject>?)
}
}
MSG_DATA_OBU_WARNING_UPDATE -> {
if (msg.obj is TrafficData) {
identify!!.renderOBUWarningObj(true, msg.obj as TrafficData)
}
}
MSG_DATA_OBU_WARNING_REMOVE -> {
if (msg.obj is TrafficData) {
identify!!.renderOBUWarningObj(false, msg.obj as TrafficData)
}
}
MSG_DATA_CLEAR -> {
identify!!.clearOldMarker()
}
MSG_DATA_AI_CLEAR -> {
aiCloudIdentify!!.clearAiMarker(msg.data.getString("mapInstance")!!)
}
@@ -147,11 +173,14 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
mDrawerHandler.sendMessage(message)
}
override fun renderAiCloudResult(resultList: List<SocketDownData.CloudRoadDataProto>, mapInstance:String) {
override fun renderAiCloudResult(
resultList: List<SocketDownData.CloudRoadDataProto>,
mapInstance: String
) {
val message = Message.obtain()
message.what = MSG_DATA_AI_TRACK
message.obj = resultList
message.data.putString("mapInstance",mapInstance)
message.data.putString("mapInstance", mapInstance)
mDrawerHandler.sendMessage(message)
}
@@ -168,10 +197,10 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConf
mDrawerHandler.sendMessage(message)
}
override fun clearAiMarker(mapInstance:String) {
override fun clearAiMarker(mapInstance: String) {
val message = Message.obtain()
message.what = MSG_DATA_AI_CLEAR
message.data.putString("mapInstance",mapInstance)
message.data.putString("mapInstance", mapInstance)
mDrawerHandler.sendMessage(message)
}

View File

@@ -76,6 +76,7 @@ class IdentifyOriginDataDrawer : Identify {
mMarkersCaches.remove(key)
MogoIdentifyManager.getInstance()
.removeMarker(key)
TrackerSourceFilterHelper.removeBottomMarker(key)
}
val filterList = filterTrafficData(resultList)
@@ -109,6 +110,7 @@ class IdentifyOriginDataDrawer : Identify {
mFilterTrafficData[uuid] = temp
mMarkersCaches[uuid] = temp
trafficDataUuidList.add(uuid)
TrackerSourceFilterHelper.filterZombieMarker(data)
}
return mFilterTrafficData
}
@@ -121,6 +123,7 @@ class IdentifyOriginDataDrawer : Identify {
for (uuid in trafficDataUuidList) {
MogoIdentifyManager.getInstance()
.removeMarker(uuid)
TrackerSourceFilterHelper.removeBottomMarker(uuid)
}
trafficDataUuidList.clear()
mMarkersCaches.clear()

View File

@@ -1,5 +1,7 @@
package com.mogo.eagle.core.function.business.identify;
import static com.mogo.map.MogoMap.DEFAULT;
import android.annotation.SuppressLint;
import android.util.ArraySet;
@@ -9,7 +11,6 @@ import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.utilcode.geometry.S2CellId;
import com.mogo.eagle.core.utilcode.geometry.S2LatLng;
import com.mogo.map.MogoMap;
import com.mogo.map.identify.MogoIdentifyManager;
import java.util.HashMap;
@@ -124,6 +125,7 @@ public class TrackManager {
cellIdCaches.forcePut(uuid, trackObj.getCellIdPos());
mMarkersCaches.put(uuid, trackObj);
trafficDataUuid.add(uuid);
TrackerSourceFilterHelper.INSTANCE.filterZombieMarker(data);
}
//Log.i("costTime","" + (System.currentTimeMillis() - cost));
}
@@ -156,7 +158,8 @@ public class TrackManager {
mMarkersCaches.remove(key);
WarningHelper.INSTANCE.remove(key);
MogoIdentifyManager.getInstance()
.removeMarker(key, MogoMap.DEFAULT);
.removeMarker(key, DEFAULT);
TrackerSourceFilterHelper.INSTANCE.removeBottomMarker(key);
}
@SuppressLint("NewApi")
@@ -167,7 +170,8 @@ public class TrackManager {
mMarkersCaches.forEach((uuid, trackObj) -> {
trackObj.clear();
MogoIdentifyManager.getInstance()
.removeMarker(uuid, MogoMap.DEFAULT);
.removeMarker(uuid, DEFAULT);
TrackerSourceFilterHelper.INSTANCE.removeBottomMarker(uuid);
});
mMarkersCaches.clear();
}

View File

@@ -3,20 +3,21 @@ package com.mogo.eagle.core.function.business.identify
import android.annotation.SuppressLint
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.function.call.biz.CallerFuncBizListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.map.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isPassenger
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isTaxi
import com.mogo.map.overlay.core.Level
import com.mogo.map.overlay.point.Point
import com.zhidaoauto.map.sdk.open.renders.marker.Marker
import com.zhidaoauto.map.sdk.open.renders.marker.MarkerOptions
import mogo.telematics.pad.MessagePad.*
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.SubSource
import mogo.telematics.pad.MessagePad.TrackedObject
import mogo.telematics.pad.MessagePad.TrackedSource
object TrackerSourceFilterHelper {
private const val TAG = "TrackerSourceColor"
private val cacheZombieMap = mutableMapOf<String, Point.Options>()
@SuppressLint("NewApi")
fun filterData(data: TrackedObject): Boolean {
@@ -31,16 +32,19 @@ object TrackerSourceFilterHelper {
1 -> if (isIPC(data)) {
trackIPCFilter = false
}
2 -> {
if (isObu(data).second) {
trackIPCFilter = false
}
}
3 -> {
if (isV2I(data).second) {
trackIPCFilter = false
}
}
4 -> {
if (isV2nRSM(data).second) {
trackIPCFilter = false
@@ -63,15 +67,15 @@ object TrackerSourceFilterHelper {
return ""
}
if(data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_CONE.type){
if (data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_CONE.type) {
return ""
}
if(FunctionBuildConfig.isFusionColor){
if(isFusion(data)){
if (FunctionBuildConfig.isFusionColor) {
if (isFusion(data)) {
color = "#982FFFFF"
}
if(isV2X(data)){
if (isV2X(data)) {
color = "#F6F6F6FF"
}
}
@@ -99,43 +103,61 @@ object TrackerSourceFilterHelper {
}
//僵尸车
if (data.addAttribute == AdditionalAttribute.ATTR_ZOMBIE) {
// if (data.addAttribute == AdditionalAttribute.ATTR_ZOMBIE) {
// color = "#7A8499FF"
// if (FunctionBuildConfig.skinMode == 1) {
// color = "#9BA8BCFF"
// }
val opt = Point.Options.Builder(TAG,Level.MAP_MARKER)
.setId(data.uuid.toString())
.latitude(data.latitude)
.longitude(data.longitude)
.isUseGps(true)
.rotate(data.heading.toFloat())
.setAnimResource(R.raw.yujingguangquan)
.setDisplayAnim(true)
.setAnimScale(getAnimScale(data.type))
.build()
CallerMapUIServiceManager.getOverlayManager()?.updateAnimPoint(opt)
//消息埋点
CallerFuncBizListenerManager.invokeAttrZombieAnalyticsEvent()
}
// }
return color
}
private fun getAnimScale(type:Int):Float{
return when (type) {
TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE.type -> {
2.6f
}
TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS.type, TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK.type -> {
4.0f
}
else -> {
0f
fun filterZombieMarker(data: TrackedObject){
if (data.addAttribute == MessagePad.AdditionalAttribute.ATTR_ZOMBIE) {
if (!cacheZombieMap.contains(data.uuid.toString())) {
val opt = updateBottomMarker(data)
cacheZombieMap[data.uuid.toString()] = opt
}else{
val opt = cacheZombieMap[data.uuid.toString()]
opt?.let {
val build = it.builder().latitude(data.latitude).longitude(data.longitude).rotate(data.heading.toFloat()).build()
cacheZombieMap[data.uuid.toString()] = build
CallerMapUIServiceManager.getOverlayManager()?.showOrUpdatePoint(build)
}
}
}
}
private fun updateBottomMarker(data: TrackedObject) : Point.Options{
val scale = when (data.type) {
TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE.type,
TrafficTypeEnum.TYPE_TRAFFIC_ID_BICYCLE.type ,
TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO.type -> 0.1f
TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE.type -> 0.16f
TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS.type,
TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK.type -> 0.19f
else -> 0.2f
}
val opt = Point.Options.Builder(TAG, Level.DEFAULT)
.setId("9999" + data.uuid.toString())
.latitude(data.latitude)
.longitude(data.longitude)
.isUseGps(true)
.rotate(data.heading.toFloat())
.icon3DRes(R.raw.yujingguangquan)
.scale(scale)
.set3DMode(true)
.build()
CallerMapUIServiceManager.getOverlayManager()?.showOrUpdatePoint(opt)
return opt
}
fun removeBottomMarker(id: String){
CallerMapUIServiceManager.getOverlayManager()?.removePoint("9999$id")
cacheZombieMap.remove(id)
}
/**
* 过滤所有 工控感知数据 all match
*/

View File

@@ -42,8 +42,8 @@ class NDERoadCameraNetWorkModel private constructor() {
crossID,
loc.longitude,
loc.latitude,
// CallerMapUIServiceManager.getCityCode() ?: ""
"0734"
CallerMapUIServiceManager.getCityCode() ?: ""
// "0734" //todo emArrow test
)
}
}
@@ -75,8 +75,8 @@ class NDERoadCameraNetWorkModel private constructor() {
ip,
loc.longitude,
loc.latitude,
// CallerMapUIServiceManager.getCityCode() ?: ""
"0734"
CallerMapUIServiceManager.getCityCode() ?: ""
// "0734" //todo emArrow test
)
}
}

View File

@@ -0,0 +1,7 @@
package com.mogo.eagle.core.function.business.travelreality
data class EventReqEntity(
var points: List<Point>,
var cityCode: String = "0734",
var adCode: String = ""
)

View File

@@ -1,15 +1,25 @@
package com.mogo.eagle.core.function.business.travelreality
import android.content.Context
import android.graphics.Bitmap
import android.graphics.drawable.Drawable
import com.amap.api.maps.model.LatLng
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.GranularRoundedCorners
import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.request.target.CustomTarget
import com.bumptech.glide.request.transition.Transition
import com.mogo.commons.constants.HostConst
import com.mogo.eagle.core.data.BaseResponse
import com.mogo.eagle.core.data.Response
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.apiCall
import com.mogo.eagle.core.network.apiResponseCall
import com.mogo.eagle.core.network.request
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.Md5Util
import retrofit2.http.Query
import me.jessyan.autosize.utils.AutoSizeUtils
import java.util.Locale
class TravelRealityModel private constructor() {
@@ -28,7 +38,7 @@ class TravelRealityModel private constructor() {
/**
* 查询道路事件
*/
fun getEventsWithTrajRequest(reqData: List<Point>,
fun getEventsWithTrajRequest(reqData: EventReqEntity,
onSuccess: ((List<EventBean>) -> Unit), onError: ((String) -> Unit)){
request<Response<List<EventBean>?>>{
loader {
@@ -50,14 +60,15 @@ class TravelRealityModel private constructor() {
/**
* 查询路口设备
*/
fun getCrossDevice(lon: Double, lat: Double, cityCode: String?,
onSuccess: ((List<CrossDeviceBean>) -> Unit), onError: ((String) -> Unit)) {
fun getCrossDevice(onSuccess: ((List<CrossDeviceBean>) -> Unit), onError: ((String) -> Unit)) {
request<BaseResponse<List<CrossDeviceBean>?>>{
loader {
apiCall{
val time = System.currentTimeMillis().toString()
val md5String = "${CROSS_DEVICE.uppercase(Locale.getDefault())}$time"
getNetWorkApi(HostConst.getNDEHost()).getCrossDevice(Md5Util.getMD5Result(md5String), time, "", lon, lat, cityCode)
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
val cityCode = CallerMapUIServiceManager.getCityCode() ?: "0734"
getNetWorkApi(HostConst.getNDEHost()).getCrossDevice(Md5Util.getMD5Result(md5String), time, "", loc.longitude, loc.latitude, cityCode)
}
}
onSuccess {
@@ -72,14 +83,15 @@ class TravelRealityModel private constructor() {
/**
* 智慧路口路网范围
*/
fun getCityRoadRange(lon: Double, lat: Double, cityCode: String?,
onSuccess: ((List<List<Double>?>?) -> Unit), onError: ((String) -> Unit)) {
fun getCityRoadRange(onSuccess: ((List<List<Double>?>?) -> Unit), onError: ((String) -> Unit)) {
request<BaseResponse<List<List<Double>?>?>>{
loader {
apiCall{
val time = System.currentTimeMillis().toString()
val md5String = "${CITY_ROAD_RANGE.uppercase(Locale.getDefault())}$time"
getNetWorkApi(HostConst.getNDEHost()).getCityRoadRange(Md5Util.getMD5Result(md5String), time, lon, lat, cityCode)
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
val cityCode = CallerMapUIServiceManager.getCityCode() ?: "0734"
getNetWorkApi(HostConst.getNDEHost()).getCityRoadRange(Md5Util.getMD5Result(md5String), time, loc.longitude, loc.latitude, cityCode)
}
}
onSuccess {
@@ -94,14 +106,15 @@ class TravelRealityModel private constructor() {
/**
* 智慧道路轨迹
*/
fun getCityRoadTrack(lon: Double, lat: Double, cityCode: String?,
onSuccess: ((List<List<List<Double>?>?>?) -> Unit), onError: ((String) -> Unit)) {
fun getCityRoadTrack(onSuccess: ((List<List<List<Double>?>?>?) -> Unit), onError: ((String) -> Unit)) {
request<BaseResponse<List<List<List<Double>?>?>?>>{
loader {
apiCall{
val time = System.currentTimeMillis().toString()
val md5String = "${CITY_ROAD_TRACK.uppercase(Locale.getDefault())}$time"
getNetWorkApi(HostConst.getNDEHost()).getCityRoadTrack(Md5Util.getMD5Result(md5String), time, lon, lat, cityCode)
val loc = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
val cityCode = CallerMapUIServiceManager.getCityCode() ?: "0734"
getNetWorkApi(HostConst.getNDEHost()).getCityRoadTrack(Md5Util.getMD5Result(md5String), time, loc.longitude, loc.latitude, cityCode)
}
}
onSuccess {
@@ -112,4 +125,32 @@ class TravelRealityModel private constructor() {
}
}
}
fun downloadImage(context: Context, url: String?,
latLng: LatLng,
onSuccess: ((Bitmap, LatLng) -> Unit),
onFailed: ((LatLng) -> Unit)
) {
if (url.isNullOrEmpty()) return
val radiusPx = AutoSizeUtils.dp2px(context, 15f).toFloat()
val options = RequestOptions().transform(
GranularRoundedCorners(radiusPx, radiusPx,0f,0f)
)
Glide.with(context)
.asBitmap()
.apply(options)
.load(url)
.into(object : CustomTarget<Bitmap>() {
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
onSuccess(resource, latLng)
}
override fun onLoadCleared(placeholder: Drawable?) {}
override fun onLoadFailed(errorDrawable: Drawable?) {
super.onLoadFailed(errorDrawable)
onFailed(latLng)
}
})
}
}

View File

@@ -24,7 +24,7 @@ interface TravelRealityService {
suspend fun getEventsWithTrajRequest(
@Header("MogoAuthKey") authKey: String,
@Header("MogoReqTime") time: String,
@Body reqData: List<Point>
@Body reqData: EventReqEntity
): Response<List<EventBean>>
/**

View File

@@ -0,0 +1,48 @@
package com.mogo.eagle.core.function.business.travelreality.view
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Bitmap
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.map.R
@SuppressLint("ViewConstructor")
class EventVideoView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
private val title: String? = "全息路口"
) : ConstraintLayout (
context,
attrs,
defStyleAttr
) {
init {
LayoutInflater.from(context).inflate(R.layout.layout_event_video_maker, this, true)
initView()
}
private lateinit var videoImgView: ImageView
private fun initView() {
videoImgView = findViewById(R.id.videoImg)
val titleView = findViewById<TextView>(R.id.tvTitle)
title?.let {
titleView.text = it
}
}
fun setBitmap(bitmap: Bitmap) {
videoImgView.setImageBitmap(bitmap)
}
fun setPlaceHolder() {
videoImgView.setImageResource(R.drawable.video_marker_place_holder)
}
}

View File

@@ -2,10 +2,9 @@ package com.mogo.eagle.core.function.view
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import android.util.Log
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.function.api.map.road.IMoGoMapRoadListener
import com.mogo.eagle.core.function.api.map.roma.IMoGoAiCloudIdentifyDataListener
import com.mogo.eagle.core.function.business.ai.AiCloudIdentifyDataManager.Companion.aiCloudIdentifyDataManager
@@ -13,12 +12,15 @@ import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapAiCloudDataManager
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
import com.mogo.map.MogoMap.Companion.MAP_ROAM
import com.mogo.map.MogoMapView
import com.mogo.map.uicontroller.IMogoMapUIController
import com.mogo.map.uicontroller.VisualAngleMode
import com.zhjt.service.chain.ChainLog
import mogo.yycp.api.proto.SocketDownData
@@ -79,15 +81,16 @@ class MapRoamView(context: Context?, attrs: AttributeSet?) : MogoMapView(context
loc.latitude = latLng.first
loc.longitude = latLng.second
setExtraGPSData(loc)
val dis = CoordinateUtils.calculateLineDistance(curLat, curLng, latLng.first, latLng.second)
Log.i("emArrow", "$TAG 开始漫游 latLng:$latLng , curLat:$curLat , curLng:$curLng , dis:$dis")
val dis =
CoordinateUtils.calculateLineDistance(curLat, curLng, latLng.first, latLng.second)
// 开始漫游
trace(TAG, mapOf("startRoadRoam" to Pair("latLng" to latLng, "dis" to dis), "dis" to dis))
aiCloudIdentifyDataManager.trigger(true, 1, 300, latLng.first, latLng.second)
}
}
override fun response(requestStatus: Boolean, errorMsg: String?) {
Log.e("emArrow","road map response:$requestStatus , errorMsg:${errorMsg?:""}")
trace(TAG, mapOf("response" to requestStatus, "errorMsg" to (errorMsg?:"")))
}
override fun onAiIdentifyData(obj: SocketDownData.SocketDownDataProto?) {
@@ -114,4 +117,14 @@ class MapRoamView(context: Context?, attrs: AttributeSet?) : MogoMapView(context
getUI()?.setVisible(false)
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_TYPE_STATUS,
linkCode = ChainConstant.CHAIN_SOURCE_ADAS,
nodeAliasCode = ChainConstant.CHAIN_CODE_ROAD_ROMA,
paramIndexes = [0, 1]
)
private fun trace(tag: String, obj: Any) {
CallerLogger.d("$M_MAP$tag", "$obj")
}
}

View File

@@ -5,7 +5,6 @@ import android.animation.ValueAnimator
import android.content.Context
import android.graphics.Rect
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.animation.LinearInterpolator
@@ -18,6 +17,8 @@ import com.mogo.eagle.core.function.call.map.CallerMapIdentifyManager
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
import com.mogo.eagle.core.function.map.R
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.zhidaoauto.map.data.road.StopLine
@@ -92,12 +93,11 @@ class RoadCrossRoamView @JvmOverloads constructor(
override fun onStopLineInfo(info: StopLine) {
super.onStopLineInfo(info)
if(info.distance == 0.0){
Log.i("emArrow", "showState return , distance is zero")
if(info.distance == 0.0 || info.distance > 200){
CallerLogger.d("$M_MAP$TAG", "showState return , distance is ${info.distance}")
return
}
showState = info.distance < 200 && info.distance > 100
// Log.i("emArrow", "showState $showState , distance:${info.distance}")
showState = info.distance <= 200 && info.distance > 100
}
private fun attachView() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="280dp"
android:layout_height="352dp"
android:background="@drawable/event_video_bg"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/videoImg"
android:layout_width="240dp"
android:layout_height="200dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="66dp"
/>
<TextView
android:id="@+id/tvTitle"
android:layout_width="152dp"
android:layout_height="36dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:gravity="center"
android:textStyle="bold"
android:layout_marginBottom="65dp"
tools:text="全息路口"
android:textColor="#132A54"
android:textSize="25dp"
/>
<ImageView
android:layout_width="88dp"
android:layout_height="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@drawable/event_logo_icon"
android:layout_marginBottom="40dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -60,6 +60,8 @@
<attr name="compassDrawable" />
<!-- 智慧道路范围纹理 -->
<attr name="roadRangeDrawable" format="reference" />
<attr name="globalPathColor" format="color" />
<attr name="roadTrajectoryColor" format="color" />
<!-- 起点图片 -->
<attr name="startPointDrawable" />
<!-- 终点图片 -->