3_headland_generator.py
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 import math
9 import fields2cover as f2c
10 
11 rand = f2c.Random(42);
12 robot = f2c.Robot(2.0, 26.0);
13 field = rand.generateRandField(1e4, 5);
14 cells = field.getField();
15 
16 print("####### Tutorial 3.1 Constant width headland generator ######");
17 const_hl = f2c.HG_Const_gen();
18 no_hl = const_hl.generateHeadlands(cells, 3.0 * robot.getWidth());
19 print("The complete area is ", cells.area(),
20  ", and the area without headlands is ", no_hl.area());
21 
23 f2c.Visualizer.plot(field);
24 f2c.Visualizer.plot(no_hl);
26 
27 
29 f2c.Visualizer.plot(field);
30 f2c.Visualizer.plot(no_hl);
31 f2c.Visualizer.save("Tutorial_3_1_Const_width.png");
f2c::Visualizer::plot
static void plot(double x, double y, const std::vector< double > &color={})
Definition: visualizer.cpp:23
f2c::Random
Definition: random.h:23
f2c::Visualizer::show
static void show()
Definition: visualizer.cpp:268
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