Giter VIP home page Giter VIP logo

fields2cover / fields2cover Goto Github PK

View Code? Open in Web Editor NEW
425.0 425.0 86.0 3.26 MB

Robust and efficient coverage paths for autonomous agricultural vehicles. A modular and extensible Coverage Path Planning library

Home Page: https://fields2cover.github.io/

License: BSD 3-Clause "New" or "Revised" License

CMake 7.27% Dockerfile 1.03% C++ 74.21% SWIG 2.91% Python 14.57%
agriculture autonomous-vehicles coverage-path-planning cpp17 path-planning

fields2cover's Introduction

Fields2Cover

Robust and efficient coverage paths for autonomous agricultural vehicles

Open in GitHub Codespaces

DOI build CODECOV license Language-C++ Language-Python stars forks

image

The extended documentation is here.

The coverage path planning problem (CPP) aims to create a path to cover an area with one or several vehicles. CPP has many application as cleaning robots, surveillance, de-mining or agriculture. Each of the application has its own requirements. For example, in cleaning robots environment is usually unknown and the objective is improve the probability of cover the area. On the other hand, CPP in agriculture knows the area to cover, but the coverage has to be complete.

Fields2Cover library provides several algorithms to plan the coverage path on any kind of fields:

image

Although the development of this project is focused on offline planning of agricultural vehicles, the library accepts pull requests from other types of coverage planners.

F2C version 2.0

The version 2.0 of Fields2Cover comes with support for non-convex fields and fields with obstacles!! This has been huge request from the community and finally it's here.

A quick list of new additions to the library:

  1. Decomposition algorithms:
    • Trapezoidal and Boustrophedon decomposition. Those algorithms are useful to split any concave field into several convex sub-fields.
  2. Route planner:
    • Route optimizer using OR-tools can be used to order the swaths, instead of just using a known pattern.
    • Support for a point used as the start and end points of the route.
  3. Path planner:
    • Support for routes provided by the route optimizer.
  4. Swath generator:
    • Speed improvement on swath generation.
    • New cost function: NSwathModified. It uses an approximation to compute the number of swaths, reducing computation costs.
  5. Many bugs fixed.

Citing

Please cite the following paper (https://ieeexplore.ieee.org/document/10050562) when using Fields2Cover for your research:

@article{Mier_Fields2Cover_An_open-source_2023,
  author={Mier, Gonzalo and Valente, João and de Bruin, Sytze},
  journal={IEEE Robotics and Automation Letters},
  title={Fields2Cover: An Open-Source Coverage Path Planning Library for Unmanned Agricultural Vehicles},
  year={2023},
  volume={8},
  number={4},
  pages={2166-2172},
  doi={10.1109/LRA.2023.3248439}
}

Why?

There are many CPP papers out there, but almost no code about their implementation. Due to this, research about this topic is slow as you need to implement every algorithm you want to compare with.

Fields2Cover provides a flexible structure and several algorithms to compare with, so any developer can research about this topic easily.

Installation

The Fields2Cover package has only been tested on Ubuntu 18.04, 20.04 and 22.04. If you are able to run it in other operative systems, open an issue/PR and it will be added to this guide

Requirements on Linux

Some packages are needed before compiling the package:

📝 If your OS is Ubuntu 18.04 or 20.04, you would need to do sudo add-apt-repository ppa:ubuntugis/ppa

sudo apt-get update
sudo apt-get install --no-install-recommends software-properties-common
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install --no-install-recommends build-essential ca-certificates cmake \
     doxygen g++ git libeigen3-dev libgdal-dev libpython3-dev python3 python3-pip \
     python3-matplotlib python3-tk lcov libgtest-dev libtbb-dev swig libgeos-dev \
     gnuplot libtinyxml2-dev nlohmann-json3-dev
python3 -m pip install gcovr

Also, OR-tools for C++ is needed. Follow its installation process.

Compilation

First, clone this repository. Then, from the source code folder of the project:

mkdir -p build;
cd build;
cmake -DCMAKE_BUILD_TYPE=Release ..;
make -j$(nproc);

Finally, you can install it as:

sudo make install;

Add it to your projects

To add Fields2Cover into your CMakeLists.txt, it is as easy as:

find_package(Fields2Cover REQUIRED)
target_link_libraries(<<<your_package>>> Fields2Cover)

Compilation with python interface

Assuming you have satisfied the "Requirements on Linux" and completed the initial "Compilation" step.

Install the packages required as:

sudo apt install swig python3-pytest

Then, from the source code folder of the project, adjust the BUILD_PYTHON option of the existing build:

cd build;
cmake -DBUILD_PYTHON=ON ..;
make -j$(nproc);
sudo make install;

To test if the compilation and installation of the python interface is correct, run on python:

import fields2cover

Or run on the main folder:

pytest-3 tests/python/

Stability

Fields2Cover is still in early development, so feedback and bug reports are appreciated. At the moment, it should expected that breaking changes may be introduced as new functionality is added, bugs are fixed, and APIs are streamlined.

Contribute

If you find any issue/bug/proposal, open an issue and we will try to solve/discuss it.

Pull requests are more than welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

Contributions can be easily made using Open in GitHub Codespaces

License

Fields2Cover project is under BSD-3 license.

TODO

  • Support small obstacles
  • Headland coverage
  • Create SWIG interface with Lua/R
  • ...

Credits and more info

This library is only possible thanks to GDAL who provides the basic types of this library. Other great libraries that made Fields2Cover possible are OR-tools, hbanzhaf/steering_functions, nlohmann/json, leethomason/tinyxml2, ttk592/spline and alandefreitas/matplotplusplus

This code repository is part of the project Fields2Cover which is (partly) financed by the Dutch Research Council (NWO).

fields2cover's People

Contributors

aosmw avatar clalancette avatar developerdenesh avatar gonzalo-mier avatar jfulem avatar marnonel6 avatar mdabek avatar philipogorman avatar rick-v-e avatar stevemacenski avatar timple avatar tomasloksa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fields2cover's Issues

Documentation: Installation instructions

Hello everyone!

I was about to try this library. So I followed the installation instructions mentioned here and here.

In the end I was able to compile it and test it using python import way - yes, I am going through the python path on Ubuntu.

I am creating this issue because the installation instructions are not complete and one has to tweak them at several places.

The points specifically:

  1. Ubuntu 20.04 doesn't have add-apt-repository installed by default. At least not in all the flavours available. And since it is utilized just at the start in order to be able to install gis one has to either install it beforehand or do the repository addition manually as a whole. In short, it suffices to prepend a snippet like this:
apt-get -y update && apt-get install -y --no-install-recommends software-properties-common
  1. Several key dependencies are missing by default and ought to be explicitly installed. I am talking about these: swig and libtbb-dev. It suffices to append them to the existitng apt-get install call

  2. In case python2 is not installed, there is no python alias or symlink for python3, again at least not in all ubuntu flavours. Can be fixed by creating a symlink:

ln -s /usr/bin/python3 /usr/bin/python

The process I had to do is documented here.

Does not compile with clang

Hello,

we have a lot of fields to cover 😅 and we are using the clang-15 compiler in our builds.
There is a tiny error when compiling with it. I even believe clang might be right on this and gcc is too forgiving (for reference).

In file included from Fields2Cover/src/fields2cover/objectives/swath_length.cpp:7:
In file included fromFields2Cover/include/fields2cover/objectives/swath_length.h:12:
In file included from Fields2Cover/include/fields2cover/types.h:20:
Fields2Cover/include/fields2cover/types/Cell.h:26:9: error: expression not permitted as operand of fold expression
  (sstr << std::dec << ... << args);
   ~~~~~^~~~~~~~~~~
   (            )
2 warnings and 1 error generated.

Nevertheless, i've prepared a small fix, hope it will be accepted: #78

Kind Regards
Theo

Not completely covering field

Hi,

I am using Fields2Cover for covering a complete field with a drone. As example, I have a field of 48x48 and a drone with a field-of-view of 11x11. Here is the code to generate the swaths:

import fields2cover as f2c
import numpy as np

robot = f2c.Robot(11.0, 11.0)
robot.setMinRadius(0)
robot.start_point = f2c.optional_Point(f2c.Point(3.0, 4.0))
robot.linear_curv_change = 0

field_border = f2c.LinearRing()
field_border.addPoint(0, 0)
field_border.addPoint(0, 47)
field_border.addPoint(47, 47)
field_border.addPoint(47, 0)
field_border.addPoint(field_border.StartPoint())

field_cell = f2c.Cell()
field_cell.addRing(field_border)

field = f2c.Field()
field.field.addGeometry(field_cell)

# Generate no headland
const_hl = f2c.HG_Const_gen()
no_hl = const_hl.generateHeadlands(field.field, 0)
bf = f2c.SG_BruteForce()

swaths = bf.generateSwaths(np.pi, robot.op_width, no_hl.getGeometry(0))

sorter = f2c.RP_Boustrophedon()
swaths = sorter.genSortedSwaths(swaths)


print(swaths)

f2c.Visualizer.figure(100)
f2c.Visualizer.plot(swaths)
f2c.Visualizer.show()

The produced swaths:

SWATHS(SWATH([(41.5, 0, 0), (41.5, 47, 0)], width = 11), SWATH([(30.5, 47, 0), (30.5, 0, 0)], width = 11), SWATH([(19.5, 0, 0), (19.5, 47, 0)], width = 11), SWATH([(8.5, 47, 0), (8.5, 0, 0)], width = 11))

The produced figure:

Figure_100

On the right side of the field, the drone is covering till the end of the field (41.5 + 11/2 = 47), which is how I expected it. However, on the left side of the field, a strip with width 3 (8.5 - 11/2 = 3) is not covered. I would expect that there would be another swath that covers this strip of 3. Did I do something wrong in the code above?

Compilation steps are not rendered

The compilation steps from the readme are not rendered (at least not on GitHub).

I am not an expert at .rst files, but the other code blocks in the readme do render, and they a have a blank line between the start of the code block and the content of the code block. So maybe that is the solution for the compilation code blocks as well?

Python interface

Hi, great work! I’d like to ask whether you are planning any interface to python or any python wrapper?

Import JSON reads only first field

Parser::importJson reads only the first field from the JSON. If the JSON (GeoJSON) contains more fields one would expect that all the fields will appear in the F2CFields fields (which is a vector of F2CField).

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "Name": "field1"
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              -90.13470527300802,
              41.46915182229183,
              0
            ],
            [
              -90.133492914607,
              41.47136257818229,
              0
            ],
            [
              -90.13591763140903,
              41.47259252972829,
              0
            ],
            [
              -90.13680276033013,
              41.47207804303187,
              0
            ],
            [
              -90.13774689788767,
              41.47240763655048,
              0
            ],
            [
              -90.1383852635944,
              41.472825655176955,
              0
            ],
            [
              -90.13910946003789,
              41.473830496641824,
              0
            ],
            [
              -90.13992485152885,
              41.474373104542266,
              0
            ],
            [
              -90.14028963198977,
              41.474135965355195,
              0
            ],
            [
              -90.14038619150844,
              41.47374207122346,
              0
            ],
            [
              -90.13723727820812,
              41.46921613624346,
              0
            ],
            [
              -90.13470527300802,
              41.46915182229183,
              0
            ]
          ]
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "Name": "field2"
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              -90.12925795209429,
              41.46795419481983,
              0
            ],
            [
              -90.1324947808007,
              41.46807214926753,
              0
            ],
            [
              -90.13247510406907,
              41.46895680085933,
              0
            ],
            [
              -90.13523969032265,
              41.46891994061772,
              0
            ],
            [
              -90.13611530660938,
              41.46819010351813,
              0
            ],
            [
              -90.13625304400279,
              41.46792470617217,
              0
            ],
            [
              -90.13622352884705,
              41.46778463491272,
              0
            ],
            [
              -90.134688740749,
              41.46554345360544,
              0
            ],
            [
              -90.1340197305524,
              41.46541812210039,
              0
            ],
            [
              -90.13400005374898,
              41.46502000863133,
              0
            ],
            [
              -90.13193399284772,
              41.4637887904667,
              0
            ],
            [
              -90.12940552784,
              41.46336854897521,
              0
            ],
            [
              -90.12925795209429,
              41.46795419481983,
              0
            ]
          ]
        ]
      }
    }
  ]
}

