forked from philbort/udacity_self_driving_car
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
82 lines (62 loc) · 2.83 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
#include <iostream>
#include <vector>
#include <fstream>
#include <sstream>
#include <string>
#include "measurement_package.h"
#include "map.h"
#include "help_functions.h"
#include "bayesianFilter.h"
using namespace std;
int main()
{
/******************************************************************************
* declaration:
*****************************************************************************/
//define example: 01, 02, 03, 04
string example_string = "04";
//declare map:
map map_1d;
//declare measurement list:
vector<MeasurementPackage> measurement_pack_list;
//declare helpers:
help_functions helper;
//define file names:
char in_file_name_ctr[1024];
char in_file_name_obs[1024];
char in_file_name_gt[1024];
/******************************************************************************
* read map and measurements: *
*****************************************************************************/
//read map:
helper.read_map_data("data/map_1d.txt", map_1d);
//define file name of controls:
sprintf(in_file_name_ctr, "data/example%s/control_data.txt",
example_string.c_str());
//define file name of observations:
sprintf(in_file_name_obs, "data/example%s/observations/",
example_string.c_str());
//read in data to measurement package list:
helper.read_measurement_data(in_file_name_ctr,
in_file_name_obs,
measurement_pack_list);
/*******************************************************************************
* start 1d_bayesian filter *
*******************************************************************************/
//create instance of 1d_bayesian localization filter:
bayesianFilter localization_1d_bayesian;
//cycle:
for (size_t t = 0; t < measurement_pack_list.size(); ++t)
//Call 1d_bayesian filter:
localization_1d_bayesian.process_measurement(measurement_pack_list[t],
map_1d,
helper);
/*******************************************************************************
* print/compare results: *
********************************************************************************/
//define file name of gt data:
sprintf(in_file_name_gt, "data/example%s/gt_example%s.txt",example_string.c_str(),example_string.c_str() );
///compare gt data with results:
helper.compare_data(in_file_name_gt, localization_1d_bayesian.bel_x);
return 0;
}