[Orxonox-commit 6174] r10832 - in code/branches/AI_HS15: data/levels src/orxonox/controllers

gania at orxonox.net gania at orxonox.net
Mon Nov 23 11:17:22 CET 2015


Author: gania
Date: 2015-11-23 11:17:22 +0100 (Mon, 23 Nov 2015)
New Revision: 10832

Modified:
   code/branches/AI_HS15/data/levels/AITest.oxw
   code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc
   code/branches/AI_HS15/src/orxonox/controllers/CommonController.h
   code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc
   code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc
   code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc
Log:
minor bugfixes and code style improvement

Modified: code/branches/AI_HS15/data/levels/AITest.oxw
===================================================================
--- code/branches/AI_HS15/data/levels/AITest.oxw	2015-11-22 18:32:02 UTC (rev 10831)
+++ code/branches/AI_HS15/data/levels/AITest.oxw	2015-11-23 10:17:22 UTC (rev 10832)
@@ -56,7 +56,7 @@
         <Template link=spaceshipassff />
       </templates>
       <controller>
-        <DivisionController team=1 formationMode="DIAMOND">
+        <DivisionController team=1 formationMode="wall" action="FIGHT">
         </DivisionController>
       </controller>
     </SpaceShip>
@@ -93,7 +93,7 @@
         <Template link=spaceshipassff />
       </templates>
       <controller>
-        <DivisionController team=2 formationMode="FINGER4">
+        <DivisionController team=2 formationMode="wall" action="FIGHT">
         </DivisionController>
       </controller>
     </SpaceShip>

Modified: code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc	2015-11-22 18:32:02 UTC (rev 10831)
+++ code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc	2015-11-23 10:17:22 UTC (rev 10832)
@@ -50,10 +50,8 @@
 
     CommonController::CommonController( Context* context ): Controller( context )
     {
-        this->bSetupWorked = false;
 
        
-        this->executingMoveToPoint_ = false;
         this->action_ = Action::FLY;
         this->stopLookingAtTarget();
        
@@ -70,8 +68,48 @@
     {
         SUPER( CommonController, XMLPort, xmlelement, mode );
         XMLPortParam( CommonController, "formationMode", setFormationModeXML, getFormationModeXML,  xmlelement, mode );
+        XMLPortParam( CommonController, "action", setActionXML, getActionXML,  xmlelement, mode );
 
     }
+    void CommonController::setActionXML( std::string val)
+    {
+        const std::string valUpper = getUppercase( val );
+        Action::Value value;
+        
+        if ( valUpper == "FIGHT" )
+            value = Action::FIGHT;
+        else if ( valUpper == "FLY" )
+            value = Action::FLY;
+        else if ( valUpper == "PROTECT" )
+            value = Action::PROTECT;
+        else
+            ThrowException( ParseError, std::string( "Attempting to set an unknown Action: '" )+ val + "'." );
+        this->setAction( value );
+    }
+    std::string CommonController::getActionXML()
+    {
+        switch ( this->action_ )
+        {
+            case Action::FIGHT:
+            {
+                return "FIGHT";
+                break;
+            }
+            case Action::FLY:
+            {
+                return "FLY";
+                break;
+            }
+            case Action::PROTECT:
+            {
+                return "PROTECT";
+                break;
+            }
+            default:
+                return "FIGHT";
+                break;
+        }
+    }
     void CommonController::setFormationModeXML( std::string val )
     {
         const std::string valUpper = getUppercase( val );
@@ -117,6 +155,10 @@
     {
         return this->action_;
     }
+    void CommonController::setAction (Action::Value action)
+    {
+        this->action_ = action;
+    }
 
     void CommonController::setAction (Action::Value action, ControllableEntity* target)
     {
@@ -155,12 +197,37 @@
             
         }
     }
+    void CommonController::setClosestTarget()
+    {
+        if (!this->getControllableEntity())
+            return;
+
+        Pawn* closestTarget = 0;
+        float minDistance =  std::numeric_limits<float>::infinity();
+        
+        for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+        {
+            if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP)) )
+                continue;
+
+            float distance = CommonController::distance (*itP, this->getControllableEntity());
+            if (distance < minDistance)
+            {
+                closestTarget = *itP;
+                minDistance = distance;
+            }
+        }
+        if (closestTarget)
+        {
+           (this)->setTarget(static_cast<ControllableEntity*>(closestTarget));
+        }   
+    }
     void CommonController::maneuver() 
     {
-        counter++;
+        maneuverCounter_++;
 
-        if (counter > 5)
-            counter = 0;
+        if (maneuverCounter_ > 5)
+            maneuverCounter_ = 0;
         if ( this->target_ && this->getControllableEntity())
         {
             Vector3 thisPosition = this->getControllableEntity()->getWorldPosition();
@@ -182,7 +249,7 @@
 
 
             //bool bThisIsLookingAtTarget = this->isLooking ( getControllableEntity(), this->target_, math::pi/4 );
-            bool bTargetIsLookingAtThis = this->isLooking ( this->target_, getControllableEntity(), math::pi/5.0f );
+            bool bTargetIsLookingAtThis = this->isLooking ( this->target_, getControllableEntity(), math::pi/10.0f );
             
 
 
@@ -216,7 +283,7 @@
             else if ( !bTargetIsLookingAtThis )
             {
                 this->setTargetPosition( this->positionOfTarget_ );
-              /*  if (counter == 0)
+              /*  if (maneuverCounter_ == 0)
                 {
                     this->setTargetPosition( this->positionOfTarget_ );   
                     return;
@@ -230,7 +297,7 @@
             else 
             {   
             
-                if (counter == 0)
+                if (maneuverCounter_ == 0)
                 {
                     this->setTargetPosition( this->positionOfTarget_ );   
                     return;
@@ -561,7 +628,7 @@
         return ( getAngle( this->getControllableEntity() ->getPosition() , 
             this->getControllableEntity() ->getOrientation()  * WorldEntity::FRONT, this->positionOfTarget_ ) < angle );
     }
-    bool CommonController::isLooking( ControllableEntity* entityThatLooks, ControllableEntity* entityBeingLookedAt, float angle )const
+    bool CommonController::isLooking( ControllableEntity* entityThatLooks, ControllableEntity* entityBeingLookedAt, float angle )
     {
         if ( !entityThatLooks || !entityBeingLookedAt )
             return false;
@@ -586,7 +653,7 @@
 
         float squaredDistance = squaredDistanceToTarget();
 
-        if ( squaredDistance < 9000000.0f && this->isLookingAtTarget( math::pi / 10.0f)) {
+        if ( squaredDistance < 9000000.0f && this->isLookingAtTarget( math::pi / 20.0f)) {
             return true;
         }
         else
@@ -614,8 +681,6 @@
             return;
         }
       
-
-        
         Pawn* pawn = orxonox_cast<Pawn*>( this->getControllableEntity() );
 
         if ( pawn )

Modified: code/branches/AI_HS15/src/orxonox/controllers/CommonController.h
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/CommonController.h	2015-11-22 18:32:02 UTC (rev 10831)
+++ code/branches/AI_HS15/src/orxonox/controllers/CommonController.h	2015-11-23 10:17:22 UTC (rev 10832)
@@ -72,126 +72,120 @@
 
         public:
             static const float hardcoded_projectile_speed = 750;
-
             static const float ACTION_INTERVAL = 1.0f;
 
-
             CommonController(Context* context);
             virtual ~CommonController();
 
+            //----[XML data]----
+                virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+                //----[Action data]----
+                    Action::Value getAction ();
+                    void setAction (Action::Value action);
+                    void setAction (Action::Value action, ControllableEntity* target);
+                    void setAction (Action::Value action, const Vector3& target);
+                    void setAction (Action::Value action, const Vector3& target,  const Quaternion& orient );
+                    void setActionXML( std::string val);
+                    std::string getActionXML();
+                //----[/Action data]----
+                //----[Formation data]----
+                    virtual void setFormationModeXML(std::string val);
+                    virtual std::string getFormationModeXML();
+                    virtual void setFormationMode(FormationMode::Value val)
+                        { this->formationMode_ = val; }
+                    inline FormationMode::Value getFormationMode() const
+                        { return this->formationMode_; }
+                //----[/Formation data]----
+                //----[Rank data]----
+                    virtual void setRank(Rank::Value val)
+                        { this->rank_ = val; }
+                    inline Rank::Value getRank() const
+                        { return this->rank_; }
+                //----[/Rank data]----
+            //----[/XML data]----
 
+            //----[Interaction with other Controllers]----
+                virtual bool setWingman(CommonController* wingman);
+                virtual bool hasWingman();        
 
+                void setPositionOfTarget(const Vector3& target);
+                void setOrientationOfTarget(const Quaternion& orient);
 
+                void setTarget(ControllableEntity* target);
+                ControllableEntity* getTarget();
+                bool hasTarget();
 
-            virtual void setFormationMode(FormationMode::Value val)
-                { this->formationMode_ = val; }
-            inline FormationMode::Value getFormationMode() const
-                { return this->formationMode_; }
-            virtual void setFormationModeXML(std::string val);
-            virtual std::string getFormationModeXML();
+                void setTargetPosition(const Vector3& target);
+                void setTargetOrientation(const Quaternion& orient);
+                void setTargetOrientation(ControllableEntity* target);
+            //----[/Interaction with other Controllers]----
 
-            virtual void setRank(Rank::Value val)
-                { this->rank_ = val; }
-            inline Rank::Value getRank() const
-                { return this->rank_; }
+            //----[Helper functions]----
+                float randomInRange(float a, float b);
+                static float distance(ControllableEntity* entity1, ControllableEntity* entity2);
+                static bool sameTeam (ControllableEntity* entity1, ControllableEntity* entity2);
+                static bool isLooking( ControllableEntity* entityThatLooks, ControllableEntity* entityBeingLookedAt, float angle ) ;
 
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+                float squaredDistanceToTarget() const;
+                bool isLookingAtTarget(float angle) const;
+            //----[/Helper functions]----
 
-
-
-            virtual bool setWingman(CommonController* wingman);
-            virtual bool hasWingman();
-            static bool sameTeam (ControllableEntity* entity1, ControllableEntity* entity2);
-            void setTarget(ControllableEntity* target);
-            bool hasTarget();
-            ControllableEntity* getTarget();
-            void setTargetOrientation(const Quaternion& orient);
-            void setTargetOrientation(ControllableEntity* target);
-            void setTargetPosition(const Vector3& target);
-
-            /*void spin();
-            void turn180();*/
-            Action::Value getAction ();
-            void setAction (Action::Value action, ControllableEntity* target);
-            void setAction (Action::Value action, const Vector3& target);
-            void setAction (Action::Value action, const Vector3& target,  const Quaternion& orient );
-
         protected:
-            void dodge(Vector3& thisPosition, Vector3& diffUnit);
-            int counter;
-            void moveToPoint(const Vector3& relativeTargetPosition, float angleRoll);
-            bool moveAndRoll(float dt);
+            //----[Flying functionality]----
+                void stopMoving();
 
-            void moveToPosition(const Vector3& target, float dt);
-            void moveToTargetPosition(float dt);
-            //enum Mode {ROCKET, ATTACK, MOVE, HOLD};//TODO; implement DEFENCE, MOVING modes
+                void moveToPoint(const Vector3& relativeTargetPosition, float angleRoll);
+                bool moveAndRoll(float dt);
 
-            //Mode mode_;
-            void copyOrientation(const Quaternion& orient, float dt);
-            void copyTargetOrientation(float dt);
+                void moveToPosition(const Vector3& target, float dt);
+                void moveToTargetPosition(float dt);
 
-            static float distance(ControllableEntity* entity1, ControllableEntity* entity2);
-            float squaredDistanceToTarget() const;
-            void doFire();
-            void aimAtTarget();
-            bool isLookingAtTarget(float angle) const;
-            bool isLooking( ControllableEntity* entityThatLooks, ControllableEntity* entityBeingLookedAt, float angle )const;
+                void copyOrientation(const Quaternion& orient, float dt);
+                void copyTargetOrientation(float dt);
 
-            //checks if spaceship points at enemy and if there are allies inbetween
-            bool canFire();
-            std::map<std::string, int> weaponModes_; //<! Links each "weapon" to it's weaponmode - managed by setupWeapons()
-            //std::vector<int> projectiles_; //<! Displays amount of projectiles of each weapon. - managed by setupWeapons()
-            float timeout_; //<! Timeout for rocket usage. (If a rocket misses, a bot should stop using it.)
-            void setupWeapons(); //<! Defines which weapons are available for a bot. Is recalled whenever a bot was killed.
-            bool bSetupWorked; //<! If false, setupWeapons() is called.
-            int getFiremode(std::string name);
+                void lookAtTarget(float dt);
+                void stopLookingAtTarget();
+                void startLookingAtTarget();
 
-            float randomInRange(float a, float b);
-            bool bHasTargetPosition_;
-            Vector3 targetPosition_;
-            bool bHasTargetOrientation_;
-            Quaternion targetOrientation_;
+                bool bLookAtTarget_;        
+            //----[/Flying functionality]----
+            
+            //----[Fighting functionality]----
+                void maneuver();
+                void dodge(Vector3& thisPosition, Vector3& diffUnit);
+                void aimAtTarget();           
+                bool canFire();
+                void doFire();
+                void setClosestTarget();
 
-            Vector3 destination_;
-            bool bHasDestination;
+                bool bShooting_;
+                int maneuverCounter_;         
+            //----[/Fighting functionality]----            
+            
+            //----[where-to-fly information]----
+                bool bHasTargetPosition_;
+                Vector3 targetPosition_;
+                bool bHasTargetOrientation_;
+                Quaternion targetOrientation_;
+                // Vector3 destination_;
+                // bool bHasDestination;
+            //----[/where-to-fly information]----
+            
+            //----[who-to-kill information]----
+                WeakPtr<ControllableEntity> target_;
+                //WeakPtr<ControllableEntity> objectiveTarget_;
 
+                bool bHasPositionOfTarget_;
+                Vector3 positionOfTarget_;
+                bool bHasOrientationOfTarget_;
+                Quaternion orientationOfTarget_;
+            //----[/who-to-kill information]----
 
-            void stopMoving();
-            void setPositionOfTarget(const Vector3& target);
-            void setOrientationOfTarget(const Quaternion& orient);
-            bool bHasPositionOfTarget_;
-            Vector3 positionOfTarget_;
-            bool bHasOrientationOfTarget_;
-            Quaternion orientationOfTarget_;
-
-
-            WeakPtr<ControllableEntity> target_;
-            //WeakPtr<ControllableEntity> thisEntity_;
-
-           
-
-            Action::Value action_;
-            bool bEngaging_;
-            bool bShooting_;
-            WeakPtr<ControllableEntity> objectiveTarget_;
-
-            void lookAtTarget(float dt);
-            void stopLookingAtTarget();
-            void startLookingAtTarget();
-            bool bLookAtTarget_;
-            void maneuver();
-            void chooseManeuverType();
-            void gunsD();
-            void attack();
-            void scissors();
-            FormationMode::Value formationMode_;
-            Rank::Value rank_;
-        
-            bool executingMoveToPoint_;
-         
-        private:
-            
-               
+            //----["Private" variables]----
+                FormationMode::Value formationMode_;
+                Rank::Value rank_;
+                Action::Value action_;
+            //----[/"Private" variables]----               
     };
 }
 

Modified: code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc	2015-11-22 18:32:02 UTC (rev 10831)
+++ code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc	2015-11-23 10:17:22 UTC (rev 10832)
@@ -83,46 +83,47 @@
     }
     void DivisionController::action()
     {
-        //----find a target----
-        if ( !this->hasTarget() )
-        {
-            for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
-            {
-                if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP)) )
-                    continue;           
 
-                
-                if (static_cast<ControllableEntity*>(*itP) != (this)->getControllableEntity()
-                    && CommonController::distance (*itP, this->getControllableEntity())  < 10000)
-                {
-                    (this)->setAction(Action::FIGHT, *itP);
-                }   
-            }
-        }
         
         if (this->action_ == Action::FIGHT)
         {
-            //----choose where to go----
-            this->maneuver();
-            //----fire if you can----
-            this->bShooting_ = this->canFire();
-
-            if (this->target_)
+            if (!this->hasTarget())
             {
-                if (this->myWingman_)
-                {
-                    //----wingmans shall support the fire of their leaders----
-                    this->myWingman_->setAction (Action::FIGHT, this->target_);                    
-                }
-                
+                //----find a target----
+                this->setClosestTarget(); 
+            }
+            else
+            {
                 //----fly in formation if far enough----
                 Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition();         
                 if (diffVector.length() > 3000)
                 {
                     this->setTargetPositionOfWingman();
-                    //this->setTargetPositionOfFollower();                    
-                }   
+                    this->setTargetPositionOfFollower();                    
+                }
+                else
+                {
+                    //----wingmans shall support the fire of their leaders----
+                    if (this->myWingman_)
+                    {
+                        this->myWingman_->setAction (Action::FIGHT, this->target_);     
+                    }
+                    if (this->myFollower_)
+                    {
+                        this->myFollower_->setAction (Action::FIGHT);                                    
+                    }
+
+                }
+                
             }
+            if (this->hasTarget())
+            {
+                //----choose where to go----
+                this->maneuver();
+                //----fire if you can----
+                this->bShooting_ = this->canFire();                
+            }
+
         }
         else if (this->action_ == Action::FLY)
         {
@@ -151,13 +152,13 @@
             }
             case FormationMode::FINGER4: 
             {
-                targetRelativePositionOfWingman = new Vector3 (400, 0, -200);  
+                targetRelativePositionOfWingman = new Vector3 (400, 0, 200);  
                 break;
             }
          
             case FormationMode::DIAMOND: 
             {
-                targetRelativePositionOfWingman = new Vector3 (400, 0, -200);                  
+                targetRelativePositionOfWingman = new Vector3 (400, 0, 200);                  
                 break;
             }
         }
@@ -184,13 +185,13 @@
             }
             case FormationMode::FINGER4: 
             {
-                targetRelativePositionOfFollower = new Vector3 (-400, 0, -200);   
+                targetRelativePositionOfFollower = new Vector3 (-400, 0, 200);   
                 break;
             }
             
             case FormationMode::DIAMOND: 
             {
-                targetRelativePositionOfFollower = new Vector3 (-400, 0, -200);                   
+                targetRelativePositionOfFollower = new Vector3 (-400, 0, 200);                   
                 break;
             }
         }

