實線是牆壁,虛線是虛擬框出的cell。
起點為start,一開始編號和cell均為未知,出發後第一個cell編號是1 ,並且得到為從1跨到2的點,產生編號2的cell。
走到編號2的cell,得到點產生編號3的cell、接著得到點
產生編號4的cell。Ps:”接著得到點
由於這是剛剛跨過來的這個邊界因此不用產生新的cell”。
再來從編號2的cell走到編號3的cell,相同的得到產生編號5的cell,得到
產生編號6的cell,得到
產生編號7的cell。 Ps:”得到點
由於這是剛剛跨過來的這個邊界因此不用產生新的cell”。
把所有突破口存到crosspoint[100]
紀錄和判斷每次wall_follow第一個突破口(crosspoint[first_bump])
紀錄每次wall_follow的起始點(stop_laser == 1 | first_bump != 0)
若沒有碰撞點則”直接從頭搜尋”最起始的突破口或者”紀錄上次搜尋到哪當作搜尋的起點”(first_bump == 0)
判斷剛跨過的突破口不紀錄!(記錄跨cell的邊界)(LastCrossBoundary)
跨出cell的行為,找牆wall_follow 或者 直直衝到邊界
處理不同突破口進到同樣的cell
-
record and decide first cross point when wall_follow once(finish)
-
If there isn't new cross point,searching cross point from start or from index searched last time in crosspoint array.(finish)
-
not record cross point at last cross boundary.(finish)
-
when cross cell,finding the nearest wall to wall_follow or go straight until it is out the boundary.(finish)
-
If differnt boundary produce different cross point, but they enter the same cell.(no solution so far)