Skip to content

Commit 1942505

Browse files
authored
Update to Jazzy/Rolling with F2C v1.2.1 (#82)
* [coverage_planning] make it build on rolling with F2C v1.2.1 * fix Werror=maybe-uninitialized * restore tests and add missing ament_index_cpp to CMakeLists * update demo launcher for Gazebo Ignition * explicitly add models to avoid errors * move robot pose and polygon to (0,0) In GZ Ignition, tb3 publishes its ground truth pose as odometry with respect to its start position. Even when spawning the model at (5,5), the map->base_link transform is 0 because the robot did not drive. This causes navigation to fail as the robot pose is too far from the start of the path. * Add .gitignore Copied from ros-navigation/navigation2 * Restore robot pose & polygon to (5,5) and add (5,5) to map->odom tf as it is the transform from world/map frame to the robot's initial pose * Update row_coverage_demo_launch.py to Gazebo Ignition * Note on F2C version * Update test workflow * lint and format * add BTCPP_format to BT xmls * CI: change F2C branch and update to Jazzy & Noble * try F2C v1.2.1 * [tmp] ignore F2C compile errors * Update lint step to jazzy * test with cartesian polygon * Revert "try F2C v1.2.1" This reverts commit cb65987. * Revert "[tmp] ignore F2C compile errors" This reverts commit 8164091. * [tmp] rm failing test in opennav_coverage_bt * switch test to cartesian_frame * restore non-cartesian field test * Revert "[tmp] rm failing test in opennav_coverage_bt" This reverts commit 6a61940. * restore rclcpp:shutdown() Without the shutdown: The tests are passing in `RUN_ALL_TESTS()`, the test itself is failing with timeout. Most probably because `server_thread.join()` hangs forever.
1 parent fa92ed2 commit 1942505

22 files changed

+269
-111
lines changed

Diff for: .github/deps.repos

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ repositories:
22
Fields2Cover:
33
type: git
44
url: https://github.com/Fields2Cover/Fields2Cover.git
5-
version: main
5+
version: v1.2.1-devel

Diff for: .github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
name: ament_${{ matrix.linter }}
88
runs-on: ubuntu-latest
99
container:
10-
image: rostooling/setup-ros-docker:ubuntu-jammy-ros-iron-ros-base-latest
10+
image: rostooling/setup-ros-docker:ubuntu-noble-ros-jazzy-ros-base-latest
1111
strategy:
1212
fail-fast: false
1313
matrix:
@@ -17,7 +17,7 @@ jobs:
1717
- uses: ros-tooling/[email protected]
1818
with:
1919
linter: ${{ matrix.linter }}
20-
distribution: iron
20+
distribution: jazzy
2121
package-name: |
2222
opennav_coverage
2323
opennav_coverage_bt

Diff for: .github/workflows/test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ jobs:
1212
ROS_DISTRO: ${{ matrix.ros_distro }}
1313
RMW_IMPLEMENTATION: rmw_cyclonedds_cpp
1414
container:
15-
image: rostooling/setup-ros-docker:ubuntu-jammy-latest
15+
image: rostooling/setup-ros-docker:ubuntu-noble-latest
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
ros_distro: [iron]
19+
ros_distro: [jazzy]
2020
steps:
2121
- uses: actions/checkout@v2
2222
- name: Install Cyclone DDS
@@ -28,7 +28,7 @@ jobs:
2828
import-token: ${{ secrets.GITHUB_TOKEN }}
2929
target-ros2-distro: ${{ matrix.ros_distro }}
3030
vcs-repo-file-url: "${{ github.workspace }}/.github/deps.repos"
31-
- uses: actions/upload-artifact@v1
31+
- uses: actions/upload-artifact@v4
3232
with:
3333
name: colcon-logs
3434
path: ros_ws/log

Diff for: .gitignore

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Compiled Object files
2+
*.slo
3+
*.lo
4+
*.o
5+
*.obj
6+
7+
# Precompiled Headers
8+
*.gch
9+
*.pch
10+
11+
# Compiled Dynamic libraries
12+
*.so
13+
*.dylib
14+
*.dll
15+
16+
# Fortran module files
17+
*.mod
18+
*.smod
19+
20+
# Compiled Static libraries
21+
*.lai
22+
*.la
23+
*.a
24+
*.lib
25+
26+
# Executables
27+
*.exe
28+
*.out
29+
*.app
30+
31+
# Colcon output
32+
build
33+
log
34+
install
35+
36+
# Visual Studio Code files
37+
.vscode
38+
39+
# Eclipse project files
40+
.cproject
41+
.project
42+
.pydevproject
43+
44+
# Python artifacts
45+
__pycache__/
46+
*.py[cod]
47+
.ipynb_checkpoints
48+
49+
sphinx_doc/_build
50+
51+
# CLion artifacts
52+
.idea
53+
cmake-build-debug/
54+
55+
# doxygen docs
56+
doc/html/

Diff for: README.md

+9
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ PS: Click on either image to see the demo videos! :-)
3434

