Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions rclcpp_action/src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,16 @@ ClientBase::is_ready(const rcl_wait_set_t & wait_set)
}

pimpl_->next_ready_event = ClientBaseImpl::NO_EVENT_READY;
// The following 'if' statements set the priority of execution for different entities.
// The order of priority for action components are:
// Status > Goal Response > Result Response > Cancel Response > Feedback.
// Feedback has the lowest priority, since if the client spins slower than the
// server's feedback rate, it may never process the action results.

if (is_status_ready) {
pimpl_->next_ready_event = static_cast<size_t>(EntityType::StatusSubscription);
return true;
}

if (is_goal_response_ready) {
pimpl_->next_ready_event = static_cast<size_t>(EntityType::GoalClient);
Expand All @@ -375,11 +385,6 @@ ClientBase::is_ready(const rcl_wait_set_t & wait_set)
return true;
}

if (is_status_ready) {
pimpl_->next_ready_event = static_cast<size_t>(EntityType::StatusSubscription);
return true;
}

return false;
}

Expand Down
7 changes: 4 additions & 3 deletions rclcpp_action/test/test_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ TEST_F(TestClientAgainstServer, async_send_goal_with_feedback_callback_wait_for_

ASSERT_EQ(5u, wrapped_result.result->sequence.size());
EXPECT_EQ(3, wrapped_result.result->sequence.back());
EXPECT_EQ(5, feedback_count);
EXPECT_EQ(2, feedback_count);
}

TEST_F(TestClientAgainstServer, async_send_goal_with_result_callback_wait_for_result)
Expand Down Expand Up @@ -1010,11 +1010,12 @@ TEST_F(TestClientAgainstServer, execute_rcl_errors)
{
ActionGoal goal;
goal.order = 5;
auto mock = mocking_utils::patch_and_return(
"lib:rclcpp_action", rcl_action_take_result_response, RCL_RET_ERROR);

auto future_goal_handle = action_client->async_send_goal(goal, send_goal_ops);
dual_spin_until_future_complete(future_goal_handle);
auto mock = mocking_utils::patch_and_return(
"lib:rclcpp_action", rcl_action_take_result_response, RCL_RET_ERROR);

auto goal_handle = future_goal_handle.get();
auto future_result = action_client->async_get_result(goal_handle);
EXPECT_THROW(
Expand Down