Compilation on Ubuntu 22.04, gcc 11.3

@Gonzalo-Mier, just to let you know. I compiled F2C on Ubuntu 22.04 with Python 3.10.6. It works great for me.
Then I compiled it on Ubuntu 20.04 with Python 3.10.9 as well - this requires a slight modification of CMake.

find_package(Python3 3.10 EXACT REQUIRED COMPONENTS Interpreter Development)

if(Python_VERSION VERSION_GREATER_EQUAL 3)
  list(APPEND CMAKE_SWIG_FLAGS "-py3;-DPY3")
endif()

if(BUILD_DOC)
  list(APPEND CMAKE_SWIG_FLAGS "-doxygen")
endif()

set(CMAKE_SWIG_FLAGS "")
set_source_files_properties(../${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../include/ ${Python3_INCLUDE_DIRS} )
file(GLOB_RECURSE Swig_SRC "${CMAKE_CURRENT_SOURCE_DIR}/../../include/fields2cover.h")

# Add swig module
SWIG_ADD_LIBRARY(fields2cover_python LANGUAGE python SOURCES ../${PROJECT_NAME}.i)
swig_link_libraries(fields2cover_python Fields2Cover ${Python3_LIBRARIES} ${PROJ_LIBRARY} ${GDAL_LIBRARIES})

But there is one strange thing in both cases.

This works:

n = path.states.size()
points = [path.states[i].point for i in range(n)]

This is crashing when iterating through the list of points after it's created:

states = list(path.states)
points = [item.point for item in states]

AerialmapDisplay

Dear author,
What is the purpose of the AerialmapDisplay plugin in Rviz? I am running roslaunch fields2cover_ros view_field.launch , it keeps displaying anomalies and there is no GPS API available. How can I solve this problem?
And the Error reported in terminal:
[ERROR] [1691649397.168491921]: PluginlibFactory: The plugin for class 'rviz_plugins/AerialMapDisplay' failed to load. Error: According to the loaded plugin descriptions the class rviz_plugins/AerialMapDisplay with base class type rviz::Display does not exist. Declared types are rviz/AccelStamped rviz/Axes rviz/Camera rviz/DepthCloud rviz/Effort rviz/FluidPressure rviz/Grid rviz/GridCells rviz/Illuminance rviz/Image rviz/InteractiveMarkers rviz/LaserScan rviz/Map rviz/Marker rviz/MarkerArray rviz/Odometry rviz/Path rviz/PointCloud rviz/PointCloud2 rviz/PointStamped rviz/Polygon rviz/Pose rviz/PoseArray rviz/PoseWithCovariance rviz/Range rviz/RelativeHumidity rviz/RobotModel rviz/TF rviz/Temperature rviz/TwistStamped rviz/WrenchStamped rviz_plugin_tutorials/Imu

The Rviz display it like this...
fields2cover

I look forward to hearing from you soon. thank you!
Kind regards,
Finn

Robot Start Point

When trying to set the robot start point I get a TypeError.
This probably has to do with how std::optional is handled in the cpp to python workflow.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In [15], line 49
     45 print(max_x)
     46 print(max_y)
---> 49 robot.start_point = f2c.Point(max_x, max_y)

TypeError: in method 'Robot_start_point_set', argument 2 of type 'std::optional< f2c::types::Point > *'

Based on the (cpp) API docs, I expect to be able to set the robot start point.
https://fields2cover.github.io/api/structf2c_1_1types_1_1Robot.html#exhale-struct-structf2c-1-1types-1-1robot

Apple Arm -- Dockerfile build errors, GDAL Version

Having the following build error in a container generated from the repo Dockerfile

In file included from /workspace/fields2cover/include/fields2cover/types/Geometry.h:120,
                 from /workspace/fields2cover/include/fields2cover/types/Point.h:17,
                 from /workspace/fields2cover/include/fields2cover/types.h:15,
                 from /workspace/fields2cover/include/fields2cover/headland_generator/constant_headland.h:11,
                 from /workspace/fields2cover/src/fields2cover/headland_generator/constant_headland.cpp:8:
/workspace/fields2cover/include/fields2cover/types/Geometry_impl.hpp: In instantiation of 'std::string f2c::types::Geometry<T, R>::exportToWkt() const [with T = OGRMultiPolygon; OGRwkbGeometryType R = wkbMultiPolygon; std::string = std::__cxx11::basic_string<char>]':
/workspace/fields2cover/include/fields2cover/types/Geometries_impl.hpp:21:3:   required from 'SAMETYPE f2c::types::Geometries<SAMETYPE, T, R, CHILDRENTYPE>::clone() const [with SAMETYPE = f2c::types::Cells; T = OGRMultiPolygon; OGRwkbGeometryType R = wkbMultiPolygon; CHILDRENTYPE = f2c::types::Cell]'
/workspace/fields2cover/src/fields2cover/headland_generator/constant_headland.cpp:14:36:   required from here
/workspace/fields2cover/include/fields2cover/types/Geometry_impl.hpp:206:28: error: no matching function for call to 'OGRMultiPolygon::exportToWkt()'
  206 |   return data->exportToWkt();

I looked at GDAL api documentation, and it seem like that is a valid function call, so I am unsure what is going on 🤔
https://gdal.org/api/ogrgeometry_cpp.html#_CPPv4NK15OGRMultiPolygon11exportToWktERK13OGRWktOptionsP6OGRErr

Is it possible to use this library to plan a coverage path connecting multiple convex polygons?

I am trying to do coverage planning for a field with obstacles. My idea was to use convex decomposition to split the polygon into multiple convex shapes so I wouldn't have a problem with the obstacles. Can this library support making multiple fields from those polygons and then applying CPP for the connected polygons to generate one final path instead of multiple individual paths? If not, how can I define the start and end point for each coverage planning so I can use it in connecting the generated paths?

Build Failure

I was following the instructions to build the lib. I'm using cmake version 3.23.2 on Ubuntu 18.04.

While Building this is the error I see:

/home/user/Fields2Cover/include/fields2cover/types/Geometry_impl.hpp:231:28: error: no matching function for call to ‘OGRPoint::exportToWkt()’
   return data->exportToWkt();

Compilation on Debian 12 Bookworm deprecated declaration Python3.11

While compiling on Debian 12 Bookworm I got issues with deprecated declaration:

f2c/build/_deps/matplotlib_cpp-src/include/matplotlibcpp.h:174:26: warning: ‘void Py_SetProgramName(const wchar_t*)’ is deprecated [-Wdeprecated-declarations]
  174 |         Py_SetProgramName(name);
      |         ~~~~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/python3.11/Python.h:94,
                 from /home/rysiek/workspace-ilot/ncrobot/ncrobot-fields2cover/f2c/build/_deps/matplotlib_cpp-src/include/matplotlibcpp.h:5:
/usr/include/python3.11/pylifecycle.h:37:38: note: declared here
   37 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
      |                                      ^~~~~~~~~~~~~~~~~
build/_deps/matplotlib_cpp-src/include/matplotlibcpp.h:182:22: warning: ‘void PySys_SetArgv(int, wchar_t**)’ is deprecated [-Wdeprecated-declarations]
  182 |         PySys_SetArgv(argc, const_cast<wchar_t **>(argv));
      |         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.11/Python.h:96:
/usr/include/python3.11/sysmodule.h:13:38: note: declared here
   13 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **);
      |                                      ^~~~~~~~~~~~~

