Skip to content

Commit d6e41a2

Browse files
authored
Migrate to Kilted (#94)
* update msg for Kilted * [opennav_coverage_bt] migrate BT xml files * migrate coverage_navigator * rm error_msg from ComputeCoveragePath * use newer rostooling docker images, run test for Kilted * run linter on Kilted * use base image
1 parent 77dcdca commit d6e41a2

File tree

8 files changed

+53
-19
lines changed

8 files changed

+53
-19
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
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-noble-ros-jazzy-ros-base-latest
10+
image: ghcr.io/ros-tooling/setup-ros-docker/setup-ros-docker-ubuntu-noble-ros-kilted-ros-base:master
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: jazzy
20+
distribution: kilted
2121
package-name: |
2222
opennav_coverage
2323
opennav_coverage_bt

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ jobs:
1212
ROS_DISTRO: ${{ matrix.ros_distro }}
1313
RMW_IMPLEMENTATION: rmw_cyclonedds_cpp
1414
container:
15-
image: rostooling/setup-ros-docker:ubuntu-noble-latest
15+
image: ghcr.io/ros-tooling/setup-ros-docker/setup-ros-docker-ubuntu-noble-ros-kilted-ros-base:master
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
ros_distro: [jazzy]
19+
ros_distro: [kilted]
2020
steps:
2121
- uses: actions/checkout@v2
2222
- name: Install Cyclone DDS
2323
run: sudo apt install ros-${{ matrix.ros_distro }}-rmw-cyclonedds-cpp -y
2424
- name: Build and run tests
2525
id: action-ros-ci
26-
uses: ros-tooling/action-ros-ci@v0.3
26+
uses: ros-tooling/action-ros-ci@v0.4
2727
with:
2828
import-token: ${{ secrets.GITHUB_TOKEN }}
2929
target-ros2-distro: ${{ matrix.ros_distro }}

opennav_coverage_bt/behavior_trees/navigate_w_basic_complete_coverage.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'polygons="{field_polygon}" polygons_frame_id="{polygon_frame_id}"' if set polygon via NavigateCompleteCoverage
2020
or file_field="{field_filepath}" if setting polygon file via NavigateCompleteCoverage -->
2121
<ComputeCoveragePath nav_path="{path}" polygons="{field_polygon}" polygons_frame_id="{polygon_frame_id}" error_code_id="{compute_coverage_error_code}"/>
22-
<FollowPath path="{path}" controller_id="FollowPath" error_code_id="{follow_path_error_code}"/>
22+
<FollowPath path="{path}" controller_id="FollowPath" error_code_id="{follow_path_error_code}" error_msg="{follow_path_error_msg}"/>
2323
</Sequence>
2424
</RateController>
2525
</BehaviorTree>

opennav_coverage_bt/behavior_trees/navigate_w_basic_complete_coverage_nav_to_start.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424

2525
<!-- Go to start of path before navigating -->
2626
<GetPoseFromPath path="{path}" pose="{start_pose}" index="0" />
27-
<ComputePathToPose goal="{start_pose}" path="{path_to_start}" planner_id="GridBased" error_code_id="{compute_path_error_code}"/>
28-
<FollowPath path="{path_to_start}" controller_id="FollowPath" error_code_id="{follow_path_error_code}"/>
27+
<ComputePathToPose goal="{start_pose}" path="{path_to_start}" planner_id="GridBased" error_code_id="{compute_path_error_code}" error_msg="{compute_path_error_msg}"/>
28+
<FollowPath path="{path_to_start}" controller_id="FollowPath" error_code_id="{follow_path_error_code}" error_msg="{follow_path_error_msg}"/>
2929

3030
<!-- Follow computed path -->
31-
<FollowPath path="{path}" controller_id="FollowPath" error_code_id="{follow_path_error_code}"/>
31+
<FollowPath path="{path}" controller_id="FollowPath" error_code_id="{follow_path_error_code}" error_msg="{follow_path_error_msg}"/>
3232
</Sequence>
3333
</RateController>
3434
</BehaviorTree>

opennav_coverage_bt/behavior_trees/navigate_w_basic_row_complete_coverage.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'polygons="{field_polygon}" polygons_frame_id="{polygon_frame_id}"' if set polygon via NavigateCompleteCoverage
2020
or file_field="{field_filepath}" if setting polygon file via NavigateCompleteCoverage -->
2121
<ComputeCoveragePath nav_path="{path}" file_field="{field_filepath}" error_code_id="{compute_coverage_error_code}"/>
22-
<FollowPath path="{path}" controller_id="FollowPath" error_code_id="{follow_path_error_code}"/>
22+
<FollowPath path="{path}" controller_id="FollowPath" error_code_id="{follow_path_error_code}" error_msg="{follow_path_error_msg}"/>
2323
</Sequence>
2424
</RateController>
2525
</BehaviorTree>

opennav_coverage_msgs/action/NavigateCompleteCoverage.action

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ string behavior_tree
1414
# Error codes
1515
# Note: The expected priority order of the errors should match the message order
1616
uint16 NONE=0
17+
uint16 UNKNOWN=800
18+
uint16 FAILED_TO_LOAD_BEHAVIOR_TREE=801
19+
uint16 TF_ERROR=802
1720

1821
uint16 error_code
22+
string error_msg
23+
1924
---
2025
#feedback definition
2126

opennav_coverage_navigator/include/opennav_coverage_navigator/coverage_navigator.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ class CoverageNavigator
111111
/**
112112
* @brief Goal pose initialization on the blackboard
113113
* @param goal Action template's goal message to process
114+
* @return bool if goal was initialized successfully to be processed
114115
*/
115-
void initializeGoalPose(ActionT::Goal::ConstSharedPtr goal);
116+
bool initializeGoalPose(ActionT::Goal::ConstSharedPtr goal);
116117

117118
rclcpp::Time start_time_;
118119
std::string path_blackboard_id_, field_blackboard_id_, polygon_blackboard_id_;

opennav_coverage_navigator/src/coverage_navigator.cpp

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ CoverageNavigator::configure(
5151

5252
// Odometry smoother object for getting current speed
5353
odom_smoother_ = odom_smoother;
54+
55+
// Groot monitoring
56+
if (!node->has_parameter(getName() + ".enable_groot_monitoring")) {
57+
node->declare_parameter(getName() + ".enable_groot_monitoring", false);
58+
}
59+
60+
if (!node->has_parameter(getName() + ".groot_server_port")) {
61+
node->declare_parameter(getName() + ".groot_server_port", 1667);
62+
}
63+
64+
bt_action_server_->setGrootMonitoring(
65+
node->get_parameter(getName() + ".enable_groot_monitoring").as_bool(),
66+
node->get_parameter(getName() + ".groot_server_port").as_int());
67+
5468
return true;
5569
}
5670

@@ -90,11 +104,12 @@ CoverageNavigator::goalReceived(ActionT::Goal::ConstSharedPtr goal)
90104
RCLCPP_ERROR(
91105
logger_, "BT file not found: %s. Navigation canceled.",
92106
bt_xml_filename.c_str());
107+
bt_action_server_->setInternalError(ActionT::Result::FAILED_TO_LOAD_BEHAVIOR_TREE,
108+
std::string("Error loading XML file: ") + bt_xml_filename + ". Navigation canceled.");
93109
return false;
94110
}
95111

96-
initializeGoalPose(goal);
97-
return true;
112+
return initializeGoalPose(goal);
98113
}
99114

100115
void
@@ -185,7 +200,13 @@ CoverageNavigator::onPreempt(ActionT::Goal::ConstSharedPtr goal)
185200
// if pending goal requests the same BT as the current goal, accept the pending goal
186201
// if pending goal has an empty behavior_tree field, it requests the default BT file
187202
// accept the pending goal if the current goal is running the default BT file
188-
initializeGoalPose(bt_action_server_->acceptPendingGoal());
203+
if (!initializeGoalPose(bt_action_server_->acceptPendingGoal())) {
204+
RCLCPP_WARN(
205+
logger_,
206+
"Preemption request was rejected since the goal could not be "
207+
"initialized. For now, continuing to track the last goal until completion.");
208+
bt_action_server_->terminatePendingGoal();
209+
}
189210
} else {
190211
RCLCPP_WARN(
191212
logger_,
@@ -198,14 +219,19 @@ CoverageNavigator::onPreempt(ActionT::Goal::ConstSharedPtr goal)
198219
}
199220
}
200221

201-
void
222+
bool
202223
CoverageNavigator::initializeGoalPose(ActionT::Goal::ConstSharedPtr goal)
203224
{
204225
geometry_msgs::msg::PoseStamped current_pose;
205-
nav2_util::getCurrentPose(
206-
current_pose, *feedback_utils_.tf,
207-
feedback_utils_.global_frame, feedback_utils_.robot_frame,
208-
feedback_utils_.transform_tolerance);
226+
if (!nav2_util::getCurrentPose(
227+
current_pose, *feedback_utils_.tf,
228+
feedback_utils_.global_frame, feedback_utils_.robot_frame,
229+
feedback_utils_.transform_tolerance))
230+
{
231+
bt_action_server_->setInternalError(ActionT::Result::TF_ERROR,
232+
"Initial robot pose is not available.");
233+
return false;
234+
}
209235

210236
if (goal->field_filepath.size() == 0) {
211237
RCLCPP_INFO(
@@ -227,6 +253,8 @@ CoverageNavigator::initializeGoalPose(ActionT::Goal::ConstSharedPtr goal)
227253
blackboard->set<std::vector<geometry_msgs::msg::Polygon>>(
228254
polygon_blackboard_id_, goal->polygons);
229255
blackboard->set<std::string>(polygon_frame_blackboard_id_, goal->frame_id);
256+
257+
return true;
230258
}
231259

232260
} // namespace opennav_coverage_navigator

0 commit comments

Comments
 (0)