def timer_callback()

in simulation_ws/src/robot_fleet/scripts/gazebo_model_mover.py [0:0]


    def timer_callback(self, event):
        """In this callback, we find out all the stale data and remove the corresponding models."""
        if bool(self.all_data):  # if dict not empty
            for name, data_w_time in self.all_data.iteritems():
                if rospy.Time.now() - data_w_time[1] > rospy.Duration(10):  # If data is staler than 30 secs
                    rospy.logwarn("Removing {} from data since its stale".format(name))
                    self.all_data.pop(name)
                    
                    request = DeleteModelRequest()
                    request.model_name = name

                    response =  self.delete_model(request)
                    rospy.loginfo(response)
                    break  # Since we are popping an element, it will mess up the for loop. Remove one at a time.