As a workaround I had to add -Wno-error=deprecated-declarations in CMakeLists.txt for target_compile_options.

How to run Fields2Cover ?

Hello,

After install Fields2Cover (Ubuntu 20.04), and import fields2cover successfully. I tried to run this project with
pytest tests/python/, I can see a small window come out but disappeared quickly. My question is: is it correct way to run this project, so the path planning animation can be seen graphically as shown in the project's Readme? Or how to run this project to see the path planning graphically?

Thanks,

Support for overlapping paths

Currently overlapping paths are not supported:

From the paper

In the current version, the library only supports parallel non-overlapping swaths.

What would it take to implement overlaps of constant width? Where would be the best place to insert it (I imagine it is in the swath generation step).

odd turns when attempting to generate dubins paths

I am working with some custom swath generation to work with a field shape that is of interest to us.

image

And when generating curves, I am getting really odd curves from these sorted swaths at the top, but not at the bottom.
image

I know I am not providing much detail right now, but are there some general things I might want to look at in terms of this behavior?

I am just not really sure why the turns at one end double back on themselves yet.
image

Build folder not found

During the build stage, according to the Compilation section. One is supposed to cd build, however a build folder does not exist

Headland covering

It would be great to have a function that generates path in order to cover the headland too (I think to navigate through that after all the swaths are covered).
This would be absolutely important for larger headland such as tractor's (they have Turning Radius of 5-6 meters, at least)

Headland width is not constant

Hello everyone,

one of my test datasets produces headlands with non constant distance to the field boundaries. Especially at the top and at the bottom, the distance is way to small.

image

my code:

import json
import fields2cover as f2c

with open('coords_local.json') as json_file:
  coords = json.load(json_file)
  
print(f"{len(coords)} points")

rand = f2c.Random(42)
robot = f2c.Robot(6, 6)
const_hl = f2c.HG_Const_gen()

outter_ring = f2c.LinearRing()
for coord in coords:  
  point = f2c.Point(coord["x"], coord["y"])

  outter_ring.addGeometry(point)

cell = f2c.Cell()
cell.addRing(outter_ring)

cells = f2c.Cells()
cells.addGeometry(cell)

field = f2c.Field(cells)

no_hl = const_hl.generateHeadlands(cells, robot.robot_width)

f2c.Visualizer.figure(1)
f2c.Visualizer.plot(field)
f2c.Visualizer.plot(no_hl)
f2c.Visualizer.save("Headland")

My data:
coords_local.json.zip

Do you have any ideas how to solve that?

Best regards
Andy

JSON parser failure

Please any idea why this fails to be parsed?
[json.exception.type_error.302] type must be number, but is null

It can be easily parsed by python json module.

{
   "type": "FeatureCollection",
   "features": [
     {
       "type": "Feature",
       "properties": {
         "Name": "field1"
       },
       "geometry": {
         "type": "Polygon",
         "coordinates": [
           [
             [
               -90.13470527300802,
               41.46915182229183,
               0
             ],
             [
               -90.133492914607,
               41.47136257818229,
               0
             ],
             [
               -90.13591763140903,
               41.47259252972829,
               0
             ],
             [
               -90.13680276033013,
               41.47207804303187,
               0
             ],
             [
               -90.13774689788767,
               41.47240763655048,
               0
             ],
             [
               -90.1383852635944,
               41.472825655176955,
               0
             ],
             [
               -90.13910946003789,
               41.473830496641824,
               0
             ],
             [
               -90.13992485152885,
               41.474373104542266,
               0
             ],
             [
               -90.14028963198977,
               41.474135965355195,
               0
             ],
             [
               -90.14038619150844,
               41.47374207122346,
               0
             ],
             [
               -90.13723727820812,
               41.46921613624346,
               0
             ],
             [
               -90.13470527300802,
               41.46915182229183,
               0
             ]
           ]
         ]
       }
     },
     {
       "type": "Feature",
       "properties": {
         "Name": "field8"
       },
       "geometry": {
         "type": "Polygon",
         "coordinates": [
           [
             
             [
               -90.15812575272224,
               41.47675215453035,
               0
             ],
             [
               -90.15810663611147,
               41.474145382708606,
               0
             ],
             [
               -90.15684493980102,
               41.47415970591714,
               0
             ],
             [
               -90.15688317302254,
               41.473300307803335
             ],
             [
               -90.15738020490242,
               41.473257337598575,
               0
             ],
             [
               -90.15749490456702,
               41.47235495671821,
               0
             ],
             [
               -90.15596557570585,
               41.47226901502683,
               0
             ],
             [
               -90.15575529298744,
               41.4715385060499,
               0
             ],
             [
               -90.15380539868943,
               41.47119473427116,
               0
             ],
             [
               -90.15223783660673,
               41.47109446715895,
               0
             ],
             [
               -90.1514540555654,
               41.470320972794994,
               0
             ],
             [
               -90.14994384331497,
               41.46943287529232,
               0
             ],
             [
               -90.14931299515975,
               41.46873098317513,
               0
             ],
             [
               -90.14705723508952,
               41.46777124083853,
               0
             ],
             [
               -90.14436179297172,
               41.46894584891602,
               0
             ],
             [
               -90.1444764926363,
               41.46914638963168,
               0
             ],
             [
               -90.14858656395069,
               41.469175038254726,
               0
             ]
           ]
         ]
       }
     }
   ]
 }
 

Visualizer Plot not working in python

Hi
Visualizer plot does not work for paths or cells or swaths. Below is the error:

return _fields2cover_python.Visualizer_plot(*args)
TypeError: Wrong number or type of arguments for overloaded function 'Visualizer_plot'.
  Possible C/C++ prototypes are:
    f2c::Visualizer::plot(std::vector< double,std::allocator< double > > const &,std::vector< double,std::allocator< double > > const &,std::string const &)
    f2c::Visualizer::plot(std::vector< double,std::allocator< double > > const &,std::vector< double,std::allocator< double > > const &)
    f2c::Visualizer::plot< f2c::types::Point >(f2c::types::Point const &,std::string const &)
    f2c::Visualizer::plot< f2c::types::Point >(std::vector< f2c::types::Point,std::allocator< f2c::types::Point > > const &,std::string const &)
    f2c::Visualizer::plot< f2c::types::Point >(std::vector< f2c::types::Point,std::allocator< f2c::types::Point > > const &)
    f2c::Visualizer::plot< f2c::types::Point >(f2c::types::Point const &)
    f2c::Visualizer::plot< f2c::types::MultiPoint >(f2c::types::MultiPoint const &,std::string const &)
    f2c::Visualizer::plot< f2c::types::MultiPoint >(std::vector< f2c::types::MultiPoint,std::allocator< f2c::types::MultiPoint > > const &,std::string const &)
    f2c::Visualizer::plot< f2c::types::MultiPoint >(std::vector< f2c::types::MultiPoint,std::allocator< f2c::types::MultiPoint > > const &)
    f2c::Visualizer::plot< f2c::types::MultiPoint >(f2c::types::MultiPoint const &)
    f2c::Visualizer::plot< f2c::types::LineString >(f2c::types::LineString const &,std::string const &)
    f2c::Visualizer::plot< f2c::types::LineString >(std::vector< f2c::types::LineString,std::allocator< f2c::types::LineString > > const &,std::string const &)
    f2c::Visualizer::plot< f2c::types::LineString >(std::vector< f2c::types::LineString,std::allocator< f2c::types::LineString > > const &)
    f2c::Visualizer::plot< f2c::types::LineString >(f2c::types::LineString const &)
    f2c::Visualizer::plot< f2c::types::LinearRing >(f2c::types::LinearRing const &,std::string const &)
    f2c::Visualizer::plot< f2c::types::LinearRing >(std::vector< f2c::types::LinearRing,std::allocator< f2c::types::LinearRing > > const &,std::string const &)
    f2c::Visualizer::plot< f2c::types::LinearRing >(std::vector< f2c::types::LinearRing,std::allocator< f2c::types::LinearRing > > const &)
    f2c::Visualizer::plot< f2c::types::LinearRing >(f2c::types::LinearRing const &)

Please let us know if there's a fix on the way.

Nav2 Integration

Hi! Thanks for the chat today! I'm happy to be working together to have out-of-the-box support for coverage planning in ROS 2 via Nav2! As discussed:

Things we need to support:

Tentatively:

  • I'd plan to work on the ROS 2 / Nav2 integration server work + documentation / tutorials -- with some demos needed for API use for example to work from
  • Vinny / Adam plan to work with Gonzalo on the technical features above
  • I think all 3 of us should get together to discuss the ROS 2 Action interface

This will definitely make a good ROSCon talk for 2024 for Vinny/Adam/Gonzalo or a subset of them to present!

CC @vinnnyr @Aposhian

catkin_make_isolated error

catkin_make_isolated
Base path: /home/boson/nvme0n1p1/catkin_f2c
Source space: /home/boson/nvme0n1p1/catkin_f2c/src
Build space: /home/boson/nvme0n1p1/catkin_f2c/build_isolated
Devel space: /home/boson/nvme0n1p1/catkin_f2c/devel_isolated
Install space: /home/boson/nvme0n1p1/catkin_f2c/install_isolated

~~  traversing 2 packages in topological order:
~~  - fields2cover (plain cmake)
~~  - fields2cover_ros

