Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
fmessmer committed Sep 25, 2023
1 parent f64801a commit 8ddb3c2
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions include/ros1_bridge/action_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class ActionFactory_1_2 : public ActionFactoryInterface
void goal_cb(ROS1GoalHandle gh1)
{
const std::string goal_id = gh1.getGoalID().id;
RCLCPP_INFO(ros2_node_->get_logger(), "ActionFactory_1_2::goal_cb");

// create a new handler for the goal
std::shared_ptr<GoalHandler> handler;
Expand Down Expand Up @@ -151,22 +150,24 @@ class ActionFactory_1_2 : public ActionFactoryInterface
[this, &gh2_future](std::shared_future<ROS2GoalHandle> gh2) mutable {
try {
// this is a workaround for the underlying actionlib implementation bug
// this callback function should never get called the the shared_future
// this callback function should never get called the the shared_future
// is not ready/valid
int counter = 0;
while(!gh2_future.valid())
{
if( counter >= 10)
{
RCLCPP_ERROR(this->logger_, "std::shared_future not valid for more than 1.0 seconds. "
"Rejecting action goal.");
while (!gh2_future.valid()) {
if (counter >= 10) {
RCLCPP_ERROR(
this->logger_,
"std::shared_future not valid for more than 1.0 seconds. "
"Rejecting action goal.");
gh1_.setRejected();
return;
}
RCLCPP_WARN(this->logger_, "std::shared_future not valid. "
"This indicates a bug in the actionlib implementation. "
"goal_reponse_callback should only get called when the future is valid. "
"Waiting and retrying...");
RCLCPP_WARN(
this->logger_,
"std::shared_future not valid. "
"This indicates a bug in the actionlib implementation. "
"goal_reponse_callback should only get called when the future is valid. "
"Waiting and retrying...");
rclcpp::sleep_for(std::chrono::milliseconds(100));
counter++;
}
Expand All @@ -186,9 +187,11 @@ class ActionFactory_1_2 : public ActionFactoryInterface
auto fut = client_->async_cancel_goal(gh2_);
}
}
} catch (const std::future_error& e) {
RCLCPP_ERROR_STREAM(this->logger_, "Caught a future_error with code '" << e.code()
<< "' Message: '" << e.what()<<"'");
} catch (const std::future_error & e) {
RCLCPP_ERROR_STREAM(
this->logger_,
"Caught a future_error with code '" << e.code() <<
"' Message: '" << e.what() << "'");
throw;
}
};
Expand Down

0 comments on commit 8ddb3c2

Please sign in to comment.