-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathant.h
More file actions
77 lines (58 loc) · 1.78 KB
/
ant.h
File metadata and controls
77 lines (58 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef ANT_H
#define ANT_H
#include "pheromonemap.h"
#include "foodmap.h"
#include <Eigen/Dense>
#include "random.h"
class Random;
class PheromoneMap;
class FoodMap;
class Ant
{
public:
Ant(PheromoneMap &foodPheromoneMapPassedIn, PheromoneMap &homePheromoneMapPassedIn, FoodMap &foodMapPassedIn);
virtual ~Ant();
double get_ant_x_coordinate() const;
double get_ant_y_coordinate() const;
double get_random_angle() const;
void update();
void rotate_orientation();
void set_orientation(double angle);
virtual void set_random_angle();
virtual void move_ant_location();
bool has_food();
Eigen::Vector2d get_orientation();
Eigen::Vector2d get_position();
protected:
double PI{3.14159};
double antMotionRangeInDegrees{15.0};
double viewingAngle{20.0};
double speed{3.0};
double randomAngle{90.0};
double initialPosition{500.0};
double positionLimit{initialPosition * 2};
int xCor{0};
int yCor{1};
int foodSearchTolerance{4};
int colonySearchTolerance{50};
bool foodIndicator{false};
Random randomNumberMaker;
void set_x_orientation(double x);
void set_y_orientation(double y);
void flip_direction();
void look_for_edge();
void look_for_food();
void look_for_colony();
void look_for_home_pheromones();
void look_for_food_pheromones();
void drop_food_pheromone();
void drop_home_pheromone();
void initialize_position();
PheromoneMap& foodPheromoneMap;
PheromoneMap& homePheromoneMap;
FoodMap& foodMap;
Eigen::Vector2d antPosition{{0.0,0.0}}; // 2 means two dimensions, d means double data type
Eigen::Vector2d antOrientation{{0.0,0.0}};
private:
};
#endif // ANT_H