3535
https://github.com/user-attachments/assets/e44d8f10-c5b0-4345-81ad-25f3bcd06030
3636

37+
### Fields2Cover Installation
38+
39+
opennav_coverage works with Field2Cover v1.2.1. The newest version v2.0.0 is not supported at the moment.
40+
41+
To install Fields2Cover, clone it into a colcon workspace and build with `colcon build`.
42+
43+
- Humble & Iron: Use tag `v1.2.1`
44+
- Jazzy & rolling: Use branch `v1.2.1-devel`
45+
3746
## Interfaces
3847

3948
The two main interfaces are `NavigateCompleteCoverage` and `ComputeCoveragePath`. The first is the action definition to request the BT Navigator's `CoverageNavigator` plugin to navigate usign a Complete Coverage task input. The latter is an analog to the `PlannerServer`'s action definition for computing Complete Coverage paths using the `opennav_coverage` action server. See `opennav_coverage_msgs` for complete details.

Diff for: opennav_coverage/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.5)
22
project(opennav_coverage)
33

44
find_package(ament_cmake REQUIRED)
5+
find_package(ament_index_cpp REQUIRED)
56
find_package(rclcpp REQUIRED)
67
find_package(rclcpp_action REQUIRED)
78
find_package(rclcpp_lifecycle REQUIRED)
@@ -29,6 +30,7 @@ set(executable_name opennav_coverage)
2930
set(library_name ${executable_name}_core)
3031

3132
set(dependencies
33+
ament_index_cpp
3234
rclcpp
3335
rclcpp_action
3436
rclcpp_lifecycle

Diff for: opennav_coverage/package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
<buildtool_depend>ament_cmake</buildtool_depend>
1111

12+
<depend>ament_index_cpp</depend>
1213
<depend>rclcpp</depend>
1314
<depend>rclcpp_action</depend>
1415
<depend>rclcpp_lifecycle</depend>

Diff for: opennav_coverage/src/coverage_server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ CoverageServer::on_configure(const rclcpp_lifecycle::State & /*state*/)
4646
node, "coordinates_in_cartesian_frame", rclcpp::ParameterValue(true));
4747
get_parameter("coordinates_in_cartesian_frame", cartesian_frame_);
4848

49-
double action_server_result_timeout;
49+
double action_server_result_timeout = 10.0;
5050
nav2_util::declare_parameter_if_not_declared(
5151
node, "action_server_result_timeout", rclcpp::ParameterValue(10.0));
5252
get_parameter("action_server_result_timeout", action_server_result_timeout);

Diff for: opennav_coverage_bt/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ find_package(nav2_behavior_tree REQUIRED)
1212
find_package(nav_msgs REQUIRED)
1313
find_package(geometry_msgs REQUIRED)
1414
find_package(opennav_coverage_msgs REQUIRED)
15-
find_package(behaviortree_cpp_v3 REQUIRED)
15+
find_package(behaviortree_cpp REQUIRED)
1616

1717
# potentially replace with nav2_common, nav2_package()
1818
set(CMAKE_CXX_STANDARD 17)
@@ -33,7 +33,7 @@ set(dependencies
3333
nav_msgs
3434
geometry_msgs
3535
opennav_coverage_msgs
36-
behaviortree_cpp_v3
36+
behaviortree_cpp
3737
)
3838

3939
add_library(opennav_compute_complete_coverage_action_bt_node SHARED src/compute_complete_coverage_path.cpp)

Diff for: opennav_coverage_bt/behavior_trees/navigate_w_basic_row_complete_coverage.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
This BT shows field file usage with the row coverage server
1212
-->
1313

14-
<root main_tree_to_execute="MainTree">
14+
<root BTCPP_format="4" main_tree_to_execute="MainTree">
1515
<BehaviorTree ID="MainTree">
1616
<RateController hz="0.0000001"> <!-- once, for demo -->
1717
<Sequence name="NavigateWithoutReplanning">

Diff for: opennav_coverage_bt/include/opennav_coverage_bt/utils.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define OPENNAV_COVERAGE_BT__UTILS_HPP_
1717

