85 using std::stringstream;
87 using yarp::sig::Vector;
88 using yarp::os::Bottle;
92 Vector *
data = portSkinDiagnosticsErrorsIn.read(
false);
94#if SKINMANAGER_TH_DIAGREAD_DEBUG
96 cout << dbgTag <<
"Skin diagnostics data: ";
97 for (
size_t i = 0; i <
data->size(); ++i) {
98 cout << (*data)[i] <<
" ";
104 Bottle &
out = portSkinManagerErrorsOut.prepare();
108 deque<bool> errorTaxels;
109 int errorCode = (int) (*
data)[3];
110 if (!(errorCode & SkinErrorCode::StatusOK)) {
113 if (errorCode & 0xFFF0) {
114 errorTaxels.resize(12,
false);
115 int errorMask = SkinErrorCode::TaxelStuck00;
116 for (
int tax = 0; tax < 12; ++tax) {
117 errorTaxels[tax] = ((errorCode & errorMask) != 0);
118 errorMask = errorMask << 1;
122 if (errorTaxels.size() > 0) {
125 ss <<
"ERROR: Net ID (" << (*data)[0] <<
"): Board ID (" << (*data)[1]
126 <<
"): Sensor ID (" << (*data)[2] <<
"): The following taxels are stuck/faulty: \t";
127 for (
size_t i = 0; i < errorTaxels.size(); ++i) {
128 if (errorTaxels[i]) {
133 out.addString(ss.str().c_str());
138 if (errorCode & SkinErrorCode::ErrorReading12C) {
139 ss <<
"ERROR: Net ID (" << (*data)[0] <<
"): Board ID (" << (*data)[1]
140 <<
"): Sensor ID (" << (*data)[2] <<
"): Cannot read from this sensor.";
141 }
else if (errorCode & SkinErrorCode::ErrorACK4C) {
142 ss <<
"ERROR: Net ID (" << (*data)[0] <<
"): Board ID (" << (*data)[1]
143 <<
"): Sensor ID (" << (*data)[2] <<
"): This sensor does not respond to the initialisation message (0x4C).";
146 ss.seekg(0, ios::end);
148 ss.seekg(0, ios::beg);
149 out.addString(ss.str().c_str());
154 ss <<
"DEBUG: Skin is working fine.";
155 out.addString(ss.str().c_str());
160 if (
out.size() > 0) {
161 portSkinManagerErrorsOut.write();