Requesting different services with the same client node
Hi all!
So I have a ROS client like thus
ros::ServiceClient client
I also have two services:
1) "start_load_recording": This service basically tells a sensor to start logging force data into a text file. The type of message conveyed over this service is 'startMsg'
2) "stop_load_recording": This service tells that very same sensor to stop logging the force data, and close down the text file. The type of message conveyed over this service is 'stopMsg'
The thing is, I want to have a client which can request both these services. Thus I am using the client as a sort of 'on-off switch' for logging and un-logging the force data.
Can I do that? For example,
client = n.serviceClient<cell_node::startMsg>("start_load_recording");
//prepare my service message request variables. Lets say its called strt
client.call(strt);
.
.
.
//few lines of code
.
.
.
client = n.serviceClient<cell_node::stopMsg>("stop_load_recording");
//prepare my service message request variables. Lets say its called stop
client.call(stop);
Can I do the above?
Thanks and all help is greatly appreciated!