ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

call a class method inside callback for CBState

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

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 -0600

amarbanerjee23 gravatar image

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



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

Seen: 225 times

Last updated: Apr 11 '19