replace time.sleep by rospy.Rate.sleep

time was not even imported, so I don't know why this could ever have worked...