<commit_before>#! /usr/bin/env python

import rospy

from monitored_navigation.ui_helper import UIHelper

import actionlib
from mary_tts.msg import maryttsAction, maryttsGoal

    
class HelpSpeech(UIHelper):

    def __init__(self):

        self.speaker=actionlib.SimpleActionClient('/speak', maryttsAction)
        rospy.loginfo("Waiting for marytts action...") 
        self.speaker.wait_for_server()
        rospy.loginfo("Done") 
        
        self.nav_help_speech='I am having problems moving. Please push me to a clear area.'
        self.bumper_help_speech='My bumper is being pressed. Please release it so I can move on!'
        self.help_failed_speech='Something is still wrong. Are you sure I am in a clear area?'
        self.help_finished_speech='Thank you! I will be on my way.'
        
        UIHelper.__init__(self)
 

    def ask_help(self, failed_component, interaction_service, n_fails):
        if failed_component=='navigation':
            self.call_speech(self.nav_help_speech)
        elif failed_component=='bumper':
            self.call_speech(self.bumper_help_speech)
        
    def being_helped(self, failed_component, interaction_service, n_fails):
        return
        
    def help_finished(self, failed_component, interaction_service, n_fails):
        self.call_speech(self.help_finished_speech)
        
    def help_failed(self, failed_component, interaction_service, n_fails):
        self.call_speech(self.help_failed)
    
   
    def call_speech(self, text):
        self.speaker.send_goal(maryttsGoal(text=text))
        self.speaker.wait_for_result()
 
  <commit_msg>only say thank you when you're helped<commit_after>#! /usr/bin/env python

import rospy

from monitored_navigation.ui_helper import UIHelper

import actionlib
from mary_tts.msg import maryttsAction, maryttsGoal

    
class HelpSpeech(UIHelper):

    def __init__(self):

        self.speaker=actionlib.SimpleActionClient('/speak', maryttsAction)
        rospy.loginfo("Waiting for marytts action...") 
        self.speaker.wait_for_server()
        rospy.loginfo("Done") 
        
        self.nav_help_speech='I am having problems moving. Please push me to a clear area.'
        self.bumper_help_speech='My bumper is being pressed. Please release it so I can move on!'
        self.help_failed_speech='Something is still wrong. Are you sure I am in a clear area?'
        self.help_finished_speech='Thank you! I will be on my way.'
        
        self.was_helped=False
        
        UIHelper.__init__(self)
 

    def ask_help(self, failed_component, interaction_service, n_fails):
        if failed_component=='navigation':
            self.call_speech(self.nav_help_speech)
        elif failed_component=='bumper':
            self.call_speech(self.bumper_help_speech)
        
    def being_helped(self, failed_component, interaction_service, n_fails):
        self.was_helped=True
        return
        
    def help_finished(self, failed_component, interaction_service, n_fails):
        if self.was_helped:
            self.call_speech(self.help_finished_speech)
        self.was_helped=False
        
    def help_failed(self, failed_component, interaction_service, n_fails):
        self.call_speech(self.help_failed)
    
   
    def call_speech(self, text):
        self.speaker.send_goal(maryttsGoal(text=text))
        self.speaker.wait_for_result()
 
  
{'fraction_non_alphanumeric': 0.082203889216264, 'fraction_numerical': 0.0, 'mean_word_length': 2.980070339976553, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6342734', 'n_tokens_mistral': 1081, 'n_tokens_neox': 1027, 'n_words': 229}