[6.5.0][道路事件] 经纬度弄反了,导致绘制不可见
This commit is contained in:
@@ -6,14 +6,17 @@ import androidx.test.core.app.ActivityScenario
|
|||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
import androidx.test.filters.LargeTest
|
import androidx.test.filters.LargeTest
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import com.google.protobuf.ByteString
|
||||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||||
import com.mogo.eagle.core.function.call.autopilot.CallerV2nNioEventListenerManager
|
import com.mogo.eagle.core.function.call.autopilot.CallerV2nNioEventListenerManager
|
||||||
import com.mogo.eagle.core.function.main.MainLauncherActivity
|
import com.mogo.eagle.core.function.main.MainLauncherActivity
|
||||||
|
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
|
||||||
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
|
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
|
||||||
import com.mogo.map.MapDataWrapper
|
import com.mogo.map.MapDataWrapper
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
|
import mogo.telematics.pad.MessagePad
|
||||||
import mogo.telematics.pad.MessagePad.V2nCrossSpeed
|
import mogo.telematics.pad.MessagePad.V2nCrossSpeed
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -23,10 +26,10 @@ import java.util.concurrent.TimeUnit
|
|||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
@LargeTest
|
@LargeTest
|
||||||
class GreenWaveTest {
|
class V2NTest {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "RoadInfoTest"
|
private const val TAG = "GreenWaveTest"
|
||||||
}
|
}
|
||||||
|
|
||||||
lateinit var launch: ActivityScenario<MainLauncherActivity>
|
lateinit var launch: ActivityScenario<MainLauncherActivity>
|
||||||
@@ -74,4 +77,48 @@ class GreenWaveTest {
|
|||||||
.build())
|
.build())
|
||||||
delay(TimeUnit.MINUTES.toMillis(10))
|
delay(TimeUnit.MINUTES.toMillis(10))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testPeopleCross(): Unit = runBlocking {
|
||||||
|
val arguments = InstrumentationRegistry.getArguments()
|
||||||
|
val millis = arguments.getString("delay", "0").toLong()
|
||||||
|
if (millis > 0) {
|
||||||
|
delay(millis)
|
||||||
|
}
|
||||||
|
val targetX = arguments.getString("lon", "0").toDouble()
|
||||||
|
val targetY = arguments.getString("lat", "0").toDouble()
|
||||||
|
val targetHeading = arguments.getString("angle", "0").toDouble()
|
||||||
|
val targetDistance = arguments.getString("distance", "0").toDouble()
|
||||||
|
var car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||||
|
var distance = CoordinateUtils.calculateLineDistance(car.longitude, car.latitude, targetX, targetY)
|
||||||
|
Log.d(TAG, "target_distance: $targetDistance, current distance: $distance")
|
||||||
|
while (distance > targetDistance) {
|
||||||
|
delay(2000)
|
||||||
|
car = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||||
|
distance = CoordinateUtils.calculateLineDistance(car.longitude, car.latitude, targetX, targetY)
|
||||||
|
}
|
||||||
|
Log.d(TAG, "2 -- > target_distance: $targetDistance, current distance: $distance")
|
||||||
|
var newPoint = DrivingDirectionUtils.calculateNewPoint(targetX, targetY, targetHeading, targetDistance)
|
||||||
|
Log.d(TAG, "location:[x:${targetX}, y:${targetY}, new_location:[x:${newPoint.first}, y:${newPoint.second}]")
|
||||||
|
FunctionBuildConfig.isNewV2NData = true
|
||||||
|
FunctionBuildConfig.v2nMainSwitch = true
|
||||||
|
val eventId = "xxxxxxxxxxxxx"
|
||||||
|
for (i in 0 until 500) {
|
||||||
|
CallerV2nNioEventListenerManager.invokeV2nNioCrossoverEvent(
|
||||||
|
MessagePad.Event.getDefaultInstance().toBuilder()
|
||||||
|
.setLongitude(newPoint.first)
|
||||||
|
.setLatitude(newPoint.second)
|
||||||
|
.setEventId(eventId)
|
||||||
|
.setTimestamp(System.currentTimeMillis())
|
||||||
|
.addAllTargetIds(emptyList())
|
||||||
|
.addTargetIdsBytes(ByteString.EMPTY)
|
||||||
|
.addTargetIds("0")
|
||||||
|
.setExts("{ \"cameraIp\": \"172.18.7.40\" }")
|
||||||
|
.build())
|
||||||
|
delay(50)
|
||||||
|
newPoint = DrivingDirectionUtils.calculateNewPoint(targetX, targetY, targetHeading, 0.5)
|
||||||
|
}
|
||||||
|
delay(TimeUnit.MINUTES.toMillis(10))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -82,12 +82,6 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
|||||||
private const val MSG_WHAT_DRAW_GREEN_WAVE = 0x1014 // 绿波通行
|
private const val MSG_WHAT_DRAW_GREEN_WAVE = 0x1014 // 绿波通行
|
||||||
private const val MSG_WHAT_DRAW_PEOPLE_CROSS = 0x1015 // 行人横穿
|
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 ->
|
private val callback = Handler.Callback { msg ->
|
||||||
if (msg.what == MSG_WHAT_DRAW_SHIGONE || msg.what == MSG_WHAT_DRAW_SHIGU) {
|
if (msg.what == MSG_WHAT_DRAW_SHIGONE || msg.what == MSG_WHAT_DRAW_SHIGU) {
|
||||||
val events = msg.obj as? List<*>
|
val events = msg.obj as? List<*>
|
||||||
@@ -133,8 +127,8 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
|||||||
val polygon = itx.polygonList.map { Pair.create(it.longitude, it.latitude) }
|
val polygon = itx.polygonList.map { Pair.create(it.longitude, it.latitude) }
|
||||||
marker(Marker(id,
|
marker(Marker(id,
|
||||||
poiType,
|
poiType,
|
||||||
itx.latitude,
|
|
||||||
itx.longitude,
|
itx.longitude,
|
||||||
|
itx.latitude,
|
||||||
itx.heading,
|
itx.heading,
|
||||||
polygon,
|
polygon,
|
||||||
null,
|
null,
|
||||||
@@ -254,7 +248,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
|||||||
AiRoadMarker.aiMakers.getOrPut(id) {
|
AiRoadMarker.aiMakers.getOrPut(id) {
|
||||||
AiRoadMarker().apply {
|
AiRoadMarker().apply {
|
||||||
val poiType = getPoiType(itx.eventType).poiType
|
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 ->
|
V2XRoadEventEntity().also { e ->
|
||||||
e.poiType = poiType
|
e.poiType = poiType
|
||||||
e.location = MarkerLocation().also { l ->
|
e.location = MarkerLocation().also { l ->
|
||||||
@@ -391,9 +385,11 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (msg.what == MSG_WHAT_DRAW_PEOPLE_CROSS) {
|
} 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 data = msg.obj as? MessagePad.Event ?: return@Callback true
|
||||||
AiRoadMarker.aiMakers.getOrPut(data.eventId) {
|
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 carLocation = CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
|
||||||
val distance = CoordinateUtils.calculateLineDistance(carLocation.longitude, carLocation.latitude, data.longitude, data.latitude)
|
val distance = CoordinateUtils.calculateLineDistance(carLocation.longitude, carLocation.latitude, data.longitude, data.latitude)
|
||||||
if (distance > 150) {
|
if (distance > 150) {
|
||||||
@@ -401,6 +397,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
|||||||
V2XBizTrace.onAck(TAG, mapOf("people cross" to "distance > 150"), true)
|
V2XBizTrace.onAck(TAG, mapOf("people cross" to "distance > 150"), true)
|
||||||
return@Callback true
|
return@Callback true
|
||||||
}
|
}
|
||||||
|
Logger.i(TAG, "people cross -- 3 --")
|
||||||
val cameraIp = if(TextUtils.isEmpty(data.exts)) ""
|
val cameraIp = if(TextUtils.isEmpty(data.exts)) ""
|
||||||
else (GsonUtils.fromJson(data.exts, Map::class.java)["cameraIp"])?:""
|
else (GsonUtils.fromJson(data.exts, Map::class.java)["cameraIp"])?:""
|
||||||
// 弹事件框
|
// 弹事件框
|
||||||
@@ -415,6 +412,7 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
|||||||
data.latitude)
|
data.latitude)
|
||||||
AiRoadMarker()
|
AiRoadMarker()
|
||||||
}.also {
|
}.also {
|
||||||
|
Logger.i(TAG, "people cross -- 4 --")
|
||||||
it.marker(Marker(data.eventId, EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType, data.longitude, data.latitude, 0.0), drawMarker = true, false, isHighFrequency = true)
|
it.marker(Marker(data.eventId, EventTypeEnumNew.TYPE_SOCKET_ROAD_PEOPLE_CROSS.poiType, data.longitude, data.latitude, 0.0), drawMarker = true, false, isHighFrequency = true)
|
||||||
}.receive()
|
}.receive()
|
||||||
}
|
}
|
||||||
@@ -487,7 +485,7 @@ 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)
|
val points = V2NUtils.generateIntermediatePoints(kotlin.Pair(start.first, start.second), end, 50.0 * 1e-7)
|
||||||
V2XBizTrace.onAck(points, "computeCrossCountBetween", true)
|
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_end
|
||||||
@@ -607,7 +605,6 @@ internal object V2NIdentifyDrawer: IEventDismissListener {
|
|||||||
private fun drawPeopleCross(event: MessagePad.Event) {
|
private fun drawPeopleCross(event: MessagePad.Event) {
|
||||||
Log.d("V2NIdentifyDrawer", "---drawPeopleCross---: $event, [${FunctionBuildConfig.v2nMainSwitch}, ${FunctionBuildConfig.isNewV2NData}]")
|
Log.d("V2NIdentifyDrawer", "---drawPeopleCross---: $event, [${FunctionBuildConfig.v2nMainSwitch}, ${FunctionBuildConfig.isNewV2NData}]")
|
||||||
if (V2NCarTypeCheck.verifyCarType() && FunctionBuildConfig.v2nMainSwitch && FunctionBuildConfig.isNewV2NData) {
|
if (V2NCarTypeCheck.verifyCarType() && FunctionBuildConfig.v2nMainSwitch && FunctionBuildConfig.isNewV2NData) {
|
||||||
handler.removeMessages(MSG_WHAT_DRAW_PEOPLE_CROSS)
|
|
||||||
handler.sendMessage(Message.obtain(handler, MSG_WHAT_DRAW_PEOPLE_CROSS, event))
|
handler.sendMessage(Message.obtain(handler, MSG_WHAT_DRAW_PEOPLE_CROSS, event))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ 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.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||||
import com.mogo.eagle.core.function.call.hmi.CallerRoadV2NEventWindowListenerManager
|
import com.mogo.eagle.core.function.call.hmi.CallerRoadV2NEventWindowListenerManager
|
||||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
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.CoordinateUtils
|
||||||
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
|
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
|
||||||
import com.mogo.eagle.function.biz.v2x.V2XBizTrace
|
import com.mogo.eagle.function.biz.v2x.V2XBizTrace
|
||||||
@@ -100,6 +101,7 @@ class AiRoadMarker {
|
|||||||
fun marker(marker: Marker, drawMarker: Boolean, drawRoadLine: Boolean = false, isHighFrequency:Boolean = false) {
|
fun marker(marker: Marker, drawMarker: Boolean, drawRoadLine: Boolean = false, isHighFrequency:Boolean = false) {
|
||||||
val markerId = marker.id
|
val markerId = marker.id
|
||||||
if (isHighFrequency && drawMarker) {
|
if (isHighFrequency && drawMarker) {
|
||||||
|
Logger.d(TAG, "marker --->poiType: $marker, ${EventTypeEnumNew.getMarker3DRes(marker.poiType)}")
|
||||||
val builder = getOrPutPointOptionBuilder(markerId, V2XConst.V2X_MARKER_OWNER, MAP_MARKER)
|
val builder = getOrPutPointOptionBuilder(markerId, V2XConst.V2X_MARKER_OWNER, MAP_MARKER)
|
||||||
builder
|
builder
|
||||||
.set3DMode(true)
|
.set3DMode(true)
|
||||||
@@ -117,6 +119,7 @@ class AiRoadMarker {
|
|||||||
}
|
}
|
||||||
val wrapper = MarkerWrapper(markerId, marker.poi_lon, marker.poi_lat, 1, elapsedDistance = distance)
|
val wrapper = MarkerWrapper(markerId, marker.poi_lon, marker.poi_lat, 1, elapsedDistance = distance)
|
||||||
wrapper.onRemoved = {
|
wrapper.onRemoved = {
|
||||||
|
Logger.d(TAG, "222 -> marker --->poiType: $marker, ${EventTypeEnumNew.getMarker3DRes(marker.poiType)}")
|
||||||
CallerRoadV2NEventWindowListenerManager.dismiss(markerId)
|
CallerRoadV2NEventWindowListenerManager.dismiss(markerId)
|
||||||
builders.remove(markerId)
|
builders.remove(markerId)
|
||||||
markerIds.remove(p.id)
|
markerIds.remove(p.id)
|
||||||
@@ -365,8 +368,8 @@ class AiRoadMarker {
|
|||||||
data class Marker(
|
data class Marker(
|
||||||
val id: String,
|
val id: String,
|
||||||
val poiType: String,
|
val poiType: String,
|
||||||
val poi_lat: Double,
|
|
||||||
val poi_lon: Double,
|
val poi_lon: Double,
|
||||||
|
val poi_lat: Double,
|
||||||
val poi_angle: Double,
|
val poi_angle: Double,
|
||||||
val polygon: List<Pair<Double, Double>>? = null,
|
val polygon: List<Pair<Double, Double>>? = null,
|
||||||
var farthestPoint: Pair<Double, Double>? = null,
|
var farthestPoint: Pair<Double, Double>? = null,
|
||||||
|
|||||||
@@ -142,11 +142,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
|||||||
if (gnssInfo != null) {
|
if (gnssInfo != null) {
|
||||||
if (1 == FunctionBuildConfig.gpsProvider) {
|
if (1 == FunctionBuildConfig.gpsProvider) {
|
||||||
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
|
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
|
||||||
CallerAutoPilotStatusListenerManager.updateAutoPilotLocAndTime(
|
CallerAutoPilotStatusListenerManager.updateAutoPilotLocAndTime(gnssInfo.satelliteTime, gnssInfo.longitude, gnssInfo.latitude, gnssInfo.heading)
|
||||||
gnssInfo.satelliteTime,
|
|
||||||
gnssInfo.longitude,
|
|
||||||
gnssInfo.latitude
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -287,11 +287,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
|||||||
// 同步给MAP地图
|
// 同步给MAP地图
|
||||||
CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(gnssInfo)
|
CallerObuLocationWGS84ListenerManager.invokeObuLocationWGS84(gnssInfo)
|
||||||
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
|
// 同步更新经纬度和系统时间至 AutoPilotStatusListener
|
||||||
CallerAutoPilotStatusListenerManager.updateAutoPilotLocAndTime(
|
CallerAutoPilotStatusListenerManager.updateAutoPilotLocAndTime(System.currentTimeMillis() / 1000.0, gnssInfo.longitude, gnssInfo.latitude, gnssInfo.heading)
|
||||||
System.currentTimeMillis() / 1000.0,
|
|
||||||
gnssInfo.longitude,
|
|
||||||
gnssInfo.latitude
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ open class AutopilotStatusInfo : Serializable, Cloneable {
|
|||||||
@Volatile
|
@Volatile
|
||||||
var locationLon = 0.0
|
var locationLon = 0.0
|
||||||
|
|
||||||
|
@Volatile
|
||||||
|
var locationHeading = 0.0
|
||||||
|
|
||||||
@Volatile
|
@Volatile
|
||||||
var satelliteTime = 0.0
|
var satelliteTime = 0.0
|
||||||
|
|
||||||
|
|||||||
@@ -133,9 +133,10 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
|||||||
/**
|
/**
|
||||||
* 通过Gnss定位更新来同步更新自动驾驶状态
|
* 通过Gnss定位更新来同步更新自动驾驶状态
|
||||||
*/
|
*/
|
||||||
fun updateAutoPilotLocAndTime(satelliteTime: Double, lon: Double, lat: Double) {
|
fun updateAutoPilotLocAndTime(satelliteTime: Double, lon: Double, lat: Double, heading: Double) {
|
||||||
mAutopilotStatusInfo.locationLat = lat
|
mAutopilotStatusInfo.locationLat = lat
|
||||||
mAutopilotStatusInfo.locationLon = lon
|
mAutopilotStatusInfo.locationLon = lon
|
||||||
|
mAutopilotStatusInfo.locationHeading = heading
|
||||||
mAutopilotStatusInfo.satelliteTime = satelliteTime
|
mAutopilotStatusInfo.satelliteTime = satelliteTime
|
||||||
mAutopilotStatusInfo.locationStatus = true
|
mAutopilotStatusInfo.locationStatus = true
|
||||||
invokeAutoPilotStatus()
|
invokeAutoPilotStatus()
|
||||||
|
|||||||
Reference in New Issue
Block a user