rclcpp
master
C++ ROS Client Library API
|
Go to the documentation of this file.
15 #ifndef RCLCPP__WAIT_SET_POLICIES__SEQUENTIAL_SYNCHRONIZATION_HPP_
16 #define RCLCPP__WAIT_SET_POLICIES__SEQUENTIAL_SYNCHRONIZATION_HPP_
39 namespace wait_set_policies
71 > add_subscription_function)
74 add_subscription_function(
std::move(subscription), mask);
87 > remove_subscription_function)
90 remove_subscription_function(
std::move(subscription), mask);
103 add_guard_condition_function(
std::move(guard_condition));
116 remove_guard_condition_function(
std::move(guard_condition));
168 remove_client_function(
std::move(client));
181 add_service_function(
std::move(service));
194 remove_service_function(
std::move(service));
207 > add_waitable_function)
223 remove_waitable_function(
std::move(waitable));
234 prune_deleted_entities_function();
238 template<
class WaitResultT>
267 rebuild_rcl_wait_set();
280 rcl_ret_t ret = rcl_wait(&rcl_wait_set, time_left_to_wait_ns.count());
281 if (RCL_RET_OK == ret) {
285 }
else if (RCL_RET_TIMEOUT == ret) {
288 }
else if (RCL_RET_WAIT_SET_EMPTY == ret) {
295 }
while (should_loop());
317 #endif // RCLCPP__WAIT_SET_POLICIES__SEQUENTIAL_SYNCHRONIZATION_HPP_
void sync_remove_guard_condition(std::shared_ptr< rclcpp::GuardCondition > &&guard_condition, std::function< void(std::shared_ptr< rclcpp::GuardCondition > &&)> remove_guard_condition_function)
Remove guard condition without thread-safety.
Definition: sequential_synchronization.hpp:111
SequentialSynchronization(rclcpp::Context::SharedPtr)
Definition: sequential_synchronization.hpp:46
void sync_remove_waitable(std::shared_ptr< rclcpp::Waitable > &&waitable, std::function< void(std::shared_ptr< rclcpp::Waitable > &&)> remove_waitable_function)
Remove waitable without thread-safety.
Definition: sequential_synchronization.hpp:218
void sync_remove_subscription(std::shared_ptr< rclcpp::SubscriptionBase > &&subscription, const rclcpp::SubscriptionWaitSetMask &mask, std::function< void(std::shared_ptr< rclcpp::SubscriptionBase > &&, const rclcpp::SubscriptionWaitSetMask &) > remove_subscription_function)
Remove guard condition without thread-safety.
Definition: sequential_synchronization.hpp:82
std::function< bool()> create_loop_predicate(std::chrono::nanoseconds time_to_wait_ns, std::chrono::steady_clock::time_point start)
Definition: synchronization_policy_common.hpp:36
@ Ready
Definition: wait_result_kind.hpp:26
void sync_remove_client(std::shared_ptr< rclcpp::ClientBase > &&client, std::function< void(std::shared_ptr< rclcpp::ClientBase > &&)> remove_client_function)
Remove client without thread-safety.
Definition: sequential_synchronization.hpp:163
void sync_add_subscription(std::shared_ptr< rclcpp::SubscriptionBase > &&subscription, const rclcpp::SubscriptionWaitSetMask &mask, std::function< void(std::shared_ptr< rclcpp::SubscriptionBase > &&, const rclcpp::SubscriptionWaitSetMask &) > add_subscription_function)
Add subscription without thread-safety.
Definition: sequential_synchronization.hpp:66
WaitResultKind
Represents the various kinds of results from waiting on a wait set.
Definition: wait_result_kind.hpp:24
void sync_remove_timer(std::shared_ptr< rclcpp::TimerBase > &&timer, std::function< void(std::shared_ptr< rclcpp::TimerBase > &&)> remove_timer_function)
Remove timer without thread-safety.
Definition: sequential_synchronization.hpp:137
WaitSet policy that explicitly provides no thread synchronization.
Definition: sequential_synchronization.hpp:43
Options used to determine what parts of a subscription get added to or removed from a wait set.
Definition: subscription_wait_set_mask.hpp:24
std::chrono::nanoseconds calculate_time_left_to_wait(std::chrono::nanoseconds original_time_to_wait_ns, std::chrono::steady_clock::time_point start)
Definition: synchronization_policy_common.hpp:51
void sync_add_timer(std::shared_ptr< rclcpp::TimerBase > &&timer, std::function< void(std::shared_ptr< rclcpp::TimerBase > &&)> add_timer_function)
Add timer without thread-safety.
Definition: sequential_synchronization.hpp:124
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
WaitResultT sync_wait(std::chrono::nanoseconds time_to_wait_ns, std::function< void()> rebuild_rcl_wait_set, std::function< rcl_wait_set_t &()> get_rcl_wait_set, std::function< WaitResultT(WaitResultKind wait_result_kind)> create_wait_result)
Implements wait without any thread-safety.
Definition: sequential_synchronization.hpp:240
void sync_remove_service(std::shared_ptr< rclcpp::ServiceBase > &&service, std::function< void(std::shared_ptr< rclcpp::ServiceBase > &&)> remove_service_function)
Remove service without thread-safety.
Definition: sequential_synchronization.hpp:189
~SequentialSynchronization()=default
@ Timeout
Definition: wait_result_kind.hpp:27
Common structure for synchronization policies.
Definition: synchronization_policy_common.hpp:29
void sync_add_waitable(std::shared_ptr< rclcpp::Waitable > &&waitable, std::shared_ptr< void > &&associated_entity, std::function< void(std::shared_ptr< rclcpp::Waitable > &&, std::shared_ptr< void > &&) > add_waitable_function)
Add waitable without thread-safety.
Definition: sequential_synchronization.hpp:202
void sync_add_guard_condition(std::shared_ptr< rclcpp::GuardCondition > &&guard_condition, std::function< void(std::shared_ptr< rclcpp::GuardCondition > &&)> add_guard_condition_function)
Add guard condition without thread-safety.
Definition: sequential_synchronization.hpp:98
void sync_wait_result_acquire()
Definition: sequential_synchronization.hpp:302
void sync_wait_result_release()
Definition: sequential_synchronization.hpp:308
@ Empty
Definition: wait_result_kind.hpp:28
void sync_add_client(std::shared_ptr< rclcpp::ClientBase > &&client, std::function< void(std::shared_ptr< rclcpp::ClientBase > &&)> add_client_function)
Add client without thread-safety.
Definition: sequential_synchronization.hpp:150
void throw_from_rcl_error(rcl_ret_t ret, const std::string &prefix="", const rcl_error_state_t *error_state=nullptr, void(*reset_error)()=rcl_reset_error)
Throw a C++ std::exception which was created based on an rcl error.
void sync_prune_deleted_entities(std::function< void()> prune_deleted_entities_function)
Prune deleted entities without thread-safety.
Definition: sequential_synchronization.hpp:231
const std::array< std::shared_ptr< rclcpp::GuardCondition >, 0 > & get_extra_guard_conditions()
Return any "extra" guard conditions needed to implement the synchronization policy.
Definition: sequential_synchronization.hpp:55
void sync_add_service(std::shared_ptr< rclcpp::ServiceBase > &&service, std::function< void(std::shared_ptr< rclcpp::ServiceBase > &&)> add_service_function)
Add service without thread-safety.
Definition: sequential_synchronization.hpp:176