Services and Actions client


I have a doubt regarding the service and action client. In service client, we wait for the service server to be running and then we create a connection with the server


service_client = rospy.ServiceProxy("/xyz", Service_Message)

while in action client, we first establish a connection and wait for the action server.

action_client = actionlib.SimpleActionClient(“xyz”, Action_message)


Why is there a difference in the approach when services and actions are so similar and also how is it possible to establish a connection with action server, when it isnt available?

Thanks a lot in advance.

A service is a synchronized / serial procedure. You send a request and wait for a return, while an action server is asynchronous. It basically is just a topic subscriber and publisher with a specific structure.