==> Processing plain cmake package: 'fields2cover'
==> cmake /home/boson/nvme0n1p1/catkin_f2c/src/fields2coverpath_boson/fields2cover -DCMAKE_INSTALL_PREFIX=/home/boson/nvme0n1p1/catkin_f2c/devel_isolated/fields2cover -G Unix Makefiles in '/home/boson/nvme0n1p1/catkin_f2c/build_isolated/fields2cover/devel'
-- Using the single-header code from /home/boson/nvme0n1p1/catkin_f2c/build_isolated/fields2cover/devel/_deps/json-src/single_include/
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find Python3 (missing: Python3_LIBRARIES Python3_INCLUDE_DIRS
Development) (found version "3.9.5")
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.16/Modules/FindPython/Support.cmake:2214 (find_package_handle_standard_args)
/usr/share/cmake-3.16/Modules/FindPython3.cmake:300 (include)
/home/boson/nvme0n1p1/catkin_f2c/build_isolated/fields2cover/devel/_deps/matplotlib_cpp-src/CMakeLists.txt:31 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/boson/nvme0n1p1/catkin_f2c/build_isolated/fields2cover/devel/CMakeFiles/CMakeOutput.log".
<== Failed to process package 'fields2cover':
Command '['cmake', '/home/boson/nvme0n1p1/catkin_f2c/src/fields2coverpath_boson/fields2cover', '-DCMAKE_INSTALL_PREFIX=/home/boson/nvme0n1p1/catkin_f2c/devel_isolated/fields2cover', '-G', 'Unix Makefiles']' returned non-zero exit status 1.

Reproduce this error by running:
==> cd /home/boson/nvme0n1p1/catkin_f2c/build_isolated/fields2cover && cmake /home/boson/nvme0n1p1/catkin_f2c/src/fields2coverpath_boson/fields2cover -DCMAKE_INSTALL_PREFIX=/home/boson/nvme0n1p1/catkin_f2c/devel_isolated/fields2cover -G 'Unix Makefiles'

Command failed, exiting.

Hi @Gonzalo-Mier Can you please help us solve this error please?

How to get the swath endpoint

Is there any way to get the endpoint coordinates of both ends of swath?
Maybe it's because of my carelessness that I didn't see it in the python tutorial.

Just like the endpoint of one of the swaths in the picture (circled in red)

image

Thank you!

Tutorial scripts are not working. Unit test also not working.

Hi, Tutorial C++ snippets are having run-time errors, I have attached the output of all the examples and unit tests.
Please help us.

boson@boson:~/Fields2Cover/build/tutorials$ ./1_basic_types_tutorial

####### Tutorial 1.1 Initialize a Point ######
Point 1: Point(1.2, 3.4, 0)
Point 2: Point(9.8, 7.6, 5.4)
Point 3: Point(11, 22, 0)
Point 4: Point(3, 0, -1). Its components are: {x: 3, y: 0, z: -1}
Point 5: Point(0, 4, 4)


####### Tutorial 1.2 Basic types are shared pointers ######
Access to OGRPoints: 5
Without accessing: 5

The old point is Point(1, 2, 0)
Old point is: Point(1, 2, 0) and cloned point is: Point(5, 10, 0)
Old point is: Point(5.5, 11, 0) and copied point is: Point(5.5, 11, 0)


####### Tutorial 1.3 Initialize a F2CLineString ######
Length of line 1: 5
Length of line 2: 2


####### Tutorial 1.4 Initialize a F2CLinearRing ######
Area of the ring: 0.5


####### Tutorial 1.5 Initializing other collections ######
Lines have length: 5, 2, 

The area of the cell is: 3

The area of the cells is: 3


Points contains 2 points.
Points contains 3 points.
Points contains 4 points.


####### Tutorial 1.6 Accessing elements in collections ######
First point in points: Point(1, 2, 0)

Modified p_0: Point(100000, 200000, 0)
First point in points without modification: Point(1, 2, 0)
Modified first point in points: Point(100000, 200000, 0)


####### Tutorial 1.9 Visualizing Fields2Cover data ######
Segmentation fault (core dumped)

./2_objective_functions_tutorial

####### Tutorial 2.1.1 Remaining Area ######
The remaining area is 0.25
The remaining area with sign is -0.25


####### Tutorial 2.2.1 Field Coverage ######
The field coverage with swath1 is 0.5 and with all of the swaths 1
The field coverage with sign for all of the swaths is -1

####### Tutorial 2.2.2 Number of swaths ######
The number of swaths with swath1 is 1 and with all of the swaths 3

####### Tutorial 2.2.3 Overlap ######
The field overlapping with swath1 is 0 and with all of the swaths 0.5

####### Tutorial 2.2.4 Swath length ######
The swath length with swath1 is 4 and with all of the swaths 12


####### Tutorial 2.3.1 Distance with turns ######
The complete length is: 3.57166 =~= 3.5708

####### Tutorial 2.3.2 Direct distance without turns ######
The aproximated length is: 3


####### Tutorial 2.4.1 Path length ######
The path length is: 3

./3_headland_generator_tutorial

####### Tutorial 3.1 Constant width headland generator ######
The complete area is 10000, and the area without headlands is 7709.94
Segmentation fault (core dumped)

./4_swath_generator_tutorial

####### Tutorial 4.1 Brute force swath generator ######
Segmentation fault (core dumped)

./5_route_planning_tutorial

####### Tutorial 5.1 Boustrophedon ######
Segmentation fault (core dumped)

./6_path_planning_tutorial

####### Tutorial 6.1 Dubins curves ######
Segmentation fault (core dumped)

UNIT TEST RESULTS

~/Fields2Cover/build/tests$ ./unittests

[==========] Running 159 tests from 43 test suites.
[----------] Global test environment set-up.
[----------] 2 tests from fields2cover_hl_const_gen
[ RUN      ] fields2cover_hl_const_gen.empty_area
[       OK ] fields2cover_hl_const_gen.empty_area (0 ms)
[ RUN      ] fields2cover_hl_const_gen.border_area
[       OK ] fields2cover_hl_const_gen.border_area (1 ms)
[----------] 2 tests from fields2cover_hl_const_gen (1 ms total)

[----------] 6 tests from fields2cover_obj_complete_turn_path_obj
[ RUN      ] fields2cover_obj_complete_turn_path_obj.computeCost_cost
[       OK ] fields2cover_obj_complete_turn_path_obj.computeCost_cost (2 ms)
[ RUN      ] fields2cover_obj_complete_turn_path_obj.computeCost_cost_2
[       OK ] fields2cover_obj_complete_turn_path_obj.computeCost_cost_2 (1 ms)
[ RUN      ] fields2cover_obj_complete_turn_path_obj.computeCost_cost_long_swath
[       OK ] fields2cover_obj_complete_turn_path_obj.computeCost_cost_long_swath (134 ms)
[ RUN      ] fields2cover_obj_complete_turn_path_obj.computeCost_cost_dubinsCC
[       OK ] fields2cover_obj_complete_turn_path_obj.computeCost_cost_dubinsCC (71 ms)
[ RUN      ] fields2cover_obj_complete_turn_path_obj.computeCost_cost_reedsshepp
[       OK ] fields2cover_obj_complete_turn_path_obj.computeCost_cost_reedsshepp (70 ms)
[ RUN      ] fields2cover_obj_complete_turn_path_obj.computeCost_cost_reedssheppHC
[       OK ] fields2cover_obj_complete_turn_path_obj.computeCost_cost_reedssheppHC (70 ms)
[----------] 6 tests from fields2cover_obj_complete_turn_path_obj (348 ms total)

[----------] 1 test from fields2cover_complete_pred_turn_path_obj
[ RUN      ] fields2cover_complete_pred_turn_path_obj.params_check
[       OK ] fields2cover_complete_pred_turn_path_obj.params_check (0 ms)
[----------] 1 test from fields2cover_complete_pred_turn_path_obj (0 ms total)

[----------] 2 tests from fields2cover_obj_direct_dist_path_obj
[ RUN      ] fields2cover_obj_direct_dist_path_obj.computeCost_cost
[       OK ] fields2cover_obj_direct_dist_path_obj.computeCost_cost (0 ms)
[ RUN      ] fields2cover_obj_direct_dist_path_obj.params_check
[       OK ] fields2cover_obj_direct_dist_path_obj.params_check (0 ms)
[----------] 2 tests from fields2cover_obj_direct_dist_path_obj (0 ms total)

[----------] 3 tests from fields2cover_obj_field_coverage
[ RUN      ] fields2cover_obj_field_coverage.get_best_value
[       OK ] fields2cover_obj_field_coverage.get_best_value (1 ms)
[ RUN      ] fields2cover_obj_field_coverage.computeCost_cost
[       OK ] fields2cover_obj_field_coverage.computeCost_cost (1 ms)
[ RUN      ] fields2cover_obj_field_coverage.params_check
[       OK ] fields2cover_obj_field_coverage.params_check (0 ms)
[----------] 3 tests from fields2cover_obj_field_coverage (2 ms total)

[----------] 3 tests from fields2cover_obj_n_swath
[ RUN      ] fields2cover_obj_n_swath.get_best_value
[       OK ] fields2cover_obj_n_swath.get_best_value (0 ms)
[ RUN      ] fields2cover_obj_n_swath.computeCost_cost
[       OK ] fields2cover_obj_n_swath.computeCost_cost (0 ms)
[ RUN      ] fields2cover_obj_n_swath.params_check
[       OK ] fields2cover_obj_n_swath.params_check (0 ms)
[----------] 3 tests from fields2cover_obj_n_swath (0 ms total)

[----------] 2 tests from fields2cover_obj_overlaps
[ RUN      ] fields2cover_obj_overlaps.computeCost_cost
[       OK ] fields2cover_obj_overlaps.computeCost_cost (2 ms)
[ RUN      ] fields2cover_obj_overlaps.params_check
[       OK ] fields2cover_obj_overlaps.params_check (0 ms)
[----------] 2 tests from fields2cover_obj_overlaps (2 ms total)

[----------] 2 tests from fields2cover_obj_pathLength
[ RUN      ] fields2cover_obj_pathLength.computeCost
[       OK ] fields2cover_obj_pathLength.computeCost (1 ms)
[ RUN      ] fields2cover_obj_pathLength.params_check
[       OK ] fields2cover_obj_pathLength.params_check (0 ms)
[----------] 2 tests from fields2cover_obj_pathLength (2 ms total)

