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

call a class method inside callback for CBState

asked 2017-09-06 00:51:02 -0500

amarbanerjee23 gravatar image

Hi all, I wish to call a class method inside the callback method for CBState. However, the callback method does not have a self parameter. When I call a class method from inside the callback I get the exception "User data key 'class_method_name' not available. Available keys :[]". Is there any specific way to do this ?

Any hint or help would be a great help !!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-09-07 02:05:15 -0500

amarbanerjee23 gravatar image

updated 2019-04-11 18:40:59 -0500

jayess gravatar image

Hi all, I found the answer. We need to pass the methods in the cb_args[]. E.g.


Then in the part of @smach.cb_interface(), we need to pass a function name in the input_keys[] E.g.


Then inside the callback simply call the method with the same name as passed in the input keys e.g

def my_call_back(self,method_to_call):
edit flag offensive delete link more

Question Tools



Asked: 2017-09-06 00:51:02 -0500

Seen: 271 times

Last updated: Apr 11 '19