Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Outline• Überblick – Schnittstellen• Reaktive hierarchische Verhaltenssteuerung (Dual
Dynamics)• Software-Rahmen
- Ebenen- Sensoren / Aktoren- Verhaltenstruktur
• Implementierte Sensoren/Aktoren/Verhalten• Hausaufgaben
Überblick - Schnittstellen
Steuerung
Simulator
Bildauswertung Kommunikation
Kamera Spielfeld Funk
Reaktive hierarchische Verhaltnenssteuerung
(Dual Dynamics)
Software-Rahmen
Robot
Ebene
Sensor
AktorAktorManager
SensorManager
VerhaltenManager Verhalten
RobotOmni
RobotDummy
Team
Spiel
Agent
Klasse Agent
Klasse Ebene
Klasse Sensor
KlasseAktor
KlasseVerhalten
Sensoren auf RobotOmniEbene0
�SensorFloat s_ausrichtenWinkel
� SensorFloat s_drehGeschw
� SensorPos s_fahrGeschwSmooth
� SensorFloat s_fahrtausrichten
� SensorPos s_fahrtausrichtenPos
� SensorFloat s_schuss
� SensorPos s_position
�SensorPos s_orientierung
�SensorPos s_geschwindigkeit
�SensorFloat s_drehGeschwindigkeit
�SensorFloat s_ballAbstand
�SensorFloat s_ballWinkel
�SensorPos s_naechstesHindernis
�SensorPos s_zielPos
�SensorFloat s_zielWinkel
�SensorFloat s_zielGeschw
�SensorFloat s_maxGeschw
�SensorBool s_ballausweichen
�SensorBool s_zumBall
�SensorBoolSlow s_isTorwart
Geerbt von RobotEbene0 RobotOmniEbene0
Aktoren auf RobotOmniEbene0
� AktorFloat a_drehGeschw
� AktorPos a_fahrGeschw
� AktorFloat a_schuss
� Steuern v_steuern
� Panikausweichen v_panikausweichen
� ElferSchiessen v_elferSchiessen
� TorwartFlucht v_torwartFlucht
� TorwartAufFreistossWarten v_torwartAufFreistossWarten
� TorwartBallBewachen v_torwartBallBewachen
� TorwartElferHalten v_torwartElferHalten
� TorwartElferStellen v_torwartElferStellen
� TorwartHalten v_torwartHalten
� TorwartHauWeg v_torwartHauWeg
� TorwartPostenAmPfosten v_torwartPostenAmPfosten
� TorwartStellen v_torwartStellen
� TestDrehen v_testDrehen
� TestFahren v_testFahren
� TestJoystickCtrl v_testJoystickCtrl
Verhalten auf RobotOmniEbene0
Sensoren auf RobotOmniEbene1
�SensorBool s_pfadplanen
�SensorBool s_flanken
�SensorBool s_ballausweichen
�SensorFloat s_fahrtausrichten
�SensorPos s_fahrtausrichtenPos
�SensorBoolSlow s_ballWegVonDerWand
�SensorPos s_einschlagZiel
�SensorFloat s_einschlagWinkel
�SensorBoolSlow s_ballWeghauen
�SensorBoolSlow s_inHauwegPos
�SensorPos s_position
�SensorPos s_orientierung
�SensorPos s_geschwindigkeit
�SensorPos s_ballAbfangPos
�SensorPos s_schussZielPos
�SensorPos s_zielPos
�SensorObjectSlow s_schussZielObject
�SensorBool s_zumBall
�SensorBoolSlow s_isTorwart
�SensorBoolSlow s_isAbwehr
�SensorBoolSlow s_isMitte
�SensorBoolSlow s_isAngriff
�SensorBoolSlow s_torwartElferStellen
�SensorBoolSlow s_torwartElferHalten
Geerbt von RobotEbene1 RobotOmniEbene1
Aktoren auf RobotOmniEbene1
�AktorFloat a_fahrtausrichten
�AktorPos a_fahrtausrichtenPos
�AktorFloat a_drehGeschw
�AktorFloat a_schuss
�AktorBool a_zumBall
�AktorBoolSlow a_isTorwart
�AktorPosSlow a_homePos
�AktorBoolSlow a_elferSchiessen
�AktorBoolSlow a_torwartElferStellen
�AktorBoolSlow a_torwartElferHalten
�AktorPos a_zielPos
�AktorFloat a_zielGeschw
�AktorFloat a_maxGeschw
�AktorBool a_ballausweichen
�AktorFloatSlow a_panikausweichenAus
�AktorBoolSlow a_strafraumAus
Geerbt von RobotEbene1 RobotOmniEbene1
Verhalten auf RobotOmniEbene1�Vollstrecken v_vollstrecken
�HauWeg v_hauWeg
�HauRein v_hauRein
�Passen v_passen
�Dribbeln v_dribbeln
�Anlauf v_anlauf
�FahrenZumOrt v_fahrenZumOrt
�BallWegVonDerWand v_ballWegVonDerWand
�NahkampfDreher v_nahkampfDreher
�Pfadplanen v_pfadplanen
�TestAufE1 v_testAufE1
�Test8Fahren v_test8Fahren
�TestLissajou v_testLissajou
�TestMouseCtrl v_testMouseCtrl
�TorwartE1 v_torwartE1
Sensoren auf SpielEbene0�SensorFloat s_actionTime
�SensorFloat s_funkRate
�SensorFloatSlow s_anstossRadius
�SensorPos s_ballGeschwindigkeit
�SensorPos s_ballPos
�SensorFloat s_droppedFrames
�SensorFloatSlow s_elferPunktX
�SensorPosSlow s_feldGroesse
�SensorPosSlow s_freistossPunkt
�SensorPos s_glatteBallPos
�SensorFloatSlow s_halbeStrafraumBreite
�SensorFloatSlow s_halbeTorbreite
�SensorBoolSlow s_isFunky
�SensorBoolSlow s_modusAnstoss
�SensorBoolSlow s_modusElfer
�SensorBoolSlow s_modusFreistoss
�SensorBoolSlow s_modusFreistossIndirekt
�SensorBoolSlow s_modusFuerGelb
�SensorBoolSlow s_modusSpielen
�SensorObjectSlow s_schuetze
�SensorBoolSlow s_schuetzeGewaehlt
�SensorFloatSlow s_strafraumAnfang
�SensorPosSlow s_strafraumGroesse
�SensorPosSlow s_torGroesse
�SensorPos s_visionBallPos
�SensorFloat s_visionBallQuality
�SensorFloatSlow s_zentimeter
Sensoren auf SpielEbene1�SensorFloat s_actionTime
�SensorPos s_ballGeschwindigkeit
�SensorPos s_ballPos
�SensorBoolSlow s_modusAnstoss
�SensorBoolSlow s_modusElfer
�SensorBoolSlow s_modusFreistoss
�SensorBoolSlow s_modusFreistossIndirekt
�SensorBoolSlow s_modusFuerGelb
�SensorBoolSlow s_modusSpielen
�SensorPos s_mouseAusrichtenPos
�SensorPos s_mouseZielPos
�SensorObjectSlow s_schuetze
�SensorBoolSlow s_schuetzeGewaehlt
Ein einfaches VerhaltenFahren zum Ort (RobotOmniEbene1)
/ * * Faehr t zu ei nem Or t ( i m Gegensat z zu Anl auf unabhaengi g vom Bal l ) . Wei cht dem Bal l aus, f al l s noet i g. * /
c l ass Fahr enZumOr t : publ i c Ver hal t en {publ i c:
Fahr enZumOr t ( Robot Omni Ebene1 * e, Spi el Ebene1* s, Ver hal t enManager & vm) ;
v i r t ual ~Fahr enZumOr t ( ) ;/ * * Akt i v i er t s i ch, wenn er NI CHT s_zumBal l sol l und di e Pf adpl anung ni cht nöt i g i s t . Di es i s t der Fal l , wenn di e Ger ade St r ecke f r ei i s t ( al so kei ne Hi nder ni sse oder
St r af r aum i m Weg ) und wi r d i n Robot Omni Ebene1: : akt ual i s i er eVonOben ber echnet und i n s_pf adpl anen
geschr i eben. * /f l oat akt i v i er ungsf unkt i on( ) ;voi d zi el f unkt i on( ) ;
Robot Omni Ebene1 * e;Spi el Ebene1* s;
} ;
Ein einfaches VerhaltenFahren zum Ort (RobotOmniEbene1)
Fahr enZumOr t : : Fahr enZumOr t ( Robot Omni Ebene1 * e, Spi el Ebene1* s,Ver hal t enManager & vm)
: Ver hal t en( " Fahr enZumOr t " , vm){
t hi s- >e = e;t hi s- >s = s;
}
Fahr enZumOr t : : ~Fahr enZumOr t ( ){
}f l oat Fahr enZumOr t : : akt i v i er ungsf unkt i on( ){
i f ( ! e- >s_zumBal l . get ( ) && ! e- >s_pf adpl anen. get ( ) )r et ur n 1. f ;
el ser et ur n 0. f ;
}
Ein einfaches VerhaltenFahren zum Ort (RobotOmniEbene1)
voi d Fahr enZumOr t : : z i el f unkt i on( ){
const f l oat r obbi Br ei t e = e- >s_r obbi Br ei t e. get ( ) ;const f l oat sei t e = e- >s_sei t e. get ( ) ;const Vec2f & r obbi Pos = e- >s_posi t i on. get ( ) ;const Vec2f & bal l Pos = s- >s_bal l Pos. get ( ) ;const Vec2f & zi el Pos = e- >s_zi el Pos. get ( ) ;const Vec2f & f ahr t ausr i cht enPos = e-
>s_f ahr t ausr i cht enPos. get ( ) ;const f l oat f ahr t ausr i cht en = e- >s_f ahr t ausr i cht en. get ( ) ;
const Vec2f unser Tor ( sei t e, 0. f ) ;const Vec2f t or Di r = ( r obbi Pos- unser Tor ) . get Nor mal i zed( ) ;const Vec2f p1 = r obbi Pos+0. 5f * r obbi Br ei t e* t or Di r ;const Vec2f p2 = p1 - t or Di r . gedr eht ( 0. 5f * RcMat h: : pi ) ;const bool bal l Auswei chen = bal l Pos. i sLef t Of ( p1, p2) ;
e- >a_zi el Pos. change( t hi s, z i el Pos) ;e- >a_zi el Geschw. change( t hi s, 0. f ) ;e- >a_maxGeschw. change( t hi s, e- >s_maxGeschw. get ( ) ) ;e- >a_f ahr t ausr i cht en. change( t hi s, f ahr t ausr i cht en) ;e- >a_f ahr t ausr i cht enPos. change( t hi s , f ahr t ausr i cht enPos) ;e- >a_bal l auswei chen. change( t hi s, bal l Auswei chen) ;e- >a_schuss. change( t hi s , 0. f ) ;
}
Vec2f Klassen
�float x �float y �Vec2f(float xx, float yy) �Vec2f(float xx[2]) �Vec2f() �Vec2f(const Vec2i& v) �float cross(const Vec2f& v2) const�float dist(const Vec2f& v) const�float dist2(const Vec2f& v) const�void drehe( float a )�void dreheCCW90()�void dreheCW90() �Vec2f gedreht( float a ) const�Vec2f gedrehtCosSin(RcWinkel w) const�Vec2f getNormalized() const�bool isLeftOf(const Vec2f& g1, const Vec2f& g2)const�bool isLeftOf(const Vec2f& v) const
�virtual std::istream& load(std::istream& in) �float norm() const�float norm2() const�Vec2f& normalize() �Vec2f& normalizeSave()�bool operator!=(const Vec2f& v) const�Vec2f& operator*=(float scalar) �Vec2f operator+(const Vec2f& v) const�Vec2f& operator+=(const Vec2f& v) �Vec2f operator-(const Vec2f& v) const�Vec2f operator-() const�Vec2f& operator-=(const Vec2f& v)�void operator=(const Vec2f& v) �Vec2f& operator=(const Vec2i& v)�bool operator==(const Vec2f& v) const�Vec2f& projectTo(const Vec2f& to) �Vec2f projectionTo(const Vec2f& to) const�virtual std::ostream& save(std::ostream& out)
RcMath Klassenstatic float eins_durch_pi static float pi static bool GetCrossPoint( ... ) static bool GetCrossPoint( ... ) static float abstandPunktGerade( ... )static float fDeterminante(...)static Vec2f global2local(const Vec2f &orRobot, const Vec2f &globalDirection)static Vec2f local2global(const Vec2f &orRobot, const Vec2f &localDirection)static bool isPunktInRechteck(...) static bool isRechteckSchnitt(...) static bool isStreckenSchnitt(...) static Vec2f linkerTangentenPunkt(..) static Vec2f lotPunktAufGerade( ... )static Vec2f lotPunktAufGerade( ... )template<class T>static T maximum(T a, T b)template<class T>static T minimum(T a, T b)static float rampe( float x0, float x, float x1 )static float rangeCut(float lower_border, float value, float upper_border)static float rangeCutSave(float border1, float value, float border2)static Vec2f rechterTangentenPunkt(...) static int round(float x)static float signum( float a)static float vwinkel(const Vec2f& v1, const Vec2f& v2 )static RcWinkel vwinkelCosSin(Vec2f v1, Vec2f v2 )
Roboter soll zum Ball
• Anlauf
• Pfadplanen
• Vollstrecken
• Passen
• Dribbeln
• Ball weg von der Wand
• Nahkampfdreher
• Hau weg
Welche Verhalten können aktiviert werden?
Anlauf
• Aktivierung: Weg zum Ball frei
• Ziel: Hinter Ball Richtung Schussziel
• Gehemmt von: allen
Pfadplanen
• Aktivierung: Weg zum Ball nicht frei
• Ziel: Hinter Ball Richtung Schussziel
• Gehemmt von: allen außer Anlauf
Vollstrecken• Aktivierung: Direkter Schuss zum nicht möglich
• Ziel: Fahre mit laufendem Schussapparat in Richtung Schussziel
• Gehemmt von: niemand
Passen• Aktivierung:
- Direkter Schuss zum Tor nicht möglich
- Anderer Spieler steht günstig
• Ziel: Fahre mit langsam laufendem Schussapparat in Richtung Schussziel
• Gehemmt von: Vollstrecken
Dribbeln• Aktivierung:
- Direkter Weg zum Tor nicht frei
- Es soll nicht gepaßt werden
• Ziel: Dribbel bis freie Schussposition
• Gehemmt von: alle außer Pfadplanen und Anlauf
Ball weg von der Wand• Aktivierung:
- Ball nahe an der Wand
• Ziel: Drehe in Richtung des Gegnertors
• Gehemmt von: Vollstrecken
Nahkampfdreher• Aktivierung:
- Ball nahe an Gegner
• Ziel: Drehe in Richtung des Gegnertors
• Gehemmt von: Vollstrecken, Ball weg von der Wand
Hau weg
• Aktivierung:
- Ball auf eigner Seite
- Vor ihm ausreichend Platz
• Ziel: Schiesse ungefähr in Richtung Tor
• Gehemmt von: Vollstrecken, Passen
Übung