Using Actionlib for publishing force data in ROS
Hello All!
So here is what I want to implement, in a simple list format
1) I want to have a topic which publishes data from my force sensor (serial) onto the network constantly.
2) I want to have a service, which when called, starts logging force values from the data stream being published.
3) In the case that I use multiple force sensors at once, I want to have each topic publishing and service request-response business to happen in an individual thread.
My current implementation (which simply publishes topics for all sensors in a while(ros::ok()) loop for all sensors) publishes data at about 16 Hz per force sensor, and I have a feeling it is the ROS stuff that is messing with the data output rate. I tried reading serial data off the sensors into a file without any ROS stuff in between, and then manually counted/calculated the frequency of data logging. I got an average frequency of about 55 Hz per sensor, clearly indicating that I am choking the system somewhere.
This is when I remembered a prior suggestion by Lorentz that I should use the actionlib library within ROS to achieve my above listed objectives. Is there any good tutorial on implementing actionlib server/client systems within threads, encapsulated in a class structure in C++?
Also, I am open to other suggestions with which I can increase my data rate compared to what it is now. I got frequent suggestions from my friends about using a circular queue/ buffer, also known as a ring buffer to store my data temporarily until it is read. How can I implement this buffer idea under a ROS backdrop? Any pointers in this matter would go a long way in solving this issue.
Thanks and any help is much appreciated!