[----------] 1 test from fields2cover_obj_pp_obj
[ RUN      ] fields2cover_obj_pp_obj.isMinimizing
[       OK ] fields2cover_obj_pp_obj.isMinimizing (0 ms)
[----------] 1 test from fields2cover_obj_pp_obj (0 ms total)

[----------] 2 tests from fields2cover_obj_remArea
[ RUN      ] fields2cover_obj_remArea.computeCost
[       OK ] fields2cover_obj_remArea.computeCost (0 ms)
[ RUN      ] fields2cover_obj_remArea.params_check
[       OK ] fields2cover_obj_remArea.params_check (0 ms)
[----------] 2 tests from fields2cover_obj_remArea (0 ms total)

[----------] 1 test from fields2cover_obj_rp_obj
[ RUN      ] fields2cover_obj_rp_obj.computeCost_cost
[       OK ] fields2cover_obj_rp_obj.computeCost_cost (0 ms)
[----------] 1 test from fields2cover_obj_rp_obj (0 ms total)

[----------] 3 tests from fields2cover_obj_sg_obj
[ RUN      ] fields2cover_obj_sg_obj.get_best_value
[       OK ] fields2cover_obj_sg_obj.get_best_value (0 ms)
[ RUN      ] fields2cover_obj_sg_obj.computeCost_cost
[       OK ] fields2cover_obj_sg_obj.computeCost_cost (0 ms)
[ RUN      ] fields2cover_obj_sg_obj.params_check
[       OK ] fields2cover_obj_sg_obj.params_check (0 ms)
[----------] 3 tests from fields2cover_obj_sg_obj (0 ms total)

[----------] 2 tests from fields2cover_obj_swath_length
[ RUN      ] fields2cover_obj_swath_length.computeCost_cost
[       OK ] fields2cover_obj_swath_length.computeCost_cost (0 ms)
[ RUN      ] fields2cover_obj_swath_length.params_check
[       OK ] fields2cover_obj_swath_length.params_check (0 ms)
[----------] 2 tests from fields2cover_obj_swath_length (0 ms total)

[----------] 2 tests from fields2cover_pp_dubins_cc
[ RUN      ] fields2cover_pp_dubins_cc.turn_dist
[       OK ] fields2cover_pp_dubins_cc.turn_dist (1 ms)
[ RUN      ] fields2cover_pp_dubins_cc.random_points
[       OK ] fields2cover_pp_dubins_cc.random_points (24 ms)
[----------] 2 tests from fields2cover_pp_dubins_cc (25 ms total)

[----------] 4 tests from fields2cover_pp_dubins
[ RUN      ] fields2cover_pp_dubins.turn_dist
[       OK ] fields2cover_pp_dubins.turn_dist (1 ms)
[ RUN      ] fields2cover_pp_dubins.random_points
[       OK ] fields2cover_pp_dubins.random_points (538 ms)
[ RUN      ] fields2cover_pp_dubins.cached_turn
[       OK ] fields2cover_pp_dubins.cached_turn (5 ms)
[ RUN      ] fields2cover_pp_dubins.turn_valid
[       OK ] fields2cover_pp_dubins.turn_valid (4 ms)
[----------] 4 tests from fields2cover_pp_dubins (548 ms total)

[----------] 1 test from fields2cover_pp_pp
[ RUN      ] fields2cover_pp_pp.turn_dist
[       OK ] fields2cover_pp_pp.turn_dist (2 ms)
[----------] 1 test from fields2cover_pp_pp (2 ms total)

[----------] 2 tests from fields2cover_pp_reeds_shepp_hc
[ RUN      ] fields2cover_pp_reeds_shepp_hc.turn_dist
[       OK ] fields2cover_pp_reeds_shepp_hc.turn_dist (2 ms)
[ RUN      ] fields2cover_pp_reeds_shepp_hc.random_points
[       OK ] fields2cover_pp_reeds_shepp_hc.random_points (20 ms)
[----------] 2 tests from fields2cover_pp_reeds_shepp_hc (22 ms total)

[----------] 2 tests from fields2cover_pp_reeds_shepp
[ RUN      ] fields2cover_pp_reeds_shepp.turn_dist
[       OK ] fields2cover_pp_reeds_shepp.turn_dist (1 ms)
[ RUN      ] fields2cover_pp_reeds_shepp.random_points
[       OK ] fields2cover_pp_reeds_shepp.random_points (17 ms)
[----------] 2 tests from fields2cover_pp_reeds_shepp (18 ms total)

[----------] 2 tests from fields2cover_route_boustrophedon
[ RUN      ] fields2cover_route_boustrophedon.genSortedSwaths
[       OK ] fields2cover_route_boustrophedon.genSortedSwaths (0 ms)
[ RUN      ] fields2cover_route_boustrophedon.genSortedSwaths_empty_swaths
[       OK ] fields2cover_route_boustrophedon.genSortedSwaths_empty_swaths (0 ms)
[----------] 2 tests from fields2cover_route_boustrophedon (0 ms total)

[----------] 5 tests from fields2cover_custom_order
[ RUN      ] fields2cover_custom_order.defined_order
[       OK ] fields2cover_custom_order.defined_order (0 ms)
[ RUN      ] fields2cover_custom_order.constructor_order
[       OK ] fields2cover_custom_order.constructor_order (0 ms)
[ RUN      ] fields2cover_custom_order.incomplete_order
[       OK ] fields2cover_custom_order.incomplete_order (0 ms)
[ RUN      ] fields2cover_custom_order.bad_order
[       OK ] fields2cover_custom_order.bad_order (0 ms)
[ RUN      ] fields2cover_custom_order.out_of_range
[       OK ] fields2cover_custom_order.out_of_range (0 ms)
[----------] 5 tests from fields2cover_custom_order (0 ms total)

[----------] 2 tests from fields2cover_route_snake
[ RUN      ] fields2cover_route_snake.genSortedSwaths_even
[       OK ] fields2cover_route_snake.genSortedSwaths_even (0 ms)
[ RUN      ] fields2cover_route_snake.genSortedSwaths_odd
[       OK ] fields2cover_route_snake.genSortedSwaths_odd (1 ms)
[----------] 2 tests from fields2cover_route_snake (1 ms total)

[----------] 6 tests from fields2cover_route_spiral
[ RUN      ] fields2cover_route_spiral.genSortedSwaths_even
[       OK ] fields2cover_route_spiral.genSortedSwaths_even (0 ms)
[ RUN      ] fields2cover_route_spiral.genSortedSwaths_odd
[       OK ] fields2cover_route_spiral.genSortedSwaths_odd (0 ms)
[ RUN      ] fields2cover_route_spiral.genSortedSwaths_even_size
[       OK ] fields2cover_route_spiral.genSortedSwaths_even_size (0 ms)
[ RUN      ] fields2cover_route_spiral.genSortedSwaths_odd_size
[       OK ] fields2cover_route_spiral.genSortedSwaths_odd_size (0 ms)
[ RUN      ] fields2cover_route_spiral.genSortedSwaths_default_size
[       OK ] fields2cover_route_spiral.genSortedSwaths_default_size (0 ms)
[ RUN      ] fields2cover_route_spiral.genSortedSwaths_default_cstr
[       OK ] fields2cover_route_spiral.genSortedSwaths_default_cstr (0 ms)
[----------] 6 tests from fields2cover_route_spiral (0 ms total)

[----------] 1 test from fields2cover_swath_brute_gen
[ RUN      ] fields2cover_swath_brute_gen.best_angle
[       OK ] fields2cover_swath_brute_gen.best_angle (260 ms)
[----------] 1 test from fields2cover_swath_brute_gen (260 ms total)

[----------] 8 tests from fields2cover_types_cell
[ RUN      ] fields2cover_types_cell.constructor
[       OK ] fields2cover_types_cell.constructor (0 ms)
[ RUN      ] fields2cover_types_cell.setGeometry
[       OK ] fields2cover_types_cell.setGeometry (0 ms)
[ RUN      ] fields2cover_types_cell.getArea
[       OK ] fields2cover_types_cell.getArea (0 ms)
[ RUN      ] fields2cover_types_cell.addRing
[       OK ] fields2cover_types_cell.addRing (0 ms)
[ RUN      ] fields2cover_types_cell.createLineUntilBorder
[       OK ] fields2cover_types_cell.createLineUntilBorder (0 ms)
[ RUN      ] fields2cover_types_cell.isPointInBorder
[       OK ] fields2cover_types_cell.isPointInBorder (0 ms)
[ RUN      ] fields2cover_types_cell.isPointIn
[       OK ] fields2cover_types_cell.isPointIn (0 ms)
[ RUN      ] fields2cover_types_cell.Buffer
[       OK ] fields2cover_types_cell.Buffer (0 ms)
[----------] 8 tests from fields2cover_types_cell (0 ms total)

[----------] 9 tests from fields2cover_types_cells
[ RUN      ] fields2cover_types_cells.constructor
[       OK ] fields2cover_types_cells.constructor (0 ms)
[ RUN      ] fields2cover_types_cells.Difference
[       OK ] fields2cover_types_cells.Difference (0 ms)
[ RUN      ] fields2cover_types_cells.Buffer
[       OK ] fields2cover_types_cells.Buffer (0 ms)
[ RUN      ] fields2cover_types_cells.Intersection
[       OK ] fields2cover_types_cells.Intersection (0 ms)
[ RUN      ] fields2cover_types_cells.LongLines
[       OK ] fields2cover_types_cells.LongLines (0 ms)
[ RUN      ] fields2cover_types_cells.WherePoint
[       OK ] fields2cover_types_cells.WherePoint (0 ms)
[ RUN      ] fields2cover_types_cells.setGeometry
[       OK ] fields2cover_types_cells.setGeometry (0 ms)
[ RUN      ] fields2cover_types_cells.splitByLine
[       OK ] fields2cover_types_cells.splitByLine (1 ms)
[ RUN      ] fields2cover_types_cells.isPointIn
[       OK ] fields2cover_types_cells.isPointIn (0 ms)
[----------] 9 tests from fields2cover_types_cells (1 ms total)

