MCPcopy Create free account
hub / github.com/Fields2Cover/Fields2Cover / main

Function main

tutorials/4_swath_generator.cpp:11–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include <iostream>
10
11int main() {
12 f2c::Random rand(42);
13 F2CRobot robot (2.0, 6.0);
14 f2c::hg::ConstHL const_hl;
15 F2CCells cells = rand.generateRandField(1e4, 5).getField();
16 F2CCells no_hl = const_hl.generateHeadlands(cells, 3.0 * robot.getWidth());
17
18 std::cout << "####### Tutorial 4.1 Brute force swath generator ######" << std::endl;
19 f2c::obj::NSwath n_swath_obj;
20 f2c::sg::BruteForce bf_sw_gen;
21 F2CSwaths swaths_bf_nswath = bf_sw_gen.generateBestSwaths(n_swath_obj, robot.getCovWidth(), no_hl.getGeometry(0));
22
23
24 f2c::Visualizer::figure();
25 f2c::Visualizer::plot(cells);
26 f2c::Visualizer::plot(no_hl);
27 f2c::Visualizer::plot(swaths_bf_nswath);
28 f2c::Visualizer::save("Tutorial_4_1_Brute_force_NSwath.png");
29
30
31 f2c::obj::SwathLength swathlength_obj;
32 F2CSwaths swaths_bf_swathlength = bf_sw_gen.generateBestSwaths(swathlength_obj, robot.getCovWidth(), no_hl.getGeometry(0));
33
34
35 f2c::Visualizer::figure();
36 f2c::Visualizer::plot(cells);
37 f2c::Visualizer::plot(no_hl);
38 f2c::Visualizer::plot(swaths_bf_swathlength);
39 f2c::Visualizer::save("Tutorial_4_1_Brute_force_SwathLength.png");
40
41
42 F2CSwaths swaths_bf_angle = bf_sw_gen.generateSwaths(M_PI, robot.getCovWidth(), no_hl.getGeometry(0));
43 f2c::Visualizer::figure();
44 f2c::Visualizer::plot(cells);
45 f2c::Visualizer::plot(no_hl);
46 f2c::Visualizer::plot(swaths_bf_angle);
47 f2c::Visualizer::save("Tutorial_4_1_Brute_force_Angle.png");
48
49 return 0;
50}
51

Callers

nothing calls this directly

Calls 7

generateRandFieldMethod · 0.80
generateHeadlandsMethod · 0.80
generateBestSwathsMethod · 0.80
getCovWidthMethod · 0.80
generateSwathsMethod · 0.80
getWidthMethod · 0.45
getGeometryMethod · 0.45

Tested by

no test coverage detected