===== fingerpub and surfaceClassifier ===== In order to do surface classification these two nodes should be running. Start the fingerpub node (./bin/fingerpub) first and then the surfaceClassifier (./bin/surfaceClassifier). **fingerpub** reads information directly from the sensors and publishes it as adns messages (//adns.msg//) in the //fingertip/adns// topic. It also implements a service called //ChangeActiveSensor// that the **surfaceClassifier** node uses to specify the active sensor. **surfaceClassifier** subscribes to the //fingertip/adns// topic and is used to create, save and edit models, as well as doing the surface classification (prediction). This node also subscribes to a topic //fingertip/classifier_command//, which one can use to send commands to it in order to do the mentioned tasks (create, save, edit, etc). When "predicting" (recognizing surfaces) this node publishes the recognized surfaces as a string message in the //fingertip/detected_class//. ==== Command list ==== You can send commands to the **surfaceClassifier** using the following instruction: rostopic pub -1 /fingertip/classifier_command std_msgs/String rostopic pub -1 /fingertip/classifier_command std_msgs/String This is the list of commands that you can send: ^ Command ^ Function ^ | normal | Sets normal mode, this means no image is sent in the adns message and data from all connected sensors is sent. This mode is used for other purposes but not for surface recognition. | | frame0 | Chooses sensor 0 as active sensor. The fingerpub node will send adns messages (including images) belonging only to this sensor. If sensor is not connected a message will be displayed. When adding a class to the model or predicting, the selected sensor can be changed "on the fly", before stoptraining or stoppredict. | | frame1 | Same as frame0 but selects sensor 1. | | frame2 | Same as frame0 but selects sensor 2. | | frame3 | Same as frame0 but selects sensor 3. | | addclass:classname | Adds a new class to the model and automatically starts adding frames to it. The stoptraining command must be sent to stop adding frames for this class. If you want to use the model at a later time, remember to save it using the savemodel command. | | removeclass:classname | Removes the specified class from the current loaded model. To save the changes permanently in the model file remember to savemodel. | | listclasses | List the classes in the current loaded model. | | clearmodel | Clears all the classes in the current loaded model. The model file is not affected if you don't savemodel. | | stoptraining | To stop adding frames to a class. | | pausetraining | To pause adding frames to a class. | | resumetraining | To resume adding frames to a class. | | buildsvm | To build the SVM (Support Vector Machine). A model must be created or loaded first. | | predict | To start recognizing surfaces. An SVM must be built first. The recognized surfaces are published in the //fingertip/detected_class// topic. | | stoppredict | To stop prediction (surface recognition) and stop publishing the recognized surfaces. | | savemodel | Saves changes made to the current loaded model permanently into the model file for later use. IMPORTANT: it always writes to //model.bin// | | loadmodel | It adds classes in //model.bin// to the current loaded model. | ==== command sequence example ==== Assuming sensor 0 is connected. rostopic pub -1 /fingertip/classifier_command std_msgs/String frame0 rostopic pub -1 /fingertip/classifier_command std_msgs/String addclass:table rostopic pub -1 /fingertip/classifier_command std_msgs/String stoptraining rostopic pub -1 /fingertip/classifier_command std_msgs/String addclass:paper rostopic pub -1 /fingertip/classifier_command std_msgs/String stoptraining rostopic pub -1 /fingertip/classifier_command std_msgs/String addclass:breadboard rostopic pub -1 /fingertip/classifier_command std_msgs/String pausetraining rostopic pub -1 /fingertip/classifier_command std_msgs/String resumetraning rostopic pub -1 /fingertip/classifier_command std_msgs/String stoptraining rostopic pub -1 /fingertip/classifier_command std_msgs/String buildsvm rostopic pub -1 /fingertip/classifier_command std_msgs/String predict rostopic pub -1 /fingertip/classifier_command std_msgs/String stoppredict If you want to save the model for a later time then rostopic pub -1 /fingertip/classifier_command std_msgs/String savemodel To use the saved model at a later time, load it, build the svm, choose a sensor that is connected and then start predicting or editing the model. For example: rostopic pub -1 /fingertip/classifier_command std_msgs/String loadmodel rostopic pub -1 /fingertip/classifier_command std_msgs/String buildsvm rostopic pub -1 /fingertip/classifier_command std_msgs/String frame0 rostopic pub -1 /fingertip/classifier_command std_msgs/String predict rostopic pub -1 /fingertip/classifier_command std_msgs/String stoppredict ==== Viewing sensor images ==== rosrun image_view image_view image:=/fingertip/image Where is the sensor you want to see (0-3).