These two options represent the same time. In code, you should definitely use
ros::Time::now(). It will get you the current ROS time that is being published to
/clock without most of the overhead involved with subscribing to the topic yourself. Plus, it looks a lot better in your code.
Originally posted by DimitriProsser with karma: 11163 on 2012-05-15
This answer was ACCEPTED on the original site
Post score: 2
Comment by Lorenz on 2012-05-15:
Isn't /clock only published by simulation and only used by ros::Time when use_sim_time is true? I think on a real system, subscribing to it would just not work.
Comment by DimitriProsser on 2012-05-15:
I believe you might be correct