[----------] 3 tests from fields2cover_types_field
[ RUN      ] fields2cover_types_field.area
[       OK ] fields2cover_types_field.area (0 ms)
[ RUN      ] fields2cover_types_field.clone
[       OK ] fields2cover_types_field.clone (0 ms)
[ RUN      ] fields2cover_types_field.getCellsAbsPosition
[       OK ] fields2cover_types_field.getCellsAbsPosition (0 ms)
[----------] 3 tests from fields2cover_types_field (0 ms total)

[----------] 2 tests from fields2cover_types_geometries
[ RUN      ] fields2cover_types_geometries.access_iterators
[       OK ] fields2cover_types_geometries.access_iterators (0 ms)
[ RUN      ] fields2cover_types_geometries.mult_iterators
[       OK ] fields2cover_types_geometries.mult_iterators (0 ms)
[----------] 2 tests from fields2cover_types_geometries (0 ms total)

[----------] 19 tests from fields2cover_types_geometry
[ RUN      ] fields2cover_types_geometry.getAngContinuity
[       OK ] fields2cover_types_geometry.getAngContinuity (0 ms)
[ RUN      ] fields2cover_types_geometry.intersects
[       OK ] fields2cover_types_geometry.intersects (0 ms)
[ RUN      ] fields2cover_types_geometry.touches
[       OK ] fields2cover_types_geometry.touches (1 ms)
[ RUN      ] fields2cover_types_geometry.disjoint
[       OK ] fields2cover_types_geometry.disjoint (0 ms)
[ RUN      ] fields2cover_types_geometry.within
[       OK ] fields2cover_types_geometry.within (0 ms)
[ RUN      ] fields2cover_types_geometry.crosses
[       OK ] fields2cover_types_geometry.crosses (1 ms)
[ RUN      ] fields2cover_types_geometry.distance
[       OK ] fields2cover_types_geometry.distance (0 ms)
[ RUN      ] fields2cover_types_geometry.getDimMinX
[       OK ] fields2cover_types_geometry.getDimMinX (0 ms)
[ RUN      ] fields2cover_types_geometry.getDimMinY
[       OK ] fields2cover_types_geometry.getDimMinY (0 ms)
[ RUN      ] fields2cover_types_geometry.getDimMaxX
[       OK ] fields2cover_types_geometry.getDimMaxX (0 ms)
[ RUN      ] fields2cover_types_geometry.getDimMaxY
[       OK ] fields2cover_types_geometry.getDimMaxY (0 ms)
[ RUN      ] fields2cover_types_geometry.getHeight
[       OK ] fields2cover_types_geometry.getHeight (0 ms)
[ RUN      ] fields2cover_types_geometry.getWidth
[       OK ] fields2cover_types_geometry.getWidth (0 ms)
[ RUN      ] fields2cover_types_geometry.getMinSafeLength
[       OK ] fields2cover_types_geometry.getMinSafeLength (0 ms)
[ RUN      ] fields2cover_types_geometry.equality
[       OK ] fields2cover_types_geometry.equality (0 ms)
[ RUN      ] fields2cover_types_geometry.exportToGML
[       OK ] fields2cover_types_geometry.exportToGML (0 ms)
[ RUN      ] fields2cover_types_geometry.exportToKML
[       OK ] fields2cover_types_geometry.exportToKML (0 ms)
[ RUN      ] fields2cover_types_geometry.exportToJson
[       OK ] fields2cover_types_geometry.exportToJson (0 ms)
[ RUN      ] fields2cover_types_geometry.rotateFromPoint
[       OK ] fields2cover_types_geometry.rotateFromPoint (0 ms)
[----------] 19 tests from fields2cover_types_geometry (2 ms total)

[----------] 2 tests from fields2cover_types_linestring
[ RUN      ] fields2cover_types_linestring.init
[       OK ] fields2cover_types_linestring.init (0 ms)
[ RUN      ] fields2cover_types_linestring.loop
[       OK ] fields2cover_types_linestring.loop (0 ms)
[----------] 2 tests from fields2cover_types_linestring (0 ms total)

[----------] 4 tests from fields2cover_types_linearring
[ RUN      ] fields2cover_types_linearring.init
[       OK ] fields2cover_types_linearring.init (0 ms)
[ RUN      ] fields2cover_types_linearring.getArea
[       OK ] fields2cover_types_linearring.getArea (0 ms)
[ RUN      ] fields2cover_types_linearring.mult_equal
[       OK ] fields2cover_types_linearring.mult_equal (0 ms)
[ RUN      ] fields2cover_types_linearring.loop
[       OK ] fields2cover_types_linearring.loop (0 ms)
[----------] 4 tests from fields2cover_types_linearring (0 ms total)

[----------] 5 tests from fields2cover_types_multilinestring
[ RUN      ] fields2cover_types_multilinestring.init
[       OK ] fields2cover_types_multilinestring.init (0 ms)
[ RUN      ] fields2cover_types_multilinestring.getGeometry
[       OK ] fields2cover_types_multilinestring.getGeometry (0 ms)
[ RUN      ] fields2cover_types_multilinestring.append
[       OK ] fields2cover_types_multilinestring.append (0 ms)
[ RUN      ] fields2cover_types_multilinestring.setGeometry
[       OK ] fields2cover_types_multilinestring.setGeometry (0 ms)
[ RUN      ] fields2cover_types_multilinestring.getLineSegments
[       OK ] fields2cover_types_multilinestring.getLineSegments (0 ms)
[----------] 5 tests from fields2cover_types_multilinestring (0 ms total)

[----------] 2 tests from fields2cover_types_multipoint
[ RUN      ] fields2cover_types_multipoint.init
[       OK ] fields2cover_types_multipoint.init (0 ms)
[ RUN      ] fields2cover_types_multipoint.getGeometry
[       OK ] fields2cover_types_multipoint.getGeometry (0 ms)
[----------] 2 tests from fields2cover_types_multipoint (0 ms total)

[----------] 6 tests from fields2cover_types_path
[ RUN      ] fields2cover_types_path.appendSwath
[       OK ] fields2cover_types_path.appendSwath (0 ms)
[ RUN      ] fields2cover_types_path.op_plus_equal
[       OK ] fields2cover_types_path.op_plus_equal (0 ms)
[ RUN      ] fields2cover_types_path.populate_and_reduce
[       OK ] fields2cover_types_path.populate_and_reduce (3 ms)
[ RUN      ] fields2cover_types_path.length
[       OK ] fields2cover_types_path.length (0 ms)
[ RUN      ] fields2cover_types_path.serialize
[       OK ] fields2cover_types_path.serialize (0 ms)
[ RUN      ] fields2cover_types_path.moveTo
[       OK ] fields2cover_types_path.moveTo (0 ms)
[----------] 6 tests from fields2cover_types_path (3 ms total)

[----------] 10 tests from fields2cover_types_point
[ RUN      ] fields2cover_types_point.minus
[       OK ] fields2cover_types_point.minus (0 ms)
[ RUN      ] fields2cover_types_point.plus
[       OK ] fields2cover_types_point.plus (0 ms)
[ RUN      ] fields2cover_types_point.mult_equal
[       OK ] fields2cover_types_point.mult_equal (0 ms)
[ RUN      ] fields2cover_types_point.multiply
[       OK ] fields2cover_types_point.multiply (0 ms)
[ RUN      ] fields2cover_types_point.plus_v
[       OK ] fields2cover_types_point.plus_v (0 ms)
[ RUN      ] fields2cover_types_point.minus_v
[       OK ] fields2cover_types_point.minus_v (0 ms)
[ RUN      ] fields2cover_types_point.clone
[       OK ] fields2cover_types_point.clone (0 ms)
[ RUN      ] fields2cover_types_point.set
[       OK ] fields2cover_types_point.set (0 ms)
[ RUN      ] fields2cover_types_point.print
[       OK ] fields2cover_types_point.print (0 ms)
[ RUN      ] fields2cover_types_point.rotateFromPoint
[       OK ] fields2cover_types_point.rotateFromPoint (0 ms)
[----------] 10 tests from fields2cover_types_point (0 ms total)

[----------] 1 test from fields2cover_types_robot
[ RUN      ] fields2cover_types_robot.init
[       OK ] fields2cover_types_robot.init (0 ms)
[----------] 1 test from fields2cover_types_robot (0 ms total)

[----------] 1 test from fields2cover_types_route
[ RUN      ] fields2cover_types_route.init
[       OK ] fields2cover_types_route.init (0 ms)
[----------] 1 test from fields2cover_types_route (0 ms total)

[----------] 1 test from fields2cover_types_stip
[ RUN      ] fields2cover_types_stip.clone
[       OK ] fields2cover_types_stip.clone (1 ms)
[----------] 1 test from fields2cover_types_stip (1 ms total)

[----------] 8 tests from fields2cover_types_swath
[ RUN      ] fields2cover_types_swath.hasSameDir
[       OK ] fields2cover_types_swath.hasSameDir (0 ms)
[ RUN      ] fields2cover_types_swath.comparison
[       OK ] fields2cover_types_swath.comparison (0 ms)
[ RUN      ] fields2cover_types_swath.length
[       OK ] fields2cover_types_swath.length (0 ms)
[ RUN      ] fields2cover_types_swath.set_id
[       OK ] fields2cover_types_swath.set_id (0 ms)
[ RUN      ] fields2cover_types_swath.width
[       OK ] fields2cover_types_swath.width (0 ms)
[ RUN      ] fields2cover_types_swath.area
[       OK ] fields2cover_types_swath.area (0 ms)
[ RUN      ] fields2cover_types_swath.angles
[       OK ] fields2cover_types_swath.angles (0 ms)
[ RUN      ] fields2cover_types_swath.start_and_end_points
[       OK ] fields2cover_types_swath.start_and_end_points (0 ms)
[----------] 8 tests from fields2cover_types_swath (0 ms total)

