15 #ifndef RCLCPP__TIME_SOURCE_HPP_
16 #define RCLCPP__TIME_SOURCE_HPP_
23 #include "builtin_interfaces/msg/time.hpp"
24 #include "rosgraph_msgs/msg/clock.hpp"
25 #include "rcl_interfaces/msg/parameter_event.hpp"
62 rclcpp::Node::SharedPtr node,
64 bool use_clock_thread =
true);
75 bool use_clock_thread =
true);
99 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base_interface,
100 rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr node_topics_interface,
101 rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph_interface,
102 rclcpp::node_interfaces::NodeServicesInterface::SharedPtr node_services_interface,
103 rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr node_logging_interface,
104 rclcpp::node_interfaces::NodeClockInterface::SharedPtr node_clock_interface,
105 rclcpp::node_interfaces::NodeParametersInterface::SharedPtr node_parameters_interface);
134 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base_;
135 rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr node_topics_;
136 rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph_;
137 rclcpp::node_interfaces::NodeServicesInterface::SharedPtr node_services_;
138 rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr node_logging_;
139 rclcpp::node_interfaces::NodeClockInterface::SharedPtr node_clock_;
140 rclcpp::node_interfaces::NodeParametersInterface::SharedPtr node_parameters_;
149 using MessageT = rosgraph_msgs::msg::Clock;
154 rclcpp::CallbackGroup::SharedPtr clock_callback_group_;
155 rclcpp::executors::SingleThreadedExecutor::SharedPtr clock_executor_;
162 void create_clock_sub();
165 void destroy_clock_sub();
168 using ParamMessageT = rcl_interfaces::msg::ParameterEvent;
176 enum UseSimTimeParameterState {UNSET, SET_TRUE, SET_FALSE};
177 UseSimTimeParameterState parameter_state_;
180 void enable_ros_time();
182 void disable_ros_time();
185 static void set_clock(
186 const builtin_interfaces::msg::Time::SharedPtr msg,
187 bool set_ros_time_enabled,
188 rclcpp::Clock::SharedPtr clock);
192 bool ros_time_active_{
false};
201 rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr sim_time_cb_handler_{
nullptr};
206 #endif // RCLCPP__TIME_SOURCE_HPP_