void gazebo_stats_callback(ConstWorldStatisticsPtr &msg) { Time t(msg->sim_time().sec(), msg->sim_time().nsec()); Time rt(msg->real_time().sec(), msg->real_time().nsec()); // Time rt = Time::realNow(); // if(gazebo_registered) { Time::setTime(t, t.seconds() / rt.seconds()); // } // gazebo_last_time = }
void cb2(ConstWorldStatisticsPtr &_msg) { std_msgs::Float64 realtime, simtime,nanosec; realtime.data=_msg->real_time().sec(); //nanosec.data=_msg->real_time().nsec(); simtime.data=_msg->sim_time().sec(); pub2.publish(realtime); pub3.publish(simtime); //pub4.publish(nanosec); }