How can I have a subscriber within an action service? [PYTHON] [closed]

asked 2020-05-05 19:29:53 -0600

naegling77 gravatar image

The problem I face is that both the action server and subscriber uses callback.So how can I make it work?

def action_callback():
  sub = rospy.Subscriber( , ,sub_callback)
  .
  .
  .
  rospy.spin()
server = actionlib.SimpleActionServer(... , ... , action_callback)
rospy.spin()
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by naegling77
close date 2020-07-30 14:41:47.242020

Comments

yes! it will work most for time, are keeping it in the loop?

Nitesh_j gravatar image Nitesh_j  ( 2020-05-06 12:12:40 -0600 )edit

Yes, it works actually. I just had a small mistake with the rospy.sleep()

naegling77 gravatar image naegling77  ( 2020-05-06 12:26:03 -0600 )edit

Okay ,all the best

Nitesh_j gravatar image Nitesh_j  ( 2020-05-06 12:30:18 -0600 )edit

Does anyone have a complete working example code on this?

lsrosa gravatar image lsrosa  ( 2021-11-12 06:47:36 -0600 )edit