Contents
Introduction
In this tutorial we'll use rosbag to record and rqt_bag to replay a movement on the Dexterous Hand, using a Cyberglove or any other command method. Please note that the method is very generic: with rosbag you can record and replay any topics you want.
Recording
If you are using the Cyberglove we assume you have started the Cyberglove and remapper as described in this tutorial.
Alternatively you could record movements from the GUI Joint sliders or any other node publishing to the hand command topics. The Hand interface doesn't necessarily need to be started for the time being: we're just going to record the hand targets sent on the command topics.
To record the command topics for every joint together, we use rosbag record with a regular expression :
$ rosbag record -e "/sh_(.*)_mixed_position_velocity_controller/command"
You you should see rosbag start recording and subscribe to each of the command topics the data being recorded.
When you close rosbag, you'll see a new file created in your present working directory, the filename should be of the format YYYY-MM-DD-hh-mm-ss.bag.
Replaying
You can now replay your recorded data, just run rqt_gui and select Bag under the plugins menu, then open the newly created file (replace by the correct file name):
$ rxbag 2013-04-21-12-37-36.bag
You now need to make sure rqt_gui is publishing the data: right click on the Bag window, select Publish->Publish all. Now you can press the play button and your recorded movement will be played back. You'll see your current position within the replayed sequence.