24 Print the numbers of a countdown on the terminal in-place, without using a new line for each number
26 :param duration: How long to count down
27 :param stepsize: Time between steps
28 :param text: What text to display each tick. Must include a format string, eg. 'launch in {}...'
30 step, substep = divmod(duration, stepsize)
31 for i
in range(int(step), 0, -stepsize):
32 if not rospy.is_shutdown():
33 sys.stdout.write(
"\r" + text.format(i))
38 if step > 0: sys.stdout.write(
'\n')
43 Rounding operation broadcast over a tuple
45 :param tup: tuple to be rounded
46 :param decimals: how many decimals to round to
47 :return: tuple of same dimension but with lower precision
49 return tuple([round(elem, decimals)
for elem
in tup])