Repository navigation
Migrate to Fields2Cover v2 (Humble) - #105
SteveMacenski merged 11 commits into
Conversation
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.
There was a problem hiding this comment.
Pull request overview
Migrates opennav_coverage and opennav_row_coverage from Fields2Cover v1.2.1 to Fields2Cover v2 (API updates to match v2.0.0), including updates in servers, generators, utilities, and unit tests to preserve the existing coverage-planning behavior.
Changes:
- Updated code to Fields2Cover v2 API (encapsulated members/accessors, renamed methods, updated robot model, swath/path planner API changes).
- Updated tests to reflect v2 defaults and signature changes (e.g.,
generateRandFieldargument order,PathState::typedefault). - Updated build/linking to explicitly link GDAL and adjust Fields2Cover/TinyXML2 target discovery.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| opennav_row_coverage/src/row_swath_generator.cpp | Updates LineString endpoint API to v2 camelCase accessors. |
| opennav_row_coverage/src/row_coverage_server.cpp | Uses new F2CField accessors and robot setters in dynamic params callback. |
| opennav_row_coverage/package.xml | Switches TinyXML2 dependency to tinyxml2_vendor. |
| opennav_row_coverage/CMakeLists.txt | Adds GDAL + TinyXML2 vendor discovery and conditional Fields2Cover target selection/linking. |
| opennav_coverage/test/test_utils.cpp | Updates Path state access and adjusts tests for v2 PathState::type defaults. |
| opennav_coverage/test/test_swath.cpp | Updates random field generator signature and F2CField accessor usage. |
| opennav_coverage/test/test_route.cpp | Updates random field generator signature and F2CField accessor usage. |
| opennav_coverage/test/test_robot.cpp | Updates robot model access to v2 getter. |
| opennav_coverage/test/test_path.cpp | Updates random field generator signature and F2CField accessor usage. |
| opennav_coverage/test/test_headland.cpp | Updates random field generator signature and F2CField accessor usage. |
| opennav_coverage/src/swath_generator.cpp | Updates BruteForce swath generator API to setStepAngle(). |
| opennav_coverage/src/path_generator.cpp | Updates path planner API (planPath) and turn discretization handling. |
| opennav_coverage/src/coverage_server.cpp | Uses F2CField v2 accessors and robot setters in dynamic params callback. |
| opennav_coverage/include/opennav_coverage/utils.hpp | Reworks Path state access to v2 (size()/operator[]/back()). |
| opennav_coverage/include/opennav_coverage/types.hpp | Removes duplicate LineString typedef in favor of F2CLineString. |
| opennav_coverage/include/opennav_coverage/robot_params.hpp | Migrates robot parameter initialization/access to v2 setters/getters. |
| opennav_coverage/CMakeLists.txt | Adds GDAL dependency and conditional Fields2Cover target selection + system includes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) | ||
|
|
||
| target_link_libraries(${executable_name} Fields2Cover tinyxml2::tinyxml2) | ||
| target_link_libraries(${executable_name} ${FIELDS2COVER_LIBRARIES} tinyxml2::tinyxml2 GDAL::GDAL) |
- Bump actions/upload-artifact v1->v4 and actions/checkout v2->v4; the v1 artifact action is disabled by GitHub and failed the build job before it ran. - Pin Fields2Cover in deps.repos to the v2.0.0 release tag (built from source) instead of main, for reproducible CI matching the migrated version.
|
Note: this PR also includes small CI fixes (upload-artifact/checkout action bumps + pinning F2C to v2.0.0 in deps.repos) — humble's build job was failing on the now-disabled upload-artifact@v1 before any build ran. Happy to split these into a separate PR if you'd prefer. |
|
Also worth noting: Fields2Cover v2 is now available as a binary package — apt-get install ros-humble-fields2cover (currently 2.0.0) — so a from-source install is no longer required for local development. rosdep resolves the fields2cover key to it directly, and both packages build and pass tests against the apt package as well as a from-source build. CI still pins F2C to v2.0.0 from source in deps.repos for reproducibility. |
|
Can we update the |
Thanks for the direction, a few thoughts:
Happy to work on the main migration together — just point me in the right direction if there's anything specific you'd like done differently for Jazzy/Rolling, and I'll get it done. |
|
Cool, I've retargeted the base to humble-v2 and updated the README accordingly. Good to merge whenever you'd like. |
|
I'll merge this when paired with the |
|
Sounds good. I just started working on the Jazzy migration — I'll keep you posted. The plan is the same as humble: first resolve any API breaking changes for main, validate on both Jazzy and Rolling, then we can plan for new features from there. |
|
@SteveMacenski quick question —does main currently target Rolling only, or both Jazzy and Rolling? I'm running into some issues trying to support both and want to make sure I'm targeting the right distributions. Update: I've got it building on both Jazzy and Rolling now. |
|
My bad on the update above — that was entirely on me. I'd assumed The actual failure on Jazzy is in That looks like the newer |
|
Hi @SteveMacenski — sorry for the frequent messages. Good news first: inside dev containers, The wall I'm now hitting on Rolling CI:
What I tried (chronologically):
I've worked through several layers of this, but I'm honestly unsure what shape you'd want the CI to take here — so I'd really appreciate your guidance on the right approach before I keep pushing in a particular direction. I'm still actively working on it in the meantime, and happy to take whatever direction you prefer. |
|
Opened the |
Main targets rolling only. Jazzy or others are 'nice to have' but not required. Did you figure out your issues? |
Summary
Migrates
opennav_coverageandopennav_row_coveragefrom Fields2Cover 1.2.1 to Fields2Cover v2 (verified againstv2.0.0). 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.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.
Changes
Each commit is scoped to one migration area:
types.hppLineStringtypedefF2CRobotpublic fields → setters/getters (setWidth/setCovWidth/setMinTurningRadius/setMaxDiffCurv,getWidth/getCovWidth); same in both dynamic-parameter callbacksBruteForce::step_anglefield →setStepAngle()PathPlanning::searchBestPath→planPath;turn_point_distfield →TurningBase::setDiscretization()F2CFieldcoord_sys/fieldmembers →getCRS()/getField()utils.hppPath::states→operator[]/size()/back()(now private)LineString::StartPoint()/EndPoint()→ camelCasestartPoint()/endPoint()generateRandFieldargument order (swapped in v2) andPathState::typenow defaulting toSWATHHeadland and route generators required no source changes (their APIs are unchanged in v2).
Build system
GDAL::GDALexplicitly — v2's CMake target no longer propagates GDAL as an interface dependency, so consumers emitting OGR symbols inline must link it themselves.opennav_row_coverageviatinyxml2_vendor+find_package(TinyXML2)(the systemlibtinyxml2-devships no CMake config).Fields2Coverfor source installs,Fields2Cover::Fields2Coverfor the ROS/apt package) and mark F2C headers as SYSTEM includes so their own-Wshadowwarnings do not break this-Werrorbuild.Validation
v2.0.0(tested with the ROS apt packageros-humble-fields2coverand a from-source install).Behavioral validation (RViz)
Coverage plan for a 50×50 m cartesian field: outer boundary (green), headland-inset planning field (orange), parallel swaths, and connecting Dubins turns.
Notes
v2.0.0tag. Behavioral parity with v1 (e.g. turn-point density viasetDiscretizationvs the oldturn_point_dist) was sanity-checked visually; a deterministic golden-output test would be a good follow-up.