Skip to content

Commit cb5292b

Browse files
authored
Refactor/remove reference action feedback (#702)
* remove guidance action feedback * remove reference feedback from waypoint manager action * colcon ignore docking
1 parent 077c99c commit cb5292b

5 files changed

Lines changed: 22 additions & 60 deletions

File tree

guidance/los_guidance/src/los_guidance_ros.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,6 @@ void LOSGuidanceNode::execute(
182182

183183
adaptive_los_guidance_->update_angles(last_point_, next_point_);
184184

185-
auto feedback =
186-
std::make_shared<vortex_msgs::action::LOSGuidance::Feedback>();
187185
auto result = std::make_shared<vortex_msgs::action::LOSGuidance::Result>();
188186

189187
rclcpp::Rate loop_rate(1000.0 / time_step_.count());
@@ -213,23 +211,22 @@ void LOSGuidanceNode::execute(
213211

214212
adaptive_los_guidance_->update_adaptive_estimates(errors);
215213

216-
vortex_msgs::msg::LOSGuidance reference_msg = fill_los_reference();
217-
218-
feedback->feedback = reference_msg;
219-
220-
goal_handle->publish_feedback(feedback);
221-
reference_pub_->publish(reference_msg);
222-
223214
if ((eta_ - next_point_).as_vector().norm() < goal_reached_tol_) {
224215
result->success = true;
225216
goal_handle->succeed(result);
226217
u_desired_ = 0.0;
227-
vortex_msgs::msg::LOSGuidance reference_msg = fill_los_reference();
228-
reference_pub_->publish(reference_msg);
218+
auto final_reference_msg =
219+
std::make_unique<vortex_msgs::msg::LOSGuidance>(
220+
fill_los_reference());
221+
reference_pub_->publish(std::move(final_reference_msg));
229222
spdlog::info("Goal reached");
230223
return;
231224
}
232225

226+
auto reference_msg = std::make_unique<vortex_msgs::msg::LOSGuidance>(
227+
fill_los_reference());
228+
reference_pub_->publish(std::move(reference_msg));
229+
233230
loop_rate.sleep();
234231
}
235232
}

guidance/reference_filter_dp/src/ros/reference_filter_ros.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ void ReferenceFilterNode::execute(
170170

171171
follower_->start(pose, twist, wp, convergence_threshold);
172172

173-
auto feedback = std::make_shared<
174-
vortex_msgs::action::ReferenceFilterWaypoint::Feedback>();
175173
auto result = std::make_shared<
176174
vortex_msgs::action::ReferenceFilterWaypoint::Result>();
177175

@@ -205,24 +203,22 @@ void ReferenceFilterNode::execute(
205203
if (target_reached) {
206204
follower_->snap_state_to_reference();
207205

208-
vortex_msgs::msg::ReferenceFilter final_reference_msg =
209-
fill_reference_msg(follower_->state());
206+
auto final_reference_msg =
207+
std::make_unique<vortex_msgs::msg::ReferenceFilter>(
208+
fill_reference_msg(follower_->state()));
210209

211-
feedback->reference = final_reference_msg;
212-
goal_handle->publish_feedback(feedback);
213-
reference_pub_->publish(final_reference_msg);
210+
reference_pub_->publish(std::move(final_reference_msg));
214211

215212
result->success = true;
216213
goal_handle->succeed(result);
217214
spdlog::info("Goal reached");
218215
return;
219216
}
220217

221-
vortex_msgs::msg::ReferenceFilter reference_msg =
222-
fill_reference_msg(filter_state);
223-
reference_pub_->publish(reference_msg);
224-
feedback->reference = reference_msg;
225-
goal_handle->publish_feedback(feedback);
218+
auto reference_msg =
219+
std::make_unique<vortex_msgs::msg::ReferenceFilter>(
220+
fill_reference_msg(filter_state));
221+
reference_pub_->publish(std::move(reference_msg));
226222
loop_rate.sleep();
227223
}
228224
if (!rclcpp::ok() && goal_handle->is_active()) {

mission/FSM/docking/COLCON_IGNORE

Whitespace-only changes.

mission/waypoint_manager/include/waypoint_manager/waypoint_manager_ros.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <memory>
55
#include <rclcpp/rclcpp.hpp>
66
#include <rclcpp_action/rclcpp_action.hpp>
7-
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
87

98
#include <vector>
109
#include <vortex_msgs/action/reference_filter_waypoint.hpp>
@@ -105,8 +104,6 @@ class WaypointManagerNode : public rclcpp::Node {
105104
bool persistent_action_mode_active_{false};
106105
bool priority_mode_active_{false};
107106

108-
ReferenceFilterAction::Feedback latest_ref_feedback_;
109-
bool has_reference_pose_{false};
110107
bool is_cancel_in_progress_{false};
111108

112109
std::uint64_t mission_id_ = 0;

mission/waypoint_manager/src/waypoint_manager_ros.cpp

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include <spdlog/spdlog.h>
33
#include <cmath>
44
#include <rclcpp_components/register_node_macro.hpp>
5-
#include <vortex/utils/ros/ros_conversions.hpp>
65

76
namespace vortex::mission {
87

@@ -87,11 +86,6 @@ WaypointManagerNode::construct_result(bool success) const {
8786
auto result =
8887
std::make_shared<vortex_msgs::action::WaypointManager_Result>();
8988
result->success = success;
90-
result->pose_valid = has_reference_pose_;
91-
if (has_reference_pose_) {
92-
result->final_pose = vortex::utils::ros_conversions::to_pose_msg(
93-
latest_ref_feedback_.reference);
94-
}
9589
return result;
9690
}
9791

@@ -100,7 +94,6 @@ void WaypointManagerNode::cleanup_mission_state() {
10094
current_index_ = 0;
10195
persistent_action_mode_active_ = false;
10296
priority_mode_active_ = false;
103-
has_reference_pose_ = false;
10497

10598
if (active_reference_filter_goal_) {
10699
reference_filter_client_->async_cancel_goal(
@@ -122,6 +115,12 @@ void WaypointManagerNode::send_next_reference_filter_goal() {
122115
return;
123116
}
124117

118+
if (active_action_goal_ && active_action_goal_->is_active()) {
119+
auto wm_fb = std::make_shared<WaypointManager::Feedback>();
120+
wm_fb->current_waypoint = waypoints_[current_index_];
121+
active_action_goal_->publish_feedback(wm_fb);
122+
}
123+
125124
ReferenceFilterAction::Goal rf_goal;
126125
rf_goal.waypoint = waypoints_[current_index_];
127126
rf_goal.convergence_threshold = convergence_threshold_;
@@ -153,7 +152,6 @@ rclcpp_action::GoalResponse WaypointManagerNode::handle_waypoint_goal(
153152
current_index_ = 0;
154153
persistent_action_mode_active_ = goal->persistent;
155154
priority_mode_active_ = false;
156-
has_reference_pose_ = false;
157155
convergence_threshold_ = goal->convergence_threshold;
158156

159157
if (waypoints_.empty() && !persistent_action_mode_active_) {
@@ -212,7 +210,6 @@ void WaypointManagerNode::handle_send_waypoints_service_request(
212210
mission_id_++;
213211
waypoints_ = request->waypoints;
214212
current_index_ = 0;
215-
has_reference_pose_ = false;
216213

217214
if (active_reference_filter_goal_) {
218215
reference_filter_client_->async_cancel_goal(
@@ -269,31 +266,6 @@ void WaypointManagerNode::send_reference_filter_goal(
269266
}
270267
};
271268

272-
options.feedback_callback =
273-
[this, this_mission](
274-
ReferenceFilterGoalHandle::SharedPtr,
275-
const std::shared_ptr<const ReferenceFilterAction::Feedback> fb) {
276-
if (this_mission != mission_id_) {
277-
return;
278-
}
279-
280-
latest_ref_feedback_ = *fb;
281-
has_reference_pose_ = true;
282-
283-
if (!active_action_goal_ || !active_action_goal_->is_active())
284-
return;
285-
286-
geometry_msgs::msg::Pose robot_pose =
287-
vortex::utils::ros_conversions::to_pose_msg(fb->reference);
288-
289-
if (current_index_ < waypoints_.size()) {
290-
auto wm_fb = std::make_shared<WaypointManager::Feedback>();
291-
wm_fb->current_pose = robot_pose;
292-
wm_fb->current_waypoint = waypoints_[current_index_];
293-
active_action_goal_->publish_feedback(wm_fb);
294-
}
295-
};
296-
297269
options
298270
.result_callback = [this, this_mission](
299271
const ReferenceFilterGoalHandle::WrappedResult&

0 commit comments

Comments
 (0)