1818
#include <charconv>
19-
#include "behaviortree_cpp_v3/behavior_tree.h"
19+
#include "behaviortree_cpp/behavior_tree.h"
2020

2121
namespace BT
2222
{

Diff for: opennav_coverage_bt/package.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<depend>nav_msgs</depend>
1919
<depend>geometry_msgs</depend>
2020
<depend>opennav_coverage_msgs</depend>
21-
<depend>behaviortree_cpp_v3</depend>
21+
<depend>behaviortree_cpp</depend>
2222

2323
<test_depend>ament_lint_common</test_depend>
2424
<test_depend>ament_lint_auto</test_depend>

Diff for: opennav_coverage_bt/src/cancel_complete_coverage_path.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ CoverageCancel::CoverageCancel(
3131

3232
} // namespace opennav_coverage_bt
3333

34-
#include "behaviortree_cpp_v3/bt_factory.h"
34+
#include "behaviortree_cpp/bt_factory.h"
3535
BT_REGISTER_NODES(factory)
3636
{
3737
BT::NodeBuilder builder =

Diff for: opennav_coverage_bt/src/compute_complete_coverage_path.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void ComputeCoveragePathAction::halt()
9999

100100
} // namespace opennav_coverage_bt
101101

102-
#include "behaviortree_cpp_v3/bt_factory.h"
102+
#include "behaviortree_cpp/bt_factory.h"
103103
BT_REGISTER_NODES(factory)
104104
{
105105
BT::NodeBuilder builder =

Diff for: opennav_coverage_bt/test/test_cancel_complete_coverage.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <set>
1818
#include <string>
1919

20-
#include "behaviortree_cpp_v3/bt_factory.h"
20+
#include "behaviortree_cpp/bt_factory.h"
2121

2222
#include "nav2_behavior_tree/utils/test_action_server.hpp"
2323
#include "opennav_coverage_bt/cancel_complete_coverage_path.hpp"
@@ -125,7 +125,7 @@ TEST_F(CancelCoverageActionTestFixture, test_ports)
125125
{
126126
std::string xml_txt =
127127
R"(
128-
<root main_tree_to_execute = "MainTree" >
128+
<root BTCPP_format="4" main_tree_to_execute="MainTree">
129129
<BehaviorTree ID="MainTree">
130130
<CancelCoverage name="CoverageCancel"/>
131131
</BehaviorTree>

Diff for: opennav_coverage_bt/test/test_compute_coverage_path.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "nav_msgs/msg/path.hpp"
2121
#include "geometry_msgs/msg/pose_stamped.hpp"
2222

23-
#include "behaviortree_cpp_v3/bt_factory.h"
23+
#include "behaviortree_cpp/bt_factory.h"
2424

2525
#include "nav2_behavior_tree/utils/test_action_server.hpp"
2626
#include "opennav_coverage_bt/compute_complete_coverage_path.hpp"
@@ -123,7 +123,7 @@ TEST_F(ComputeCoveragePathActionTestFixture, test_tick)
123123
// create tree
124124
std::string xml_txt =
125125
R"(
126-
<root main_tree_to_execute = "MainTree" >
126+
<root BTCPP_format="4" main_tree_to_execute="MainTree">
127127
<BehaviorTree ID="MainTree">
128128
<ComputeCoveragePath nav_path="{path}"/>
129129
</BehaviorTree>
@@ -141,13 +141,13 @@ TEST_F(ComputeCoveragePathActionTestFixture, test_tick)
141141

142142
// check if returned path is correct
143143
nav_msgs::msg::Path path;
144-
config_->blackboard->get<nav_msgs::msg::Path>("path", path);
144+
[[maybe_unused]] auto res = config_->blackboard->get<nav_msgs::msg::Path>("path", path);
145145
EXPECT_EQ(path.poses.size(), 2u);
146146
EXPECT_EQ(path.poses[0].pose.position.x, 0.0);
147147
EXPECT_EQ(path.poses[1].pose.position.x, 1.0);
148148

149149
// halt node so another goal can be sent
150-
tree_->rootNode()->halt();
150+
tree_->haltTree();
151151
EXPECT_EQ(tree_->rootNode()->status(), BT::NodeStatus::IDLE);
152152
}
153153

@@ -169,7 +169,7 @@ int main(int argc, char ** argv)
169169
int all_successful = RUN_ALL_TESTS();
170170

171171
// shutdown ROS
172-
// rclcpp::shutdown();
172+
rclcpp::shutdown();
173173
server_thread.join();
174174

175175
return all_successful;

0 commit comments

Comments
 (0)