File tree 1 file changed +22
-7
lines changed
1 file changed +22
-7
lines changed Original file line number Diff line number Diff line change 10
10
from smach_msgs .msg import SmachContainerStatus
11
11
from hmi import TimeoutException
12
12
from robot_skills import get_robot
13
+ from robot_skills .simulation import is_sim_modes
13
14
14
15
15
16
# clue should be separated with 15 spaces
@@ -100,14 +101,28 @@ def joke(self):
100
101
101
102
self ._robot .speech .speak ("Would you like to hear another one?" )
102
103
103
- r = None
104
- try :
105
- r = self ._robot .hmi .query ('' , 'T -> yes | no' , 'T' ).sentence
106
- except TimeoutException :
107
- pass
104
+ stop : bool = False
105
+ answer = None
106
+ if is_sim_modes ():
107
+ try :
108
+ answer = self ._robot .hmi .query ('' , 'T -> yes | no' , 'T' ).sentence
109
+ except TimeoutException :
110
+ pass
111
+
112
+ if not answer or answer == "no" :
113
+ stop = True
114
+
115
+ else :
116
+ try :
117
+ answer = self ._robot .picovoice .get_intent ("yesOrNo" , None , True , self .timeout )
118
+ except TimeoutException :
119
+ pass
120
+
121
+ if not answer or not answer .semantics or answer .semantics == "no"
122
+ stop = True
108
123
109
- if not r or r == "no" :
110
- self ._robot .speech .speak ("Ok, I will be quiet for another %d minutes" % self ._standby_min )
124
+ if stop :
125
+ self ._robot .speech .speak (f "Ok, I will be quiet for another { self ._standby_min } minutes" )
111
126
self ._last_update = rospy .Time .now ()
112
127
113
128
You can’t perform that action at this time.
0 commit comments