-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
90 lines (64 loc) · 2.02 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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
#include <cstdlib>
#include <iostream>
#include <cutil.h>
#include "rrt.hpp"
int main(int argc, char * argv[])
{
printf("\n\n**===-------------------------------------------------===**\n");
printf("\n\n**===--- RRT ---===**\n");
printf("\n\n**===-------------------------------------------------===**\n");
double start[] = {5,50};
double goal[] = {70,50};
int num_circs;
int rand_num;
//expecting command line args to be rand num, then num circs
if (argc > 2)
{
num_circs = std::atoi(argv[2]);
rand_num = std::atoi(argv[1]);
} else if (argc > 1) {
rand_num = std::atoi(argv[1]);
num_circs = 2048;
} else {
num_circs = 2048;
rand_num = 10;
}
RRT rrt(start, goal, rand_num);
rrt.randomCircles(num_circs, 0.0, 0.5);
// rrt.explore();
// rrt.exploreObstacles();
// rrt.exploreCuda();
unsigned int timer;
float host_time;
CUT_SAFE_CALL(cutCreateTimer(&timer));
cutStartTimer(timer);
rrt.exploreObstacles();
cutStopTimer(timer);
printf("\n\n**===-------------------------------------------------===**\n");
printf("Host CPU Processing time: %f (ms)\n", cutGetTimerValue(timer));
host_time = cutGetTimerValue(timer);
CUT_SAFE_CALL(cutDeleteTimer(timer));
float device_time;
CUT_SAFE_CALL(cutCreateTimer(&timer));
cutStartTimer(timer);
rrt.exploreCuda();
cutStopTimer(timer);
printf("\n\n**===-------------------------------------------------===**\n");
printf("CUDA Processing time: %f (ms)\n", cutGetTimerValue(timer));
device_time = cutGetTimerValue(timer);
printf("Speedup: %fX\n", host_time/device_time);
CUT_SAFE_CALL(cutDeleteTimer(timer));
std::vector<vertex> path;
rrt.traverseGraph(path);
// rrt.printGraph();
rrt.visualizeGraph();
// find path
//
// std::cout << "-----------------------" << std::endl;
// for(unsigned int i = 0; i < path.size(); i++)
// {
// std::cout << "[" << path.at(i).x << " " << path.at(i).y << "]" << std::endl;
// }
// std::cout << "-----------------------" << std::endl;
return 0;
}