38 #include "rosgraph_msgs/Clock.h" 42 #define SIM_TIME_INCREMENT_US 10000 51 int main(
int argc,
char** argv)
59 node_priv.
param<
int>(
"sim_speedup", sim_speedup, 1);
63 int rv = gettimeofday(&start, NULL);
66 rv = gettimeofday(&now, NULL);
69 ROS_ERROR(
"Invalid return from gettimeofday: %d", rv);
73 rosgraph_msgs::Clock sim_time;
74 sim_time.clock.sec = now.tv_sec - start.tv_sec;
75 sim_time.clock.nsec = now.tv_usec * 1000;
78 ROS_INFO(
"Starting simulation time publisher at time: %d.%d", sim_time.clock.sec, sim_time.clock.nsec);
85 while (sim_time.clock.nsec > 1000000000)
87 sim_time.clock.nsec -= 1000000000;
#define SIM_TIME_INCREMENT_US
void publish(const boost::shared_ptr< M > &message) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ROSCPP_DECL void spinOnce()
int main(int argc, char **argv)