[----------] 4 tests from fields2cover_types_swaths
[ RUN      ] fields2cover_types_swaths.append
[       OK ] fields2cover_types_swaths.append (1 ms)
[ RUN      ] fields2cover_types_swaths.sort
[       OK ] fields2cover_types_swaths.sort (0 ms)
[ RUN      ] fields2cover_types_swaths.reverseDirOddSwaths
[       OK ] fields2cover_types_swaths.reverseDirOddSwaths (0 ms)
[ RUN      ] fields2cover_types_swaths.push_back
[       OK ] fields2cover_types_swaths.push_back (0 ms)
[----------] 4 tests from fields2cover_types_swaths (1 ms total)

[----------] 6 tests from fields2cover_utils_parser
[ RUN      ] fields2cover_utils_parser.import_gml
[       OK ] fields2cover_utils_parser.import_gml (3 ms)
[ RUN      ] fields2cover_utils_parser.get_area_imported
[       OK ] fields2cover_utils_parser.get_area_imported (8 ms)
[ RUN      ] fields2cover_utils_parser.file_not_found
[       OK ] fields2cover_utils_parser.file_not_found (1 ms)
[ RUN      ] fields2cover_utils_parser.import_json
Segmentation fault (core dumped)

Spiral route pattern won't work as expected if bulk of swaths is bigger than 6

The spiral pattern do not behave as expected on the central swaths. The expected behavior is to have all the swaths on the right in one direction, and opposite direction for the left ones.

field_circular

Code used:

import fields2cover as f2c
import math

robot = f2c.Robot(2.5, 2.5);
robot.cruise_speed = 2.0;
robot.max_icc = 0.5;
robot.linear_curv_change = 1.0;

line = f2c.LinearRing(f2c.VectorPoint(
[f2c.Point(), f2c.Point(1e2,0), f2c.Point(1e2,5e1), f2c.Point(0,5e1), f2c.Point(0,0)]));
cell = f2c.Cell(line);

hl_gen = f2c.HG_Const_gen()
no_hl = hl_gen.generateHeadlands(f2c.Cells(cell), 5.5);
 
bf_sw_gen = f2c.SG_BruteForce()
swaths = bf_sw_gen.generateSwaths(0, robot.op_width, no_hl.getGeometry(0))
swath_order = f2c.RP_Spiral(36)
swaths = swath_order.genSortedSwaths(swaths)
 
dubins = f2c.PP_DubinsCurvesCC();
path_planner = f2c.PP_PathPlanning();
path = path_planner.searchBestPath(robot,swaths, dubins);

f2c.Visualizer.figure(1000)
f2c.Visualizer.plot(cell)
f2c.Visualizer.plot(no_hl)
f2c.Visualizer.plot(path)
f2c.Visualizer.plot(swaths)
f2c.Visualizer.save("field_circular.png")

pytest-3 error

Hi author, after I run "pytest-3", many errors like the following occur !

______________________________ ERROR collecting tests/python/import_f2c_test.py _______________________________
ImportError while importing test module '/home/lgg/Fields2Cover/tests/python/import_f2c_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/python/import_f2c_test.py:9: in
import fields2cover as f2c
E ModuleNotFoundError: No module named 'fields2cover'

roslaunch error

Hello Author , When I run "roslaunch", the terminal reports the following error:
terminate called after throwing an instance of 'std::invalid_argument'
what(): File not found
What is the reason?

cmake does not check if gtest is installed

The cmake is not checking if gtest is installed in the system and fails during the compilation with missing headers:

Fields2Cover/tests/cpp/headland_generator/const_hl_test.cpp:7:10: fatal error: gtest/gtest.h: Nie ma takiego pliku ani katalogu
7 | #include <gtest/gtest.h>
| ^~~~~~~~~~~~~~~

How to save the produced path points into a json file

Hi @Gonzalo-Mier,
I would like to save the generated path points into a Geojson file,
Can you please direct me on, how to do it?

I am using fields2cover_ros for visulization of ganerated paths,
I am getting good results with it.
Now I am interested in saving all the produced path GPS points into a JSON file(another file). so that I can use it on my vehicle.

