ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Hi all, I found the answer. We need to pass the methods in the cb_args[]. E.g. smach.StateMachine.add('STATE1',CBState(self.my_call_back,cn_args=[self.class_method_tobe_called_inside_call_back]......................
Then in the part of @smach.cb_interface(), we need to pass a function name in the input_keys[] E.g. @smach.cb_interface(input_keys['class_method_to_call_inside_callback'])
Then inside the callback simply call the method with the same name as passed in the input keys e.g @smach.cb_interface(input_keys['method_to_call']) **def my_call_back(self,method_to_call): method_to_call()
2 | No.2 Revision |
Hi all, I found the answer.
We need to pass the methods in the cb_args[]
.
E.g. . E.g.
smach.StateMachine.add('STATE1',CBState(
smach.StateMachine.add('STATE1',CBState(self.my_call_back,cn_args=[self.class_method_tobe_called_inside_call_back]...................... self.my_call_back,cn_args=[self.class_method_tobe_called_inside_call_back]))
Then in the part of @smach.cb_interface()
, we need to pass a function name in the input_keys[]
E.g. @smach.cb_interface(input_keys['class_method_to_call_inside_callback'])E.g.
@smach.cb_interface(input_keys['class_method_to_call_inside_callback'])
Then inside the callback simply call the method with the same name as passed in the input keys
e.g
@smach.cb_interface(input_keys['method_to_call'])
**def my_call_back(self,method_to_call):e.g
@smach.cb_interface(input_keys['**method_to_call'**])
def my_call_back(self,method_to_call):