-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cpp
executable file
·54 lines (43 loc) · 1.08 KB
/
Main.cpp
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
/*
* Main.cpp
*
* Created on: Nov 18, 2015
* Author: colman
*/
#include "Map/Map.h"
#include "STC/STC.h"
#include "Settings.h"
#include "Robot.h"
#include "Plan/PlnObstacleAvoid.h"
#include "Manager.h"
#include <iostream>
#include <fstream>
#include <string>
int main() {
// load all settings from configuration file
Settings::loadConfFile();
// Map Init
Map map(Settings::MAP_RESOLUTION, Settings::ROBOT_SIZE);
// Load map from image file
const char* filePath = Settings::MAP_IMAGE_PATH.c_str();
map.loadMapFromFile(filePath);
// Map inflation
map.inflateObstacles();
map.buildFineGrid();
map.buildCoarseGrid();
// STC
Position startPos;
startPos.first = Settings::STC_START_POS_X;
startPos.second = Settings::STC_START_POS_Y;
STC stc(map, startPos);
stc.printPath();
map.addPathToFile(Settings::STC_IMAGE_PATH.c_str(),stc.getPath());
// Connect and initialize robot
Robot robot(Settings::HOST,Settings::PORT);
//add way points to robot
robot.setWayPoints(map.getWayPoints());
PlnObstacleAvoid pln(&robot);
Manager m(&robot, &pln);
m.run();
return 0;
}