Skip to content

Migrate to Fields2Cover v2 (Jazzy) - #109

Merged
SteveMacenski merged 10 commits into
open-navigation:jazzy-v2from
u33549:Feature/umutc/fields2cover2-jazzy
Jun 30, 2026
Merged

SteveMacenski merged 10 commits into
open-navigation:jazzy-v2from
u33549:Feature/umutc/fields2cover2-jazzy

Conversation

@u33549

@u33549 u33549 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates opennav_coverage and opennav_row_coverage from Fields2Cover 1.2.1 to Fields2Cover v2 (verified against v2.0.0) on the jazzy branch. All breaking API usage is updated so both packages build and pass their tests against F2C v2, with no intended behavioral change to the coverage pipeline.

This is the jazzy counterpart to the humble-v2 migration (PR #105), ported via cherry-pick (zero conflicts — the jazzy branch shares the same nav2_util-based API as humble).

Motivation

Fields2Cover v2 introduced several breaking API changes: encapsulated data models (private members + accessors), renamed methods, and a restructured robot model. This brings the coverage server stack up to date with the current F2C release on the Jazzy distribution.

Changes

Each commit is scoped to one migration area:

Area Change
types.hpp Remove duplicate LineString typedef
Robot model F2CRobot public fields → setters/getters (setWidth/setCovWidth/setMinTurningRadius/setMaxDiffCurv, getWidth/getCovWidth); same in both dynamic-parameter callbacks
Swath BruteForce::step_angle field → setStepAngle()
Path PathPlanning::searchBestPath → planPath; turn_point_dist field → TurningBase::setDiscretization()
Coverage servers F2CField coord_sys/field members → getCRS()/getField()
utils.hpp Path::states → operator[]/size()/back() (now private)
Row swath LineString::StartPoint()/EndPoint() → camelCase startPoint()/endPoint()
Tests Updated to v2 API; fixed generateRandField argument order (swapped in v2) and PathState::type now defaulting to SWATH

Headland and route generators required no source changes (their APIs are unchanged in v2).

Build system

  • Link GDAL::GDAL explicitly — v2's CMake target no longer propagates GDAL as an interface dependency.
  • Resolve tinyxml2 in opennav_row_coverage via tinyxml2_vendor + find_package(TinyXML2) (the system libtinyxml2-dev ships no CMake config).
  • Select the F2C target by name (Fields2Cover for source installs, Fields2Cover::Fields2Cover for the ROS/apt package) and mark F2C headers as SYSTEM includes so their own -Wshadow warnings do not break this -Werror build.
  • Add <depend>libgdal-dev</depend> to both package.xml files (GDAL::GDAL is now linked explicitly but was not declared as a rosdep dependency).

Validation

  • Both packages build against F2C v2.0.0 (tested with the ROS apt package ros-jazzy-fields2cover).
  • All unit tests pass: 207 tests, 0 failures.

Notes

Verified against the F2C v2.0.0 tag. Behavioral parity with v1 (e.g. turn-point density via setDiscretization vs the old turn_point_dist) was sanity-checked visually; a deterministic golden-output test would be a good follow-up.

This PR also includes small CI fixes (upload-artifact/checkout action bumps to v4, action-ros-ci to v0.4, and pinning F2C to v2.0.0 in deps.repos).

Fields2Cover v2 is available as a binary package on Jazzy — apt-get install ros-jazzy-fields2cover (currently 2.0.0) — so a from-source install is no longer required. rosdep resolves the fields2cover key to it directly, and both packages build and pass tests against the apt package. CI still pins F2C to v2.0.0 from source in deps.repos for reproducibility.

u33549 added 10 commits June 28, 2026 11:31
Fields2Cover v2 changed several build-time integration details. Update
both packages' CMake so they build against v2 regardless of how F2C is
installed (source under /usr/local or the ROS apt package
ros-humble-fields2cover under /opt/ros):

- Link GDAL explicitly (GDAL::GDAL). v2's exported target no longer
  propagates GDAL as an interface dependency, so consumers that emit OGR
  symbols inline must link it themselves.
- Resolve tinyxml2 in opennav_row_coverage via tinyxml2_vendor +
  find_package(TinyXML2); the system libtinyxml2-dev ships no CMake config.
- Select the Fields2Cover target by name: source installs expose
  'Fields2Cover', the ROS/apt package exposes 'Fields2Cover::Fields2Cover'.
- Mark Fields2Cover headers as SYSTEM includes so their own warnings
  (e.g. -Wshadow in objectives/rp_obj/*) do not break this -Werror build
  when F2C lives outside the default system include path.
- deps.repos: pin Fields2Cover from v1.2.1-devel to v2.0.0 release tag
- lint.yml / test.yml: bump actions/checkout v2→v4, action-ros-ci v0.3→v0.4
- .gitignore: exclude local dev files (.devcontainer, Fields2Cover, audit docs)
- README: update Fields2Cover installation section to reflect v2 requirement
Copilot AI review requested due to automatic review settings June 28, 2026 09:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@SteveMacenski SteveMacenski left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retarget to jazzy-v2

Otherwise LGTM

@u33549
u33549 changed the base branch from jazzy to jazzy-v2 June 29, 2026 17:43
@SteveMacenski
SteveMacenski merged commit 5f43727 into open-navigation:jazzy-v2 Jun 30, 2026
7 checks passed
@u33549 u33549 changed the title Port Fields2Cover v1.2.1 → v2.0.0 to the jazzy branch Migrate to Fields2Cover v2 (Jazzy) Jun 30, 2026
@u33549
u33549 deleted the Feature/umutc/fields2cover2-jazzy branch July 15, 2026 22:45
@SirAbsolute0

Copy link
Copy Markdown

Hello, I am on Ros Jazzy with F2C installed via sudo apt install ros-jazzy-fields2cover. After cloning, switching to the opennav_coverage jazzy-v2 branch, and running colcon build. I am getting this error:

--- stderr: opennav_coverage                              
/home/peter/ws/src/opennav_coverage/opennav_coverage/src/route_method.cpp: In member function ‘virtual F2CRoute opennav_coverage::TspRouteMethod::plan(const F2CCells&, const F2CSwathsByCells&, const opennav_coverage_msgs::msg::RouteMode&, const std::optional<f2c::types::Point>&)’:
/home/peter/ws/src/opennav_coverage/opennav_coverage/src/route_method.cpp:81:23: error: no matching function for call to ‘f2c::rp::RoutePlannerBase::genRoute(const F2CCells&, const F2CSwathsByCells&, bool, const double&, const bool&, const long int&, const bool&)’
   81 |     return rp.genRoute(
      |            ~~~~~~~~~~~^
   82 |       cells, swaths_by_cells, false, d_tol, redirect_swaths, time_limit, search_for_optimum);
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/ros/jazzy/include/fields2cover.h:60,
                 from /home/peter/ws/src/opennav_coverage/opennav_coverage/include/opennav_coverage/route_method.hpp:22,
                 from /home/peter/ws/src/opennav_coverage/opennav_coverage/src/route_method.cpp:17:
/opt/ros/jazzy/include/fields2cover/route_planning/route_planner_base.h:34:20: note: candidate: ‘virtual F2CRoute f2c::rp::RoutePlannerBase::genRoute(const F2CCells&, const F2CSwathsByCells&, bool, double, bool)’
   34 |   virtual F2CRoute genRoute(
      |                    ^~~~~~~~
/opt/ros/jazzy/include/fields2cover/route_planning/route_planner_base.h:34:20: note:   candidate expects 5 arguments, 7 provided
/home/peter/ws/src/opennav_coverage/opennav_coverage/src/route_method.cpp:105:38: error: no matching function for call to ‘f2c::rp::RoutePlannerBase::genRoute(F2CCells&, F2CSwathsByCells&, bool, const double&, const bool&, const long int&, const bool&)’
  105 |     F2CRoute cell_route = rp.genRoute(
      |                           ~~~~~~~~~~~^
  106 |       cell, cell_swaths, false, d_tol, redirect_swaths, time_limit, search_for_optimum);
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/ros/jazzy/include/fields2cover/route_planning/route_planner_base.h:34:20: note: candidate: ‘virtual F2CRoute f2c::rp::RoutePlannerBase::genRoute(const F2CCells&, const F2CSwathsByCells&, bool, double, bool)’
   34 |   virtual F2CRoute genRoute(
/opt/ros/jazzy/include/fields2cover/route_planning/route_planner_base.h:34:20: note:   candidate expects 5 arguments, 7 provided
gmake[2]: *** [CMakeFiles/opennav_coverage_core.dir/build.make:146: CMakeFiles/opennav_coverage_core.dir/src/route_method.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:190: CMakeFiles/opennav_coverage_core.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< opennav_coverage [2.94s, exited with code 2]

I am assuming this has to do with the API changes, and is this expected since the migration is still ongoing?

@u33549

u33549 commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @SirAbsolute0, Binary installation was supported until the 128th pr, but unfortunately this is no longer possible after that.
#128

Edit: Jazzy-v2 integration is not complete yet, I'm still working on it, but if you want to use it only with F2CV2 instead of trying new features, you can return to this PR from your git history.

@SirAbsolute0

Copy link
Copy Markdown

@u33549 Thank you for the comment. It was because of the pre-built binary.

@u33549

u33549 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

I'm glad the problem has been solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants