ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

ServiceState not detecting output_keys

asked 2012-02-09 02:45:57 -0600

joan gravatar image

updated 2014-01-28 17:11:19 -0600

ngrennan gravatar image

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?

edit retag flag offensive close merge delete

Comments

+1 for documenting your experiences with smach http://wikiri.upc.es/index.php/IRI_ROS_smach_guide

phil0stine gravatar image phil0stine  ( 2012-03-20 05:38:32 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
1

answered 2012-05-18 11:48:33 -0600

jbohren gravatar image

This has been fixed with this revision, and a regression test has been added: https://kforge.ros.org/smach/executive_smach/rev/f3611457d263

edit flag offensive delete link more
0

answered 2012-03-20 10:31:05 -0600

phil0stine gravatar image

updated 2012-03-20 10:32:02 -0600

You might need to include the callback decorator, cb_interface

edit flag offensive delete link more
0

answered 2012-03-20 10:04:50 -0600

Siegfried Gevatter gravatar image

updated 2012-03-20 10:05:00 -0600

Maybe you need to explicitly declare the output key in the State Machine?

Like this:

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'},
                  output_keys=['sm_var'])
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-02-09 02:45:57 -0600

Seen: 876 times

Last updated: May 18 '12