Get mean of two ros::Time stamps
Given two ros::Time
instances t1
and t2
. What is the easiest, clearest way to compute the mean them, that is the time that is in the middle between t1
and t2
?
The obvious solution (t1 + t2) / 2
does unfortunately not work, as +
is undefined for two ros::Time
instances.
My second idea, t1 + (t2 - t1) / 2
does still not work. The subtraction and addition work, but it will fail on the division.
Of course, I could just convert the time stamps to seconds to do the calculation, but I wonder if there is a nicer way, using ros::Time
.