Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
p x
SuZhouAvp
Commits
bf2504a1
"app/src/main/vscode:/vscode.git/clone" did not exist on "09291f3255627ece66be6dd553a2d520fd83a231"
Commit
bf2504a1
authored
Dec 18, 2025
by
p x
Browse files
优化召泊车录像
parent
bd9ceed0
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/src/main/assets/mock/Car_fangzhen_call.txt
View file @
bf2504a1
{
"rs": [
[116.5024625,39.8090317],[116.50246452571352,39.809032676237166],[116.50246655142706,39.80903365247434],[116.5024685771406,39.80903462871151],[116.50247060285415,39.80903560494868],[116.50247262856767,39.80903658118585],[116.50247465428123,39.809037557423025],[116.50247667999476,39.80903853366019],[116.5024787057083,39.80903950989737],[116.50248073142184,39.809040486134535],[116.50248275713537,39.80904146237171],[116.50248478284891,39.80904243860888],[116.50248554937339,39.80904280015562],[116.50248625256704,39.8090431183115],[116.50248696285315,39.809043426953984],[116.50248768001542,39.80904372598901],[116.50248840383534,39.80904401532554],[116.50248913409246,39.80904429487541],[116.50248987056432,39.80904456455347],[116.50249061302658,39.809044824277564],[116.50249136125309,39.80904507396862],[116.50249211501594,39.809045313550534],[116.5024928740855,39.809045542950344],[116.50249363823058,39.809045762098165],[116.50249440721838,39.80904597092725],[116.50249518081468,39.809046169374014],[116.50249595878384,39.80904635737795],[116.50249674088887,39.80904653488182],[116.50249752689155,39.80904670183156],[116.50249831655243,39.809046858176316],[116.50249910963099,39.80904700386845],[116.50249990588564,39.8090471388636],[116.50250070507383,39.80904726312063],[116.50250150695214,39.8090473766017],[116.50250231127629,39.80904747927224],[116.50250311780128,39.809047571100976],[116.50250392628145,39.80904765205992],[116.5025047364705,39.80904772212444],[116.50250554812165,39.80904778127317],[116.50250636098767,39.8090478294881],[116.50250717482095,39.809047866754554],[116.50250798937358,39.80904789306116],[116.50250880439745,39.80904790839994],[116.50250961964429,39.809047912766175],[116.50251043486577,39.80904790615856],[116.50251124981355,39.809047888579094],[116.50251206423943,39.80904786003317],[116.50251287789527,39.80904782052943],[116.50251369053326,39.80904777007994],[116.50251450190586,39.80904770870008],[116.5025153117659,39.80904763640851],[116.50251611986671,39.80904755322727],[116.50251692596213,39.8090474591817],[116.5025177298066,39.809047354300446],[116.50251853115527,39.80904723861545],[116.50251932976404,39.80904711216196],[116.50252012538965,39.80904697497849],[116.50252091778974,39.80904682710682],[116.50252170672294,39.80904666859201],[116.50252249194894,39.80904649948232],[116.50252327322852,39.80904631982929],[116.50252405032373,39.80904612968762],[116.50252482299786,39.809045929115264],[116.50252559101551,39.809045718173266],[116.50252635414277,39.80904549692593],[116.50252711214716,39.80904526544063],[116.50252786479781,39.80904502378788],[116.50252861186543,39.80904477204128],[116.50252935312245,39.80904451027753],[116.50253008834312,39.80904423857637],[116.50253081730344,39.80904395702054],[116.50253153978137,39.80904366569581],[116.50253225555686,39.80904336469095],[116.50253296441184,39.80904305409761],[116.50253366613042,39.80904273401042],[116.50253436049884,39.80904240452689],[116.50253504730557,39.80904206574736],[116.50253572634142,39.809041717775045],[116.50253639739954,39.80904136071593],[116.50253706027554,39.80904099467878],[116.50253771476747,39.8090406197751],[116.50253836067598,39.809040236119095],[116.50253899780434,39.80903984382761],[116.50253962595843,39.80903944302016],[116.50254024494696,39.809039033818834],[116.50254085458133,39.809038616348246],[116.50254145467586,39.80903819073561],[116.50254204504778,39.80903775711055],[116.50254262551721,39.80903731560515],[116.50254319590738,39.80903686635389],[116.5025437560445,39.80903640949364],[116.502544305758,39.809035945163544],[116.50254484488038,39.80903547350505],[116.50254537324744,39.809034994661815],[116.50254589069823,39.80903450877972],[116.50254639707514,39.80903401600677],[116.5025468922239,39.80903351649306],[116.50254873251244,39.80903121870854],[116.50255048525985,39.80902903906369],[116.50255215519805,39.809026971172585],[116.50255374705901,39.80902500864927],[116.50255526557463,39.809023145107844],[116.50255671547697,39.80902137416238],[116.50255810149788,39.80901968942692],[116.50255942836942,39.80901808451557],[116.5025607008234,39.80901655304239],[116.50256192359191,39.80901508862146],[116.50256310140682,39.80901368486684],[116.50256423900012,39.8090123353926],[116.50256534110378,39.80901103381284],[116.50256641244967,39.80900977374158],[116.50256745776986,39.809008548792946],[116.50256848179617,39.80900735258098],[116.50256948926067,39.80900617871975],[116.50257048489526,39.80900502082334],[116.50257147343187,39.809003872505826],[116.50257245960252,39.80900272738129],[116.50257344813913,39.809001579063775],[116.50257444377361,39.80900042116737],[116.50257545123799,39.80899924730615],[116.50257647526416,39.80899805109418],[116.50257752058411,39.80899682614553],[116.50257859192976,39.80899556607427],[116.5025796940331,39.808994264494494],[116.50258083162609,39.808992915020255],[116.50258200944063,39.80899151126563],[116.50258323220868,39.808990046844684],[116.50258450466227,39.808988515371496],[116.50258583153325,39.80898691046014],[116.50258721755367,39.80898522572469],[116.5025886674554,39.80898345477921],[116.50259018597043,39.808981591237774],[116.5025917778307,39.808979628714454],[116.50259344776819,39.80897756082334],[116.50259520051483,39.80897538117847],[116.50259704080258,39.80897308339394],
[
116.50259710003452,
39.80897313092863
],
[
116.50260652829927,
39.80896138259575
...
...
app/src/main/java/com/sd/cavphmi/viewmodels/MockVM.kt
View file @
bf2504a1
...
...
@@ -34,6 +34,7 @@ import com.sd.cavphmi.highmap.ReverCar
import
com.sd.cavphmi.highmap.Spinfo
import
com.sd.cavphmi.utils.FileIoUtils
import
com.sd.cavphmi.utils.MyMapUtils
import
com.sd.cavphmi.utils.ToastHelper
import
dagger.hilt.android.lifecycle.HiltViewModel
import
dagger.hilt.android.qualifiers.ApplicationContext
import
kotlinx.coroutines.Dispatchers
...
...
@@ -44,6 +45,8 @@ import kotlinx.coroutines.launch
import
kotlinx.coroutines.withContext
import
javax.inject.Inject
import
kotlin.math.absoluteValue
import
kotlin.random.Random
import
kotlin.random.nextInt
@HiltViewModel
...
...
@@ -116,7 +119,11 @@ class MockVM @Inject constructor(
var
head
=
0.0
var
oldHead
=
0.0
var
bearing
=
0f
val
random
=
Random
mRoutes
.
rs
.
forEachIndexed
{
index
,
it
->
//变速
CarPanelBean
.
instance
.
speed
.
set
(
random
.
nextInt
(
10
..
15
))
if
(
index
>
0
&&
index
<
mRoutes
.
rs
.
count
())
{
var
p1
=
mRoutes
.
rs
.
get
(
index
-
1
)
var
pc
=
mRoutes
.
rs
.
get
(
index
)
...
...
@@ -164,15 +171,12 @@ class MockVM @Inject constructor(
//改变镜头角度
HighMapApi
.
setCameraAngle
(
60f
)
HighMapApi
.
setCameraDistance
(
30f
)
CarPanelBean
.
instance
.
speed
.
set
(
5
)
//减速
//从停车点再前进一点
var
forword
=
parkPath
.
result
.
routes
.
find
{
it
.
gear
==
3
}
forword
?.
polyline
?.
forEach
{
poly
->
CarPanelBean
.
instance
.
speed
.
set
(
5
)
//减速
cCar
=
CarVehicle
().
apply
{
// this.vehiclePos = this.vehiclePos?.toMutableList()
// vehiclePos?.set(0, poly.get(0))
// vehiclePos?.set(1, poly.get(1))
// vehiclePos?.set(2, poly.get(3))
this
.
vehiclePos
=
listOf
(
poly
.
get
(
0
),
poly
.
get
(
1
),
poly
.
get
(
3
))
}
//更新主车位置
...
...
@@ -204,6 +208,7 @@ class MockVM @Inject constructor(
//开始后退
var
fBack
=
parkPath
.
result
.
routes
.
find
{
it
.
gear
==
1
}
fBack
?.
polyline
?.
forEach
{
poly
->
CarPanelBean
.
instance
.
speed
.
set
(
random
.
nextInt
(
1
..
5
))
//减速变速
cCar
=
CarVehicle
().
apply
{
this
.
vehiclePos
=
listOf
(
poly
.
get
(
0
),
poly
.
get
(
1
),
poly
.
get
(
3
))
}
...
...
@@ -221,7 +226,8 @@ class MockVM @Inject constructor(
)
delay
(
300
)
}
delay
(
3000
)
//结束泊车
HighMapApi
.
setParkComplete
(
true
)
//删除导航小地图小车
deleteNavingCar
()
//关闭流光效果
...
...
@@ -229,12 +235,12 @@ class MockVM @Inject constructor(
//挂P档
CarPanelBean
.
instance
.
tapPos
.
set
(
1
)
CarPanelBean
.
instance
.
speed
.
set
(
0
)
//结束泊车
HighMapApi
.
setParkComplete
(
true
)
//给个提示
ToastHelper
.
showShort
(
context
,
"泊车完成"
)
// delay(3000)
//降地锁
// lockStatu.up = false
// HighMapApi.setLockStatus(lockStatu)
//
}
}
...
...
@@ -274,8 +280,6 @@ class MockVM @Inject constructor(
})
HighMapApi
.
setParkStatu
(
ParkStatu
(
spinfos
))
delay
(
5000
)
var
cCar
:
CarVehicle
var
gson
=
Gson
()
//画局部图小车
...
...
@@ -289,34 +293,8 @@ class MockVM @Inject constructor(
39.809955271625505
,
116.50204936866068
)
//挂前进挡
CarPanelBean
.
instance
.
tapPos
.
set
(
2
)
//开始出库
/* var callStr = FileIoUtils.getAsset(context, "mock/callpath.txt")
val callPath = gson.fromJson<ParkPath>(callStr, ParkPath::class.java)
CarPanelBean.instance.speed.set(5)//减速
var forword = callPath.result.routes.find { it.gear == 3 }
forword?.polyline?.forEach { poly ->
cCar = CarVehicle().apply {
this.vehiclePos = listOf(poly.get(0), poly.get(1), poly.get(3))
}
//更新主车位置
carVehicle.value = cCar
//更新小地图小车
showNavingCarPosition(
Tools.latLngToNdsPoint(
LatLng(
cCar.vehiclePos!!.get(1),
cCar.vehiclePos!!.get(0)
)
),
cCar.vehiclePos!!.get(2).toFloat()
)
delay(200)
}*/
var
str
=
FileIoUtils
.
getAsset
(
context
,
"mock/Car_fangzhen_call.txt"
)
val
mRoutes
=
gson
.
fromJson
<
MRoutes
>(
str
,
MRoutes
::
class
.
java
)
...
...
@@ -327,17 +305,26 @@ class MockVM @Inject constructor(
AllLine
(
it
[
1
],
it
[
0
])
}
HighMapApi
.
setCarNavPath
(
lines
,
showdistance
=
200
)
//开始跟车
HighMapApi
.
setCameraAngle
(
30f
)
HighMapApi
.
setCameraDistance
(
8f
)
//加速
CarPanelBean
.
instance
.
speed
.
set
(
25
)
//模拟车辆移动
var
head
=
0.0
var
oldHead
=
0.0
var
bearing
=
0.0
val
random
=
Random
mRoutes
.
rs
.
forEachIndexed
{
index
,
it
->
if
(
index
>
0
&&
index
<
mRoutes
.
rs
.
count
())
{
if
(
index
==
1
)
{
delay
(
5000
)
//开始跟车
HighMapApi
.
setCameraAngle
(
30f
)
HighMapApi
.
setCameraDistance
(
8f
)
}
if
(
index
<=
139
)
{
//正在小心翼翼的出库
CarPanelBean
.
instance
.
speed
.
set
(
random
.
nextInt
(
1
..
5
))
}
else
{
//开起来了
CarPanelBean
.
instance
.
speed
.
set
(
random
.
nextInt
(
10
..
16
))
}
if
(
index
>
0
&&
index
<
mRoutes
.
rs
.
count
())
{
var
p1
=
mRoutes
.
rs
.
get
(
index
-
1
)
var
pc
=
mRoutes
.
rs
.
get
(
index
)
// head = BasicTools.calculateBearing(p1[0],p1[1], pc[1], pc[0])
...
...
@@ -347,15 +334,15 @@ class MockVM @Inject constructor(
)
// bearing = head
// println("-------- head = ${head} oldHead = ${oldHead} ${(head - oldHead).absoluteValue.toInt()}")
//
if (oldHead!=0.0 && (head - oldHead).absoluteValue.toInt() < 45) {
//
bearing = head
//
}
if
(
oldHead
!=
0.0
&&
(
head
-
oldHead
).
absoluteValue
.
toInt
()
<
45
)
{
bearing
=
head
}
cCar
=
CarVehicle
().
apply
{
this
.
vehiclePos
=
listOf
(
it
[
0
],
it
[
1
],
h
ea
d
)
this
.
vehiclePos
=
listOf
(
it
[
0
],
it
[
1
],
b
ea
ring
)
}
oldHead
=
head
//更新主车位置
carVehicle
.
value
=
cCar
oldHead
=
head
//更新小地图小车
showNavingCarPosition
(
Tools
.
latLngToNdsPoint
(
...
...
@@ -384,19 +371,20 @@ class MockVM @Inject constructor(
//挂N档等人
CarPanelBean
.
instance
.
tapPos
.
set
(
0
)
CarPanelBean
.
instance
.
speed
.
set
(
0
)
ToastHelper
.
showShort
(
context
,
"召车完成"
)
//上人
val
parts
=
mutableListOf
<
String
>()
FileIoUtils
.
getAssetMock
(
context
,
"mock/call_shangren.txt"
,
parts
)
parts
.
forEach
{
str
->
if
(
str
.
isNotEmpty
())
{
var
bean
=
parseDataBean
(
str
,
PerceptionBean
::
class
.
java
)
if
(
bean
!=
null
)
{
targetPre
?.
value
=
bean
delay
(
500
)
}
}
}
HighMapApi
.
clearPtcData
()
/*
val parts = mutableListOf<String>()
FileIoUtils.getAssetMock(context, "mock/call_shangren.txt", parts)
parts.forEach { str ->
if (str.isNotEmpty()) {
var bean = parseDataBean(str, PerceptionBean::class.java)
if (bean != null) {
targetPre?.value = bean
delay(500)
}
}
}
HighMapApi.clearPtcData()
*/
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment