Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 30, 2010, 11:54:45 PM (14 years ago)
Author:
solex
Message:

minor changes to ai controllers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ai/src/orxonox/controllers/ArtificialController.cc

    r6997 r7029  
    9191
    9292        XMLPortParam(ArtificialController, "team", setTeam, getTeam, xmlelement, mode).defaultValues(-1);
    93         XMLPortParam(ArtificialController, "formation", setFormationFlight, getFormationFlight, xmlelement, mode).defaultValues(true);
    94     }
    95 
    96 // Documentation only here to get a faster overview for creating a useful documentation, what you're reading here not intended for an actual documentation...
     93        XMLPortParam(ArtificialController, "formationflight", setFormationFlight, getFormationFlight, xmlelement, mode).defaultValues(true);
     94        XMLPortParam(ArtificialController, "formation_size", setFormationSize, getFormationSize, xmlelement, mode).defaultValues(STANDARD_MAX_FORMATION_SIZE);
     95    }
     96
     97// Documentation only here to get a faster overview for creating a useful documentation...
    9798
    9899    /**
     
    231232
    232233    /**
    233         @brief Gets called if ControllableEntity is changed. Resets the bot when it dies.
     234        @brief Gets called when ControllableEntity is being changed. Resets the bot when it dies.
    234235    */
    235236    void ArtificialController::changedControllableEntity()
     
    473474
    474475    /**
    475         @brief Master sets its slaves free for \var FREEDOM_COUNT seconds.
     476        @brief Master sets its slaves free for @var FREEDOM_COUNT seconds.
    476477    */
    477478    void ArtificialController::forceFreeSlaves()
     
    564565    void ArtificialController::spinInit()
    565566    {
    566          COUT(0) << "~spinInit" << std::endl;
     567        COUT(0) << "~spinInit" << std::endl;
    567568        if(this->state_ != MASTER) return;
    568569        this->specificMasterAction_ = SPIN;
     
    582583        @brief Master begins to follow a human player. Is a "specific master action".
    583584        @param humanController human to follow.
    584         @param alaways follows human forever if true - only inplemented for false yet.
    585     */
    586     void ArtificialController::followHuman(Pawn* human, bool always)
    587     {
    588         if (human == NULL)
    589         {
    590             this->specificMasterAction_ = NONE;
     585        @param alaways follows human forever if true, else it follows it for @var SECONDS_TO_FOLLOW_HUMAN seconds.
     586    */
     587    void ArtificialController::followHumanInit(Pawn* human, bool always)
     588    {
     589        COUT(0) << "~followInit" << std::endl;
     590        if (human == NULL || this->state_ != MASTER)
    591591            return;
    592         }
     592
     593        this->specificMasterAction_  =  FOLLOWHUMAN;
     594
     595        this->setTarget(human);
    593596        if (!always)
    594         {
    595             this->setTarget(human);
    596597            this->specificMasterActionHoldCount_ = SECONDS_TO_FOLLOW_HUMAN;
    597             this->specificMasterAction_  =  HOLD;
    598         }
    599 
    600     }
     598        else
     599            this->specificMasterActionHoldCount_ = INT_MAX; //for now...
     600
     601    }
     602
     603    /**
     604        @brief Follows target with adjusted speed. Called within tick.
     605    */
     606    void ArtificialController::follow()
     607    {
     608        this->moveToTargetPosition(); //standard position apprach for now.
     609    }
     610
    601611
    602612
Note: See TracChangeset for help on using the changeset viewer.