Modified: code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc	2015-11-22 18:32:02 UTC (rev 10831)
+++ code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc	2015-11-23 10:17:22 UTC (rev 10832)
@@ -88,57 +88,51 @@
             LeaderController* newDivisionLeader = findNewDivisionLeader();
             this->myDivisionLeader_ = newDivisionLeader;
 
-            if (newDivisionLeader)
-            {
-                //orxout(internal_error) << "new DivisionLeader set" << endl;
-            }
-            //----If no leader found, attack someone----
-            //----TODO: find closest enemy----
-            else
-            {
-                if ( !this->hasTarget() || this->action_ != Action::FIGHT )
-                {
-                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
-                    {
-                        if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP)) )
-                            continue;
-
-                        this->setAction(Action::FIGHT, (*itP));
-                        break;   
-                    }    
-                }
-                
-            }
-
         }
         //----If have leader----
         else
         {
-            this->chooseTarget();
         }
 
         //----action was set to fight----
         if (this->action_ == Action::FIGHT)
         {
-            //----choose where to go----
-            this->maneuver();
-            //----fire if you can----
-            this->bShooting_ = this->canFire();
-
-            if (this->target_)
+            if (!this->hasTarget())
             {
-                //----wingmans shall support the fire of their leaders----
-                if (this->myWingman_)
+                if (this->myDivisionLeader_)
                 {
-                    this->myWingman_->setAction (Action::FIGHT, this->target_);                    
+                    this->chooseTarget();                
                 }
+                else
+                {
+                    this->setClosestTarget(); 
+                }
+            }
+            else
+            {
+                
                 //----fly in formation if far enough----
                 Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition();         
                 if (diffVector.length() > 3000)
                 {
                     this->setTargetPositionOfWingman();
                 }   
+                else
+                {
+                    //----wingmans shall support the fire of their leaders----
+                    if (this->myWingman_)
+                    {
+                        this->myWingman_->setAction (Action::FIGHT, this->target_);                    
+                    }
+                }
             }
+            if (this->hasTarget())
+            {
+                //----choose where to go----
+                this->maneuver();
+                //----fire if you can----
+                this->bShooting_ = this->canFire();                
+            }
         }
 
         //----action was set to fly----
