<commit_before>import rospy
import smach

from monitor_pause import MonitorPause
from monitored_navigation.recover_state_machine import RecoverStateMachine

#TODO: log pauses? 
#from mongo_logger import MonitoredNavEventClass 




class PauseState(RecoverStateMachine):
    def __init__(self):
        RecoverStateMachine.__init__(self)
        self.resume_monitor=MonitorPause(is_paused=True)
        
        with self:
            smach.StateMachine.add('PAUSE_STATE',
                                   self.resume_monitor,
                                   transitions={'preempted':'preempted',
                                                'invalid':'recovered_without_help',
                                                'valid':'recovered_without_help'})
 <commit_msg>logging pauses - user taking over with gamepad or pause service calls - to mongodb<commit_after>import rospy
import smach

from monitor_pause import MonitorPause
from monitored_navigation.recover_state_machine import RecoverStateMachine

from mongo_logger import MonitoredNavEventClass 




class PauseState(RecoverStateMachine):
    def __init__(self):
        
        self.nav_stat=None
        
        RecoverStateMachine.__init__(self)
        self.resume_monitor=MonitorPause(is_paused=True)
        
        with self:
            smach.StateMachine.add('PAUSE_STATE',
                                   self.resume_monitor,
                                   transitions={'preempted':'preempted',
                                                'invalid':'recovered_without_help',
                                                'valid':'recovered_without_help'})
                                                
    def execute(self, userdata):
        self.nav_stat=MonitoredNavEventClass()
        self.nav_stat.initialize(recovery_mechanism="paused")
        result=smach.StateMachine.execute(self, userdata)
        self.nav_stat.finalize(was_helped=False,n_tries=0)
        self.nav_stat.insert()
        return result
 
{'fraction_non_alphanumeric': 0.06746031746031746, 'fraction_numerical': 0.000496031746031746, 'mean_word_length': 1.9402332361516035, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '984577', 'n_tokens_mistral': 522, 'n_tokens_neox': 499, 'n_words': 85}