Isn't it different to servers....Unit 5: ROS Actions

Respected Prof,
In the code below, first we connect to server and then we wait for it to be running. In Service_Server, we used to first wait for the server to be running and then create connection to the server. Why is it opposite to Service_Server ?

code:
# create the connection to the action server
client = actionlib.SimpleActionClient(’/ardrone_action_server’, ArdroneAction)
# waits until the action server is up and running
client.wait_for_server()

The line client = actionlib.SimpleActionClient(’/ardrone_action_server’, ArdroneAction) is creating a client object, so it’s not necessarily connecting to the server at that precise moment. Where do you see that it’s opposite in Service_Server?

In the pic below, the service_client first waits for the server to be running. Then it connects to it.

But in this other pic below, which is about action_client, the action_client first makes connection, then it waits for the server to run

Note how the first one is a connection to the service (rospy.ServiceProxy) and the second is a connection to the action server (actionlib.SimpleActionClient)

@abdulbasitisdost

You don’t need to bother about things like this. It’s the way it is - how ROS has designed it to work, we just follow it :wink:

Sure Professor. :sweat_smile:
Yeah May be that’s like taking away it’s abstract nature…But I thought may be it would stick to my mind easily if I can write them both in the same way