everything seems to work together as expected
(if not perfectly)
This commit is contained in:
@@ -23,6 +23,8 @@ def inform_controller_factory(who):
|
||||
def handle_request(r):
|
||||
module = r.module
|
||||
message = r.message
|
||||
_state_old = STATE
|
||||
permission = False
|
||||
global STATE
|
||||
|
||||
if module == 'walker':
|
||||
@@ -30,12 +32,10 @@ def handle_request(r):
|
||||
if STATE in ('idle', 'walk'):
|
||||
STATE = 'walk'
|
||||
permission = True
|
||||
else:
|
||||
permission = False
|
||||
elif message == 'stop':
|
||||
if STATE == 'walk':
|
||||
STATE = 'idle'
|
||||
permission = True
|
||||
permission = True
|
||||
|
||||
elif module == 'fall_detector':
|
||||
permission = True
|
||||
@@ -48,28 +48,27 @@ def handle_request(r):
|
||||
if message == 'imitate':
|
||||
if STATE == 'imitate':
|
||||
permission = True
|
||||
else:
|
||||
permission = False
|
||||
|
||||
elif module == 'speech_recognition':
|
||||
if message == 'imitate':
|
||||
if message == 'recognize':
|
||||
if STATE in ('idle', 'imitate'):
|
||||
permission = True
|
||||
elif message == 'imitate':
|
||||
if STATE == 'idle':
|
||||
STATE = 'imitate'
|
||||
permission = True
|
||||
else:
|
||||
permission = False
|
||||
if message == 'stop':
|
||||
elif message == 'stop':
|
||||
if STATE == 'imitate':
|
||||
STATE = 'idle'
|
||||
permission = True
|
||||
else:
|
||||
permission = False
|
||||
|
||||
rospy.loginfo(
|
||||
'Got request from %s to %s. Permission: %s. State is now: %s.' % (
|
||||
rospy.logdebug(
|
||||
'GOT REQUEST FROM %s TO %s.\nPERMISSION: %s.\nSTATE IS NOW: %s.' % (
|
||||
module, message, permission, STATE
|
||||
)
|
||||
)
|
||||
if _state_old != STATE:
|
||||
rospy.loginfo('{} -> {}'.format(_state_old, STATE))
|
||||
return InformControllerResponse(permission)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user