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" 38 explicit TimeSource(rclcpp::Node::SharedPtr node);
48 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base_interface,
49 rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr node_topics_interface,
50 rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph_interface,
51 rclcpp::node_interfaces::NodeServicesInterface::SharedPtr node_services_interface,
52 rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr node_logging_interface,
53 rclcpp::node_interfaces::NodeClockInterface::SharedPtr node_clock_interface,
54 rclcpp::node_interfaces::NodeParametersInterface::SharedPtr node_parameters_interface);
74 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base_;
75 rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr node_topics_;
76 rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph_;
77 rclcpp::node_interfaces::NodeServicesInterface::SharedPtr node_services_;
78 rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr node_logging_;
79 rclcpp::node_interfaces::NodeClockInterface::SharedPtr node_clock_;
80 rclcpp::node_interfaces::NodeParametersInterface::SharedPtr node_parameters_;
86 using MessageT = rosgraph_msgs::msg::Clock;
93 void clock_cb(
const rosgraph_msgs::msg::Clock::SharedPtr msg);
96 void create_clock_sub();
99 void destroy_clock_sub();
102 using ParamMessageT = rcl_interfaces::msg::ParameterEvent;
107 void on_parameter_event(
const rcl_interfaces::msg::ParameterEvent::SharedPtr event);
110 enum UseSimTimeParameterState {UNSET, SET_TRUE, SET_FALSE};
111 UseSimTimeParameterState parameter_state_;
114 void enable_ros_time();
116 void disable_ros_time();
119 static void enable_ros_time(rclcpp::Clock::SharedPtr clock);
120 static void disable_ros_time(rclcpp::Clock::SharedPtr clock);
121 static void set_clock(
122 const builtin_interfaces::msg::Time::SharedPtr msg,
123 bool set_ros_time_enabled,
124 rclcpp::Clock::SharedPtr clock);
128 bool ros_time_active_;
130 rosgraph_msgs::msg::Clock::SharedPtr last_msg_set_;
140 #endif // RCLCPP__TIME_SOURCE_HPP_ Definition: logger.hpp:77
This header provides the get_node_topics_interface() template function.
Definition: allocator_common.hpp:24
Subscription implementation, templated on the type of message this subscription receives.
Definition: subscription.hpp:59
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
void detachClock(rclcpp::Clock::SharedPtr clock)
Definition: time_source.hpp:34
void attachClock(rclcpp::Clock::SharedPtr clock)
Attach a clock to the time source to be updated.
void attachNode(rclcpp::Node::SharedPtr node)