ServiceState not detecting output_keys
I am using SMACH to request a Service. I want to assign a response callback that parses the Server's response and computes some output values.
Here there is the most relevant part of the code simplified for better understanding:
# hri result callback
def foo_response_cb(userdata, response):
userdata.foo_var_out = response.x + response.y
return 'succeeded'
# add state to state machine
smach.StateMachine.add('FOO',
ServiceState('/service',
myService,
response_cb=foo_response_cb,
output_keys=['foo_var_out']),
remapping={'foo_var_out':'sm_var'},
transitions={'succeeded':'succeeded'})
For some reason, the output values are not detected, so I get the following error:
Writing to SMACH userdata key 'foo_var_out' but the only keys that were declared as output from this state were: ().
Which is the same error I get if I do not add any output key at all.
Can anybody give some hint of what may be happening?
+1 for documenting your experiences with smach http://wikiri.upc.es/index.php/IRI_ROS_smach_guide