4_swath_generator.cpp
Go to the documentation of this file.
1 //=============================================================================
2 // Copyright (C) 2021-2024 Wageningen University - All Rights Reserved
3 // Author: Gonzalo Mier
4 // BSD-3 License
5 //=============================================================================
6 
7 
8 #include "fields2cover.h"
9 #include <iostream>
10 
11 int main() {
12  f2c::Random rand(42);
13  F2CRobot robot (2.0, 6.0);
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;
21  F2CSwaths swaths_bf_nswath = bf_sw_gen.generateBestSwaths(n_swath_obj, robot.getCovWidth(), no_hl.getGeometry(0));
22 
23 
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 
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));
47  f2c::Visualizer::save("Tutorial_4_1_Brute_force_Angle.png");
48 
49  return 0;
50 }
51 
f2c::obj::SwathLength
Global cost function as the length of the swaths.
Definition: swath_length.h:18
f2c::hg::ConstHL
Class to generate headlands with equal width in each border.
Definition: constant_headland.h:18
1_basic_types.cells
cells
Definition: 1_basic_types.py:93
f2c::obj::NSwath
SG cost function as the number of swaths.
Definition: n_swath.h:20
f2c::Visualizer::plot
static void plot(double x, double y, const std::vector< double > &color={})
Definition: visualizer.cpp:23
4_swath_generator.swaths_bf_nswath
swaths_bf_nswath
Definition: 4_swath_generator.py:21
4_swath_generator.swaths_bf_swathlength
swaths_bf_swathlength
Definition: 4_swath_generator.py:31
3_headland_generator.rand
rand
Definition: 3_headland_generator.py:11
2_objective_functions.robot
robot
Definition: 2_objective_functions.py:76
fields2cover.h
3_headland_generator.const_hl
const_hl
Definition: 3_headland_generator.py:17
4_swath_generator.swaths_bf_angle
swaths_bf_angle
Definition: 4_swath_generator.py:40
f2c::types::Cells
Definition: Cells.h:21
f2c::types::Robot
Definition: Robot.h:25
f2c::Random
Definition: random.h:23
3_headland_generator.no_hl
no_hl
Definition: 3_headland_generator.py:18
f2c::Visualizer::figure
static void figure()
Create figure to plot on.
Definition: visualizer.cpp:254
f2c::Visualizer::save
static void save(const std::string &file)
Definition: visualizer.cpp:272
f2c::types::Swaths
Definition: Swaths.h:20
f2c::sg::BruteForce
Definition: brute_force.h:20
4_swath_generator.bf_sw_gen
bf_sw_gen
Definition: 4_swath_generator.py:20
main
int main()
Definition: 4_swath_generator.cpp:11


fields2cover
Author(s):
autogenerated on Fri Apr 25 2025 02:18:31