Set rmw_wait timeout using ros timers too (#357)

This commit is contained in:
Shane Loretz 2018-12-13 15:50:37 -08:00 committed by GitHub
parent e5df9aa428
commit 3b7c208bba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -506,10 +506,11 @@ rcl_wait(rcl_wait_set_t * wait_set, int64_t timeout)
rmw_gcs->guard_conditions[rmw_gcs->guard_condition_count] =
rmw_gcs->guard_conditions[gc_idx];
++(rmw_gcs->guard_condition_count);
} else {
// No guard condition, instead use to set the rmw_wait timeout
}
// use timer time to to set the rmw_wait timeout
// TODO(sloretz) fix spurious wake-ups on ROS_TIME timers with ROS_TIME enabled
int64_t timer_timeout = INT64_MAX;
rcl_ret_t ret = rcl_timer_get_time_until_next_call(wait_set->timers[i], &timer_timeout);
ret = rcl_timer_get_time_until_next_call(wait_set->timers[i], &timer_timeout);
if (ret != RCL_RET_OK) {
return ret; // The rcl error state should already be set.
}
@ -519,7 +520,6 @@ rcl_wait(rcl_wait_set_t * wait_set, int64_t timeout)
}
}
}
}
if (timeout == 0) {
// Then it is non-blocking, so set the temporary storage to 0, 0 and pass it.