11 #include <rosgraph_msgs/Clock.h> 49 clock_pub_ =
nh_.advertise<rosgraph_msgs::Clock>(
"/clock", 0);
59 double current_time = 0.0;
62 rosgraph_msgs::Clock
msg;
63 msg.clock = ros::Time(current_time);
79 int main(
int argc,
char **argv)
81 ros::init(argc, argv,
"clock_publisher");
float publish_rate_
Frequency (Hz) of publish on the /clock topic (ROS frequency)
ros::NodeHandle nh_
Node handler.
To publish on the /clock topic at some frequency.
void run_node()
Runs the node.
bool use_sim_time_
Whether to publish something in the /clock topic.
ros::Publisher clock_pub_
Clock publisher.
Class to publish on the /clock topic.
void init_node()
Initialises the node and its parameters.
int main(int argc, char **argv)
Main function called before node initialisation.