15 #ifndef RCLCPP__CLOCK_HPP_
16 #define RCLCPP__CLOCK_HPP_
22 #include "rclcpp/contexts/default_context.hpp"
23 #include "rclcpp/macros.hpp"
24 #include "rclcpp/time.hpp"
25 #include "rclcpp/visibility_control.hpp"
28 #include "rcutils/time.h"
29 #include "rcutils/types/rcutils_ret.h"
41 using pre_callback_t = std::function<void ()>;
45 pre_callback_t pre_callback,
46 post_callback_t post_callback,
49 pre_callback_t pre_callback;
50 post_callback_t post_callback;
57 RCLCPP_SMART_PTR_DEFINITIONS(
Clock)
121 Context::SharedPtr context = contexts::get_global_default_context());
145 Context::SharedPtr context = contexts::get_global_default_context());
171 wait_until_started(Context::SharedPtr context = contexts::get_global_default_context());
189 Context::SharedPtr context = contexts::get_global_default_context(),
220 get_clock_type()
const noexcept;
249 JumpHandler::SharedPtr
251 JumpHandler::pre_callback_t pre_callback,
252 JumpHandler::post_callback_t post_callback,
267 std::shared_ptr<Impl> impl_;
283 std::unique_ptr<ClockWaiterImpl> impl_;
289 explicit ClockWaiter(
const rclcpp::Clock::SharedPtr & clock);
307 std::unique_lock<std::mutex> & lock,
308 const rclcpp::Time & abs_time,
const std::function<
bool ()> & pred);
332 std::unique_ptr<Impl> impl_;
339 const rclcpp::Clock::SharedPtr & clock,
340 rclcpp::Context::SharedPtr context = rclcpp::contexts::get_global_default_context());
360 std::unique_lock<std::mutex> & lock,
rclcpp::Time until,
361 const std::function<
bool ()> & pred);
RCLCPP_PUBLIC void notify_one()
RCLCPP_PUBLIC std::mutex & mutex()
RCLCPP_PUBLIC bool wait_until(std::unique_lock< std::mutex > &lock, rclcpp::Time until, const std::function< bool()> &pred)
RCLCPP_PUBLIC bool wait_until(std::unique_lock< std::mutex > &lock, const rclcpp::Time &abs_time, const std::function< bool()> &pred)
RCLCPP_PUBLIC void notify_one()
RCLCPP_PUBLIC rcl_clock_t * get_clock_handle() noexcept
Return the rcl_clock_t clock handle.
RCLCPP_PUBLIC bool ros_time_is_active()
RCLCPP_PUBLIC bool wait_until_started(Context::SharedPtr context=contexts::get_global_default_context())
RCLCPP_PUBLIC Time now() const
RCLCPP_PUBLIC bool started()
RCLCPP_PUBLIC JumpHandler::SharedPtr create_jump_callback(JumpHandler::pre_callback_t pre_callback, JumpHandler::post_callback_t post_callback, const rcl_jump_threshold_t &threshold)
RCLCPP_PUBLIC Clock(rcl_clock_type_t clock_type=RCL_SYSTEM_TIME)
Default c'tor.
RCLCPP_PUBLIC bool sleep_until(Time until, Context::SharedPtr context=contexts::get_global_default_context())
RCLCPP_PUBLIC void cancel_sleep_or_wait()
RCLCPP_PUBLIC std::mutex & get_clock_mutex() noexcept
Get the clock's mutex.
RCLCPP_PUBLIC bool sleep_for(Duration rel_time, Context::SharedPtr context=contexts::get_global_default_context())
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
Encapsulation of a time source.
Describe the prerequisites for calling a time jump callback.
Struct to describe a jump in time.
enum rcl_clock_type_e rcl_clock_type_t
Time source type, used to indicate the source of a time measurement.
@ RCL_SYSTEM_TIME
Use system time.