28.02.2014 Aufrufe

Bahnplanungsframework für ein autonomes Fahrzeug - oops ...

Bahnplanungsframework für ein autonomes Fahrzeug - oops ...

Bahnplanungsframework für ein autonomes Fahrzeug - oops ...

MEHR ANZEIGEN
WENIGER ANZEIGEN

Erfolgreiche ePaper selbst erstellen

Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.

6.1 A* 57<br />

47 Node otherWay = GetNode ( openSet , n e i g h b o r ) ;<br />

i f ( otherWay == n u l l )<br />

49 / / No node was found , so i t ’ s new , add i t t o open s e t<br />

openSet . Add ( n e i g h b o r ) ;<br />

51 e l s e i f ( n e i g h b o r .G < otherWay .G)<br />

{<br />

53 / / This n e i g h b o r has b e t t e r s c o r e<br />

/ / o v e r w r i t e otherWay with n e i g h b o r<br />

55 openSet . Remove ( otherWay ) ;<br />

openSet . Add ( n e i g h b o r ) ;<br />

57 }<br />

}<br />

59 }<br />

r e t u r n n u l l ; / / No way found<br />

61 }<br />

63 p u b l i c L i s t R e c o n s t r u c t P a t h ( Node node )<br />

{<br />

65 / / The p a r e n t p a r a m e t e r of t h e node i s s e t w h i l e c r e a t i n g<br />

/ / t h e n e i g h b o r s ( f i r s t time c u r r e n t . Neighbors i s c a l l e d )<br />

67<br />

L i s t r e s = new L i s t ( ) ;<br />

69 / / Go from t h e end t o t h e p a r e n t of each node<br />

/ / u n t i l f i n d t h e r o o t , t h a t has no p a r e n t<br />

71 w h i l e ( node . P a r e n t != n u l l )<br />

{<br />

73 r e s . I n s e r t ( 0 , node ) ;<br />

node = node . P a r e n t ;<br />

75 }<br />

r e t u r n r e s ;<br />

77 }<br />

Algorithmus (6.1): A*-Algorithmus im C# Stil.<br />

Die Methoden float Score(Node from, Node to) und float Heuristic(Node<br />

from, Node to), können nach belieben angepasst werden und haben teilweise große Auswirkungen<br />

auf die Arbeitsweise des Algorithmus und sollen in den nächsten Kapiteln besser erklärt<br />

werden. Im Normalfall wird als Score die Länge der gesamten Bahn vom Startpunkt geliefert und als<br />

Heuristik der euklidische Abstand.

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!