ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I was facing the same issue and realized that it happened because my node runs before gazebo simulation is ready. So, for me the solution was to simply run the node that contains ros::Time::now only after the gazebo simulation is ready and running.
I guess this is because ros::Time::now().toSec() gets the time of simulation that you see in gazebo, that's why it has to be run after running gazebo.
I hope this helps