Changeset 10681 for code/branches/AI_HS15/src/orxonox/controllers
- Timestamp:
- Oct 23, 2015, 7:44:20 AM (9 years ago)
- Location:
- code/branches/AI_HS15/src/orxonox/controllers
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/AI_HS15/src/orxonox/controllers/DivisionController.h
r10678 r10681 38 38 { 39 39 public: 40 DivisionController(Context* context);41 virtual ~DivisionController();40 DivisionController(Context* context); 41 virtual ~DivisionController(); 42 42 43 //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);43 //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 44 44 45 //Using british military aircraft formations 46 enum FormationMode {VEE,FINGER4,DIAMOND, WALL}; 47 void setFormationMode(FormationMode val); 48 inline FormationMode getFormationMode() const 49 { return this->formationMode_; } 50 51 virtual void doFire(); 45 52 53 //WAYPOINT FUNCTIONS` 54 void addWaypoint(WorldEntity* waypoint); 55 WorldEntity* getWaypoint(unsigned int index) const; 46 56 57 inline void setAccuracy(float accuracy) 58 { this->squaredaccuracy_ = accuracy*accuracy; } 59 inline float getAccuracy() const 60 { return sqrt(this->squaredaccuracy_); } 61 void updatePointsOfInterest(std::string name, float distance); 62 void manageWaypoints(); 47 63 48 64 protected: 49 65 50 66 //Target enemy, set by fleet controller. 67 WeakPtr<Pawn> target_; 68 bool bHasTargetPosition_; 69 Vector3 targetPosition_; 70 bool bHasTargetOrientation_; 71 Quaternion targetOrientation_; 72 void setTargetPosition(const Vector3& target); 73 void searchRandomTargetPosition(); 74 75 void setTargetOrientation(const Quaternion& orient); 76 void setTargetOrientation(Pawn* target); 77 78 virtual void positionReached() {} 79 80 static bool sameTeam(ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype); // hack 81 82 83 void setTarget(Pawn* target); 84 85 void searchNewTarget(); 86 void forgetTarget(); 87 88 void targetDied(); 89 bool bShooting_; 90 void aimAtTarget(); 91 92 bool isCloseAtTarget(float distance) const; 93 bool isLookingAtTarget(float angle) const; 94 95 //Has nothing to do with desiredRelativePosition_, 96 //is set by fleet controller. 97 Vector3* desiredAbsolutePosition_; 98 99 enum Maneuver {NONE, SPIN, TURN180}; 100 Maneuver maneuver_; 101 102 void moveToPosition(const Vector3& target); 103 void moveToTargetPosition(); 104 void absoluteMoveToPosition(const Vector3& target); 105 void copyOrientation(const Quaternion& orient); 106 void copyTargetOrientation(); 107 108 void turn180Init(); 109 void spinInit(); 110 void spin(); 111 void turn180(); 112 113 //WAYPOINT DATA 114 std::vector<WeakPtr<WorldEntity> > waypoints_; 115 size_t currentWaypoint_; 116 float squaredaccuracy_; 117 WorldEntity* defaultWaypoint_; 118 51 119 private: 52 120 }; -
code/branches/AI_HS15/src/orxonox/controllers/FleetController.h
r10678 r10681 67 67 { 68 68 public: 69 FleetController(Context* context);70 virtual ~FleetController();69 FleetController(Context* context); 70 virtual ~FleetController(); 71 71 72 72 73 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);73 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 74 74 75 //gameGoal_ is to be set in XML76 //DOMINATE is default, makes AI want to be the only team alive77 //MOVE makes a fleet move to a set absolute position (set in variable goalPosition_)78 //DESTROY makes a fleet destroy a target (set in variable goalTarget_)79 //PROTECT makes a fleet protect a target (set in variable goalProtect_)80 enum GameGoal {DOMINATE, MOVE, DESTROY, PROTECT};81 82 /*void setGameGoal(GameGoal gameGoal)83 { this->gameGoal_ = gameGoal; }84 GameGoal getGameGoal() const85 { return this->gameGoal_; }86 87 void setGoalPosition(Vector3* goalPosition)88 { this->goalPosition_ = goalPosition; }89 Vector3* getGoalPosition() const90 { return this->goalPosition_; }91 92 void setGoalTarget(Pawn* goalTarget)93 { this->goalTarget_ = goalTarget; }94 Pawn* getGoalTarget() const95 { return this->goalTarget_; }96 97 void setGoalProtect(Pawn* goalProtect)98 { this->goalProtect_ = goalProtect; }99 Pawn* getGoalProtect() const100 { return this->goalProtect_; }*/75 //gameGoal_ is to be set in XML 76 //DOMINATE is default, makes AI want to be the only team alive 77 //MOVE makes a fleet move to a set absolute position (set in variable goalPosition_) 78 //DESTROY makes a fleet destroy a target (set in variable goalTarget_) 79 //PROTECT makes a fleet protect a target (set in variable goalProtect_) 80 enum GameGoal {DOMINATE, MOVE, DESTROY, PROTECT}; 81 82 /*void setGameGoal(GameGoal gameGoal) 83 { this->gameGoal_ = gameGoal; } 84 GameGoal getGameGoal() const 85 { return this->gameGoal_; } 86 87 void setGoalPosition(Vector3* goalPosition) 88 { this->goalPosition_ = goalPosition; } 89 Vector3* getGoalPosition() const 90 { return this->goalPosition_; } 91 92 void setGoalTarget(Pawn* goalTarget) 93 { this->goalTarget_ = goalTarget; } 94 Pawn* getGoalTarget() const 95 { return this->goalTarget_; } 96 97 void setGoalProtect(Pawn* goalProtect) 98 { this->goalProtect_ = goalProtect; } 99 Pawn* getGoalProtect() const 100 { return this->goalProtect_; }*/ 101 101 102 102 -
code/branches/AI_HS15/src/orxonox/controllers/LeaderController.cc
r10678 r10681 59 59 } 60 60 //**********************************************NEW 61 void LeaderController::defaultBehaviour(float maxrand)61 /* void LeaderController::defaultBehaviour(float maxrand) 62 62 { 63 63 64 } 64 }*/ 65 65 66 66 } -
code/branches/AI_HS15/src/orxonox/controllers/LeaderController.h
r10678 r10681 38 38 { 39 39 public: 40 LeaderController(Context* context); 41 virtual ~LeaderController(); 40 41 LeaderController(Context* context); 42 virtual ~LeaderController(); 42 43 43 virtual void tick(float dt); //<! Carrying out the targets set in action().44 virtual void tick(float dt); //<! Carrying out the targets set in action(). 44 45 45 46 protected: 46 virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour ~ setting targets. 47 void defaultBehaviour(float maxrand); //<! Helper function for code reusage. Some concrete commands for a bot. 47 48 virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour ~ setting targets. 49 //void defaultBehaviour(float maxrand); //<! Helper function for code reusage. Some concrete commands for a bot. 50 51 52 53 54 enum Mode {KEEPFORMATION, ROCKET, KILLENEMY}; 55 Mode mode_; 56 57 //WEAPONSYSTEM DATA 58 std::map<std::string, int> weaponModes_; //<! Links each "weapon" to it's weaponmode - managed by setupWeapons() 59 //std::vector<int> projectiles_; //<! Displays amount of projectiles of each weapon. - managed by setupWeapons() 60 float timeout_; //<! Timeout for rocket usage. (If a rocket misses, a bot should stop using it.) 61 void setupWeapons(); //<! Defines which weapons are available for a bot. Is recalled whenever a bot was killed. 62 bool bSetupWorked; //<! If false, setupWeapons() is called. 63 int getFiremode(std::string name); 64 65 void boostControl(); //<! Sets and resets the boost parameter of the spaceship. Bots alternate between boosting and saving boost. 48 66 49 67 private: 50 static const float ACTION_INTERVAL;68 static const float ACTION_INTERVAL; 51 69 52 Timer actionTimer_; //<! Regularly calls action().53 70 Timer actionTimer_; //<! Regularly calls action(). 71 54 72 }; 55 73 } -
code/branches/AI_HS15/src/orxonox/controllers/SectionController.h
r10678 r10681 38 38 { 39 39 public: 40 SectionController(Context* context);41 virtual ~SectionController();40 SectionController(Context* context); 41 virtual ~SectionController(); 42 42 43 //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 44 43 //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 45 44 46 45 47 46 48 47 protected: 48 49 //A division is the biggest block of spaceships. 50 //In division one section is leading, the other one always stays on the same position 51 //relative to the Leader of the leading section. 52 //In section a Wingman always stays on same position relative to the Leader. 53 //That position is desiredRelativePosition_ 54 Vector3* desiredRelativePosition_; 55 49 56 50 57 58 LeaderController* leader_; 59 WingmanController* wingman_; 60 51 61 private: 52 62 }; -
code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc
r10678 r10681 65 65 } 66 66 //**********************************************NEW 67 void WingmanController::defaultBehaviour(float maxrand)67 /*void WingmanController::defaultBehaviour(float maxrand) 68 68 { 69 69 70 } 70 }*/ 71 71 72 72 } -
code/branches/AI_HS15/src/orxonox/controllers/WingmanController.h
r10678 r10681 31 31 32 32 33 #include " SectionController.h"33 #include "LeaderController.h" 34 34 35 35 36 36 namespace orxonox 37 37 { 38 class _OrxonoxExport WingmanController : public SectionController, public Tickable38 class _OrxonoxExport WingmanController : public LeaderController 39 39 { 40 40 public: … … 46 46 protected: 47 47 virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour ~ setting targets. 48 void defaultBehaviour(float maxrand); //<! Helper function for code reusage. Some concrete commands for a bot.48 //void defaultBehaviour(float maxrand); //<! Helper function for code reusage. Some concrete commands for a bot. 49 49 50 50 51 51 52 private: 52 53 static const float ACTION_INTERVAL;
Note: See TracChangeset
for help on using the changeset viewer.