I am confused with the coordinate frame of the points at the below block of code.
(https://github.com/Fields2Cover/fields2cover_ros/blob/master/src/Fields2CoverVisualizerNode.cpp#L160)

Segmentation fault when generating headland

Hi,

Thanks for developing this library.

I was trying to generate paths for a field with custom dimensions using Python. However, I ended up with a Segmentation fault . After a long time debugging, I found the cause: the dist_headland parameter in generateHeadlands was larger than the 0.5 * width of field. Which of course make sense that this is not possible, however it was quite difficult to debug. See example code blow:

import math

import fields2cover as f2c

rand = f2c.Random(42)
robot = f2c.Robot(11.0, 11.0)
const_hl = f2c.HG_Const_gen()

field_border = f2c.LinearRing()
field_border.addPoint(0, 0)
field_border.addPoint(0, 100)
field_border.addPoint(100, 100)
field_border.addPoint(100, 0)
field_border.addPoint(field_border.StartPoint())

field_cell = f2c.Cell()
field_cell.addRing(field_border)

field = f2c.Field()
field.field.addGeometry(field_cell)

# field = rand.generateRandField(4, 1e5)
cells = field.field
no_hl = const_hl.generateHeadlands(cells,50) # <- segmentation fault
# no_hl = const_hl.generateHeadlands(cells,49) # <- fine
bf = f2c.SG_BruteForce()
swaths = bf.generateSwaths(math.pi, robot.op_width, no_hl.getGeometry(0))
snake_sorter = f2c.RP_Snake()
swaths = snake_sorter.genSortedSwaths(swaths)

f2c.Visualizer.figure(100)
f2c.Visualizer.plot(field)
# f2c.Visualizer.plot(no_hl)
# f2c.Visualizer.plot(snake_sorter)
f2c.Visualizer.plot(swaths)
f2c.Visualizer.show()

Maybe it is an idea to print a warning when this is the case, when dist_headland is larger than 0.5 * width or height of field. That can make debugging much easier.

Route planning with custom pattern

Create a route planner that in the constructor you could add the pattern you want and it sort the swaths following that order.

Versions of the spiral pattern could be coded with this planner as:
f2c::rp::CustomOrder sorter(swaths, {1, 2});
or
f2c::rp::CustomOrder sorter(swaths, {6, 1, 5, 2, 4, 3});
or
f2c::rp::CustomOrder sorter(swaths, {1, 6, 2, 5, 3, 4});

import fields2cover not working. (help)

System

Operating System: Ubuntu 20.04.5 LTS
Kernel: Linux 5.15.0-56-generic
Architecture: x86-64

Error msg:

 sudo make install;
[sudo] password for boson: 
[ 16%] Built target steering_functions
[ 17%] Built target tinyxml2
[ 51%] Built target Fields2Cover
[ 53%] Built target xmltest
[ 54%] Built target 1_basic_types_tutorial
[ 56%] Built target 4_swath_generator_tutorial
[ 57%] Built target 3_headland_generator_tutorial
[ 59%] Built target 5_route_planning_tutorial
[ 60%] Built target 6_path_planning_tutorial
[ 62%] Built target 2_objective_functions_tutorial
[ 62%] Built target fields2cover_python_swig_compilation
[ 64%] Built target fields2cover_python
[100%] Built target unittests
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /usr/local/lib/libtinyxml2.a
-- Up-to-date: /usr/local/lib/cmake/tinyxml2/tinyxml2-static-targets.cmake
-- Installing: /usr/local/lib/cmake/tinyxml2/tinyxml2-static-targets-release.cmake
-- Up-to-date: /usr/local/lib/cmake/tinyxml2/tinyxml2-config.cmake
-- Up-to-date: /usr/local/lib/cmake/tinyxml2/tinyxml2-config-version.cmake
-- Up-to-date: /usr/local/include/tinyxml2.h
-- Up-to-date: /usr/local/lib/pkgconfig/tinyxml2.pc
-- Up-to-date: /usr/local/lib/libsteering_functions.a
-- Up-to-date: /usr/local/cmake/spline/splineTargets.cmake
-- Installing: /usr/local/cmake/spline/splineConfig.cmake
-- Up-to-date: /usr/local/include/spline.h
-- Up-to-date: /usr/local/cmake/matplotlib_cpp/matplotlib_cppTargets.cmake
-- Installing: /usr/local/cmake/matplotlib_cpp/matplotlib_cppConfig.cmake
-- Up-to-date: /usr/local/include/matplotlibcpp.h
-- Up-to-date: /usr/local/lib/libFields2Cover.so
-- Up-to-date: /usr/local/include/fields2cover.h
-- Up-to-date: /usr/local/cmake/fields2cover/Fields2CoverTargets.cmake
-- Installing: /usr/local/cmake/fields2cover/Fields2CoverTargets-release.cmake
-- Up-to-date: /usr/local/cmake/fields2cover/Fields2CoverConfig.cmake
-- Installing: /usr/local/cmake/fields2cover/Fields2CoverConfigVersion.cmake
-- Up-to-date: /usr/local/share/Fields2Cover/package.xml
-- Up-to-date: /usr/local/include
-- Up-to-date: /usr/local/include/fields2cover
-- Up-to-date: /usr/local/include/fields2cover/objectives
-- Up-to-date: /usr/local/include/fields2cover/objectives/overlaps.h
-- Up-to-date: /usr/local/include/fields2cover/objectives/complete_turn_path_obj.h
-- Up-to-date: /usr/local/include/fields2cover/objectives/field_coverage.h
-- Up-to-date: /usr/local/include/fields2cover/objectives/direct_dist_path_obj.h
-- Up-to-date: /usr/local/include/fields2cover/objectives/n_swath.h
-- Up-to-date: /usr/local/include/fields2cover/objectives/sg_objective.h
-- Up-to-date: /usr/local/include/fields2cover/objectives/path_length.h
-- Up-to-date: /usr/local/include/fields2cover/objectives/pp_objective.h
-- Up-to-date: /usr/local/include/fields2cover/objectives/rp_objective.h
-- Up-to-date: /usr/local/include/fields2cover/objectives/base_objective.h
-- Up-to-date: /usr/local/include/fields2cover/objectives/hg_objective.h
-- Up-to-date: /usr/local/include/fields2cover/objectives/rem_area.h
-- Up-to-date: /usr/local/include/fields2cover/objectives/swath_length.h
-- Up-to-date: /usr/local/include/fields2cover/route_planning
-- Up-to-date: /usr/local/include/fields2cover/route_planning/boustrophedon_order.h
-- Up-to-date: /usr/local/include/fields2cover/route_planning/single_cell_swaths_order_base.h
-- Up-to-date: /usr/local/include/fields2cover/route_planning/custom_order.h
-- Up-to-date: /usr/local/include/fields2cover/route_planning/spiral_order.h
-- Up-to-date: /usr/local/include/fields2cover/route_planning/snake_order.h
-- Up-to-date: /usr/local/include/fields2cover/types
-- Up-to-date: /usr/local/include/fields2cover/types/Point.h
-- Up-to-date: /usr/local/include/fields2cover/types/Robot.h
-- Up-to-date: /usr/local/include/fields2cover/types/Swaths.h
-- Up-to-date: /usr/local/include/fields2cover/types/LineString.h
-- Up-to-date: /usr/local/include/fields2cover/types/LinearRing.h
-- Up-to-date: /usr/local/include/fields2cover/types/Geometry_impl.hpp
-- Up-to-date: /usr/local/include/fields2cover/types/Swath.h
-- Up-to-date: /usr/local/include/fields2cover/types/Cell.h
-- Up-to-date: /usr/local/include/fields2cover/types/Geometries.h
-- Up-to-date: /usr/local/include/fields2cover/types/MultiPoint.h
-- Up-to-date: /usr/local/include/fields2cover/types/MultiLineString.h
-- Up-to-date: /usr/local/include/fields2cover/types/Route.h
-- Up-to-date: /usr/local/include/fields2cover/types/Field.h
-- Up-to-date: /usr/local/include/fields2cover/types/Geometries_impl.hpp
-- Up-to-date: /usr/local/include/fields2cover/types/OptimizationParams.h
-- Up-to-date: /usr/local/include/fields2cover/types/Geometry.h
-- Up-to-date: /usr/local/include/fields2cover/types/Strip.h
-- Up-to-date: /usr/local/include/fields2cover/types/Cells.h
-- Up-to-date: /usr/local/include/fields2cover/types/Path.h
-- Up-to-date: /usr/local/include/fields2cover/swath_generator
-- Up-to-date: /usr/local/include/fields2cover/swath_generator/swath_generator_base_impl.hpp
-- Up-to-date: /usr/local/include/fields2cover/swath_generator/swath_generator_base.h
-- Up-to-date: /usr/local/include/fields2cover/swath_generator/brute_force.h
-- Up-to-date: /usr/local/include/fields2cover/path_planning
-- Up-to-date: /usr/local/include/fields2cover/path_planning/reeds_shepp_curves.h
-- Up-to-date: /usr/local/include/fields2cover/path_planning/turning_base.h
-- Up-to-date: /usr/local/include/fields2cover/path_planning/dubins_curves_cc.h
-- Up-to-date: /usr/local/include/fields2cover/path_planning/reeds_shepp_curves_hc.h
-- Up-to-date: /usr/local/include/fields2cover/path_planning/path_planning.h
-- Up-to-date: /usr/local/include/fields2cover/path_planning/dubins_curves.h
-- Up-to-date: /usr/local/include/fields2cover/path_planning/steer_to_path.hpp
-- Up-to-date: /usr/local/include/fields2cover/headland_generator
-- Up-to-date: /usr/local/include/fields2cover/headland_generator/constant_headland.h
-- Up-to-date: /usr/local/include/fields2cover/headland_generator/headland_generator_base.h
-- Up-to-date: /usr/local/include/fields2cover/utils
-- Up-to-date: /usr/local/include/fields2cover/utils/visualizer.h
-- Up-to-date: /usr/local/include/fields2cover/utils/transformation.h
-- Up-to-date: /usr/local/include/fields2cover/utils/random.h
-- Up-to-date: /usr/local/include/fields2cover/utils/parser.h
-- Up-to-date: /usr/local/include/fields2cover/types.h
-- Up-to-date: /usr/local/include/fields2cover.h
running install
/usr/local/lib/python3.8/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(

Issue

$ python

Python 3.8.10 (default, Nov 14 2022, 12:59:47) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fields2cover
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'fields2cover'

Max_Icc and Set Radius

So looking at this

- *max_icc*: is the maximum Instantaneous Center of Curvature on a turn. It's the inverse of the radius. It's preferable to use the function ``setMinRadius(double)``.
I realized the robot.max_icc is set by the setMinRadius function, but can also be accessed directly and modified.

I ran into some unexpected behavior since I was calling setMinRadius but then also setting max_icc manually, which should be setting the same thing, essentially.

Would you be open to making max_icc private to the robot and only allowing that value to be set via setMinRadius publically to prevent future confusion?

ERROR: PluginlibFactory

Hello,

After installed the Fields2Cover ROS version (I am using Ubuntu 20.04) and run it with roslaunch fields2cover_ros view_field.launch
I got the following error. In RViz, the AerialMapDisplay is red which is not working. The demo.rviz is open but The /Visualizer cannot be opened as shown in your example. Would you please help me on the issue? Any instruction how to run the path planing?

Thanks!

Best Regards,

wen@wen-ubuntu:~/catkin_ws/Fields2Cover$ roslaunch fields2cover_ros view_field.launch
... logging to /home/wen/.ros/log/624f0de4-8ab0-11ed-a91a-55903af4772a/roslaunch-wen-ubuntu-35234.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://wen-ubuntu:37359/

SUMMARY
========

PARAMETERS
 * /rosdistro: noetic
 * /rosversion: 1.15.15
 * /visualizer/field_file: /home/wen/catkin_...

NODES
  /
    rqt_reconfigure (rqt_reconfigure/rqt_reconfigure)
    rviz (rviz/rviz)
    static_tf_fake (tf2_ros/static_transform_publisher)
    visualizer (fields2cover_ros/visualizer_node)

auto-starting new master
process[master]: started with pid [35253]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 624f0de4-8ab0-11ed-a91a-55903af4772a
process[rosout-1]: started with pid [35274]
started core service [/rosout]
process[visualizer-2]: started with pid [35277]
process[rviz-3]: started with pid [35281]
process[rqt_reconfigure-4]: started with pid [35283]
process[static_tf_fake-5]: started with pid [35284]

[ERROR] [1672672571.230346043]: PluginlibFactory: The plugin for class 'rviz_plugins/AerialMapDisplay' failed to load.  Error: According to the loaded plugin descriptions the class rviz_plugins/AerialMapDisplay with base class type rviz::Display does not exist. Declared types are  rviz/AccelStamped rviz/Axes rviz/Camera rviz/DepthCloud rviz/Effort rviz/FluidPressure rviz/Grid rviz/GridCells rviz/Illuminance rviz/Image rviz/InteractiveMarkers rviz/LaserScan rviz/Map rviz/Marker rviz/MarkerArray rviz/Odometry rviz/Path rviz/PointCloud rviz/PointCloud2 rviz/PointStamped rviz/Polygon rviz/Pose rviz/PoseArray rviz/PoseWithCovariance rviz/Range rviz/RelativeHumidity rviz/RobotModel rviz/TF rviz/Temperature rviz/TwistStamped rviz/WrenchStamped rviz_plugin_tutorials/Imu

Planning of Loops

I have noticed that f2c plans loops for turns that seem tighter than what we would need.

Figure_100

Minimal example

import fields2cover as f2c

if __name__ == '__main__':
    # field
    rand = f2c.Random(42);
    field = rand.generateRandField(5, 1e4);
    cells = field.field;
    # robot
    robot = f2c.Robot(2.0, 2.0);
    robot.setMinRadius(1.0)
    # headlands
    const_hl = f2c.HG_Const_gen();
    no_hl = const_hl.generateHeadlands(cells, 3.0 * robot.robot_width);
    # swaths
    n_swath = f2c.OBJ_NSwath();
    bf_sw_gen = f2c.SG_BruteForce();
    swaths_bf_nswath = bf_sw_gen.generateBestSwaths(n_swath, robot.op_width, no_hl.getGeometry(0))
    # swath ordering
    boustrophedon_sorter = f2c.RP_Boustrophedon()
    swaths = boustrophedon_sorter.genSortedSwaths(swaths_bf_nswath)
    # path
    path_planner = f2c.PP_PathPlanning()
    dubins_cc = f2c.PP_DubinsCurvesCC()
    path_dubins_cc = path_planner.searchBestPath(robot, swaths, dubins_cc)
    # show
    f2c.Visualizer.figure(100)
    f2c.Visualizer.plot(path_dubins_cc)
    f2c.Visualizer.show()

This seems to happen for different turning radii as well.
It definitely seems like maybe this is something related to the way f2c is using steering_functions dependency?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.