smach register_trasition_cb passing *cb_args

asked 2014-11-08 10:56:54 -0500

Wedontplay gravatar image

Hi, I need to publish the current state on each state transition so I'm trying to use state transition callback to do that. I just don't gat how to pass my publisher class to the callback properly (I never used python before). If I try this:

state_publisher = StatePublisher()
...
sm.register_transition_cb(sm_transition_callback, cb_args=[state_publisher])

I have this error:

cb_args[0].publish_state(active_states)
IndexError: tuple index out of range

What is the correct way to pass an object as cb_args and retrieve it inside the callback?

Tx. Gabriele

edit retag flag offensive close merge delete