test_run.py 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697
  1. import os
  2. import sys
  3. # sys.path.append(os.path.dirname(os.path.abspath(__file__)) +
  4. # "/../../onsite_parking/")
  5. sys.path.insert(0, "/home/yct/Documents/data/onsite/Onsite_Parking")
  6. import json
  7. import input.make_map as mp
  8. from planner.hybridastar import planner as planner
  9. from input import make_car
  10. from utils import replay
  11. from utils import map_display as mdp
  12. import matplotlib.pyplot as plt
  13. import numpy as np
  14. import time
  15. # sys.setrecursionlimit(3000) # 将默认的递归深度修改为3000
  16. def linear_interpolation(x1,x2,y1,y2,num):
  17. x = np.linspace(x1,x2,num)
  18. y = np.linspace(y1,y2,num)
  19. return x,y
  20. def changeOxyB01(C_,park,ori_ox,ori_oy):
  21. ox = ori_ox.copy()
  22. oy = ori_oy.copy()
  23. C = C_
  24. isSearchFailed = False
  25. if 1<=int(park)<=8:
  26. x = np.linspace(10300, 10300, 500)
  27. y = np.linspace(7000, 1000, 500)
  28. for i in range(len(x)):
  29. ox.append(x[i])
  30. oy.append(y[i])
  31. x = np.linspace(9500, 9500, 500)
  32. y = np.linspace(7000, 1000, 500)
  33. for i in range(len(x)):
  34. ox.append(x[i])
  35. oy.append(y[i])
  36. x = np.linspace(8800, 8800, 500)
  37. y = np.linspace(5500, 6000, 500)
  38. for i in range(len(x)):
  39. ox.append(x[i])
  40. oy.append(y[i])
  41. x = np.linspace(4500, 8800, 500)
  42. y = np.linspace(6000, 6000, 500)
  43. for i in range(len(x)):
  44. ox.append(x[i])
  45. oy.append(y[i])
  46. x = np.linspace(0, 9500, 500)
  47. y = np.linspace(6700, 6700, 500)
  48. for i in range(len(x)):
  49. ox.append(x[i])
  50. oy.append(y[i])
  51. x = np.linspace(8800, 8800, 500)
  52. y = np.linspace(2800, 5500, 500)
  53. for i in range(len(x)):
  54. ox.append(x[i])
  55. oy.append(y[i])
  56. x = np.linspace(7200, 8800, 500)
  57. y = np.linspace(1300, 2800, 500)
  58. for i in range(len(x)):
  59. ox.append(x[i])
  60. oy.append(y[i])
  61. x = np.linspace(9200, 10300, 500)
  62. y = np.linspace(870, 1800, 500)
  63. for i in range(len(x)):
  64. ox.append(x[i])
  65. oy.append(y[i])
  66. C.XY_RESO = C.XY_RESO - 600
  67. if 9<=int(park)<=10:
  68. x = np.linspace(8200, 8200, 500)
  69. y = np.linspace(7000, 0, 500)
  70. for i in range(len(x)):
  71. ox.append(x[i])
  72. oy.append(y[i])
  73. x = np.linspace(1500, 5800, 500)
  74. y = np.linspace(2000, 2000, 500)
  75. for i in range(len(x)):
  76. ox.append(x[i])
  77. oy.append(y[i])
  78. x = np.linspace(2000, 2000, 500)
  79. y = np.linspace(4200, 2800, 500)
  80. for i in range(len(x)):
  81. ox.append(x[i])
  82. oy.append(y[i])
  83. x = np.linspace(2000, 5400, 500)
  84. y = np.linspace(2800, 2800, 500)
  85. for i in range(len(x)):
  86. ox.append(x[i])
  87. oy.append(y[i])
  88. C.XY_RESO = C.XY_RESO - 500
  89. if 11<=int(park)<=12:
  90. x = np.linspace(8200, 8200, 500)
  91. y = np.linspace(7000, 0, 500)
  92. for i in range(len(x)):
  93. ox.append(x[i])
  94. oy.append(y[i])
  95. x = np.linspace(1500, 5800, 500)
  96. y = np.linspace(2000, 2000, 500)
  97. for i in range(len(x)):
  98. ox.append(x[i])
  99. oy.append(y[i])
  100. x = np.linspace(1500, 1500, 500)
  101. y = np.linspace(2000, 4200, 500)
  102. for i in range(len(x)):
  103. ox.append(x[i])
  104. oy.append(y[i])
  105. x = np.linspace(2800, 2800, 500)
  106. y = np.linspace(2800, 4200, 500)
  107. for i in range(len(x)):
  108. ox.append(x[i])
  109. oy.append(y[i])
  110. x = np.linspace(2800, 5800, 500)
  111. y = np.linspace(2800, 2800, 500)
  112. for i in range(len(x)):
  113. ox.append(x[i])
  114. oy.append(y[i])
  115. C.XY_RESO = C.XY_RESO - 400
  116. if 13<=int(park)<=15:
  117. x = np.linspace(8200, 8200, 500)
  118. y = np.linspace(7000, 0, 500)
  119. for i in range(len(x)):
  120. ox.append(x[i])
  121. oy.append(y[i])
  122. x = np.linspace(1500, 5800, 500)
  123. y = np.linspace(2000, 2000, 500)
  124. for i in range(len(x)):
  125. ox.append(x[i])
  126. oy.append(y[i])
  127. x = np.linspace(2400, 2400, 500)
  128. y = np.linspace(2000, 4200, 500)
  129. for i in range(len(x)):
  130. ox.append(x[i])
  131. oy.append(y[i])
  132. x = np.linspace(4200, 4200, 500)
  133. y = np.linspace(2800, 4200, 500)
  134. for i in range(len(x)):
  135. ox.append(x[i])
  136. oy.append(y[i])
  137. x = np.linspace(4200, 5800, 500)
  138. y = np.linspace(2800, 2800, 500)
  139. for i in range(len(x)):
  140. ox.append(x[i])
  141. oy.append(y[i])
  142. C.XY_RESO = C.XY_RESO - 400
  143. if int(park)==16:
  144. x = np.linspace(8200, 8200, 500)
  145. y = np.linspace(7000, 0, 500)
  146. for i in range(len(x)):
  147. ox.append(x[i])
  148. oy.append(y[i])
  149. x = np.linspace(1500, 5800, 500)
  150. y = np.linspace(1800, 1800, 500)
  151. for i in range(len(x)):
  152. ox.append(x[i])
  153. oy.append(y[i])
  154. x = np.linspace(1500, 5800, 500)
  155. y = np.linspace(3200, 3200, 500)
  156. for i in range(len(x)):
  157. ox.append(x[i])
  158. oy.append(y[i])
  159. C.XY_RESO = C.XY_RESO - 300
  160. if park == '17': # TODO
  161. x = np.linspace(8200, 8200, 500)
  162. y = np.linspace(7000, 0, 500)
  163. for i in range(len(x)):
  164. ox.append(x[i])
  165. oy.append(y[i])
  166. x = np.linspace(500, 1200, 500)
  167. y = np.linspace(1200, 680, 500)
  168. for i in range(len(x)):
  169. ox.append(x[i])
  170. oy.append(y[i])
  171. x = np.linspace(5500, 1200, 500)
  172. y = np.linspace(2800, 1800, 500)
  173. for i in range(len(x)):
  174. ox.append(x[i])
  175. oy.append(y[i])
  176. x = np.linspace(5800, 2000, 500)
  177. y = np.linspace(1800, 680, 500)
  178. for i in range(len(x)):
  179. ox.append(x[i])
  180. oy.append(y[i])
  181. x = np.linspace(1000, 2100, 500)
  182. y = np.linspace(700, 700, 500)
  183. for i in range(len(x)):
  184. ox.append(x[i])
  185. oy.append(y[i])
  186. C.XY_RESO = C.XY_RESO - 800
  187. if park == '18': # TODO
  188. pass
  189. if park == '19'or park == '20'or park == '21'or park == '22'or park == '23'or park == '24'or park == '25':
  190. x = np.linspace(8300, 8300, 500)
  191. y = np.linspace(2800, 500, 500)
  192. for i in range(len(x)):
  193. ox.append(x[i])
  194. oy.append(y[i])
  195. x = np.linspace(1500, 5100, 500)
  196. y = np.linspace(2900, 2900, 500)
  197. for i in range(len(x)):
  198. ox.append(x[i])
  199. oy.append(y[i])
  200. x = np.linspace(1500, 3000, 500)
  201. y = np.linspace(2200, 2200, 500)
  202. for i in range(len(x)):
  203. ox.append(x[i])
  204. oy.append(y[i])
  205. x = np.linspace(5300, 3000, 500)
  206. y = np.linspace(2800, 2200, 500)
  207. for i in range(len(x)):
  208. ox.append(x[i])
  209. oy.append(y[i])
  210. C.XY_RESO = C.XY_RESO - 200
  211. if park == '26' or park == '27' or park == '28' or park == '29': # TODO
  212. x = np.linspace(7200, 7200, 500)
  213. y = np.linspace(7000, 0, 500)
  214. for i in range(len(x)):
  215. ox.append(x[i])
  216. oy.append(y[i])
  217. x = np.linspace(9800, 9800, 500)
  218. y = np.linspace(4000, 0, 500)
  219. for i in range(len(x)):
  220. ox.append(x[i])
  221. oy.append(y[i])
  222. x = np.linspace(8000, 8000, 500)
  223. y = np.linspace(2000, 0, 500)
  224. for i in range(len(x)):
  225. ox.append(x[i])
  226. oy.append(y[i])
  227. x = np.linspace(8000, 9800, 500)
  228. y = np.linspace(2000, 2000, 500)
  229. for i in range(len(x)):
  230. ox.append(x[i])
  231. oy.append(y[i])
  232. C.XY_RESO = C.XY_RESO - 500
  233. if park == '30' or park == '31' or park == '32' or park == '33' or park == '34' or park == '35':
  234. x = np.linspace(10000, 7000, 500)
  235. y = np.linspace(2000, 2000, 500)
  236. for i in range(len(x)):
  237. ox.append(x[i])
  238. oy.append(y[i])
  239. if park == '36' or park == '37' or park == '38' or park == '39' or park == '40':
  240. x = np.linspace(10000, 7000, 500)
  241. y = np.linspace(2000, 2000, 500)
  242. for i in range(len(x)):
  243. ox.append(x[i])
  244. oy.append(y[i])
  245. x = np.linspace(12000, 14000, 500)
  246. y = np.linspace(860, 860, 500)
  247. for i in range(len(x)):
  248. ox.append(x[i])
  249. oy.append(y[i])
  250. if park == '41' or park == '42' or park == '43': # TODO
  251. pass
  252. if park == '44' or park == '45' or park == '46'or park == '47'or park == '48'or park == '49':
  253. x = np.linspace(9000, 9000, 500)
  254. y = np.linspace(2800, 7000, 500)
  255. for i in range(len(x)):
  256. ox.append(x[i])
  257. oy.append(y[i])
  258. x = np.linspace(7200, 8800, 500)
  259. y = np.linspace(2000, 2800, 500)
  260. for i in range(len(x)):
  261. ox.append(x[i])
  262. oy.append(y[i])
  263. x = np.linspace(8500, 10200, 500)
  264. y = np.linspace(940, 1800, 500)
  265. for i in range(len(x)):
  266. ox.append(x[i])
  267. oy.append(y[i])
  268. x = np.linspace(9000, 10500, 500)
  269. y = np.linspace(6300, 6300, 500)
  270. for i in range(len(x)):
  271. ox.append(x[i])
  272. oy.append(y[i])
  273. C.XY_RESO = C.XY_RESO - 200
  274. if park == '50':
  275. x = np.linspace(9000, 9000, 500)
  276. y = np.linspace(2800, 7000, 500)
  277. for i in range(len(x)):
  278. ox.append(x[i])
  279. oy.append(y[i])
  280. x = np.linspace(7200, 8800, 500)
  281. y = np.linspace(2000, 2800, 500)
  282. for i in range(len(x)):
  283. ox.append(x[i])
  284. oy.append(y[i])
  285. x = np.linspace(8500, 10200, 500)
  286. y = np.linspace(940, 1800, 500)
  287. for i in range(len(x)):
  288. ox.append(x[i])
  289. oy.append(y[i])
  290. x = np.linspace(9000, 10500, 500)
  291. y = np.linspace(6300, 6300, 500)
  292. for i in range(len(x)):
  293. ox.append(x[i])
  294. oy.append(y[i])
  295. C.XY_RESO = C.XY_RESO - 500
  296. x = np.linspace(10100, 10100, 500)
  297. y = np.linspace(2500, 4500, 500)
  298. for i in range(len(x)):
  299. ox.append(x[i])
  300. oy.append(y[i])
  301. x = np.linspace(8200, 8200, 500)
  302. y = np.linspace(510, 1000, 500)
  303. for i in range(len(x)):
  304. ox.append(x[i])
  305. oy.append(y[i])
  306. return ox,oy,isSearchFailed
  307. def changeOxyB02(C_,park,ori_ox,ori_oy):
  308. ox = ori_ox.copy()
  309. oy = ori_oy.copy()
  310. isSearchFailed = False
  311. C = C_
  312. if park == '1':
  313. C.XY_RESO = C.XY_RESO - 200
  314. x = np.linspace(4000, 6000, 500)
  315. y = np.linspace(7000, 7000, 500)
  316. for i in range(len(x)):
  317. ox.append(x[i])
  318. oy.append(y[i])
  319. x = np.linspace(6000, 6000, 500)
  320. y = np.linspace(6000, 7000, 500)
  321. for i in range(len(x)):
  322. ox.append(x[i])
  323. oy.append(y[i])
  324. x = np.linspace(4000, 6000, 500)
  325. y = np.linspace(4000, 4000, 500)
  326. for i in range(len(x)):
  327. ox.append(x[i])
  328. oy.append(y[i])
  329. x = np.linspace(4000, 4000, 500)
  330. y = np.linspace(5000, 7000, 500)
  331. for i in range(len(x)):
  332. ox.append(x[i])
  333. oy.append(y[i])
  334. elif park == '2':
  335. C.XY_RESO = C.XY_RESO - 800
  336. x = np.linspace(4000, 6000, 500)
  337. y = np.linspace(7000, 7000, 500)
  338. for i in range(len(x)):
  339. ox.append(x[i])
  340. oy.append(y[i])
  341. x = np.linspace(6000, 6000, 500)
  342. y = np.linspace(6000, 7000, 500)
  343. for i in range(len(x)):
  344. ox.append(x[i])
  345. oy.append(y[i])
  346. x = np.linspace(4000, 6000, 500)
  347. y = np.linspace(4500, 4500, 500)
  348. for i in range(len(x)):
  349. ox.append(x[i])
  350. oy.append(y[i])
  351. x = np.linspace(4000, 4000, 500)
  352. y = np.linspace(5000, 7000, 500)
  353. for i in range(len(x)):
  354. ox.append(x[i])
  355. oy.append(y[i])
  356. elif park == '3':
  357. C.XY_RESO = C.XY_RESO - 800
  358. x = np.linspace(4000, 6000, 500)
  359. y = np.linspace(7000, 7000, 500)
  360. for i in range(len(x)):
  361. ox.append(x[i])
  362. oy.append(y[i])
  363. x = np.linspace(6000, 6000, 500)
  364. y = np.linspace(6000, 7000, 500)
  365. for i in range(len(x)):
  366. ox.append(x[i])
  367. oy.append(y[i])
  368. x = np.linspace(4000, 6000, 500)
  369. y = np.linspace(4000, 4000, 500)
  370. for i in range(len(x)):
  371. ox.append(x[i])
  372. oy.append(y[i])
  373. x = np.linspace(4000, 4000, 500)
  374. y = np.linspace(5000, 7000, 500)
  375. for i in range(len(x)):
  376. ox.append(x[i])
  377. oy.append(y[i])
  378. elif park == '4':
  379. C.XY_RESO = C.XY_RESO - 800
  380. x = np.linspace(4000, 6000, 500)
  381. y = np.linspace(7000, 7000, 500)
  382. for i in range(len(x)):
  383. ox.append(x[i])
  384. oy.append(y[i])
  385. x = np.linspace(6000, 6000, 500)
  386. y = np.linspace(6000, 7000, 500)
  387. for i in range(len(x)):
  388. ox.append(x[i])
  389. oy.append(y[i])
  390. x = np.linspace(4000, 6000, 500)
  391. y = np.linspace(3500, 3500, 500)
  392. for i in range(len(x)):
  393. ox.append(x[i])
  394. oy.append(y[i])
  395. x = np.linspace(4000, 4000, 500)
  396. y = np.linspace(5000, 7000, 500)
  397. for i in range(len(x)):
  398. ox.append(x[i])
  399. oy.append(y[i])
  400. elif park == '5':
  401. C.XY_RESO = C.XY_RESO - 800
  402. x = np.linspace(4000, 6000, 500)
  403. y = np.linspace(7000, 7000, 500)
  404. for i in range(len(x)):
  405. ox.append(x[i])
  406. oy.append(y[i])
  407. x = np.linspace(6000, 6000, 500)
  408. y = np.linspace(6000, 7000, 500)
  409. for i in range(len(x)):
  410. ox.append(x[i])
  411. oy.append(y[i])
  412. x = np.linspace(4000, 6000, 500)
  413. y = np.linspace(3000, 3000, 500)
  414. for i in range(len(x)):
  415. ox.append(x[i])
  416. oy.append(y[i])
  417. x = np.linspace(4000, 4000, 500)
  418. y = np.linspace(5000, 7000, 500)
  419. for i in range(len(x)):
  420. ox.append(x[i])
  421. oy.append(y[i])
  422. elif park == '6':
  423. C.XY_RESO = C.XY_RESO - 800
  424. x = np.linspace(4000, 6000, 500)
  425. y = np.linspace(7000, 7000, 500)
  426. for i in range(len(x)):
  427. ox.append(x[i])
  428. oy.append(y[i])
  429. x = np.linspace(6000, 6000, 500)
  430. y = np.linspace(6000, 7000, 500)
  431. for i in range(len(x)):
  432. ox.append(x[i])
  433. oy.append(y[i])
  434. x = np.linspace(4000, 6000, 500)
  435. y = np.linspace(1500, 1500, 500)
  436. for i in range(len(x)):
  437. ox.append(x[i])
  438. oy.append(y[i])
  439. x = np.linspace(4000, 4000, 500)
  440. y = np.linspace(1500, 7000, 500)
  441. for i in range(len(x)):
  442. ox.append(x[i])
  443. oy.append(y[i])
  444. elif park == '7':
  445. C.XY_RESO = C.XY_RESO - 800
  446. x = np.linspace(4000, 6000, 500)
  447. y = np.linspace(7000, 7000, 500)
  448. for i in range(len(x)):
  449. ox.append(x[i])
  450. oy.append(y[i])
  451. x = np.linspace(6000, 6000, 500)
  452. y = np.linspace(6000, 7000, 500)
  453. for i in range(len(x)):
  454. ox.append(x[i])
  455. oy.append(y[i])
  456. x = np.linspace(4000, 6000, 500)
  457. y = np.linspace(1000, 1000, 500)
  458. for i in range(len(x)):
  459. ox.append(x[i])
  460. oy.append(y[i])
  461. x = np.linspace(4000, 4000, 500)
  462. y = np.linspace(1000, 7000, 500)
  463. for i in range(len(x)):
  464. ox.append(x[i])
  465. oy.append(y[i])
  466. elif park == '8':
  467. C.XY_RESO = C.XY_RESO - 800
  468. x = np.linspace(4000, 6000, 500)
  469. y = np.linspace(7000, 7000, 500)
  470. for i in range(len(x)):
  471. ox.append(x[i])
  472. oy.append(y[i])
  473. x = np.linspace(6000, 6000, 500)
  474. y = np.linspace(6000, 7000, 500)
  475. for i in range(len(x)):
  476. ox.append(x[i])
  477. oy.append(y[i])
  478. # x = np.linspace(4000, 6000, 500)
  479. # y = np.linspace(1000, 1000, 500)
  480. # for i in range(len(x)):
  481. # ox.append(x[i])
  482. # oy.append(y[i])
  483. x = np.linspace(4000, 4000, 500)
  484. y = np.linspace(1000, 7000, 500)
  485. for i in range(len(x)):
  486. ox.append(x[i])
  487. oy.append(y[i])
  488. elif park == '9':
  489. C.XY_RESO = C.XY_RESO - 800
  490. x = np.linspace(4000, 6000, 500)
  491. y = np.linspace(7000, 7000, 500)
  492. for i in range(len(x)):
  493. ox.append(x[i])
  494. oy.append(y[i])
  495. x = np.linspace(5500, 5500, 500)
  496. y = np.linspace(6000, 7000, 500)
  497. for i in range(len(x)):
  498. ox.append(x[i])
  499. oy.append(y[i])
  500. x = np.linspace(5000, 6000, 500)
  501. y = np.linspace(6000, 6000, 500)
  502. for i in range(len(x)):
  503. ox.append(x[i])
  504. oy.append(y[i])
  505. x = np.linspace(4500, 4500, 500)
  506. y = np.linspace(0, 7000, 500)
  507. for i in range(len(x)):
  508. ox.append(x[i])
  509. oy.append(y[i])
  510. x = np.linspace(5000, 5000, 500)
  511. y = np.linspace(1000, 6000, 500)
  512. for i in range(len(x)):
  513. ox.append(x[i])
  514. oy.append(y[i])
  515. elif park == '10':
  516. C.XY_RESO = C.XY_RESO - 800
  517. x = np.linspace(4000, 6000, 500)
  518. y = np.linspace(7000, 7000, 500)
  519. for i in range(len(x)):
  520. ox.append(x[i])
  521. oy.append(y[i])
  522. x = np.linspace(5500, 5500, 500)
  523. y = np.linspace(6000, 7000, 500)
  524. for i in range(len(x)):
  525. ox.append(x[i])
  526. oy.append(y[i])
  527. x = np.linspace(5000, 6000, 500)
  528. y = np.linspace(6000, 6000, 500)
  529. for i in range(len(x)):
  530. ox.append(x[i])
  531. oy.append(y[i])
  532. elif park == '11':
  533. C.XY_RESO = C.XY_RESO - 800
  534. x = np.linspace(4000, 6000, 500)
  535. y = np.linspace(7000, 7000, 500)
  536. for i in range(len(x)):
  537. ox.append(x[i])
  538. oy.append(y[i])
  539. x = np.linspace(5500, 5500, 500)
  540. y = np.linspace(6000, 7000, 500)
  541. for i in range(len(x)):
  542. ox.append(x[i])
  543. oy.append(y[i])
  544. x = np.linspace(5000, 6000, 500)
  545. y = np.linspace(6000, 6000, 500)
  546. for i in range(len(x)):
  547. ox.append(x[i])
  548. oy.append(y[i])
  549. x = np.linspace(4500, 4500, 500)
  550. y = np.linspace(1500, 7000, 500)
  551. for i in range(len(x)):
  552. ox.append(x[i])
  553. oy.append(y[i])
  554. x = np.linspace(5000, 5000, 500)
  555. y = np.linspace(0, 6000, 500)
  556. for i in range(len(x)):
  557. ox.append(x[i])
  558. oy.append(y[i])
  559. x = np.linspace(3000, 4500, 500)
  560. y = np.linspace(1500, 1500, 500)
  561. for i in range(len(x)):
  562. ox.append(x[i])
  563. oy.append(y[i])
  564. elif park == '12':
  565. C.XY_RESO = C.XY_RESO - 800
  566. x = np.linspace(4000, 6000, 500)
  567. y = np.linspace(7000, 7000, 500)
  568. for i in range(len(x)):
  569. ox.append(x[i])
  570. oy.append(y[i])
  571. x = np.linspace(5500, 5500, 500)
  572. y = np.linspace(6000, 7000, 500)
  573. for i in range(len(x)):
  574. ox.append(x[i])
  575. oy.append(y[i])
  576. x = np.linspace(5000, 6000, 500)
  577. y = np.linspace(6000, 6000, 500)
  578. for i in range(len(x)):
  579. ox.append(x[i])
  580. oy.append(y[i])
  581. x = np.linspace(4500, 4500, 500)
  582. y = np.linspace(1000, 7000, 500)
  583. for i in range(len(x)):
  584. ox.append(x[i])
  585. oy.append(y[i])
  586. x = np.linspace(5000, 5000, 500)
  587. y = np.linspace(0, 6000, 500)
  588. for i in range(len(x)):
  589. ox.append(x[i])
  590. oy.append(y[i])
  591. x = np.linspace(3000, 4500, 500)
  592. y = np.linspace(1000, 1000, 500)
  593. for i in range(len(x)):
  594. ox.append(x[i])
  595. oy.append(y[i])
  596. elif park == '13':
  597. C.XY_RESO = C.XY_RESO - 800
  598. x = np.linspace(4000, 6000, 500)
  599. y = np.linspace(7000, 7000, 500)
  600. for i in range(len(x)):
  601. ox.append(x[i])
  602. oy.append(y[i])
  603. x = np.linspace(5500, 5500, 500)
  604. y = np.linspace(6000, 7000, 500)
  605. for i in range(len(x)):
  606. ox.append(x[i])
  607. oy.append(y[i])
  608. x = np.linspace(5000, 6000, 500)
  609. y = np.linspace(6000, 6000, 500)
  610. for i in range(len(x)):
  611. ox.append(x[i])
  612. oy.append(y[i])
  613. x = np.linspace(4500, 4500, 500)
  614. y = np.linspace(1000, 7000, 500)
  615. for i in range(len(x)):
  616. ox.append(x[i])
  617. oy.append(y[i])
  618. x = np.linspace(5000, 5000, 500)
  619. y = np.linspace(0, 6000, 500)
  620. for i in range(len(x)):
  621. ox.append(x[i])
  622. oy.append(y[i])
  623. x = np.linspace(2000, 4500, 500)
  624. y = np.linspace(1000, 1000, 500)
  625. for i in range(len(x)):
  626. ox.append(x[i])
  627. oy.append(y[i])
  628. x = np.linspace(3000, 5000, 500)
  629. y = np.linspace(300, 300, 500)
  630. for i in range(len(x)):
  631. ox.append(x[i])
  632. oy.append(y[i])
  633. elif park == '14':
  634. C.XY_RESO = C.XY_RESO - 800
  635. x = np.linspace(4000, 6000, 500)
  636. y = np.linspace(7000, 7000, 500)
  637. for i in range(len(x)):
  638. ox.append(x[i])
  639. oy.append(y[i])
  640. x = np.linspace(5500, 5500, 500)
  641. y = np.linspace(6000, 7000, 500)
  642. for i in range(len(x)):
  643. ox.append(x[i])
  644. oy.append(y[i])
  645. x = np.linspace(5000, 6000, 500)
  646. y = np.linspace(6000, 6000, 500)
  647. for i in range(len(x)):
  648. ox.append(x[i])
  649. oy.append(y[i])
  650. x = np.linspace(4500, 4500, 500)
  651. y = np.linspace(1000, 7000, 500)
  652. for i in range(len(x)):
  653. ox.append(x[i])
  654. oy.append(y[i])
  655. x = np.linspace(5000, 5000, 500)
  656. y = np.linspace(0, 6000, 500)
  657. for i in range(len(x)):
  658. ox.append(x[i])
  659. oy.append(y[i])
  660. x = np.linspace(0, 4500, 500)
  661. y = np.linspace(1000, 1000, 500)
  662. for i in range(len(x)):
  663. ox.append(x[i])
  664. oy.append(y[i])
  665. x = np.linspace(2000, 5000, 500)
  666. y = np.linspace(300, 300, 500)
  667. for i in range(len(x)):
  668. ox.append(x[i])
  669. oy.append(y[i])
  670. elif park == '15' or park == '16' or park == '17' or park == '18' or park == '19' or park == '20' or park == '21' or park == '22':
  671. C.XY_RESO = C.XY_RESO - 200
  672. x = np.linspace(5500, 5500, 500)
  673. y = np.linspace(6200, 7000, 500)
  674. for i in range(len(x)):
  675. ox.append(x[i])
  676. oy.append(y[i])
  677. x = np.linspace(1800, 1800, 500)
  678. y = np.linspace(1000, 6200, 500)
  679. for i in range(len(x)):
  680. ox.append(x[i])
  681. oy.append(y[i])
  682. x = np.linspace(500, 5000, 500)
  683. y = np.linspace(7300, 7300, 500)
  684. for i in range(len(x)):
  685. ox.append(x[i])
  686. oy.append(y[i])
  687. x = np.linspace(3500, 5500, 500)
  688. y = np.linspace(6200, 6200, 500)
  689. for i in range(len(x)):
  690. ox.append(x[i])
  691. oy.append(y[i])
  692. elif park == '23' or park == '24': # TOD: 23,24
  693. C.XY_RESO = C.XY_RESO - 300
  694. x = np.linspace(5500, 5500, 500)
  695. y = np.linspace(6200, 7000, 500)
  696. for i in range(len(x)):
  697. ox.append(x[i])
  698. oy.append(y[i])
  699. x = np.linspace(1800, 1800, 500)
  700. y = np.linspace(1000, 6200, 500)
  701. for i in range(len(x)):
  702. ox.append(x[i])
  703. oy.append(y[i])
  704. x = np.linspace(500, 5000, 500)
  705. y = np.linspace(7300, 7300, 500)
  706. for i in range(len(x)):
  707. ox.append(x[i])
  708. oy.append(y[i])
  709. x = np.linspace(3500, 5500, 500)
  710. y = np.linspace(6200, 6200, 500)
  711. for i in range(len(x)):
  712. ox.append(x[i])
  713. oy.append(y[i])
  714. elif park =='25':
  715. C.XY_RESO = C.XY_RESO - 300
  716. x = np.linspace(5500, 5500, 500)
  717. y = np.linspace(6200, 7000, 500)
  718. for i in range(len(x)):
  719. ox.append(x[i])
  720. oy.append(y[i])
  721. x = np.linspace(1800, 1800, 500)
  722. y = np.linspace(1000, 6200, 500)
  723. for i in range(len(x)):
  724. ox.append(x[i])
  725. oy.append(y[i])
  726. x = np.linspace(500, 5000, 500)
  727. y = np.linspace(7300, 7300, 500)
  728. for i in range(len(x)):
  729. ox.append(x[i])
  730. oy.append(y[i])
  731. x = np.linspace(3500, 5500, 500)
  732. y = np.linspace(6200, 6200, 500)
  733. for i in range(len(x)):
  734. ox.append(x[i])
  735. oy.append(y[i])
  736. x = np.linspace(500, 2500, 500)
  737. y = np.linspace(5500, 5500, 500)
  738. for i in range(len(x)):
  739. ox.append(x[i])
  740. oy.append(y[i])
  741. elif park == '26':
  742. C.XY_RESO = C.XY_RESO - 200
  743. x = np.linspace(5500, 5500, 500)
  744. y = np.linspace(6200, 7000, 500)
  745. for i in range(len(x)):
  746. ox.append(x[i])
  747. oy.append(y[i])
  748. x = np.linspace(1800, 1800, 500)
  749. y = np.linspace(1000, 6200, 500)
  750. for i in range(len(x)):
  751. ox.append(x[i])
  752. oy.append(y[i])
  753. x = np.linspace(500, 5000, 500)
  754. y = np.linspace(7300, 7300, 500)
  755. for i in range(len(x)):
  756. ox.append(x[i])
  757. oy.append(y[i])
  758. x = np.linspace(3500, 5500, 500)
  759. y = np.linspace(6200, 6200, 500)
  760. for i in range(len(x)):
  761. ox.append(x[i])
  762. oy.append(y[i])
  763. elif park == '27':
  764. C.XY_RESO = C.XY_RESO - 300
  765. x = np.linspace(5500, 5500, 500)
  766. y = np.linspace(6200, 7000, 500)
  767. for i in range(len(x)):
  768. ox.append(x[i])
  769. oy.append(y[i])
  770. x = np.linspace(1500, 5000, 500)
  771. y = np.linspace(7300, 7300, 500)
  772. for i in range(len(x)):
  773. ox.append(x[i])
  774. oy.append(y[i])
  775. x = np.linspace(3500, 5500, 500)
  776. y = np.linspace(6200, 6200, 500)
  777. for i in range(len(x)):
  778. ox.append(x[i])
  779. oy.append(y[i])
  780. elif park == '28':
  781. C.XY_RESO = C.XY_RESO - 300
  782. x = np.linspace(5500, 5500, 500)
  783. y = np.linspace(6200, 7000, 500)
  784. for i in range(len(x)):
  785. ox.append(x[i])
  786. oy.append(y[i])
  787. x = np.linspace(3500, 5000, 500)
  788. y = np.linspace(7300, 7300, 500)
  789. for i in range(len(x)):
  790. ox.append(x[i])
  791. oy.append(y[i])
  792. x = np.linspace(3500, 5500, 500)
  793. y = np.linspace(6200, 6200, 500)
  794. for i in range(len(x)):
  795. ox.append(x[i])
  796. oy.append(y[i])
  797. elif park == '29': # TOD: 29
  798. C.XY_RESO = C.XY_RESO - 300
  799. x = np.linspace(5500, 5500, 500)
  800. y = np.linspace(6200, 7000, 500)
  801. for i in range(len(x)):
  802. ox.append(x[i])
  803. oy.append(y[i])
  804. x = np.linspace(4000, 5000, 500)
  805. y = np.linspace(7300, 7300, 500)
  806. for i in range(len(x)):
  807. ox.append(x[i])
  808. oy.append(y[i])
  809. x = np.linspace(3500, 5500, 500)
  810. y = np.linspace(6200, 6200, 500)
  811. for i in range(len(x)):
  812. ox.append(x[i])
  813. oy.append(y[i])
  814. elif park == '30':
  815. C.XY_RESO = C.XY_RESO - 200
  816. x = np.linspace(5500, 5500, 500)
  817. y = np.linspace(6200, 7000, 500)
  818. for i in range(len(x)):
  819. ox.append(x[i])
  820. oy.append(y[i])
  821. x = np.linspace(500, 5000, 500)
  822. y = np.linspace(7300, 7300, 500)
  823. for i in range(len(x)):
  824. ox.append(x[i])
  825. oy.append(y[i])
  826. x = np.linspace(3500, 5500, 500)
  827. y = np.linspace(6200, 6200, 500)
  828. for i in range(len(x)):
  829. ox.append(x[i])
  830. oy.append(y[i])
  831. elif park == '31':
  832. C.XY_RESO = C.XY_RESO - 200
  833. x = np.linspace(5500, 5500, 500)
  834. y = np.linspace(6200, 7000, 500)
  835. for i in range(len(x)):
  836. ox.append(x[i])
  837. oy.append(y[i])
  838. x = np.linspace(500, 5000, 500)
  839. y = np.linspace(7300, 7300, 500)
  840. for i in range(len(x)):
  841. ox.append(x[i])
  842. oy.append(y[i])
  843. x = np.linspace(3500, 5500, 500)
  844. y = np.linspace(6200, 6200, 500)
  845. for i in range(len(x)):
  846. ox.append(x[i])
  847. oy.append(y[i])
  848. x = np.linspace(1000, 1000, 500)
  849. y = np.linspace(200, 7300, 500)
  850. for i in range(len(x)):
  851. ox.append(x[i])
  852. oy.append(y[i])
  853. elif park == '32':
  854. C.XY_RESO = C.XY_RESO - 700
  855. x = np.linspace(5500, 5500, 500)
  856. y = np.linspace(6200, 7300, 500)
  857. for i in range(len(x)):
  858. ox.append(x[i])
  859. oy.append(y[i])
  860. x = np.linspace(500, 5500, 500)
  861. y = np.linspace(7200, 7200, 500)
  862. for i in range(len(x)):
  863. ox.append(x[i])
  864. oy.append(y[i])
  865. x = np.linspace(3500, 5500, 500)
  866. y = np.linspace(6200, 6200, 500)
  867. for i in range(len(x)):
  868. ox.append(x[i])
  869. oy.append(y[i])
  870. x = np.linspace(1200, 1200, 500)
  871. y = np.linspace(200, 7300, 500)
  872. for i in range(len(x)):
  873. ox.append(x[i])
  874. oy.append(y[i])
  875. x = np.linspace(1800, 1800, 500)
  876. y = np.linspace(5500, 6500, 500)
  877. for i in range(len(x)):
  878. ox.append(x[i])
  879. oy.append(y[i])
  880. x = np.linspace(500, 5500, 500)
  881. y = np.linspace(4200, 4200, 500)
  882. for i in range(len(x)):
  883. ox.append(x[i])
  884. oy.append(y[i])
  885. elif park == '33' or park == '34' or park == '36':
  886. C.XY_RESO = C.XY_RESO - 200
  887. x = np.linspace(5500, 5500, 500)
  888. y = np.linspace(6200, 7000, 500)
  889. for i in range(len(x)):
  890. ox.append(x[i])
  891. oy.append(y[i])
  892. x = np.linspace(500, 5000, 500)
  893. y = np.linspace(7300, 7300, 500)
  894. for i in range(len(x)):
  895. ox.append(x[i])
  896. oy.append(y[i])
  897. x = np.linspace(3500, 5500, 500)
  898. y = np.linspace(6200, 6200, 500)
  899. for i in range(len(x)):
  900. ox.append(x[i])
  901. oy.append(y[i])
  902. x = np.linspace(1000, 1000, 500)
  903. y = np.linspace(200, 7300, 500)
  904. for i in range(len(x)):
  905. ox.append(x[i])
  906. oy.append(y[i])
  907. elif park == '35':
  908. C.XY_RESO = C.XY_RESO - 700
  909. x = np.linspace(5500, 5500, 500)
  910. y = np.linspace(6200, 7300, 500)
  911. for i in range(len(x)):
  912. ox.append(x[i])
  913. oy.append(y[i])
  914. x = np.linspace(500, 5500, 500)
  915. y = np.linspace(7200, 7200, 500)
  916. for i in range(len(x)):
  917. ox.append(x[i])
  918. oy.append(y[i])
  919. x = np.linspace(3500, 5500, 500)
  920. y = np.linspace(6200, 6200, 500)
  921. for i in range(len(x)):
  922. ox.append(x[i])
  923. oy.append(y[i])
  924. x = np.linspace(1200, 1200, 500)
  925. y = np.linspace(200, 7300, 500)
  926. for i in range(len(x)):
  927. ox.append(x[i])
  928. oy.append(y[i])
  929. x = np.linspace(1800, 1800, 500)
  930. y = np.linspace(4500, 6500, 500)
  931. for i in range(len(x)):
  932. ox.append(x[i])
  933. oy.append(y[i])
  934. x = np.linspace(500, 5500, 500)
  935. y = np.linspace(1500, 1500, 500)
  936. for i in range(len(x)):
  937. ox.append(x[i])
  938. oy.append(y[i])
  939. elif park == '37':
  940. C.XY_RESO = C.XY_RESO - 700
  941. x = np.linspace(5500, 5500, 500)
  942. y = np.linspace(6200, 7300, 500)
  943. for i in range(len(x)):
  944. ox.append(x[i])
  945. oy.append(y[i])
  946. x = np.linspace(500, 5500, 500)
  947. y = np.linspace(7200, 7200, 500)
  948. for i in range(len(x)):
  949. ox.append(x[i])
  950. oy.append(y[i])
  951. x = np.linspace(3500, 5500, 500)
  952. y = np.linspace(6200, 6200, 500)
  953. for i in range(len(x)):
  954. ox.append(x[i])
  955. oy.append(y[i])
  956. x = np.linspace(1200, 1200, 500)
  957. y = np.linspace(200, 7300, 500)
  958. for i in range(len(x)):
  959. ox.append(x[i])
  960. oy.append(y[i])
  961. x = np.linspace(1800, 1800, 500)
  962. y = np.linspace(2500, 6500, 500)
  963. for i in range(len(x)):
  964. ox.append(x[i])
  965. oy.append(y[i])
  966. x = np.linspace(500, 5500, 500)
  967. y = np.linspace(500, 500, 500)
  968. for i in range(len(x)):
  969. ox.append(x[i])
  970. oy.append(y[i])
  971. elif park == '38':# TODO 35 37 38 39
  972. C.XY_RESO = C.XY_RESO - 700
  973. x = np.linspace(5500, 5500, 500)
  974. y = np.linspace(6200, 7300, 500)
  975. for i in range(len(x)):
  976. ox.append(x[i])
  977. oy.append(y[i])
  978. x = np.linspace(500, 5500, 500)
  979. y = np.linspace(7200, 7200, 500)
  980. for i in range(len(x)):
  981. ox.append(x[i])
  982. oy.append(y[i])
  983. x = np.linspace(3500, 5500, 500)
  984. y = np.linspace(6200, 6200, 500)
  985. for i in range(len(x)):
  986. ox.append(x[i])
  987. oy.append(y[i])
  988. x = np.linspace(1200, 1200, 500)
  989. y = np.linspace(200, 7300, 500)
  990. for i in range(len(x)):
  991. ox.append(x[i])
  992. oy.append(y[i])
  993. x = np.linspace(1800, 1800, 500)
  994. y = np.linspace(2500, 6500, 500)
  995. for i in range(len(x)):
  996. ox.append(x[i])
  997. oy.append(y[i])
  998. x = np.linspace(500, 5500, 500)
  999. y = np.linspace(500, 500, 500)
  1000. for i in range(len(x)):
  1001. ox.append(x[i])
  1002. oy.append(y[i])
  1003. elif park == '39' or park == '42' or park == '43' or park == '44':
  1004. x = np.linspace(5500, 5500, 500)
  1005. y = np.linspace(6200, 7300, 500)
  1006. for i in range(len(x)):
  1007. ox.append(x[i])
  1008. oy.append(y[i])
  1009. x = np.linspace(500, 5500, 500)
  1010. y = np.linspace(7200, 7200, 500)
  1011. for i in range(len(x)):
  1012. ox.append(x[i])
  1013. oy.append(y[i])
  1014. x = np.linspace(4500, 4500, 500)
  1015. y = np.linspace(500, 6200, 500)
  1016. for i in range(len(x)):
  1017. ox.append(x[i])
  1018. oy.append(y[i])
  1019. x = np.linspace(3500, 3500, 500)
  1020. y = np.linspace(6200, 7300, 500)
  1021. for i in range(len(x)):
  1022. ox.append(x[i])
  1023. oy.append(y[i])
  1024. elif park == '40' or park == '41' or park == '45':
  1025. x = np.linspace(3500, 3500, 500)
  1026. y = np.linspace(6200, 7300, 500)
  1027. for i in range(len(x)):
  1028. ox.append(x[i])
  1029. oy.append(y[i])
  1030. x = np.linspace(3500, 5000, 500)
  1031. y = np.linspace(7000, 7000, 500)
  1032. for i in range(len(x)):
  1033. ox.append(x[i])
  1034. oy.append(y[i])
  1035. x = np.linspace(5100, 5100, 500)
  1036. y = np.linspace(3700, 6500, 500)
  1037. for i in range(len(x)):
  1038. ox.append(x[i])
  1039. oy.append(y[i])
  1040. elif park == '46' or park == '47':
  1041. x = np.linspace(3500, 3500, 500)
  1042. y = np.linspace(6200, 7300, 500)
  1043. for i in range(len(x)):
  1044. ox.append(x[i])
  1045. oy.append(y[i])
  1046. x = np.linspace(3500, 5000, 500)
  1047. y = np.linspace(7000, 7000, 500)
  1048. for i in range(len(x)):
  1049. ox.append(x[i])
  1050. oy.append(y[i])
  1051. x = np.linspace(5100, 5100, 500)
  1052. y = np.linspace(3700, 6500, 500)
  1053. for i in range(len(x)):
  1054. ox.append(x[i])
  1055. oy.append(y[i])
  1056. x = np.linspace(3500, 5000, 500)
  1057. y = np.linspace(4500, 4500, 500)
  1058. for i in range(len(x)):
  1059. ox.append(x[i])
  1060. oy.append(y[i])
  1061. return ox,oy,isSearchFailed
  1062. def changeOxyB03(C_,park,ori_ox,ori_oy):
  1063. ox = ori_ox.copy()
  1064. oy = ori_oy.copy()
  1065. isSearchFailed = False
  1066. C = C_
  1067. if park == '1' or park == '2' or park == '3' or park == '4' or park == '5' or park == '6' or park == '7' or park == '8' or park == '9' or park == '10' or park == '11' or park == '12' or park == '13' or park == '14' or park == '15' or park == '16':
  1068. C.XY_RESO = C.XY_RESO - 200
  1069. x = np.linspace(4500, 4500, 500)
  1070. y = np.linspace(6000, 5000, 500)
  1071. for i in range(len(x)):
  1072. ox.append(x[i])
  1073. oy.append(y[i])
  1074. x = np.linspace(3500, 3500, 500)
  1075. y = np.linspace(3100, 7000, 500)
  1076. for i in range(len(x)):
  1077. ox.append(x[i])
  1078. oy.append(y[i])
  1079. x = np.linspace(0, 2100, 500)
  1080. y = np.linspace(5600, 5600, 500)
  1081. for i in range(len(x)):
  1082. ox.append(x[i])
  1083. oy.append(y[i])
  1084. x = np.linspace(2100, 2100, 500)
  1085. y = np.linspace(4500, 5700, 500)
  1086. for i in range(len(x)):
  1087. ox.append(x[i])
  1088. oy.append(y[i])
  1089. x = np.linspace(1000, 4000, 500)
  1090. y = np.linspace(6600, 6600, 500)
  1091. for i in range(len(x)):
  1092. ox.append(x[i])
  1093. oy.append(y[i])
  1094. x = np.linspace(1000, 1000, 100)
  1095. y = np.linspace(7700, 6600, 100)
  1096. for i in range(len(x)):
  1097. ox.append(x[i])
  1098. oy.append(y[i])
  1099. x = np.linspace(1000, 3500, 100)
  1100. y = np.linspace(3100, 3100, 100)
  1101. for i in range(len(x)):
  1102. ox.append(x[i])
  1103. oy.append(y[i])
  1104. elif park == '17' or park == '18' or park == '19' or park == '20':
  1105. x = np.linspace(4500, 4500, 500)
  1106. y = np.linspace(6000, 5000, 500)
  1107. for i in range(len(x)):
  1108. ox.append(x[i])
  1109. oy.append(y[i])
  1110. elif park == '21' or park == '22' or park == '23':
  1111. x = np.linspace(4500, 4500, 500)
  1112. y = np.linspace(6000, 5000, 500)
  1113. for i in range(len(x)):
  1114. ox.append(x[i])
  1115. oy.append(y[i])
  1116. x = np.linspace(0, 2100, 500)
  1117. y = np.linspace(5600, 5600, 500)
  1118. for i in range(len(x)):
  1119. ox.append(x[i])
  1120. oy.append(y[i])
  1121. x = np.linspace(0, 1000, 500)
  1122. y = np.linspace(3000, 3000, 500)
  1123. for i in range(len(x)):
  1124. ox.append(x[i])
  1125. oy.append(y[i])
  1126. x = np.linspace(3500, 3500, 500)
  1127. y = np.linspace(3100, 7000, 500)
  1128. for i in range(len(x)):
  1129. ox.append(x[i])
  1130. oy.append(y[i])
  1131. x = np.linspace(0, 2100, 500)
  1132. y = np.linspace(4000, 4000, 500)
  1133. for i in range(len(x)):
  1134. ox.append(x[i])
  1135. oy.append(y[i])
  1136. x = np.linspace(2100, 2100, 100)
  1137. y = np.linspace(4600, 5100, 100)
  1138. for i in range(len(x)):
  1139. ox.append(x[i])
  1140. oy.append(y[i])
  1141. x = np.linspace(1000, 4000, 500)
  1142. y = np.linspace(6600, 6600, 500)
  1143. for i in range(len(x)):
  1144. ox.append(x[i])
  1145. oy.append(y[i])
  1146. x = np.linspace(1000, 1000, 100)
  1147. y = np.linspace(7700, 6600, 100)
  1148. for i in range(len(x)):
  1149. ox.append(x[i])
  1150. oy.append(y[i])
  1151. x = np.linspace(3000, 3500, 100)
  1152. y = np.linspace(3100, 3100, 100)
  1153. for i in range(len(x)):
  1154. ox.append(x[i])
  1155. oy.append(y[i])
  1156. elif park == '24' or park == '25' or park == '26':
  1157. C.XY_RESO = C.XY_RESO - 800
  1158. x = np.linspace(4500, 4500, 500)
  1159. y = np.linspace(6000, 5000, 500)
  1160. for i in range(len(x)):
  1161. ox.append(x[i])
  1162. oy.append(y[i])
  1163. x = np.linspace(3500, 3500, 500)
  1164. y = np.linspace(4500, 7000, 500)
  1165. for i in range(len(x)):
  1166. ox.append(x[i])
  1167. oy.append(y[i])
  1168. x = np.linspace(3500, 4500, 500)
  1169. y = np.linspace(4500, 4500, 500)
  1170. for i in range(len(x)):
  1171. ox.append(x[i])
  1172. oy.append(y[i])
  1173. x = np.linspace(0, 2100, 500)
  1174. y = np.linspace(5600, 5600, 500)
  1175. for i in range(len(x)):
  1176. ox.append(x[i])
  1177. oy.append(y[i])
  1178. x = np.linspace(2100, 2100, 500)
  1179. y = np.linspace(4500, 5700, 500)
  1180. for i in range(len(x)):
  1181. ox.append(x[i])
  1182. oy.append(y[i])
  1183. x = np.linspace(1000, 4000, 500)
  1184. y = np.linspace(6600, 6600, 500)
  1185. for i in range(len(x)):
  1186. ox.append(x[i])
  1187. oy.append(y[i])
  1188. x = np.linspace(1000, 1000, 500)
  1189. y = np.linspace(7700, 6600, 500)
  1190. for i in range(len(x)):
  1191. ox.append(x[i])
  1192. oy.append(y[i])
  1193. x = np.linspace(1000, 3500, 500)
  1194. y = np.linspace(3100, 3100, 500)
  1195. for i in range(len(x)):
  1196. ox.append(x[i])
  1197. oy.append(y[i])
  1198. elif park == '27':
  1199. pass
  1200. elif park == '28' or park == '29':
  1201. C.XY_RESO = C.XY_RESO - 800
  1202. x = np.linspace(1000, 1000, 500)
  1203. y = np.linspace(7700, 6600, 500)
  1204. for i in range(len(x)):
  1205. ox.append(x[i])
  1206. oy.append(y[i])
  1207. x = np.linspace(1000, 5000, 500)
  1208. y = np.linspace(6600, 6600, 500)
  1209. for i in range(len(x)):
  1210. ox.append(x[i])
  1211. oy.append(y[i])
  1212. x = np.linspace(1000, 5000, 500)
  1213. y = np.linspace(4500, 4500, 500)
  1214. for i in range(len(x)):
  1215. ox.append(x[i])
  1216. oy.append(y[i])
  1217. x = np.linspace(4500, 4500, 500)
  1218. y = np.linspace(5000, 6000, 500)
  1219. for i in range(len(x)):
  1220. ox.append(x[i])
  1221. oy.append(y[i])
  1222. elif park == '30' or park == '31' or park == '32':
  1223. C.XY_RESO = C.XY_RESO - 900
  1224. x = np.linspace(4500, 4500, 500)
  1225. y = np.linspace(5000, 6000, 500)
  1226. for i in range(len(x)):
  1227. ox.append(x[i])
  1228. oy.append(y[i])
  1229. x = np.linspace(0, 4500, 500)
  1230. y = np.linspace(5500, 5500, 500)
  1231. for i in range(len(x)):
  1232. ox.append(x[i])
  1233. oy.append(y[i])
  1234. if park == '62'or park == '61':
  1235. for i in range(0, 3000, 1):
  1236. ox.append(i)
  1237. oy.append(5600)
  1238. for i in range(1000, 4500, 1):
  1239. ox.append(i)
  1240. oy.append(6500)
  1241. for i in range(6500, 7700, 1):
  1242. ox.append(1000)
  1243. oy.append(i)
  1244. x = np.linspace(3000, 4500, 500)
  1245. y = np.linspace(5600, 5000, 500)
  1246. for i in range(len(x)):
  1247. ox.append(x[i])
  1248. oy.append(y[i])
  1249. x = np.linspace(6000, 7800, 500)
  1250. y = np.linspace(5000, 5300, 500)
  1251. for i in range(len(x)):
  1252. ox.append(x[i])
  1253. oy.append(y[i])
  1254. x = np.linspace(8200, 10500, 500)
  1255. y = np.linspace(5720, 7700, 500)
  1256. for i in range(len(x)):
  1257. ox.append(x[i])
  1258. oy.append(y[i])
  1259. x = np.linspace(6000, 9200, 500)
  1260. y = np.linspace(4050, 4400, 500)
  1261. for i in range(len(x)):
  1262. ox.append(x[i])
  1263. oy.append(y[i])
  1264. if park == '60' or park == '59' or park == '58' or park == '57'or park == '56'or park == '55':
  1265. for i in range(0, 3000, 1):
  1266. ox.append(i)
  1267. oy.append(5600)
  1268. for i in range(1000, 4500, 1):
  1269. ox.append(i)
  1270. oy.append(6500)
  1271. for i in range(6500, 7700, 1):
  1272. ox.append(1000)
  1273. oy.append(i)
  1274. x = np.linspace(3000, 4500, 500)
  1275. y = np.linspace(5600, 5000, 500)
  1276. for i in range(len(x)):
  1277. ox.append(x[i])
  1278. oy.append(y[i])
  1279. x = np.linspace(6000, 9200, 500)
  1280. y = np.linspace(5000, 4400, 500)
  1281. for i in range(len(x)):
  1282. ox.append(x[i])
  1283. oy.append(y[i])
  1284. x = np.linspace(6000, 7000, 500)
  1285. y = np.linspace(4000, 3100, 500)
  1286. for i in range(len(x)):
  1287. ox.append(x[i])
  1288. oy.append(y[i])
  1289. if park == '54':
  1290. for i in range(0, 3000, 1):
  1291. ox.append(i)
  1292. oy.append(5600)
  1293. for i in range(1000, 4500, 1):
  1294. ox.append(i)
  1295. oy.append(6500)
  1296. for i in range(6500, 7700, 1):
  1297. ox.append(1000)
  1298. oy.append(i)
  1299. x = np.linspace(3000, 4500, 500)
  1300. y = np.linspace(5600, 5000, 500)
  1301. for i in range(len(x)):
  1302. ox.append(x[i])
  1303. oy.append(y[i])
  1304. x = np.linspace(6000, 9550, 500)
  1305. y = np.linspace(5000, 4500, 500)
  1306. for i in range(len(x)):
  1307. ox.append(x[i])
  1308. oy.append(y[i])
  1309. x = np.linspace(6000, 7000, 500)
  1310. y = np.linspace(4000, 3100, 500)
  1311. for i in range(len(x)):
  1312. ox.append(x[i])
  1313. oy.append(y[i])
  1314. if park == '53' or park == '52':
  1315. for i in range(0, 3000, 1):
  1316. ox.append(i)
  1317. oy.append(5600)
  1318. for i in range(1000, 4500, 1):
  1319. ox.append(i)
  1320. oy.append(6500)
  1321. for i in range(6500, 7700, 1):
  1322. ox.append(1000)
  1323. oy.append(i)
  1324. x = np.linspace(3000, 4500, 500)
  1325. y = np.linspace(5600, 5000, 500)
  1326. for i in range(len(x)):
  1327. ox.append(x[i])
  1328. oy.append(y[i])
  1329. x = np.linspace(6000, 9900, 500)
  1330. y = np.linspace(5000, 5200, 500)
  1331. for i in range(len(x)):
  1332. ox.append(x[i])
  1333. oy.append(y[i])
  1334. if park == '51' or park == '50' or park == '49':
  1335. for i in range(0, 3000, 1):
  1336. ox.append(i)
  1337. oy.append(5600)
  1338. for i in range(1000, 4500, 1):
  1339. ox.append(i)
  1340. oy.append(6500)
  1341. for i in range(6500, 7700, 1):
  1342. ox.append(1000)
  1343. oy.append(i)
  1344. x = np.linspace(3000, 4500, 500)
  1345. y = np.linspace(5600, 5000, 500)
  1346. for i in range(len(x)):
  1347. ox.append(x[i])
  1348. oy.append(y[i])
  1349. x = np.linspace(6000, 9100, 500)
  1350. y = np.linspace(5000, 5000, 500)
  1351. for i in range(len(x)):
  1352. ox.append(x[i])
  1353. oy.append(y[i])
  1354. # x = np.linspace(6000, 10500, 500)
  1355. # y = np.linspace(700, 700, 500)
  1356. # for i in range(len(x)):
  1357. # ox.append(x[i])
  1358. # oy.append(y[i])
  1359. x = np.linspace(7000, 7000, 500)
  1360. y = np.linspace(3100, 5000, 500)
  1361. for i in range(len(x)):
  1362. ox.append(x[i])
  1363. oy.append(y[i])
  1364. x = np.linspace(7000, 8000, 500)
  1365. y = np.linspace(3100, 3100, 500)
  1366. for i in range(len(x)):
  1367. ox.append(x[i])
  1368. oy.append(y[i])
  1369. if park == '48':
  1370. for i in range(0, 3000, 1):
  1371. ox.append(i)
  1372. oy.append(5600)
  1373. for i in range(1000, 4500, 1):
  1374. ox.append(i)
  1375. oy.append(6500)
  1376. for i in range(6500, 7700, 1):
  1377. ox.append(1000)
  1378. oy.append(i)
  1379. x = np.linspace(3000, 4500, 500)
  1380. y = np.linspace(5600, 5000, 500)
  1381. for i in range(len(x)):
  1382. ox.append(x[i])
  1383. oy.append(y[i])
  1384. x = np.linspace(6000, 9100, 500)
  1385. y = np.linspace(5000, 4400, 500)
  1386. for i in range(len(x)):
  1387. ox.append(x[i])
  1388. oy.append(y[i])
  1389. # x = np.linspace(6000, 10500, 500)
  1390. # y = np.linspace(700, 700, 500)
  1391. # for i in range(len(x)):
  1392. # ox.append(x[i])
  1393. # oy.append(y[i])
  1394. # x = np.linspace(7000, 7000, 500)
  1395. # y = np.linspace(3100, 5000, 500)
  1396. # for i in range(len(x)):
  1397. # ox.append(x[i])
  1398. # oy.append(y[i])
  1399. x = np.linspace(7000, 10500, 500)
  1400. y = np.linspace(3100, 3100, 500)
  1401. for i in range(len(x)):
  1402. ox.append(x[i])
  1403. oy.append(y[i])
  1404. if park == '47':
  1405. for i in range(0, 3000, 1):
  1406. ox.append(i)
  1407. oy.append(5600)
  1408. for i in range(1000, 4500, 1):
  1409. ox.append(i)
  1410. oy.append(6500)
  1411. for i in range(6500, 7700, 1):
  1412. ox.append(1000)
  1413. oy.append(i)
  1414. x = np.linspace(3000, 4500, 500)
  1415. y = np.linspace(5600, 5000, 500)
  1416. for i in range(len(x)):
  1417. ox.append(x[i])
  1418. oy.append(y[i])
  1419. x = np.linspace(6000, 9100, 500)
  1420. y = np.linspace(5000, 3100, 500)
  1421. for i in range(len(x)):
  1422. ox.append(x[i])
  1423. oy.append(y[i])
  1424. # x = np.linspace(6000, 10500, 500)
  1425. # y = np.linspace(700, 700, 500)
  1426. # for i in range(len(x)):
  1427. # ox.append(x[i])
  1428. # oy.append(y[i])
  1429. x = np.linspace(7000, 7000, 500)
  1430. y = np.linspace(3100, 5000, 500)
  1431. for i in range(len(x)):
  1432. ox.append(x[i])
  1433. oy.append(y[i])
  1434. x = np.linspace(7000, 10500, 500)
  1435. y = np.linspace(3100, 3100, 500)
  1436. for i in range(len(x)):
  1437. ox.append(x[i])
  1438. oy.append(y[i])
  1439. if park == '46' or park == '45':
  1440. for i in range(0, 2200, 1):
  1441. ox.append(i)
  1442. oy.append(5600)
  1443. for i in range(1000, 4500, 1):
  1444. ox.append(i)
  1445. oy.append(6500)
  1446. for i in range(6500, 7700, 1):
  1447. ox.append(1000)
  1448. oy.append(i)
  1449. x = np.linspace(2100, 4500, 500)
  1450. y = np.linspace(5600, 5000, 500)
  1451. for i in range(len(x)):
  1452. ox.append(x[i])
  1453. oy.append(y[i])
  1454. x = np.linspace(6000, 9100, 500)
  1455. y = np.linspace(5000, 5000, 500)
  1456. for i in range(len(x)):
  1457. ox.append(x[i])
  1458. oy.append(y[i])
  1459. if park == '44' or park == '43'or park == '42'or park == '41'or park == '40':
  1460. for i in range(0, 2200, 1):
  1461. ox.append(i)
  1462. oy.append(5600)
  1463. for i in range(1000, 4500, 1):
  1464. ox.append(i)
  1465. oy.append(6500)
  1466. for i in range(6500, 7700, 1):
  1467. ox.append(1000)
  1468. oy.append(i)
  1469. x = np.linspace(2100, 4500, 500)
  1470. y = np.linspace(5600, 5000, 500)
  1471. for i in range(len(x)):
  1472. ox.append(x[i])
  1473. oy.append(y[i])
  1474. x = np.linspace(7000, 10500, 500)
  1475. y = np.linspace(3100, 3100, 500)
  1476. for i in range(len(x)):
  1477. ox.append(x[i])
  1478. oy.append(y[i])
  1479. x = np.linspace(6000, 10500, 500)
  1480. y = np.linspace(5000, 5000, 500)
  1481. for i in range(len(x)):
  1482. ox.append(x[i])
  1483. oy.append(y[i])
  1484. x = np.linspace(8500, 8500, 500)
  1485. y = np.linspace(3100, 6000, 500)
  1486. for i in range(len(x)):
  1487. ox.append(x[i])
  1488. oy.append(y[i])
  1489. if park == '39':
  1490. for i in range(0, 2200, 1):
  1491. ox.append(i)
  1492. oy.append(5600)
  1493. for i in range(1000, 4500, 1):
  1494. ox.append(i)
  1495. oy.append(6500)
  1496. for i in range(6500, 7700, 1):
  1497. ox.append(1000)
  1498. oy.append(i)
  1499. x = np.linspace(2100, 4500, 500)
  1500. y = np.linspace(5600, 5000, 500)
  1501. for i in range(len(x)):
  1502. ox.append(x[i])
  1503. oy.append(y[i])
  1504. x = np.linspace(7000, 10500, 500)
  1505. y = np.linspace(3100, 3100, 500)
  1506. for i in range(len(x)):
  1507. ox.append(x[i])
  1508. oy.append(y[i])
  1509. x = np.linspace(6000, 8000, 500)
  1510. y = np.linspace(5700, 5700, 500)
  1511. for i in range(len(x)):
  1512. ox.append(x[i])
  1513. oy.append(y[i])
  1514. x = np.linspace(7500, 7500, 500)
  1515. y = np.linspace(3100, 6000, 500)
  1516. for i in range(len(x)):
  1517. ox.append(x[i])
  1518. oy.append(y[i])
  1519. x = np.linspace(7000, 8500, 500)
  1520. y = np.linspace(1700, 1700, 500)
  1521. for i in range(len(x)):
  1522. ox.append(x[i])
  1523. oy.append(y[i])
  1524. if park == '38':
  1525. for i in range(0, 2200, 1):
  1526. ox.append(i)
  1527. oy.append(5600)
  1528. for i in range(1000, 4500, 1):
  1529. ox.append(i)
  1530. oy.append(6500)
  1531. for i in range(6500, 7700, 1):
  1532. ox.append(1000)
  1533. oy.append(i)
  1534. x = np.linspace(2100, 4500, 500)
  1535. y = np.linspace(5600, 5000, 500)
  1536. for i in range(len(x)):
  1537. ox.append(x[i])
  1538. oy.append(y[i])
  1539. x = np.linspace(7000, 10500, 500)
  1540. y = np.linspace(3100, 3100, 500)
  1541. for i in range(len(x)):
  1542. ox.append(x[i])
  1543. oy.append(y[i])
  1544. x = np.linspace(6000, 8000, 500)
  1545. y = np.linspace(5700, 5700, 500)
  1546. for i in range(len(x)):
  1547. ox.append(x[i])
  1548. oy.append(y[i])
  1549. x = np.linspace(8500, 8500, 500)
  1550. y = np.linspace(3100, 6000, 500)
  1551. for i in range(len(x)):
  1552. ox.append(x[i])
  1553. oy.append(y[i])
  1554. if park == '37'or park == '36' or park == '35' or park == '34':
  1555. for i in range(0, 2200, 1):
  1556. ox.append(i)
  1557. oy.append(5600)
  1558. for i in range(1000, 4500, 1):
  1559. ox.append(i)
  1560. oy.append(6500)
  1561. for i in range(6500, 7700, 1):
  1562. ox.append(1000)
  1563. oy.append(i)
  1564. x = np.linspace(2100, 4500, 500)
  1565. y = np.linspace(5600, 5000, 500)
  1566. for i in range(len(x)):
  1567. ox.append(x[i])
  1568. oy.append(y[i])
  1569. x = np.linspace(6000, 9200, 500)
  1570. y = np.linspace(4000, 4400, 500)
  1571. for i in range(len(x)):
  1572. ox.append(x[i])
  1573. oy.append(y[i])
  1574. if park == '33':
  1575. for i in range(0, 2200, 1):
  1576. ox.append(i)
  1577. oy.append(5600)
  1578. for i in range(1000, 4500, 1):
  1579. ox.append(i)
  1580. oy.append(6500)
  1581. for i in range(6500, 7700, 1):
  1582. ox.append(1000)
  1583. oy.append(i)
  1584. x = np.linspace(2100, 4500, 500)
  1585. y = np.linspace(5600, 5000, 500)
  1586. for i in range(len(x)):
  1587. ox.append(x[i])
  1588. oy.append(y[i])
  1589. x = np.linspace(6000, 9900, 500)
  1590. y = np.linspace(4000, 5200, 500)
  1591. for i in range(len(x)):
  1592. ox.append(x[i])
  1593. oy.append(y[i])
  1594. x = np.linspace(9000, 9000, 500)
  1595. y = np.linspace(6700, 4000, 500)
  1596. for i in range(len(x)):
  1597. ox.append(x[i])
  1598. oy.append(y[i])
  1599. return ox,oy,isSearchFailed
  1600. def main():
  1601. # 输入input文件夹下场景文件
  1602. map_path = './input/B01.json'
  1603. # mdp.map_display(map_path) # 仅绘制地图
  1604. ox, oy,sp,gp = mp.make_map(map_path)
  1605. sx, sy, syaw0 = sp['x'], sp['y'], sp['yaw']
  1606. C = make_car.C
  1607. # 获取目标停车位
  1608. park = '26'
  1609. gx, gy, gyaw0 = gp[park]['x_end'], gp[park]['y_end'], gp[park]['yaw']
  1610. isSearchFailed = False
  1611. ox, oy, isSearchFailed = changeOxyB01(C,park,ox,oy)
  1612. plt.plot(ox, oy, ",k")
  1613. plt.show()
  1614. start = time.time()
  1615. # 规划算法
  1616. path = planner.hybrid_astar_planning(sx, sy, syaw0, gx, gy, gyaw0, ox, oy, C.XY_RESO, C.YAW_RESO)
  1617. end = time.time()
  1618. print(f"Time: {end-start}s")
  1619. # 算法测试结果保存
  1620. if not path: plt.plot(ox, oy, ",k")
  1621. plt.show()
  1622. output_dit={
  1623. "output_x":path.x,
  1624. "output_y": path.y,
  1625. "output_yaw": path.yaw,
  1626. "output_dir": path.direction,
  1627. }
  1628. with open(f"./output/result_{map_path.split('/')[-1].split('.json')[0]}_{park}.json", "w") as file:
  1629. json.dump(output_dit, file)
  1630. # 仿真回放
  1631. result_path = f"./output/result_{map_path.split('/')[-1].split('.json')[0]}_{park}.json"
  1632. replay.replay(map_path, result_path)
  1633. if __name__ == '__main__':
  1634. main()