tutorials
3_headland_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
F2CField
field
=
rand
.generateRandField(1e4, 5);
14
F2CCells
cells
=
field
.getField();
15
F2CRobot
robot
(2.0, 6.0);
16
17
std::cout <<
"####### Tutorial 3.1 Constant width headland generator ######"
<< std::endl;
18
f2c::hg::ConstHL
const_hl
;
19
F2CCells
no_hl
=
const_hl
.generateHeadlands(
cells
, 3.0 *
robot
.getWidth());
20
std::cout <<
"The complete area is "
<<
cells
.area() <<
21
", and the area without headlands is "
<<
no_hl
.area() << std::endl;
22
23
f2c::Visualizer::figure
();
24
f2c::Visualizer::plot
(
field
);
25
f2c::Visualizer::plot
(
no_hl
);
26
f2c::Visualizer::save
(
"Tutorial_3_1_Const_width.png"
);
27
28
return
0;
29
}
30
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::Visualizer::plot
static void plot(double x, double y, const std::vector< double > &color={})
Definition:
visualizer.cpp:23
f2c::types::Field
Definition:
Field.h:18
main
int main()
Definition:
3_headland_generator.cpp:11
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
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
2_objective_functions.field
field
Definition:
2_objective_functions.py:16
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
fields2cover
Author(s):
autogenerated on Fri Apr 25 2025 02:18:31