MCPcopy Create free account
hub / github.com/ANYbotics/grid_map / main

Function main

grid_map_demos/src/iterator_benchmark.cpp:98–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98int main(int argc, char* argv[])
99{
100 GridMap map;
101 map.setGeometry(Length(20.0, 20.0), 0.004, Position(0.0, 0.0));
102 map.add("random");
103 map["random"].setRandom();
104 map.add("layer1", 0.0);
105 map.add("layer2", 0.0);
106 map.add("layer3", 0.0);
107 map.add("layer4", 0.0);
108 map.add("layer5", 0.0);
109 map.add("layer6", 0.0);
110
111 cout << "Results for iteration over " << map.getSize()(0) << " x " << map.getSize()(1) << " (" << map.getSize().prod() << ") grid cells." << endl;
112 cout << "=========================================" << endl;
113
114 clk::time_point t1 = clk::now();
115 runGridMapIteratorVersion1(map, "random", "layer1");
116 clk::time_point t2 = clk::now();
117 cout << "Duration grid map iterator (convenient use): " << duration(t2 - t1) << " ms" << endl;
118
119 t1 = clk::now();
120 runGridMapIteratorVersion2(map, "random", "layer2");
121 t2 = clk::now();
122 cout << "Duration grid map iterator (direct access to data layers): " << duration(t2 - t1) << " ms" << endl;
123
124 t1 = clk::now();
125 runGridMapIteratorVersion3(map, "random", "layer3");
126 t2 = clk::now();
127 cout << "Duration grid map iterator (linear index): " << duration(t2 - t1) << " ms" << endl;
128
129 t1 = clk::now();
130 runEigenFunction(map, "random", "layer4");
131 t2 = clk::now();
132 cout << "Duration Eigen function: " << duration(t2 - t1) << " ms" << endl;
133
134 t1 = clk::now();
135 runCustomIndexIteration(map, "random", "layer5");
136 t2 = clk::now();
137 cout << "Duration custom index iteration: " << duration(t2 - t1) << " ms" << endl;
138
139 t1 = clk::now();
140 runCustomLinearIndexIteration(map, "random", "layer6");
141 t2 = clk::now();
142 cout << "Duration custom linear index iteration: " << duration(t2 - t1) << " ms" << endl;
143
144 return 0;
145}

Callers

nothing calls this directly

Calls 8

runEigenFunctionFunction · 0.85
runCustomIndexIterationFunction · 0.85
setGeometryMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected