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" 40 explicit TimeSource(rclcpp::Node::SharedPtr node);
50 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base_interface,
51 rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr node_topics_interface,
52 rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph_interface,
53 rclcpp::node_interfaces::NodeServicesInterface::SharedPtr node_services_interface,
54 rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr node_logging_interface,
55 rclcpp::node_interfaces::NodeClockInterface::SharedPtr node_clock_interface,
56 rclcpp::node_interfaces::NodeParametersInterface::SharedPtr node_parameters_interface);
76 rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base_;
77 rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr node_topics_;
78 rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph_;
79 rclcpp::node_interfaces::NodeServicesInterface::SharedPtr node_services_;
80 rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr node_logging_;
81 rclcpp::node_interfaces::NodeClockInterface::SharedPtr node_clock_;
82 rclcpp::node_interfaces::NodeParametersInterface::SharedPtr node_parameters_;
88 using MessageT = rosgraph_msgs::msg::Clock;
95 void clock_cb(
const rosgraph_msgs::msg::Clock::SharedPtr msg);
98 void create_clock_sub();
101 void destroy_clock_sub();
107 using ParamMessageT = rcl_interfaces::msg::ParameterEvent;
112 void on_parameter_event(
const rcl_interfaces::msg::ParameterEvent::SharedPtr event);
115 enum UseSimTimeParameterState {UNSET, SET_TRUE, SET_FALSE};
116 UseSimTimeParameterState parameter_state_;
119 void enable_ros_time();
121 void disable_ros_time();
124 static void enable_ros_time(rclcpp::Clock::SharedPtr clock);
125 static void disable_ros_time(rclcpp::Clock::SharedPtr clock);
126 static void set_clock(
127 const builtin_interfaces::msg::Time::SharedPtr msg,
128 bool set_ros_time_enabled,
129 rclcpp::Clock::SharedPtr clock);
133 bool ros_time_active_;
135 rosgraph_msgs::msg::Clock::SharedPtr last_msg_set_;
145 #endif // RCLCPP__TIME_SOURCE_HPP_ Definition: logger.hpp:77
Definition: allocator_common.hpp:24
Subscription implementation, templated on the type of message this subscription receives.
Definition: subscription.hpp:148
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
void detachClock(rclcpp::Clock::SharedPtr clock)
Definition: time_source.hpp:36
void attachClock(rclcpp::Clock::SharedPtr clock)
Attach a clock to the time source to be updated.
void attachNode(rclcpp::Node::SharedPtr node)