@@ -155,7 +149,7 @@
                 
 
     }
-    //PRE: myDivisionLeader_ != 0
+    //PRE: myDivisionLeader_ != 0 && myDivisionLeader_->action_ == Action::FIGHT
     //POST: this->target_ is set unless division leader doesn't have one
     void SectionController::chooseTarget()
     {
@@ -210,6 +204,7 @@
     }
 
     //----stay in formation----
+    //gani-TODO: sum targetAbso... and this->predicted position 
     void SectionController::setTargetPositionOfWingman()
     {
         if (!this->myWingman_)
@@ -223,7 +218,7 @@
             }
             case FormationMode::FINGER4: 
             {
-                targetRelativePositionOfWingman = new Vector3 (-400, 0, -200);  
+                targetRelativePositionOfWingman = new Vector3 (-400, 0, 200);  
                 break;
             }
             case FormationMode::DIAMOND: 

Modified: code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc	2015-11-22 18:32:02 UTC (rev 10831)
+++ code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc	2015-11-23 10:17:22 UTC (rev 10832)
@@ -84,47 +84,37 @@
         {
             CommonController* newLeader = findNewLeader();
             this->myLeader_ = newLeader;
-            if (newLeader)
-            {
-                //orxout(internal_error) << "new Leader set" << endl;
-            }
-            //----If no leader found, attack someone----
-            //----TODO: find closest enemy----
-            else
-            {
-                if ( !this->hasTarget() || this->action_ != Action::FIGHT )
-                {
-                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
-                    {
-                        if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP)) )
-                            continue;   
-                        this->setAction(Action::FIGHT, (*itP));
-                        break;
-                    }
-                }
-            }
+           
         }
         //----If have leader, he will deal with logic----
         else
         {
-
+            this->action_ = this->myLeader_->getAction();
         }
 
 
         //----action was set to fight----
         if (this->action_ == Action::FIGHT)
         {
-            //----choose where to go----
-            this->maneuver();
-            //----fire if you can----
-            this->bShooting_ = this->canFire();
+            //----If no leader found, attack someone----
+            if (!this->hasTarget() && !this->myLeader_)
+            {
+                this->setClosestTarget(); 
+            }
+            if (this->hasTarget())
+            {
+                //----choose where to go----
+                this->maneuver();
+                //----fire if you can----
+                this->bShooting_ = this->canFire();                
+            }
         }
         //----action was set to fly, leader handles the logic----
         else if (this->action_ == Action::FLY)
         {
 
         }
-        //----TODO: implement protect----
+        //----gani-TODO: implement protect----
         else if (this->action_ == Action::PROTECT)
         {
 




More information about the Orxonox-commit mailing list