Read on a topic and act when difference occurs?
I having bit of hard time solving this simple issue.. I have to create a listener which has to act when value changes. The topic i read on is sending messages of the type sensor_msg/Joinstate
when the velocity changes, i have to save the current position, and when the velocity changes again i have to write to a file what the position difference and keep on doing that until doesn't occur anymore.. I know before hand it's only going to happen 100 times..
How would you do that.. ??
Here is the code: http://pastebin.com/RxyfZ0s0