1 #ifndef RPCLISTENERTHREADH 2 #define RPCLISTENERTHREADH 25 #include <yarp/os/Bottle.h> 26 #include <yarp/os/BufferedPort.h> 27 #include <yarp/os/RateThread.h> 35 TouchDetectorThread(yarp::os::BufferedPort<yarp::os::Bottle> *
torsoPort, yarp::os::BufferedPort<yarp::os::Bottle> *
leftArmPort, yarp::os::BufferedPort<yarp::os::Bottle> *
rightArmPort, yarp::os::BufferedPort<yarp::os::Bottle> *
leftForearmPort, yarp::os::BufferedPort<yarp::os::Bottle> *
rightForearmPort, yarp::os::BufferedPort<yarp::os::Bottle> *
leftHandPort, yarp::os::BufferedPort<yarp::os::Bottle> *
rightHandPort, yarp::os::BufferedPort<yarp::os::Bottle> *
touchPort, yarp::os::BufferedPort<yarp::os::Bottle> *
touchPortCleaned,
int period, std::string
clustersConfFilepath,
double threshold,
int taxelThreshold);
52 yarp::os::BufferedPort<yarp::os::Bottle> *
torsoPort;
59 yarp::os::BufferedPort<yarp::os::Bottle> *
touchPort;
84 void updateMapping(
int bodyPart,
int firstTaxel,
int lastTaxel,
int cluster);
92 void countActivations(
int bodyPart, yarp::os::Bottle *data, std::vector<int> &activations);
101 void processPort(
int portNum, yarp::os::BufferedPort<yarp::os::Bottle> *port, std::vector<int> &activations);
110 virtual const char* what()
const throw();
120 virtual const char* what()
const throw();
bool readTaxelsMapping(std::string filename)
readTaxelsMapping Read taxels map from configure file, which relates to nbBodyParts and bodyParts ...
int getBodyPartId(std::string bodyPartName)
getBodyPartId Obtain the ID of body parts, which are "torso", "left_arm", "right_arm", "left_forearm", "right_forearm", "left_hand", "right_hand"
yarp::os::BufferedPort< yarp::os::Bottle > * rightHandPort
Yarp BufferedPort of bottle for input right hand activations.
int taxelThreshold
integer value of touched threshold
void countActivations(int bodyPart, yarp::os::Bottle *data, std::vector< int > &activations)
countActivations Counts number of activations to a body part through a buffered port of that part ...
yarp::os::BufferedPort< yarp::os::Bottle > * leftArmPort
Yarp BufferedPort of bottle for input left arm activations.
yarp::os::BufferedPort< yarp::os::Bottle > * rightForearmPort
Yarp BufferedPort of bottle for input right forearm activations.
yarp::os::BufferedPort< yarp::os::Bottle > * touchPort
Yarp BufferedPort of bottle for output touched activations.
yarp::os::BufferedPort< yarp::os::Bottle > * leftHandPort
Yarp BufferedPort of bottle for input left hand activations.
yarp::os::BufferedPort< yarp::os::Bottle > * torsoPort
Yarp BufferedPort of bottle for input torso activations.
yarp::os::BufferedPort< yarp::os::Bottle > * rightArmPort
Yarp BufferedPort of bottle for input right arm activations.
static const int noCluster
yarp::os::BufferedPort< yarp::os::Bottle > * touchPortCleaned
Yarp BufferedPort of bottle for output touched taxel.
std::string clustersConfFilepath
string value of the path to configure file of clusters
yarp::os::BufferedPort< yarp::os::Bottle > * leftForearmPort
Yarp BufferedPort of bottle for input left forearm activations.
static const int nbBodyParts
void processPort(int portNum, yarp::os::BufferedPort< yarp::os::Bottle > *port, std::vector< int > &activations)
processPort Process port of body part to receive activations to that body part
static const int nbTaxels[7]
void updateMapping(int bodyPart, int firstTaxel, int lastTaxel, int cluster)
updateMapping Change all taxels of a body part to clusterID
std::vector< int > taxels2Clusters[7]
standard vector of integer containing the taxel IDs in form of cluster ID
static const char * bodyParts[7]
TouchDetectorThread(yarp::os::BufferedPort< yarp::os::Bottle > *torsoPort, yarp::os::BufferedPort< yarp::os::Bottle > *leftArmPort, yarp::os::BufferedPort< yarp::os::Bottle > *rightArmPort, yarp::os::BufferedPort< yarp::os::Bottle > *leftForearmPort, yarp::os::BufferedPort< yarp::os::Bottle > *rightForearmPort, yarp::os::BufferedPort< yarp::os::Bottle > *leftHandPort, yarp::os::BufferedPort< yarp::os::Bottle > *rightHandPort, yarp::os::BufferedPort< yarp::os::Bottle > *touchPort, yarp::os::BufferedPort< yarp::os::Bottle > *touchPortCleaned, int period, std::string clustersConfFilepath, double threshold, int taxelThreshold)