Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 1f7ddb3

Browse files
committed
bugfix: ignore rcl_take return value RCL_RET_SUBSCRIPTION_TAKE_FAILED for subscriptions.
Signed-off-by: Staschulat Jan <jan.staschulat@de.bosch.com>
1 parent 118819f commit 1f7ddb3

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

rcl_executor/src/let_executor.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,13 @@ _rcle_read_input_data(rcle_let_executor_t * executor, rcl_wait_set_t * wait_set,
242242
rc = rcl_take(executor->handles[i].subscription, executor->handles[i].data, &messageInfo,
243243
NULL);
244244
if (rc != RCL_RET_OK) {
245-
PRINT_RCL_ERROR(rcle_read_input_data, rcl_take);
245+
246+
// it is documented, that rcl_take might return this error, even when rcl_wait reported new data
247+
if ( rc != RCL_RET_SUBSCRIPTION_TAKE_FAILED) {
248+
PRINT_RCL_ERROR(rcle_read_input_data, rcl_take);
249+
RCUTILS_LOG_ERROR_NAMED(ROS_PACKAGE_NAME, "Error number: %d",rc);
250+
}
251+
246252
return rc;
247253
}
248254
executor->handles[i].data_available = true;
@@ -350,7 +356,7 @@ _rcle_let_scheduling(rcle_let_executor_t * executor, rcl_wait_set_t * wait_set)
350356
// complexity: O(n) where n denotes the number of handles
351357
for (size_t i = 0; (i < executor->max_handles && executor->handles[i].initialized); i++) {
352358
rc = _rcle_read_input_data(executor, wait_set, i);
353-
if (rc != RCL_RET_OK) {
359+
if ((rc != RCL_RET_OK) && (rc != RCL_RET_SUBSCRIPTION_TAKE_FAILED)) {
354360
return rc;
355361
}
356362
} // for-loop

0 commit comments

Comments
 (0)