Army ant simulation
Config.h
Go to the documentation of this file.
1 
10 #ifndef CONFIG_H_
11 #define CONFIG_H_
12 
13 #include "constants.h"
14 
15 
16 namespace config
17 {
18 
19  const double WINDOW_X_PX = 1920; // [pixel]
20  const double WINDOW_Y_PX = 1080; // [pixel]
21 
22  const double WALL_WIDTH_M = 6.0; // [m]
23  const double WALL_HEIGHT_M = 3.0; // [m]
24 
25 
26 
30 struct sTerrain{
32  double runaway;
34  double v_width;
36  double v_height;
38  double v_angle;
39 };
40 
41 struct sSimulation{
42  double gravity;
43  double robot_delay;
44  double robot_distance;
45  double robot_phase;
46  double robot_initial_posX;
47  double robot_initial_posY;
48  int nb_robots;
49  double bridge_duration;
50  double dissolution_duration;
51  bool visualization;
52 };
53 
54 struct sController{
55  double angle_limit;
56  double bridge_delay;
57  double walk_delay;
58  double time_before_pushing;
59  int max_robot_window;
60  double stability_condition;
61 };
62 
63 struct sRobot{
64  double body_length;
65  double speed;
66  double wheel_distance;
67  double attach_height;
68  double wheel_radius;
69 };
70 
71 struct sWindow{
72  int WINDOW_X_PX ;
73  int WINDOW_Y_PX;
74 };
75 
76 struct sConfig{
77  struct sTerrain terrain;
78  struct sSimulation simulation;
79  struct sController controller;
80  struct sRobot robot;
81  struct sWindow window;
82 
83  std::string logfile_name;
84  std::string logfile_path;
85 };
86 
87 
89 {
90 public:
91  // clear all values
92  void Clear();
93 
94  // load a configuration file
95  bool Load(const std::string& File);
96 
97  // check if value associated with given key exists
98  bool Contains(const std::string& key) const;
99 
100  // get value associated with given key
101  bool Get(const std::string& key, std::string& value) const;
102  bool Get(const std::string& key, int& value) const;
103  bool Get(const std::string& key, long& value) const;
104  bool Get(const std::string& key, double& value) const;
105  bool Get(const std::string& key, bool& value) const;
106 
107 private:
108  // the container
109  std::map<std::string,std::string> data;
110 
111  // remove leading and trailing tabs and spaces
112  static std::string Trim(const std::string& str);
113 };
114 
115 //extern sConfig sConfig;
116 };
117 #endif /* CONFIG_H_ */
double runaway
Definition: Config.h:32
Definition: Config.h:16