最近很忙,也没空花时间去整理博客,因此仅按着自己能理解的方式记录。
ros的时间系统对于一个初学者来说其实很难处理,因为不去管好像也可以用,但会出一些报错,去学的话又觉得费工夫,不确定用不用的上。下面是一些概念的解释。
关于ros::time::now()在use_sim_time参数影响下的值。
No. The value of ros::time::now() depends on whether the parameter use_sim_time is set.
If use_sim_time == false, ros::time::now() gives you system time (seconds since 1970-01-01 0:00, so something like 1471868323.123456).
If use_sim_time == true, and you play a rosbag, ros::time::now() gives you the time when the rosbag was recorded (probably also something like 1471868323.123456).
If use_sim_time == true, and you run a simulator like Gazebo, ros::time::now() gives you the time from when the simulation was started, starting with zero (so probably something like 63.123456 if the simulator has been running for 63.123456 seconds).
Cases 2 and 3 are in simulation time, so a trajectory that takes 20 seconds to complete will alway