Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
fmessmer committed Sep 22, 2023
1 parent f64801a commit 567dae9
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions include/ros1_bridge/action_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,22 +151,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 +188,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 567dae9

Please sign in to comment.