From 2df867ab7a97de65a0ab264604beb2d7175faae6 Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Fri, 26 Aug 2016 12:19:59 +0200 Subject: [PATCH 01/24] improving projectIncomingEvents on vtRFthread side --- modules/visuoTactileRF/vtRFThread.cpp | 17 +++++++++-------- modules/visuoTactileRF/vtRFThread.h | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/visuoTactileRF/vtRFThread.cpp b/modules/visuoTactileRF/vtRFThread.cpp index 3ab67e4..8628363 100644 --- a/modules/visuoTactileRF/vtRFThread.cpp +++ b/modules/visuoTactileRF/vtRFThread.cpp @@ -417,11 +417,11 @@ void vtRFThread::run() if (incomingEvents.size()>0) { - projectIncomingEvent(); // project event onto the taxels' RF - computeResponse(stress); // compute the response of each taxel + projectIncomingEvents(); // project event onto the taxels' RF + computeResponse(stress); // compute the response of each taxel } - sendContactsToSkinGui(); // self explicative + sendContactsToSkinGui(); manageSkinEvents(); // manage the dumped port @@ -885,11 +885,13 @@ bool vtRFThread::readHeadEncodersAndUpdateEyeChains() //right eye q[7]=head[4]-head[5]/2.0; eWR->eye->setAng(q*CTRL_DEG2RAD); + + return true; } -bool vtRFThread::projectIncomingEvent() +bool vtRFThread::projectIncomingEvents() { - for (size_t k = 0; k < incomingEvents.size(); k++) + for (vector::const_iterator it = incomingEvents.begin() ; it != incomingEvents.end(); ++it) { for (int i = 0; i < iCubSkinSize; i++) { @@ -912,12 +914,11 @@ bool vtRFThread::projectIncomingEvent() yError("[vtRFThread] in projectIncomingEvent!\n"); // yInfo("T_A:\n%s",T_a.toString().c_str()); - printMessage(5,"\nProject incoming event %s onto %s taxels\n",incomingEvents.back().toString().c_str(),iCubSkin[i].name.c_str()); - + printMessage(5,"\nProject incoming event %s onto %s taxels\n",it->toString().c_str(),iCubSkin[i].name.c_str()); for (size_t j = 0; j < iCubSkin[i].taxels.size(); j++) { dynamic_cast(iCubSkin[i].taxels[j])->Evnt=projectIntoTaxelRF(iCubSkin[i].taxels[j]->getFoR(),T_a, - incomingEvents[k]); //here every taxel (TaxelPWE) is updated with the event - if it is relevant for it + (*it)); //here every taxel (TaxelPWE) is updated with the event - if it is relevant for it // There's a reason behind this choice dumpedVector.push_back(dynamic_cast(iCubSkin[i].taxels[j])->Evnt.Pos[0]); diff --git a/modules/visuoTactileRF/vtRFThread.h b/modules/visuoTactileRF/vtRFThread.h index 162df26..3a202a5 100644 --- a/modules/visuoTactileRF/vtRFThread.h +++ b/modules/visuoTactileRF/vtRFThread.h @@ -271,7 +271,7 @@ class vtRFThread: public RateThread /** * **/ - bool projectIncomingEvent(); + bool projectIncomingEvents(); /** * From 6080b8360ac9f22ddd46bb8000611cab493b5881 Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Fri, 26 Aug 2016 18:11:17 +0200 Subject: [PATCH 02/24] changes to respond to multi-events implemented; testing pending --- lib/include/iCub/periPersonalSpace/taxelPWE.h | 4 +- lib/include/iCub/periPersonalSpace/utils.h | 19 ++++-- lib/src/taxelPWE.cpp | 60 ++++++++++++------- lib/src/utils.cpp | 24 +++++--- modules/visuoTactileRF/vtRFThread.cpp | 17 +++--- 5 files changed, 79 insertions(+), 45 deletions(-) diff --git a/lib/include/iCub/periPersonalSpace/taxelPWE.h b/lib/include/iCub/periPersonalSpace/taxelPWE.h index ccea092..0b7833d 100644 --- a/lib/include/iCub/periPersonalSpace/taxelPWE.h +++ b/lib/include/iCub/periPersonalSpace/taxelPWE.h @@ -44,7 +44,7 @@ class TaxelPWE : public iCub::skinDynLib::Taxel double RFangle; // Angle of the receptive field [rad] - from the taxel normal // The effective angle is thus double that - IncomingEvent4TaxelPWE Evnt; // Stimuli/events nearing the taxel in the taxel's FoR + std::vector Evnts; // Stimuli/events nearing the taxel in the taxel's FoR parzenWindowEstimator *pwe; // /** @@ -67,7 +67,7 @@ class TaxelPWE : public iCub::skinDynLib::Taxel /** * Add or remove a sample from the pwe's histogram **/ - bool addSample(IncomingEvent4TaxelPWE ie); + bool addSample(IncomingEvent4TaxelPWE ie); bool removeSample(IncomingEvent4TaxelPWE ie); /** diff --git a/lib/include/iCub/periPersonalSpace/utils.h b/lib/include/iCub/periPersonalSpace/utils.h index e2c031c..096857a 100644 --- a/lib/include/iCub/periPersonalSpace/utils.h +++ b/lib/include/iCub/periPersonalSpace/utils.h @@ -89,8 +89,8 @@ struct IncomingEvent std::string Src; // the source of information the event is coming from double Threat; //negative valence that may be associated with an object; range <0,1>; 0 should be treated like a neutral object; 1 maximum threat - double NRM; - double TTC; + double NRM; // distance of event from taxel with sign (meters) + double TTC; //time to contact (seconds) /** * Constructors @@ -134,8 +134,8 @@ struct IncomingEvent **/ struct IncomingEvent4TaxelPWE : public IncomingEvent { - double NRM; - double TTC; + double NRM; // distance of event from taxel with sign (meters) + double TTC; //time to contact (seconds) /** * Constructors @@ -162,6 +162,17 @@ struct IncomingEvent4TaxelPWE : public IncomingEvent */ std::vector getNRMTTC(); + /** + * Return norm (~ distance in meters with sign) + */ + double getNRM(); + + /** + * Return time to contact (in seconds) + */ + double getTTC(); + + /** * Print Method **/ diff --git a/lib/src/taxelPWE.cpp b/lib/src/taxelPWE.cpp index 644af9b..b8d8568 100644 --- a/lib/src/taxelPWE.cpp +++ b/lib/src/taxelPWE.cpp @@ -8,14 +8,14 @@ using namespace std; /* TAXEL WRAPPER FOR PWE *****************************************************************/ - TaxelPWE::TaxelPWE() : Taxel(), Evnt() + TaxelPWE::TaxelPWE() : Taxel() { Resp = 0.0; RFangle = 40*M_PI/180; } TaxelPWE::TaxelPWE(const Vector &p, - const Vector &n) : Taxel(p,n), Evnt() + const Vector &n) : Taxel(p,n) { Resp = 0.0; RFangle = 40*M_PI/180; @@ -23,7 +23,7 @@ using namespace std; TaxelPWE::TaxelPWE(const Vector &p, const Vector &n, - const int &i) : Taxel(p,n,i), Evnt() + const int &i) : Taxel(p,n,i) { Resp = 0.0; RFangle = 40*M_PI/180; @@ -105,26 +105,42 @@ using namespace std; bool TaxelPWE::computeResponse(double stress_modulation) { - if (!insideFoRCheck(Evnt)) + double locResp = 0.0; + double maxResp = 0.0; + std::vector In(2); + Resp = 0.0; + for(vector::iterator it = Evnts.begin(); it!=Evnts.end(); it++) { - Resp = 0.0; + if (insideFoRCheck(*it)) + { + In[0] = it->getNRM(); + In[1] = it->getTTC(); + locResp = pwe->computeResponse(In); + yDebug("[TaxelPWE::computeResponse()] event %s inside RF\n",it->toString().c_str()); + yDebug("locResp = locResp + locResp * min(1.0,Evnt.Threat + stress_modulation)\n"); + yDebug(" = %f + %f * min(1.0,%f + %f)\n",locResp,locResp,it->Threat,stress_modulation); + locResp = locResp + (locResp * min(1.0,it->Threat + stress_modulation)); //with this amplification, + //may come out of the range (which used to be <0,255>, now <0,1> after 9.8.2016) + //- in fact up to double that range + yDebug(" locResp = %f \n",locResp); + if (locResp > maxResp) + maxResp = locResp; + } + else + yDebug("[TaxelPWE::computeResponse()] event %s outside RF\n",it->toString().c_str()); + } + In.clear(); + if (maxResp > 0.0) + { + yDebug(" Setting taxel response to maxResp: %f\n",maxResp); + Resp = maxResp; + return true; + } + else{ + yDebug(" maxResp was <=0 (%f) - Leaving taxel response 0, returning false.\n",maxResp); return false; } - - std::vector In = Evnt.getNRMTTC(); - Resp = pwe->computeResponse(In); - - //yDebug("[TaxelPWE::computeResponse()] Resp = Resp + Resp * min(1.0,Evnt.Threat + stress_modulation)\n"); - //yDebug(" = %f + %f * min(1.0,%f + %f)\n",Resp,Resp,Evnt.Threat,stress_modulation); - - - Resp = Resp + (Resp * min(1.0,Evnt.Threat + stress_modulation)); //with this amplification, - //may come out of the range (which used to be <0,255>, now <0,1> after 9.8.2016) - //- in fact double that range - //yDebug(" Resp = %f \n",Resp); - - return true; - } + } Bottle TaxelPWE::TaxelPWEIntoBottle() { @@ -208,7 +224,7 @@ using namespace std; iCub::skinDynLib::Taxel::operator=(t); - Evnt = t.Evnt; + Evnts = t.Evnts; if (pwe) { @@ -281,7 +297,7 @@ using namespace std; iCub::skinDynLib::Taxel::operator=(t); - Evnt = t.Evnt; + Evnts = t.Evnts; if (pwe) { diff --git a/lib/src/utils.cpp b/lib/src/utils.cpp index 14ba044..6f7dbb9 100644 --- a/lib/src/utils.cpp +++ b/lib/src/utils.cpp @@ -197,25 +197,31 @@ unsigned int factorial(unsigned int n) int sgn = Pos[2]>=0?1:-1; NRM = sgn * norm(Pos); - // if (norm(Vel) < 0.38 && norm(Vel) > 0.34) - // { - // TTC = 10000.0; - // } - // else - // - if (dot(Pos,Vel)==0) TTC = 0; - else TTC = -norm(Pos)*norm(Pos)/dot(Pos,Vel); + if (dot(Pos,Vel)==0) + TTC = 0; + else + TTC = -norm(Pos)*norm(Pos)/dot(Pos,Vel); } std::vector IncomingEvent4TaxelPWE::getNRMTTC() { - std::vector x; + std::vector x(2); x.push_back(NRM); x.push_back(TTC); return x; } + + double IncomingEvent4TaxelPWE::getNRM() + { + return NRM; + } + double IncomingEvent4TaxelPWE::getTTC() + { + return TTC; + } + void IncomingEvent4TaxelPWE::print() { yDebug("\tNRM: %g\t TTC: %g \t %s", NRM, TTC, IncomingEvent::toString().c_str()); diff --git a/modules/visuoTactileRF/vtRFThread.cpp b/modules/visuoTactileRF/vtRFThread.cpp index 8628363..1086df6 100644 --- a/modules/visuoTactileRF/vtRFThread.cpp +++ b/modules/visuoTactileRF/vtRFThread.cpp @@ -333,7 +333,8 @@ void vtRFThread::run() } else { - eventsBuffer.push_back(incomingEvents.back()); + eventsBuffer.push_back(incomingEvents.back()); //! the buffering and hence the learning is working only for the last event in the vector + //!so learning should be done with one stimulus only yDebug("I'm buffering! Size %lu",eventsBuffer.size()); } @@ -891,7 +892,7 @@ bool vtRFThread::readHeadEncodersAndUpdateEyeChains() bool vtRFThread::projectIncomingEvents() { - for (vector::const_iterator it = incomingEvents.begin() ; it != incomingEvents.end(); ++it) + for (vector::const_iterator it = incomingEvents.begin() ; it != incomingEvents.end(); it++) { for (int i = 0; i < iCubSkinSize; i++) { @@ -917,15 +918,15 @@ bool vtRFThread::projectIncomingEvents() printMessage(5,"\nProject incoming event %s onto %s taxels\n",it->toString().c_str(),iCubSkin[i].name.c_str()); for (size_t j = 0; j < iCubSkin[i].taxels.size(); j++) { - dynamic_cast(iCubSkin[i].taxels[j])->Evnt=projectIntoTaxelRF(iCubSkin[i].taxels[j]->getFoR(),T_a, - (*it)); //here every taxel (TaxelPWE) is updated with the event - if it is relevant for it + dynamic_cast(iCubSkin[i].taxels[j])->Evnts.push_back(projectIntoTaxelRF(iCubSkin[i].taxels[j]->getFoR(),T_a, + (*it))); //here every taxel (TaxelPWE) is updated with the event - if it is relevant for it // There's a reason behind this choice - dumpedVector.push_back(dynamic_cast(iCubSkin[i].taxels[j])->Evnt.Pos[0]); - dumpedVector.push_back(dynamic_cast(iCubSkin[i].taxels[j])->Evnt.Pos[1]); - dumpedVector.push_back(dynamic_cast(iCubSkin[i].taxels[j])->Evnt.Pos[2]); + dumpedVector.push_back((dynamic_cast(iCubSkin[i].taxels[j]))->Evnts.back().Pos[0]); + dumpedVector.push_back(dynamic_cast(iCubSkin[i].taxels[j])->Evnts.back().Pos[1]); + dumpedVector.push_back(dynamic_cast(iCubSkin[i].taxels[j])->Evnts.back().Pos[2]); - printMessage(5,"Repr. taxel ID %i\tEvent: %s\n",j,dynamic_cast(iCubSkin[i].taxels[j])->Evnt.toString().c_str()); + //printMessage(5,"Repr. taxel ID %i\tEvent: %s\n",j,dynamic_cast(iCubSkin[i].taxels[j])->Evnt.toString().c_str()); } } } From 5e91bb240590dd6f869a520119904870c29e491a Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Mon, 29 Aug 2016 14:08:23 +0200 Subject: [PATCH 03/24] improved debugging outputs --- lib/src/taxelPWE.cpp | 14 +++++++------- modules/visuoTactileRF/vtRFThread.cpp | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/src/taxelPWE.cpp b/lib/src/taxelPWE.cpp index b8d8568..98bf5e5 100644 --- a/lib/src/taxelPWE.cpp +++ b/lib/src/taxelPWE.cpp @@ -116,28 +116,28 @@ using namespace std; In[0] = it->getNRM(); In[1] = it->getTTC(); locResp = pwe->computeResponse(In); - yDebug("[TaxelPWE::computeResponse()] event %s inside RF\n",it->toString().c_str()); - yDebug("locResp = locResp + locResp * min(1.0,Evnt.Threat + stress_modulation)\n"); - yDebug(" = %f + %f * min(1.0,%f + %f)\n",locResp,locResp,it->Threat,stress_modulation); + //yDebug("[TaxelPWE::computeResponse()] Taxel ID: %d, event inside RF - event in Taxel FoR: \n %s \n",this->getID(), it->toString().c_str()); + //yDebug("locResp = locResp + locResp * min(1.0,Evnt.Threat + stress_modulation)\n"); + //yDebug(" = %.2f + %.2f * min(1.0,%.2f + %.2f)\n",locResp,locResp,it->Threat,stress_modulation); locResp = locResp + (locResp * min(1.0,it->Threat + stress_modulation)); //with this amplification, //may come out of the range (which used to be <0,255>, now <0,1> after 9.8.2016) //- in fact up to double that range - yDebug(" locResp = %f \n",locResp); + //yDebug(" locResp = %.2f \n",locResp); if (locResp > maxResp) maxResp = locResp; } else - yDebug("[TaxelPWE::computeResponse()] event %s outside RF\n",it->toString().c_str()); + ;//yDebug("[TaxelPWE::computeResponse()] Taxel ID: %d, event outside RF - event in Taxel FoR\n %s \n",this->getID(), it->toString().c_str()); } In.clear(); if (maxResp > 0.0) { - yDebug(" Setting taxel response to maxResp: %f\n",maxResp); + //yDebug(" Setting taxel response to maxResp: %.2f\n",maxResp); Resp = maxResp; return true; } else{ - yDebug(" maxResp was <=0 (%f) - Leaving taxel response 0, returning false.\n",maxResp); + //yDebug(" maxResp was <=0 (%.2f) - Leaving taxel response 0, returning false.\n",maxResp); return false; } } diff --git a/modules/visuoTactileRF/vtRFThread.cpp b/modules/visuoTactileRF/vtRFThread.cpp index 1086df6..7fd1f19 100644 --- a/modules/visuoTactileRF/vtRFThread.cpp +++ b/modules/visuoTactileRF/vtRFThread.cpp @@ -919,7 +919,8 @@ bool vtRFThread::projectIncomingEvents() for (size_t j = 0; j < iCubSkin[i].taxels.size(); j++) { dynamic_cast(iCubSkin[i].taxels[j])->Evnts.push_back(projectIntoTaxelRF(iCubSkin[i].taxels[j]->getFoR(),T_a, - (*it))); //here every taxel (TaxelPWE) is updated with the event - if it is relevant for it + (*it))); //here every taxel (TaxelPWE) is updated with the event + //future work - would be better to check if it is inside the RF and only those that pass push to the taxel's events // There's a reason behind this choice dumpedVector.push_back((dynamic_cast(iCubSkin[i].taxels[j]))->Evnts.back().Pos[0]); @@ -975,7 +976,7 @@ bool vtRFThread::computeResponse(double stress_modulation) for (size_t j = 0; j < iCubSkin[i].taxels.size(); j++) { dynamic_cast(iCubSkin[i].taxels[j])->computeResponse(stress_modulation); - printMessage(4,"\t Representative ID %i\tResponse %f (with stress modulation:%f)\n",j,dynamic_cast(iCubSkin[i].taxels[j])->Resp,stress_modulation); + printMessage(4,"\t Representative ID %i\tResponse %.2f (with stress modulation:%.2f)\n",j,dynamic_cast(iCubSkin[i].taxels[j])->Resp,stress_modulation); } } From ec12cfeb74d42d281c70d91505229222d375c2d9 Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Mon, 29 Aug 2016 14:19:21 +0200 Subject: [PATCH 04/24] mini formatting edit --- modules/visuoTactileRF/vtRFThread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/visuoTactileRF/vtRFThread.h b/modules/visuoTactileRF/vtRFThread.h index 3a202a5..4b01476 100644 --- a/modules/visuoTactileRF/vtRFThread.h +++ b/modules/visuoTactileRF/vtRFThread.h @@ -106,7 +106,7 @@ class vtRFThread: public RateThread BufferedPort skinGuiPortHandR; BufferedPort *skinPortIn; // input from the skinManager - BufferedPort ppsEventsPortOut; // output for the events + BufferedPort ppsEventsPortOut; // output for the events Port dataDumperPortOut; // output for the dataDumper (quick thing) yarp::sig::Vector dumpedVector; From cfbf17a52baf474fb0cced705c55028fcc8275c8 Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Mon, 29 Aug 2016 14:57:56 +0200 Subject: [PATCH 05/24] cleaning taxels' event vector every iteration --- lib/include/iCub/periPersonalSpace/taxelPWE.h | 2 +- lib/src/taxelPWE.cpp | 2 +- modules/visuoTactileRF/vtRFThread.cpp | 20 ++++++++++++++----- modules/visuoTactileRF/vtRFThread.h | 5 +++++ 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lib/include/iCub/periPersonalSpace/taxelPWE.h b/lib/include/iCub/periPersonalSpace/taxelPWE.h index 0b7833d..d0fd61a 100644 --- a/lib/include/iCub/periPersonalSpace/taxelPWE.h +++ b/lib/include/iCub/periPersonalSpace/taxelPWE.h @@ -84,7 +84,7 @@ class TaxelPWE : public iCub::skinDynLib::Taxel * toString Method **/ std::string toString(int verbosity=0); - + /** * Resets the parzen window estimator **/ diff --git a/lib/src/taxelPWE.cpp b/lib/src/taxelPWE.cpp index 98bf5e5..166bccc 100644 --- a/lib/src/taxelPWE.cpp +++ b/lib/src/taxelPWE.cpp @@ -127,7 +127,7 @@ using namespace std; maxResp = locResp; } else - ;//yDebug("[TaxelPWE::computeResponse()] Taxel ID: %d, event outside RF - event in Taxel FoR\n %s \n",this->getID(), it->toString().c_str()); + yWarning("[TaxelPWE::computeResponse()] Taxel ID: %d, event outside RF - should not be happening in current implementation. Event in Taxel FoR\n %s \n",this->getID(), it->toString().c_str()); } In.clear(); if (maxResp > 0.0) diff --git a/modules/visuoTactileRF/vtRFThread.cpp b/modules/visuoTactileRF/vtRFThread.cpp index 7fd1f19..e33f7a7 100644 --- a/modules/visuoTactileRF/vtRFThread.cpp +++ b/modules/visuoTactileRF/vtRFThread.cpp @@ -314,7 +314,8 @@ void vtRFThread::run() ts.update(); incomingEvents.clear(); - + resetTaxelEventVectors(); + // process the port coming from the visuoTactileWrapper if (inputEvents.size() != 0) { @@ -418,7 +419,7 @@ void vtRFThread::run() if (incomingEvents.size()>0) { - projectIncomingEvents(); // project event onto the taxels' RF + projectIncomingEvents(); // project event onto the taxels' RF and add them to taxels' representation computeResponse(stress); // compute the response of each taxel } @@ -916,11 +917,13 @@ bool vtRFThread::projectIncomingEvents() // yInfo("T_A:\n%s",T_a.toString().c_str()); printMessage(5,"\nProject incoming event %s onto %s taxels\n",it->toString().c_str(),iCubSkin[i].name.c_str()); + IncomingEvent4TaxelPWE projEvent; for (size_t j = 0; j < iCubSkin[i].taxels.size(); j++) { - dynamic_cast(iCubSkin[i].taxels[j])->Evnts.push_back(projectIntoTaxelRF(iCubSkin[i].taxels[j]->getFoR(),T_a, - (*it))); //here every taxel (TaxelPWE) is updated with the event - //future work - would be better to check if it is inside the RF and only those that pass push to the taxel's events + projEvent = projectIntoTaxelRF(iCubSkin[i].taxels[j]->getFoR(),T_a,(*it)); + if(dynamic_cast(iCubSkin[i].taxels[j])->insideFoRCheck(projEvent)) + dynamic_cast(iCubSkin[i].taxels[j])->Evnts.push_back(projEvent); //here every taxel (TaxelPWE) is updated with the events + //events outside of taxel's RF will not be added // There's a reason behind this choice dumpedVector.push_back((dynamic_cast(iCubSkin[i].taxels[j]))->Evnts.back().Pos[0]); @@ -956,6 +959,13 @@ IncomingEvent4TaxelPWE vtRFThread::projectIntoTaxelRF(const Matrix &RF,const Mat return Event_projected; } +void vtRFThread::resetTaxelEventVectors() +{ + for (int i = 0; i < iCubSkinSize; i++) + for (size_t j = 0; j < iCubSkin[i].taxels.size(); j++) + (dynamic_cast(iCubSkin[i].taxels[j]))->Evnts.clear(); +} + void vtRFThread::resetParzenWindows() { for (int i = 0; i < iCubSkinSize; i++) diff --git a/modules/visuoTactileRF/vtRFThread.h b/modules/visuoTactileRF/vtRFThread.h index 4b01476..f89fc6c 100644 --- a/modules/visuoTactileRF/vtRFThread.h +++ b/modules/visuoTactileRF/vtRFThread.h @@ -255,6 +255,11 @@ class vtRFThread: public RateThread bool getRepresentativeTaxels(const std::vector IDv, const int IDx, std::vector &v); + /** + * Resets vector of remapped events pertaining to the taxel + **/ + void resetTaxelEventVectors(); + /** * Will read encoders (torso and arms) and update arm chains. * @return true/false on success failure From 107df381aca16beeb89201c49a9c684ccd2db2ff Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Mon, 29 Aug 2016 17:54:41 +0200 Subject: [PATCH 06/24] solved segfault with dumpedVector and improving debug outputs --- lib/src/taxelPWE.cpp | 12 ++++----- lib/src/utils.cpp | 6 ++--- modules/visuoTactileRF/vtRFThread.cpp | 36 ++++++++++++++++++++------- 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/lib/src/taxelPWE.cpp b/lib/src/taxelPWE.cpp index 166bccc..cf2fca0 100644 --- a/lib/src/taxelPWE.cpp +++ b/lib/src/taxelPWE.cpp @@ -116,13 +116,13 @@ using namespace std; In[0] = it->getNRM(); In[1] = it->getTTC(); locResp = pwe->computeResponse(In); - //yDebug("[TaxelPWE::computeResponse()] Taxel ID: %d, event inside RF - event in Taxel FoR: \n %s \n",this->getID(), it->toString().c_str()); - //yDebug("locResp = locResp + locResp * min(1.0,Evnt.Threat + stress_modulation)\n"); - //yDebug(" = %.2f + %.2f * min(1.0,%.2f + %.2f)\n",locResp,locResp,it->Threat,stress_modulation); + yDebug("[TaxelPWE::computeResponse()] Taxel ID: %d, event inside RF - event in Taxel FoR: \n %s \n",this->getID(), it->toString().c_str()); + yDebug("locResp = locResp + locResp * min(1.0,Evnt.Threat + stress_modulation)\n"); + yDebug(" = %.2f + %.2f * min(1.0,%.2f + %.2f)\n",locResp,locResp,it->Threat,stress_modulation); locResp = locResp + (locResp * min(1.0,it->Threat + stress_modulation)); //with this amplification, //may come out of the range (which used to be <0,255>, now <0,1> after 9.8.2016) //- in fact up to double that range - //yDebug(" locResp = %.2f \n",locResp); + yDebug(" locResp = %.2f \n",locResp); if (locResp > maxResp) maxResp = locResp; } @@ -132,12 +132,12 @@ using namespace std; In.clear(); if (maxResp > 0.0) { - //yDebug(" Setting taxel response to maxResp: %.2f\n",maxResp); + yDebug(" Setting taxel response to maxResp: %.2f\n",maxResp); Resp = maxResp; return true; } else{ - //yDebug(" maxResp was <=0 (%.2f) - Leaving taxel response 0, returning false.\n",maxResp); + yDebug(" maxResp was <=0 (%.2f) - Leaving taxel response 0, returning false.\n",maxResp); return false; } } diff --git a/lib/src/utils.cpp b/lib/src/utils.cpp index 6f7dbb9..8b2d26e 100644 --- a/lib/src/utils.cpp +++ b/lib/src/utils.cpp @@ -145,8 +145,8 @@ unsigned int factorial(unsigned int n) string IncomingEvent::toString() const { stringstream res; - res << "Pos: "<< Pos.toString(3,3) << "\t Vel: "<< Vel.toString(3,3) - << "\t Radius: "<< Radius << "\t Src: "<< Src << "\t threat: "<< Threat ; + res << "Pos: "<< Pos.toString(3,3) << " Vel: "<< Vel.toString(3,3) + << " Radius:"<< Radius << " Src:"<< Src << " threat:"<< Threat ; return res.str(); } @@ -230,7 +230,7 @@ unsigned int factorial(unsigned int n) string IncomingEvent4TaxelPWE::toString() const { stringstream res; - res << "NRM: "<< NRM << "\t TTC: " << TTC << "\t "<< IncomingEvent::toString(); + res << setprecision(3) << "NRM:"<< NRM << " TTC:" << TTC << " "<< IncomingEvent::toString(); return res.str(); } diff --git a/modules/visuoTactileRF/vtRFThread.cpp b/modules/visuoTactileRF/vtRFThread.cpp index e33f7a7..8050243 100644 --- a/modules/visuoTactileRF/vtRFThread.cpp +++ b/modules/visuoTactileRF/vtRFThread.cpp @@ -420,6 +420,21 @@ void vtRFThread::run() if (incomingEvents.size()>0) { projectIncomingEvents(); // project event onto the taxels' RF and add them to taxels' representation + + //should keep backwards compatibility with the dumpedVector format + //it will currently dump only the last event of the possibly multiple events + //TODO check whether this should be preserved + for (int i = 0; i < iCubSkinSize; i++) + for (size_t j = 0; j < iCubSkin[i].taxels.size(); j++) + if(!(dynamic_cast(iCubSkin[i].taxels[j]))->Evnts.empty()) + { + //Ale: There's a reason behind this choice + //Matej: What does that mean? + dumpedVector.push_back((dynamic_cast(iCubSkin[i].taxels[j]))->Evnts.back().Pos[0]); + dumpedVector.push_back(dynamic_cast(iCubSkin[i].taxels[j])->Evnts.back().Pos[1]); + dumpedVector.push_back(dynamic_cast(iCubSkin[i].taxels[j])->Evnts.back().Pos[2]); + } + computeResponse(stress); // compute the response of each taxel } @@ -490,7 +505,7 @@ void vtRFThread::manageSkinEvents() if (iCubSkin[i].taxels[p]->getID() == taxelsIDs[k]) { w = dynamic_cast(iCubSkin[i].taxels[p])->Resp; - printMessage(4,"part %s: pps taxel ID %d, pos (%s), activation: %f\n",part.c_str(),taxelsIDs[k],iCubSkin[i].taxels[p]->getPosition().toString().c_str(),w); + printMessage(4,"part %s: pps taxel ID %d, pos (%s), activation: %.2f\n",part.c_str(),taxelsIDs[k],iCubSkin[i].taxels[p]->getPosition().toString(3,3).c_str(),w); //The final geoCenter and normalDir will be a weighted average of the activations geoCenter += iCubSkin[i].taxels[p]->getPosition()*w; //Matej, 24.2., changing convention - link not Root FoR normalDir += iCubSkin[i].taxels[p]->getNormal()*w; @@ -916,19 +931,21 @@ bool vtRFThread::projectIncomingEvents() yError("[vtRFThread] in projectIncomingEvent!\n"); // yInfo("T_A:\n%s",T_a.toString().c_str()); - printMessage(5,"\nProject incoming event %s onto %s taxels\n",it->toString().c_str(),iCubSkin[i].name.c_str()); + printMessage(5,"\nProject incoming event %s \t onto %s taxels\n",it->toString().c_str(),iCubSkin[i].name.c_str()); IncomingEvent4TaxelPWE projEvent; for (size_t j = 0; j < iCubSkin[i].taxels.size(); j++) { + printMessage(6," Projecting onto taxel %d.\n",iCubSkin[i].taxels[j]->getID()); projEvent = projectIntoTaxelRF(iCubSkin[i].taxels[j]->getFoR(),T_a,(*it)); + printMessage(6,"\tProjected event: %s\n",projEvent.toString().c_str()); if(dynamic_cast(iCubSkin[i].taxels[j])->insideFoRCheck(projEvent)) + { dynamic_cast(iCubSkin[i].taxels[j])->Evnts.push_back(projEvent); //here every taxel (TaxelPWE) is updated with the events //events outside of taxel's RF will not be added - - // There's a reason behind this choice - dumpedVector.push_back((dynamic_cast(iCubSkin[i].taxels[j]))->Evnts.back().Pos[0]); - dumpedVector.push_back(dynamic_cast(iCubSkin[i].taxels[j])->Evnts.back().Pos[1]); - dumpedVector.push_back(dynamic_cast(iCubSkin[i].taxels[j])->Evnts.back().Pos[2]); + printMessage(6,"\tLies inside RF - pushing to taxelPWE.Events.\n"); + } + else + printMessage(6,"\tLies outside RF.\n"); //printMessage(5,"Repr. taxel ID %i\tEvent: %s\n",j,dynamic_cast(iCubSkin[i].taxels[j])->Evnt.toString().c_str()); } @@ -961,6 +978,7 @@ IncomingEvent4TaxelPWE vtRFThread::projectIntoTaxelRF(const Matrix &RF,const Mat void vtRFThread::resetTaxelEventVectors() { + printMessage(4,"[vtRFThread::resetTaxelEventVectors()]\n"); for (int i = 0; i < iCubSkinSize; i++) for (size_t j = 0; j < iCubSkin[i].taxels.size(); j++) (dynamic_cast(iCubSkin[i].taxels[j]))->Evnts.clear(); @@ -979,14 +997,14 @@ void vtRFThread::resetParzenWindows() bool vtRFThread::computeResponse(double stress_modulation) { - printMessage(4,"Taxel responses:\n"); + printMessage(4,"[vtRFThread::computeResponse] Taxel responses:\n"); for (int i = 0; i < iCubSkinSize; i++) { printMessage(4,"%s \n",iCubSkin[i].name.c_str()); for (size_t j = 0; j < iCubSkin[i].taxels.size(); j++) { dynamic_cast(iCubSkin[i].taxels[j])->computeResponse(stress_modulation); - printMessage(4,"\t Representative ID %i\tResponse %.2f (with stress modulation:%.2f)\n",j,dynamic_cast(iCubSkin[i].taxels[j])->Resp,stress_modulation); + printMessage(4,"\t %ith %s taxel response %.2f (with stress modulation:%.2f)\n",j,iCubSkin[i].name.c_str(),dynamic_cast(iCubSkin[i].taxels[j])->Resp,stress_modulation); } } From 1697cf923f4b106fe39166d9e978c69a03d31b64 Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Tue, 30 Aug 2016 11:08:05 +0200 Subject: [PATCH 07/24] small improvements and improving debug outputs --- lib/include/iCub/periPersonalSpace/taxelPWE.h | 1 + lib/src/taxelPWE.cpp | 65 +++++++++++-------- modules/visuoTactileRF/vtRFThread.cpp | 6 +- 3 files changed, 41 insertions(+), 31 deletions(-) diff --git a/lib/include/iCub/periPersonalSpace/taxelPWE.h b/lib/include/iCub/periPersonalSpace/taxelPWE.h index d0fd61a..71a072d 100644 --- a/lib/include/iCub/periPersonalSpace/taxelPWE.h +++ b/lib/include/iCub/periPersonalSpace/taxelPWE.h @@ -92,6 +92,7 @@ class TaxelPWE : public iCub::skinDynLib::Taxel /** * Computes the response of the taxel. + * The computed response is stored inside the taxel Resp field. **/ bool computeResponse(double stress_modulation); diff --git a/lib/src/taxelPWE.cpp b/lib/src/taxelPWE.cpp index cf2fca0..6390cea 100644 --- a/lib/src/taxelPWE.cpp +++ b/lib/src/taxelPWE.cpp @@ -105,41 +105,50 @@ using namespace std; bool TaxelPWE::computeResponse(double stress_modulation) { - double locResp = 0.0; - double maxResp = 0.0; - std::vector In(2); + Resp = 0.0; - for(vector::iterator it = Evnts.begin(); it!=Evnts.end(); it++) + if(Evnts.empty()) + { + printf("[TaxelPWE::computeResponse()] Taxel ID: %d, no events for this taxel - Resp=0 and exiting.\n",this->getID()); + return true; + } + else { - if (insideFoRCheck(*it)) + printf("[TaxelPWE::computeResponse()] Taxel ID: %d, there are %u events to process.\n",this->getID(),Evnts.size()); + double locResp = 0.0; + double maxResp = 0.0; + std::vector In(2); + for(vector::iterator it = Evnts.begin(); it!=Evnts.end(); it++) { - In[0] = it->getNRM(); - In[1] = it->getTTC(); - locResp = pwe->computeResponse(In); - yDebug("[TaxelPWE::computeResponse()] Taxel ID: %d, event inside RF - event in Taxel FoR: \n %s \n",this->getID(), it->toString().c_str()); - yDebug("locResp = locResp + locResp * min(1.0,Evnt.Threat + stress_modulation)\n"); - yDebug(" = %.2f + %.2f * min(1.0,%.2f + %.2f)\n",locResp,locResp,it->Threat,stress_modulation); - locResp = locResp + (locResp * min(1.0,it->Threat + stress_modulation)); //with this amplification, - //may come out of the range (which used to be <0,255>, now <0,1> after 9.8.2016) - //- in fact up to double that range - yDebug(" locResp = %.2f \n",locResp); - if (locResp > maxResp) - maxResp = locResp; + if (insideFoRCheck(*it)) + { + In[0] = it->getNRM(); + In[1] = it->getTTC(); + locResp = pwe->computeResponse(In); + printf(" event: %s \n",it->toString().c_str()); + printf("\t locResp = locResp + locResp * min(1.0,Evnt.Threat + stress_modulation)\n"); + printf("\t = %.2f + %.2f * min(1.0,%.2f + %.2f)\n",locResp,locResp,it->Threat,stress_modulation); + locResp = locResp + (locResp * min(1.0,it->Threat + stress_modulation)); //with this amplification, + //may come out of the range (which used to be <0,255>, now <0,1> after 9.8.2016) + //- in fact up to double that range + printf("\t locResp = %.2f \n",locResp); + if (locResp > maxResp) + maxResp = locResp; + } + else + yWarning("[TaxelPWE::computeResponse()] Taxel ID: %d, event outside RF - should not be happening in current implementation. Event in Taxel FoR\n %s \n",this->getID(), it->toString().c_str()); + } + if (maxResp > 0.0) + { + printf(" Setting taxel response to maxResp: %.2f\n",maxResp); + Resp = maxResp; + } else - yWarning("[TaxelPWE::computeResponse()] Taxel ID: %d, event outside RF - should not be happening in current implementation. Event in Taxel FoR\n %s \n",this->getID(), it->toString().c_str()); - } - In.clear(); - if (maxResp > 0.0) - { - yDebug(" Setting taxel response to maxResp: %.2f\n",maxResp); - Resp = maxResp; + printf("\t maxResp was <=0 (%.2f) - Leaving taxel Resp 0.\n",maxResp); + In.clear(); return true; } - else{ - yDebug(" maxResp was <=0 (%.2f) - Leaving taxel response 0, returning false.\n",maxResp); - return false; - } } Bottle TaxelPWE::TaxelPWEIntoBottle() diff --git a/modules/visuoTactileRF/vtRFThread.cpp b/modules/visuoTactileRF/vtRFThread.cpp index 8050243..3542eb7 100644 --- a/modules/visuoTactileRF/vtRFThread.cpp +++ b/modules/visuoTactileRF/vtRFThread.cpp @@ -997,14 +997,14 @@ void vtRFThread::resetParzenWindows() bool vtRFThread::computeResponse(double stress_modulation) { - printMessage(4,"[vtRFThread::computeResponse] Taxel responses:\n"); + printMessage(4,"\n\n *** [vtRFThread::computeResponse] Taxel responses ***:\n"); for (int i = 0; i < iCubSkinSize; i++) { - printMessage(4,"%s \n",iCubSkin[i].name.c_str()); + printMessage(4,"\n ** %s ** \n",iCubSkin[i].name.c_str()); for (size_t j = 0; j < iCubSkin[i].taxels.size(); j++) { dynamic_cast(iCubSkin[i].taxels[j])->computeResponse(stress_modulation); - printMessage(4,"\t %ith %s taxel response %.2f (with stress modulation:%.2f)\n",j,iCubSkin[i].name.c_str(),dynamic_cast(iCubSkin[i].taxels[j])->Resp,stress_modulation); + printMessage(4,"\t %ith (ID: %d) %s taxel response %.2f (with stress modulation:%.2f)\n",j,iCubSkin[i].taxels[j]->getID(),iCubSkin[i].name.c_str(),dynamic_cast(iCubSkin[i].taxels[j])->Resp,stress_modulation); } } From 81b343be27720bebea5c95eb4e9d6337a65f79a8 Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Tue, 30 Aug 2016 16:22:17 +0200 Subject: [PATCH 08/24] mini - removing unneccessary clear() command --- lib/src/taxelPWE.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/taxelPWE.cpp b/lib/src/taxelPWE.cpp index 6390cea..ff950ed 100644 --- a/lib/src/taxelPWE.cpp +++ b/lib/src/taxelPWE.cpp @@ -146,7 +146,7 @@ using namespace std; } else printf("\t maxResp was <=0 (%.2f) - Leaving taxel Resp 0.\n",maxResp); - In.clear(); + return true; } } From e80f01d8bec6414617e692ec0611481d6841af69 Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Wed, 7 Sep 2016 10:34:44 +0200 Subject: [PATCH 09/24] new taxel RF checking - no cylinder, only shifted positive and negative spherical sectors (not tested) --- .../periPersonalSpace/parzenWindowEstimator.h | 4 +- lib/include/iCub/periPersonalSpace/taxelPWE.h | 13 ++- lib/src/taxelPWE.cpp | 108 +++++++++++++----- modules/visuoTactileRF/visuoTactileRF.cpp | 5 +- modules/visuoTactileRF/vtRFThread.cpp | 9 +- 5 files changed, 96 insertions(+), 43 deletions(-) diff --git a/lib/include/iCub/periPersonalSpace/parzenWindowEstimator.h b/lib/include/iCub/periPersonalSpace/parzenWindowEstimator.h index 9499f46..0d60b8f 100644 --- a/lib/include/iCub/periPersonalSpace/parzenWindowEstimator.h +++ b/lib/include/iCub/periPersonalSpace/parzenWindowEstimator.h @@ -21,7 +21,7 @@ * * @ingroup periPersonalSpace * - * Utilities used throughout the modules and libraries. + * Discrete representation of peripersonal space + interpolation (smoothing) using Parzen windows. * * \author Alessandro Roncone * @@ -58,7 +58,7 @@ class parzenWindowEstimator { protected: int dim; // the dimension of the pwe (either 1[D] or 2[D]) - yarp::sig::Matrix ext; // the extension of the Receptive field (dim*2) + yarp::sig::Matrix ext; // the extension of the Receptive field (dim*2) std::vector binsNum; // the number of partitions of the input space (x and y dimensions) std::vector binWidth; // the extension of the single sampling unit (x and y dimensions) diff --git a/lib/include/iCub/periPersonalSpace/taxelPWE.h b/lib/include/iCub/periPersonalSpace/taxelPWE.h index 71a072d..970807a 100644 --- a/lib/include/iCub/periPersonalSpace/taxelPWE.h +++ b/lib/include/iCub/periPersonalSpace/taxelPWE.h @@ -42,8 +42,11 @@ class TaxelPWE : public iCub::skinDynLib::Taxel public: double Resp; // Taxels' activation level <0,1> double RFangle; // Angle of the receptive field [rad] - from the taxel normal - // The effective angle is thus double that - + // The effective angle (also called aperture of a spherical sector) is thus double that + double sphericalSectorShiftOffset; //offset by which the RF (spherical sector) will be shifted down along the z-axis (taxel normal) + //we don't want to start with the apex at the taxel (where it would have 0 volume) + //but we want to truncate it such that it starts at the height with a specified radius; + std::vector Evnts; // Stimuli/events nearing the taxel in the taxel's FoR parzenWindowEstimator *pwe; // @@ -71,9 +74,9 @@ class TaxelPWE : public iCub::skinDynLib::Taxel bool removeSample(IncomingEvent4TaxelPWE ie); /** - * Check if the input sample is inside the Receptive field (i.e. the cone) + * Check if the input sample is inside the Receptive field (composed of a cone and a cylinder) **/ - bool insideFoRCheck(const IncomingEvent4TaxelPWE ie); + bool insideRFCheck(const IncomingEvent4TaxelPWE ie); /** * Print Method @@ -89,7 +92,7 @@ class TaxelPWE : public iCub::skinDynLib::Taxel * Resets the parzen window estimator **/ bool resetParzenWindowEstimator(); - + /** * Computes the response of the taxel. * The computed response is stored inside the taxel Resp field. diff --git a/lib/src/taxelPWE.cpp b/lib/src/taxelPWE.cpp index ff950ed..f0b7000 100644 --- a/lib/src/taxelPWE.cpp +++ b/lib/src/taxelPWE.cpp @@ -4,6 +4,10 @@ using namespace yarp::os; using namespace yarp::sig; using namespace std; +#define TAXEL_RF_ANGLE_DEG 40 +#define DESIRED_RADIUS_XY_AT_RF_APEX 0.05 // meters; we don't want the RF spherical sector to start at the apex, +//but we want to truncate it such that it starts at the height with this radius; + /****************************************************************/ /* TAXEL WRAPPER FOR PWE *****************************************************************/ @@ -11,14 +15,19 @@ using namespace std; TaxelPWE::TaxelPWE() : Taxel() { Resp = 0.0; - RFangle = 40*M_PI/180; + RFangle = TAXEL_RF_ANGLE_DEG*M_PI/180; + sphericalSectorShiftOffset = DESIRED_RADIUS_XY_AT_RF_APEX / tan(TAXEL_RF_ANGLE_DEG*M_PI/180); + //With a cone having the apex at the taxel, we calculate the height at which it has a desired radius + //This will be the RF offset } TaxelPWE::TaxelPWE(const Vector &p, const Vector &n) : Taxel(p,n) { Resp = 0.0; - RFangle = 40*M_PI/180; + RFangle = TAXEL_RF_ANGLE_DEG*M_PI/180; + sphericalSectorShiftOffset = DESIRED_RADIUS_XY_AT_RF_APEX / tan(TAXEL_RF_ANGLE_DEG*M_PI/180); + //With a cone having the apex at the taxel, we calculate the height at which it has a desired radius }; TaxelPWE::TaxelPWE(const Vector &p, @@ -26,12 +35,14 @@ using namespace std; const int &i) : Taxel(p,n,i) { Resp = 0.0; - RFangle = 40*M_PI/180; + RFangle = TAXEL_RF_ANGLE_DEG*M_PI/180; + sphericalSectorShiftOffset = DESIRED_RADIUS_XY_AT_RF_APEX / tan(TAXEL_RF_ANGLE_DEG*M_PI/180); + //With a cone having the apex at the taxel, we calculate the height at which it has a desired radius }; bool TaxelPWE::addSample(IncomingEvent4TaxelPWE ie) { - if (!insideFoRCheck(ie)) + if (!insideRFCheck(ie)) return false; std::vector x = ie.getNRMTTC(); @@ -42,38 +53,77 @@ using namespace std; bool TaxelPWE::removeSample(IncomingEvent4TaxelPWE ie) { - if (!insideFoRCheck(ie)) + if (!insideRFCheck(ie)) return false; std::vector x = ie.getNRMTTC(); return pwe->removeSample(x); } - bool TaxelPWE::insideFoRCheck(const IncomingEvent4TaxelPWE ie) + bool TaxelPWE::insideRFCheck(const IncomingEvent4TaxelPWE ie) { - std::vector binWidth = pwe->getBinWidth(); - double binLimit = 8*binWidth[0]; - - // the x,y limit of the receptive field at the incoming event's Z - double RFlimit = ie.Pos(2)/tan(RFangle); - - // the x,y limit of the receptive field in the first bin - double RFlimit_cyl = binLimit/tan(RFangle); - - // yDebug("binLimit: %g RFlimit_cyl: %g RFangle: %g \n", binLimit, RFlimit_cyl, RFangle); - // yDebug("ie.Pos\t%s\n", ie.Pos.toString(3,3).c_str()); - // yDebug("Hist:\n%s\n", pwe->getHist().toString(3,3).c_str()); - - if (ie.Pos(0)*ie.Pos(0)+ie.Pos(1)*ie.Pos(1) < RFlimit*RFlimit ) - { - return true; + double distanceSquared; //squaread Euclidean distance of stimulus from taxel + //the assumption is that max extension is >=0 and min extension is <=0 + if(ie.Pos(2)>0) //stimulus with positive z (along taxel normal) + { + if(ie.Pos(2) <= (pwe->getExt())(0,1) ) //is z-coordinate within limit? if not, it surely is not inside the spherical sector + { + Vector sphericalSectorCenter(3,0.0); + sphericalSectorCenter(2) = -sphericalSectorShiftOffset; + double maxRadiusZ = (pwe->getExt())(0,1) + sphericalSectorShiftOffset; //max radius from shifted origin of sph. sector + distanceSquared = pow(ie.Pos(0)-sphericalSectorCenter(0),2) + pow(ie.Pos(1)-sphericalSectorCenter(1),2) + pow(ie.Pos(2)- sphericalSectorCenter(2),2); + if (distanceSquared <= maxRadiusZ * maxRadiusZ) + { + double a = tan(RFangle) * (sphericalSectorShiftOffset + ie.Pos(2)); //radius of RF sector at specific height + if( (abs(ie.Pos(0)) <= a) && (abs(ie.Pos(1)) <= a) ) //stimulus x and y is within the sector at that height + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + else + { + return false; + } } - // There are two ifs only to let me debug things - if ( (abs(ie.Pos(2))<=binLimit) && (ie.Pos(0)*ie.Pos(0)+ie.Pos(1)*ie.Pos(1) < RFlimit_cyl*RFlimit_cyl) ) + else //stimulus with negative z (along taxel normal) according to coordinate transform pipeline { - return true; + if(ie.Pos(2) >= (pwe->getExt())(0,2) ) //is z-coordinate within limit? if not, it surely is not inside the spherical sector + { + Vector sphericalSectorNegativeCenter(3,0.0); + sphericalSectorNegativeCenter(2) = sphericalSectorShiftOffset; + double maxRadiusNegZ = abs((pwe->getExt())(0,2)) + sphericalSectorShiftOffset; //max radius from shifted origin of sph. sector + distanceSquared = pow(ie.Pos(0)-sphericalSectorNegativeCenter(0),2) + pow(ie.Pos(1)-sphericalSectorNegativeCenter(1),2) + pow(ie.Pos(2)-sphericalSectorNegativeCenter(2),2); + if (distanceSquared <= maxRadiusNegZ * maxRadiusNegZ) + { + double a = tan(RFangle) * (sphericalSectorShiftOffset + abs(ie.Pos(2))); //radius of RF sector at specific height + if( (abs(ie.Pos(0)) <= a) && (abs(ie.Pos(1)) <= a) ) //stimulus x and y is within the sector at that height + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + else + { + return false; + } } - return false; } void TaxelPWE::print(int verbosity) @@ -102,7 +152,7 @@ using namespace std; pwe->resetAllHist(); return true; } - + bool TaxelPWE::computeResponse(double stress_modulation) { @@ -114,13 +164,13 @@ using namespace std; } else { - printf("[TaxelPWE::computeResponse()] Taxel ID: %d, there are %u events to process.\n",this->getID(),Evnts.size()); + printf("[TaxelPWE::computeResponse()] Taxel ID: %u, there are %u events to process.\n",this->getID(),Evnts.size()); double locResp = 0.0; double maxResp = 0.0; std::vector In(2); for(vector::iterator it = Evnts.begin(); it!=Evnts.end(); it++) { - if (insideFoRCheck(*it)) + if (insideRFCheck(*it)) { In[0] = it->getNRM(); In[1] = it->getTTC(); diff --git a/modules/visuoTactileRF/visuoTactileRF.cpp b/modules/visuoTactileRF/visuoTactileRF.cpp index 65cb777..d6885ea 100644 --- a/modules/visuoTactileRF/visuoTactileRF.cpp +++ b/modules/visuoTactileRF/visuoTactileRF.cpp @@ -1,8 +1,7 @@ /* VISUO TACTILE RECEPTIVE FIELDS v. 1.0 * Copyright (C) 2013 RobotCub Consortium * Author: Alessandro Roncone & Matej Hoffmann - * email: alessandro.roncone@iit.it - * website: www.robotcub.org + * email: alessandro.roncone@yale.edu, matej.hoffmann@iit.it * Permission is granted to copy, distribute, and/or modify this program * under the terms of the GNU General Public License, version 2 or any * later version published by the Free Software Foundation. @@ -433,7 +432,7 @@ int main(int argc, char * argv[]) yInfo(" --rate rate: the period used by the thread. Default 50ms."); yInfo(" --verbosity int: verbosity level (default 0)."); yInfo(" --modality string: which modality to use (either 1D or 2D, default 1D)."); - yInfo(" --taxelsFile string: the file from which load and save taxels. Defaults:"); + yInfo(" --taxelsFile string: the file from which load and save taxels' PPS representations. Defaults:"); yInfo(" 'taxels1D.ini' if modality==1D"); yInfo(" 'taxels2D.ini' if modality==2D"); yInfo(" --rightForeArm, --rightHand, --leftForeArm, --leftHand flag: flag(s) to call if the module"); diff --git a/modules/visuoTactileRF/vtRFThread.cpp b/modules/visuoTactileRF/vtRFThread.cpp index 3542eb7..c4807e6 100644 --- a/modules/visuoTactileRF/vtRFThread.cpp +++ b/modules/visuoTactileRF/vtRFThread.cpp @@ -243,7 +243,7 @@ bool vtRFThread::threadInit() iCubSkin.push_back(sP); } } - load(); + load(); //here the representation params (bins, extent etc.) will be loaded and set to the pwe of every taxel yInfo("iCubSkin correctly instantiated. Size: %lu",iCubSkin.size()); @@ -704,11 +704,12 @@ string vtRFThread::load() bbb = bb.find("ext").asList(); if (modality=="1D") { - ext = matrixFromBottle(*bbb,0,1,2); + ext = matrixFromBottle(*bbb,0,1,2); //e.g. ext (-0.1 0.2) ~ (min max) will become [-0.1 0.2] } else { - ext = matrixFromBottle(*bbb,0,2,2); + ext = matrixFromBottle(*bbb,0,2,2); //e.g. (-0.1 0.2 0.0 1.2) ~ (min_distance max_distance min_TTC max_TTC) + //will become [min_distance max_distance ; min_TTC max_TTC] } bbb = bb.find("binsNum").asList(); @@ -938,7 +939,7 @@ bool vtRFThread::projectIncomingEvents() printMessage(6," Projecting onto taxel %d.\n",iCubSkin[i].taxels[j]->getID()); projEvent = projectIntoTaxelRF(iCubSkin[i].taxels[j]->getFoR(),T_a,(*it)); printMessage(6,"\tProjected event: %s\n",projEvent.toString().c_str()); - if(dynamic_cast(iCubSkin[i].taxels[j])->insideFoRCheck(projEvent)) + if(dynamic_cast(iCubSkin[i].taxels[j])->insideRFCheck(projEvent)) { dynamic_cast(iCubSkin[i].taxels[j])->Evnts.push_back(projEvent); //here every taxel (TaxelPWE) is updated with the events //events outside of taxel's RF will not be added From 453e6af525ae048bd10343c0c1d5c8a86addeec2 Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Wed, 7 Sep 2016 15:55:45 +0200 Subject: [PATCH 10/24] mini edit - debug output --- lib/src/taxelPWE.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/taxelPWE.cpp b/lib/src/taxelPWE.cpp index f0b7000..91283ac 100644 --- a/lib/src/taxelPWE.cpp +++ b/lib/src/taxelPWE.cpp @@ -159,7 +159,7 @@ using namespace std; Resp = 0.0; if(Evnts.empty()) { - printf("[TaxelPWE::computeResponse()] Taxel ID: %d, no events for this taxel - Resp=0 and exiting.\n",this->getID()); + //printf("[TaxelPWE::computeResponse()] Taxel ID: %d, no events for this taxel - Resp=0 and exiting.\n",this->getID()); return true; } else From d1c62e27b6c73aaaf7f22fa5d2d97cc525967a61 Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Wed, 7 Sep 2016 16:46:57 +0200 Subject: [PATCH 11/24] some fixes to insideRFcheck() - not finished yet --- lib/src/taxelPWE.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/src/taxelPWE.cpp b/lib/src/taxelPWE.cpp index 91283ac..be3cc6e 100644 --- a/lib/src/taxelPWE.cpp +++ b/lib/src/taxelPWE.cpp @@ -4,7 +4,7 @@ using namespace yarp::os; using namespace yarp::sig; using namespace std; -#define TAXEL_RF_ANGLE_DEG 40 +#define TAXEL_RF_ANGLE_DEG 40.0 #define DESIRED_RADIUS_XY_AT_RF_APEX 0.05 // meters; we don't want the RF spherical sector to start at the apex, //but we want to truncate it such that it starts at the height with this radius; @@ -15,8 +15,8 @@ using namespace std; TaxelPWE::TaxelPWE() : Taxel() { Resp = 0.0; - RFangle = TAXEL_RF_ANGLE_DEG*M_PI/180; - sphericalSectorShiftOffset = DESIRED_RADIUS_XY_AT_RF_APEX / tan(TAXEL_RF_ANGLE_DEG*M_PI/180); + RFangle = TAXEL_RF_ANGLE_DEG*M_PI/180.0; + sphericalSectorShiftOffset = DESIRED_RADIUS_XY_AT_RF_APEX / tan(TAXEL_RF_ANGLE_DEG*M_PI/180.0); //With a cone having the apex at the taxel, we calculate the height at which it has a desired radius //This will be the RF offset } @@ -25,8 +25,8 @@ using namespace std; const Vector &n) : Taxel(p,n) { Resp = 0.0; - RFangle = TAXEL_RF_ANGLE_DEG*M_PI/180; - sphericalSectorShiftOffset = DESIRED_RADIUS_XY_AT_RF_APEX / tan(TAXEL_RF_ANGLE_DEG*M_PI/180); + RFangle = TAXEL_RF_ANGLE_DEG*M_PI/180.0; + sphericalSectorShiftOffset = DESIRED_RADIUS_XY_AT_RF_APEX / tan(TAXEL_RF_ANGLE_DEG*M_PI/180.0); //With a cone having the apex at the taxel, we calculate the height at which it has a desired radius }; @@ -35,8 +35,8 @@ using namespace std; const int &i) : Taxel(p,n,i) { Resp = 0.0; - RFangle = TAXEL_RF_ANGLE_DEG*M_PI/180; - sphericalSectorShiftOffset = DESIRED_RADIUS_XY_AT_RF_APEX / tan(TAXEL_RF_ANGLE_DEG*M_PI/180); + RFangle = TAXEL_RF_ANGLE_DEG*M_PI/180.0; + sphericalSectorShiftOffset = DESIRED_RADIUS_XY_AT_RF_APEX / tan(TAXEL_RF_ANGLE_DEG*M_PI/180.0); //With a cone having the apex at the taxel, we calculate the height at which it has a desired radius }; @@ -68,12 +68,14 @@ using namespace std; { if(ie.Pos(2) <= (pwe->getExt())(0,1) ) //is z-coordinate within limit? if not, it surely is not inside the spherical sector { + printf("[TaxelPWE::insideRFCheck]: positive z-coordinate %.3f inside limit (%.3f)\n",ie.Pos(2),(pwe->getExt())(0,1)); Vector sphericalSectorCenter(3,0.0); sphericalSectorCenter(2) = -sphericalSectorShiftOffset; double maxRadiusZ = (pwe->getExt())(0,1) + sphericalSectorShiftOffset; //max radius from shifted origin of sph. sector distanceSquared = pow(ie.Pos(0)-sphericalSectorCenter(0),2) + pow(ie.Pos(1)-sphericalSectorCenter(1),2) + pow(ie.Pos(2)- sphericalSectorCenter(2),2); if (distanceSquared <= maxRadiusZ * maxRadiusZ) { + printf("[TaxelPWE::insideRFCheck]: distanceSquared: %.4f <= maxRadiusZ^2: %.4f\n",distanceSquared,maxRadiusZ*maxRadiusZ); double a = tan(RFangle) * (sphericalSectorShiftOffset + ie.Pos(2)); //radius of RF sector at specific height if( (abs(ie.Pos(0)) <= a) && (abs(ie.Pos(1)) <= a) ) //stimulus x and y is within the sector at that height { @@ -86,24 +88,28 @@ using namespace std; } else { + printf("[TaxelPWE::insideRFCheck]: distanceSquared: %.4f > maxRadiusZ^2: %.4f\n",distanceSquared,maxRadiusZ*maxRadiusZ); return false; } } else { + printf("[TaxelPWE::insideRFCheck]: positive z-coordinate %.3f outside limit (%.3f)\n",ie.Pos(2),(pwe->getExt())(0,1)); return false; } } else //stimulus with negative z (along taxel normal) according to coordinate transform pipeline { - if(ie.Pos(2) >= (pwe->getExt())(0,2) ) //is z-coordinate within limit? if not, it surely is not inside the spherical sector + if(ie.Pos(2) >= (pwe->getExt())(0,0) ) //is z-coordinate within limit? if not, it surely is not inside the spherical sector { + printf("[TaxelPWE::insideRFCheck]: negative z-coordinate %.3f inside limit (%.3f)\n",ie.Pos(2),(pwe->getExt())(0,0)); Vector sphericalSectorNegativeCenter(3,0.0); sphericalSectorNegativeCenter(2) = sphericalSectorShiftOffset; - double maxRadiusNegZ = abs((pwe->getExt())(0,2)) + sphericalSectorShiftOffset; //max radius from shifted origin of sph. sector + double maxRadiusNegZ = abs((pwe->getExt())(0,0)) + sphericalSectorShiftOffset; //max radius from shifted origin of sph. sector distanceSquared = pow(ie.Pos(0)-sphericalSectorNegativeCenter(0),2) + pow(ie.Pos(1)-sphericalSectorNegativeCenter(1),2) + pow(ie.Pos(2)-sphericalSectorNegativeCenter(2),2); if (distanceSquared <= maxRadiusNegZ * maxRadiusNegZ) { + printf("[TaxelPWE::insideRFCheck]: distanceSquared: %.4f <= maxRadiusNegZ^2: %.4f\n",distanceSquared,maxRadiusNegZ*maxRadiusNegZ); double a = tan(RFangle) * (sphericalSectorShiftOffset + abs(ie.Pos(2))); //radius of RF sector at specific height if( (abs(ie.Pos(0)) <= a) && (abs(ie.Pos(1)) <= a) ) //stimulus x and y is within the sector at that height { @@ -116,11 +122,13 @@ using namespace std; } else { + printf("[TaxelPWE::insideRFCheck]: distanceSquared: %.4f > maxRadiusNegZ^2: %.4f\n",distanceSquared,maxRadiusNegZ*maxRadiusNegZ); return false; } } else { + printf("[TaxelPWE::insideRFCheck]: negative z-coordinate %.3f outside limit (%.3f)\n",ie.Pos(2),(pwe->getExt())(0,0)); return false; } } From 3262ba06338dd9bdc1a03e21efbc257bf0405390 Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Tue, 13 Sep 2016 11:39:52 +0200 Subject: [PATCH 12/24] making taxel RF fatter --- lib/src/taxelPWE.cpp | 13 +++++++++---- modules/visuoTactileRF/vtRFThread.cpp | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/src/taxelPWE.cpp b/lib/src/taxelPWE.cpp index be3cc6e..0336b93 100644 --- a/lib/src/taxelPWE.cpp +++ b/lib/src/taxelPWE.cpp @@ -4,8 +4,8 @@ using namespace yarp::os; using namespace yarp::sig; using namespace std; -#define TAXEL_RF_ANGLE_DEG 40.0 -#define DESIRED_RADIUS_XY_AT_RF_APEX 0.05 // meters; we don't want the RF spherical sector to start at the apex, +#define TAXEL_RF_ANGLE_DEG 50.0 +#define DESIRED_RADIUS_XY_AT_RF_APEX 0.07 // meters; we don't want the RF spherical sector to start at the apex, //but we want to truncate it such that it starts at the height with this radius; /****************************************************************/ @@ -62,7 +62,7 @@ using namespace std; bool TaxelPWE::insideRFCheck(const IncomingEvent4TaxelPWE ie) { - double distanceSquared; //squaread Euclidean distance of stimulus from taxel + double distanceSquared; //squared Euclidean distance of stimulus from taxel //the assumption is that max extension is >=0 and min extension is <=0 if(ie.Pos(2)>0) //stimulus with positive z (along taxel normal) { @@ -72,17 +72,19 @@ using namespace std; Vector sphericalSectorCenter(3,0.0); sphericalSectorCenter(2) = -sphericalSectorShiftOffset; double maxRadiusZ = (pwe->getExt())(0,1) + sphericalSectorShiftOffset; //max radius from shifted origin of sph. sector - distanceSquared = pow(ie.Pos(0)-sphericalSectorCenter(0),2) + pow(ie.Pos(1)-sphericalSectorCenter(1),2) + pow(ie.Pos(2)- sphericalSectorCenter(2),2); + distanceSquared = pow(ie.Pos(0)-sphericalSectorCenter(0),2) + pow(ie.Pos(1)-sphericalSectorCenter(1),2) + pow(ie.Pos(2)- sphericalSectorCenter(2),2); //checking distance for full sphere, prior to considering the sector if (distanceSquared <= maxRadiusZ * maxRadiusZ) { printf("[TaxelPWE::insideRFCheck]: distanceSquared: %.4f <= maxRadiusZ^2: %.4f\n",distanceSquared,maxRadiusZ*maxRadiusZ); double a = tan(RFangle) * (sphericalSectorShiftOffset + ie.Pos(2)); //radius of RF sector at specific height if( (abs(ie.Pos(0)) <= a) && (abs(ie.Pos(1)) <= a) ) //stimulus x and y is within the sector at that height { + printf("[TaxelPWE::insideRFCheck]: Both, x and y coordinates (%.3f,%.3f) are inside the radius a %.3f.\n",ie.Pos(0),ie.Pos(1),a); return true; } else { + printf("[TaxelPWE::insideRFCheck]: At least one of, x and y coordinates (%.3f,%.3f) is outside the radius a %.3f.\n",ie.Pos(0),ie.Pos(1),a); return false; } } @@ -107,16 +109,19 @@ using namespace std; sphericalSectorNegativeCenter(2) = sphericalSectorShiftOffset; double maxRadiusNegZ = abs((pwe->getExt())(0,0)) + sphericalSectorShiftOffset; //max radius from shifted origin of sph. sector distanceSquared = pow(ie.Pos(0)-sphericalSectorNegativeCenter(0),2) + pow(ie.Pos(1)-sphericalSectorNegativeCenter(1),2) + pow(ie.Pos(2)-sphericalSectorNegativeCenter(2),2); + //checking distance for full sphere, prior to considering the sector if (distanceSquared <= maxRadiusNegZ * maxRadiusNegZ) { printf("[TaxelPWE::insideRFCheck]: distanceSquared: %.4f <= maxRadiusNegZ^2: %.4f\n",distanceSquared,maxRadiusNegZ*maxRadiusNegZ); double a = tan(RFangle) * (sphericalSectorShiftOffset + abs(ie.Pos(2))); //radius of RF sector at specific height if( (abs(ie.Pos(0)) <= a) && (abs(ie.Pos(1)) <= a) ) //stimulus x and y is within the sector at that height { + printf("[TaxelPWE::insideRFCheck]: Both, x and y coordinates (%.3f,%.3f) are inside the radius a %.3f.\n",ie.Pos(0),ie.Pos(1),a); return true; } else { + printf("[TaxelPWE::insideRFCheck]: At least one of, x and y coordinates (%.3f,%.3f) is outside the radius a %.3f.\n",ie.Pos(0),ie.Pos(1),a); return false; } } diff --git a/modules/visuoTactileRF/vtRFThread.cpp b/modules/visuoTactileRF/vtRFThread.cpp index c4807e6..061e897 100644 --- a/modules/visuoTactileRF/vtRFThread.cpp +++ b/modules/visuoTactileRF/vtRFThread.cpp @@ -969,7 +969,8 @@ IncomingEvent4TaxelPWE vtRFThread::projectIntoTaxelRF(const Matrix &RF,const Mat if (e.Radius != -1.0) { - Event_projected.Pos(2) -= Event_projected.Radius; + Event_projected.Pos(2) -= Event_projected.Radius; //considering the radius, this brings the object closer in z by the radius + //for the rest of the calculations (in particular in x,y), the object is treated as a point } Event_projected.computeNRMTTC(); From b9d3257559880d272bf058fdf51c368e1e22fc68 Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Wed, 14 Sep 2016 14:20:56 +0200 Subject: [PATCH 13/24] small improvements, commented out some debug printfs --- lib/src/taxelPWE.cpp | 38 +++++++++++------------ modules/visuoTactileRF/visuoTactileRF.cpp | 2 +- modules/visuoTactileRF/vtRFThread.cpp | 4 +-- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/src/taxelPWE.cpp b/lib/src/taxelPWE.cpp index 0336b93..1fa4467 100644 --- a/lib/src/taxelPWE.cpp +++ b/lib/src/taxelPWE.cpp @@ -68,35 +68,35 @@ using namespace std; { if(ie.Pos(2) <= (pwe->getExt())(0,1) ) //is z-coordinate within limit? if not, it surely is not inside the spherical sector { - printf("[TaxelPWE::insideRFCheck]: positive z-coordinate %.3f inside limit (%.3f)\n",ie.Pos(2),(pwe->getExt())(0,1)); + //printf("[TaxelPWE::insideRFCheck]: positive z-coordinate %.3f inside limit (%.3f)\n",ie.Pos(2),(pwe->getExt())(0,1)); Vector sphericalSectorCenter(3,0.0); sphericalSectorCenter(2) = -sphericalSectorShiftOffset; double maxRadiusZ = (pwe->getExt())(0,1) + sphericalSectorShiftOffset; //max radius from shifted origin of sph. sector distanceSquared = pow(ie.Pos(0)-sphericalSectorCenter(0),2) + pow(ie.Pos(1)-sphericalSectorCenter(1),2) + pow(ie.Pos(2)- sphericalSectorCenter(2),2); //checking distance for full sphere, prior to considering the sector if (distanceSquared <= maxRadiusZ * maxRadiusZ) { - printf("[TaxelPWE::insideRFCheck]: distanceSquared: %.4f <= maxRadiusZ^2: %.4f\n",distanceSquared,maxRadiusZ*maxRadiusZ); + //printf("[TaxelPWE::insideRFCheck]: distanceSquared: %.4f <= maxRadiusZ^2: %.4f\n",distanceSquared,maxRadiusZ*maxRadiusZ); double a = tan(RFangle) * (sphericalSectorShiftOffset + ie.Pos(2)); //radius of RF sector at specific height if( (abs(ie.Pos(0)) <= a) && (abs(ie.Pos(1)) <= a) ) //stimulus x and y is within the sector at that height { - printf("[TaxelPWE::insideRFCheck]: Both, x and y coordinates (%.3f,%.3f) are inside the radius a %.3f.\n",ie.Pos(0),ie.Pos(1),a); + //printf("[TaxelPWE::insideRFCheck]: Both, x and y coordinates (%.3f,%.3f) are inside the radius a %.3f.\n",ie.Pos(0),ie.Pos(1),a); return true; } else { - printf("[TaxelPWE::insideRFCheck]: At least one of, x and y coordinates (%.3f,%.3f) is outside the radius a %.3f.\n",ie.Pos(0),ie.Pos(1),a); + //printf("[TaxelPWE::insideRFCheck]: At least one of, x and y coordinates (%.3f,%.3f) is outside the radius a %.3f.\n",ie.Pos(0),ie.Pos(1),a); return false; } } else { - printf("[TaxelPWE::insideRFCheck]: distanceSquared: %.4f > maxRadiusZ^2: %.4f\n",distanceSquared,maxRadiusZ*maxRadiusZ); + // printf("[TaxelPWE::insideRFCheck]: distanceSquared: %.4f > maxRadiusZ^2: %.4f\n",distanceSquared,maxRadiusZ*maxRadiusZ); return false; } } else { - printf("[TaxelPWE::insideRFCheck]: positive z-coordinate %.3f outside limit (%.3f)\n",ie.Pos(2),(pwe->getExt())(0,1)); + //printf("[TaxelPWE::insideRFCheck]: positive z-coordinate %.3f outside limit (%.3f)\n",ie.Pos(2),(pwe->getExt())(0,1)); return false; } } @@ -104,7 +104,7 @@ using namespace std; { if(ie.Pos(2) >= (pwe->getExt())(0,0) ) //is z-coordinate within limit? if not, it surely is not inside the spherical sector { - printf("[TaxelPWE::insideRFCheck]: negative z-coordinate %.3f inside limit (%.3f)\n",ie.Pos(2),(pwe->getExt())(0,0)); + //printf("[TaxelPWE::insideRFCheck]: negative z-coordinate %.3f inside limit (%.3f)\n",ie.Pos(2),(pwe->getExt())(0,0)); Vector sphericalSectorNegativeCenter(3,0.0); sphericalSectorNegativeCenter(2) = sphericalSectorShiftOffset; double maxRadiusNegZ = abs((pwe->getExt())(0,0)) + sphericalSectorShiftOffset; //max radius from shifted origin of sph. sector @@ -112,28 +112,28 @@ using namespace std; //checking distance for full sphere, prior to considering the sector if (distanceSquared <= maxRadiusNegZ * maxRadiusNegZ) { - printf("[TaxelPWE::insideRFCheck]: distanceSquared: %.4f <= maxRadiusNegZ^2: %.4f\n",distanceSquared,maxRadiusNegZ*maxRadiusNegZ); + //printf("[TaxelPWE::insideRFCheck]: distanceSquared: %.4f <= maxRadiusNegZ^2: %.4f\n",distanceSquared,maxRadiusNegZ*maxRadiusNegZ); double a = tan(RFangle) * (sphericalSectorShiftOffset + abs(ie.Pos(2))); //radius of RF sector at specific height if( (abs(ie.Pos(0)) <= a) && (abs(ie.Pos(1)) <= a) ) //stimulus x and y is within the sector at that height { - printf("[TaxelPWE::insideRFCheck]: Both, x and y coordinates (%.3f,%.3f) are inside the radius a %.3f.\n",ie.Pos(0),ie.Pos(1),a); + // printf("[TaxelPWE::insideRFCheck]: Both, x and y coordinates (%.3f,%.3f) are inside the radius a %.3f.\n",ie.Pos(0),ie.Pos(1),a); return true; } else { - printf("[TaxelPWE::insideRFCheck]: At least one of, x and y coordinates (%.3f,%.3f) is outside the radius a %.3f.\n",ie.Pos(0),ie.Pos(1),a); + //printf("[TaxelPWE::insideRFCheck]: At least one of, x and y coordinates (%.3f,%.3f) is outside the radius a %.3f.\n",ie.Pos(0),ie.Pos(1),a); return false; } } else { - printf("[TaxelPWE::insideRFCheck]: distanceSquared: %.4f > maxRadiusNegZ^2: %.4f\n",distanceSquared,maxRadiusNegZ*maxRadiusNegZ); + //printf("[TaxelPWE::insideRFCheck]: distanceSquared: %.4f > maxRadiusNegZ^2: %.4f\n",distanceSquared,maxRadiusNegZ*maxRadiusNegZ); return false; } } else { - printf("[TaxelPWE::insideRFCheck]: negative z-coordinate %.3f outside limit (%.3f)\n",ie.Pos(2),(pwe->getExt())(0,0)); + // printf("[TaxelPWE::insideRFCheck]: negative z-coordinate %.3f outside limit (%.3f)\n",ie.Pos(2),(pwe->getExt())(0,0)); return false; } } @@ -177,7 +177,7 @@ using namespace std; } else { - printf("[TaxelPWE::computeResponse()] Taxel ID: %u, there are %u events to process.\n",this->getID(),Evnts.size()); + //printf("[TaxelPWE::computeResponse()] Taxel ID: %u, there are %u events to process.\n",this->getID(),Evnts.size()); double locResp = 0.0; double maxResp = 0.0; std::vector In(2); @@ -188,13 +188,13 @@ using namespace std; In[0] = it->getNRM(); In[1] = it->getTTC(); locResp = pwe->computeResponse(In); - printf(" event: %s \n",it->toString().c_str()); - printf("\t locResp = locResp + locResp * min(1.0,Evnt.Threat + stress_modulation)\n"); - printf("\t = %.2f + %.2f * min(1.0,%.2f + %.2f)\n",locResp,locResp,it->Threat,stress_modulation); + //printf(" event: %s \n",it->toString().c_str()); + //printf("\t locResp = locResp + locResp * min(1.0,Evnt.Threat + stress_modulation)\n"); + //printf("\t = %.2f + %.2f * min(1.0,%.2f + %.2f)\n",locResp,locResp,it->Threat,stress_modulation); locResp = locResp + (locResp * min(1.0,it->Threat + stress_modulation)); //with this amplification, //may come out of the range (which used to be <0,255>, now <0,1> after 9.8.2016) //- in fact up to double that range - printf("\t locResp = %.2f \n",locResp); + //printf("\t locResp = %.2f \n",locResp); if (locResp > maxResp) maxResp = locResp; } @@ -203,12 +203,12 @@ using namespace std; } if (maxResp > 0.0) { - printf(" Setting taxel response to maxResp: %.2f\n",maxResp); + //printf(" Setting taxel response to maxResp: %.2f\n",maxResp); Resp = maxResp; } else - printf("\t maxResp was <=0 (%.2f) - Leaving taxel Resp 0.\n",maxResp); + //printf("\t maxResp was <=0 (%.2f) - Leaving taxel Resp 0.\n",maxResp); return true; } diff --git a/modules/visuoTactileRF/visuoTactileRF.cpp b/modules/visuoTactileRF/visuoTactileRF.cpp index d6885ea..69da2ff 100644 --- a/modules/visuoTactileRF/visuoTactileRF.cpp +++ b/modules/visuoTactileRF/visuoTactileRF.cpp @@ -368,7 +368,7 @@ class visuoTactileRF: public RFModule yError("vtRFThread wasn't instantiated!!"); return false; } - yInfo("VISUO TACTILE RECEPTIVE FIELDS: vtRFThread istantiated..."); + yInfo("VISUO TACTILE RECEPTIVE FIELDS: vtRFThread instantiated..."); } else { vtRFThrd = 0; diff --git a/modules/visuoTactileRF/vtRFThread.cpp b/modules/visuoTactileRF/vtRFThread.cpp index 061e897..3f2e786 100644 --- a/modules/visuoTactileRF/vtRFThread.cpp +++ b/modules/visuoTactileRF/vtRFThread.cpp @@ -278,7 +278,7 @@ void vtRFThread::run() { stress = stressBottle->get(0).asDouble(); yAssert((stress>=0.0) && (stress<=1.0)); - yDebug("vtRFThread::run() reading %f stress value from port.\n",stress); + printMessage(3,"vtRFThread::run() reading %f stress value from port.\n",stress); } else stress = 0.0; @@ -336,7 +336,7 @@ void vtRFThread::run() { eventsBuffer.push_back(incomingEvents.back()); //! the buffering and hence the learning is working only for the last event in the vector //!so learning should be done with one stimulus only - yDebug("I'm buffering! Size %lu",eventsBuffer.size()); + printMessage(2,"I'm buffering inputs (there are events)! Buffer size %lu",eventsBuffer.size()); } // limit the size of the buffer to 80, i.e. 4 seconds of acquisition From e345019055d619e3cd3cd75caf3998566c6bd900 Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Wed, 14 Sep 2016 15:00:21 +0200 Subject: [PATCH 14/24] scripts cleanup - moving many to bonus so they are not installed --- app/scripts/{ => bonus}/PPS_Dumper.xml | 0 app/scripts/{ => bonus}/iCub_Log.xml | 0 app/scripts/bonus/iCub_Log_tx_rx_time.xml | 80 +++++++++---------- .../iCub_Log_tx_rx_time_old.xml} | 80 +++++++++---------- .../{ => bonus}/iCub_dataSetPlayer.xml | 0 .../ppsAndReactControl_LyonIntegrated.xml | 0 .../ppsAndReactControl_icub_Lyon.xml | 0 .../{ => bonus}/ppsAndReactCtrl_log_icub.xml | 0 .../{ => bonus}/pps_skinAndiCubGuis_Lyon.xml | 0 9 files changed, 80 insertions(+), 80 deletions(-) rename app/scripts/{ => bonus}/PPS_Dumper.xml (100%) rename app/scripts/{ => bonus}/iCub_Log.xml (100%) rename app/scripts/{iCub_Log_tx_rx_time.xml => bonus/iCub_Log_tx_rx_time_old.xml} (73%) rename app/scripts/{ => bonus}/iCub_dataSetPlayer.xml (100%) rename app/scripts/{ => bonus}/ppsAndReactControl_LyonIntegrated.xml (100%) rename app/scripts/{ => bonus}/ppsAndReactControl_icub_Lyon.xml (100%) rename app/scripts/{ => bonus}/ppsAndReactCtrl_log_icub.xml (100%) rename app/scripts/{ => bonus}/pps_skinAndiCubGuis_Lyon.xml (100%) diff --git a/app/scripts/PPS_Dumper.xml b/app/scripts/bonus/PPS_Dumper.xml similarity index 100% rename from app/scripts/PPS_Dumper.xml rename to app/scripts/bonus/PPS_Dumper.xml diff --git a/app/scripts/iCub_Log.xml b/app/scripts/bonus/iCub_Log.xml similarity index 100% rename from app/scripts/iCub_Log.xml rename to app/scripts/bonus/iCub_Log.xml diff --git a/app/scripts/bonus/iCub_Log_tx_rx_time.xml b/app/scripts/bonus/iCub_Log_tx_rx_time.xml index 120e428..38ad918 100644 --- a/app/scripts/bonus/iCub_Log_tx_rx_time.xml +++ b/app/scripts/bonus/iCub_Log_tx_rx_time.xml @@ -6,7 +6,7 @@ dataDumper - --name /data/skin/skin_events --txTime --rxTime + --name /data/skin_events --txTime --rxTime localhost dataDumperSkinContact @@ -14,49 +14,49 @@ dataDumper - --name /data/skin/tactile_comp_left_hand --txTime --rxTime + --name /data/skin_tactile_comp_left_hand --txTime --rxTime localhost dataDumperSkinLeftHandComp dataDumper - --name /data/skin/tactile_comp_left_forearm --txTime --rxTime + --name /data/skin_tactile_comp_left_forearm --txTime --rxTime localhost dataDumperSkinLeftForearmComp dataDumper - --name /data/skin/tactile_comp_left_arm --txTime --rxTime + --name /data/skin_tactile_comp_left_arm --txTime --rxTime localhost dataDumperSkinLeftArmComp dataDumper - --name /data/skin/tactile_comp_right_hand --txTime --rxTime + --name /data/skin_tactile_comp_right_hand --txTime --rxTime localhost dataDumperSkinRightHandComp dataDumper - --name /data/skin/tactile_comp_right_forearm --txTime --rxTime + --name /data/skin_tactile_comp_right_forearm --txTime --rxTime localhost dataDumperSkinRightForearmComp dataDumper - --name /data/skin/tactile_comp_right_arm --txTime --rxTime + --name /data/skin_tactile_comp_right_arm --txTime --rxTime localhost dataDumperSkinRightArmComp dataDumper - --name /data/skin/tactile_comp_torso --txTime --rxTime + --name /data/skin_tactile_comp_torso --txTime --rxTime localhost dataDumperSkinTorsoComp @@ -64,42 +64,42 @@ dataDumper - --name /data/joints/head_joints --txTime --rxTime + --name /data/joints_head --txTime --rxTime localhost dataDumperHeadJoints dataDumper - --name /data/joints/torso_joints --txTime --rxTime + --name /data/joints_torso --txTime --rxTime localhost dataDumperTorsoJoints dataDumper - --name /data/joints/leftArm_joints --txTime --rxTime + --name /data/joints_leftArm --txTime --rxTime localhost dataDumperLeftArmJoints dataDumper - --name /data/joints/rightArm_joints --txTime --rxTime + --name /data/joints_rightArm --txTime --rxTime localhost dataDumperRightArmJoints dataDumper - --name /data/joints/leftLeg_joints --txTime --rxTime + --name /data/joints_leftLeg --txTime --rxTime localhost dataDumperLeftLegJoints dataDumper - --name /data/joints/rightLeg_joints --txTime --rxTime + --name /data/joints_rightLeg --txTime --rxTime localhost dataDumperRightLegJoints @@ -130,42 +130,42 @@ dataDumper - --name /data/forces_and_torques/leftArm_forces --txTime --rxTime + --name /data/forces_leftArm --txTime --rxTime localhost dataDumperLeftArmForces dataDumper - --name /data/forces_and_torques/rightArm_forces --txTime --rxTime + --name /data/forces_rightArm --txTime --rxTime localhost dataDumperRightArmForces dataDumper - --name /data/forces_and_torques/leftLeg_forces --txTime --rxTime + --name /data/forces_leftLeg --txTime --rxTime localhost dataDumperLeftLegForces dataDumper - --name /data/forces_and_torques/rightLeg_forces --txTime --rxTime + --name /data/forces_rightLeg --txTime --rxTime localhost dataDumperRightLegForces dataDumper - --name /data/forces_and_torques/leftFoot_forces --txTime --rxTime + --name /data/forces_leftFoot --txTime --rxTime localhost dataDumperLeftFootForces dataDumper - --name /data/forces_and_torques/rightFoot_forces --txTime --rxTime + --name /data/forces_rightFoot --txTime --rxTime localhost dataDumperRightFootForces @@ -173,73 +173,73 @@ /skinManager/skin_events:o - /data/skin/skin_events + /data/skin_events udp /icub/skin/left_hand_comp - /data/skin/tactile_comp_left_hand + /data/skin_tactile_comp_left_hand udp /icub/skin/left_forearm_comp - /data/skin/tactile_comp_left_forearm + /data/skin_tactile_comp_left_forearm udp /icub/skin/left_arm_comp - /data/skin/tactile_comp_left_arm + /data/skin_tactile_comp_left_arm udp /icub/skin/right_hand_comp - /data/skin/tactile_comp_right_hand + /data/skin_tactile_comp_right_hand udp /icub/skin/right_forearm_comp - /data/skin/tactile_comp_right_forearm + /data/skin_tactile_comp_right_forearm udp /icub/skin/right_arm_comp - /data/skin/tactile_comp_right_arm + /data/skin_tactile_comp_right_arm udp /icub/skin/torso_comp - /data/skin/tactile_comp_torso + /data/skin_tactile_comp_torso udp /icub/head/state:o - /data/joints/head_joints + /data/joints_head udp /icub/torso/state:o - /data/joints/torso_joints + /data/joints_torso udp /icub/left_arm/state:o - /data/joints/leftArm_joints + /data/joints_leftArm udp /icub/right_arm/state:o - /data/joints/rightArm_joints + /data/joints_rightArm udp /icub/left_leg/state:o - /data/joints/leftLeg_joints + /data/joints_leftLeg udp /icub/right_leg/state:o - /data/joints/rightLeg_joints + /data/joints_rightLeg udp @@ -262,32 +262,32 @@ /icub/left_arm/analog:o - /data/forces_and_torques/leftArm_forces + /data/forces_leftArm udp /icub/right_arm/analog:o - /data/forces_and_torques/rightArm_forces + /data/forces_rightArm udp /icub/left_leg/analog:o - /data/forces_and_torques/leftLeg_forces + /data/forces_leftLeg udp /icub/right_leg/analog:o - /data/forces_and_torques/rightLeg_forces + /data/forces_rightLeg udp /icub/left_foot/analog:o - /data/forces_and_torques/leftFoot_forces + /data/forces_leftFoot udp /icub/right_foot/analog:o - /data/forces_and_torques/rightFoot_forces + /data/forces_rightFoot udp diff --git a/app/scripts/iCub_Log_tx_rx_time.xml b/app/scripts/bonus/iCub_Log_tx_rx_time_old.xml similarity index 73% rename from app/scripts/iCub_Log_tx_rx_time.xml rename to app/scripts/bonus/iCub_Log_tx_rx_time_old.xml index 38ad918..120e428 100644 --- a/app/scripts/iCub_Log_tx_rx_time.xml +++ b/app/scripts/bonus/iCub_Log_tx_rx_time_old.xml @@ -6,7 +6,7 @@ dataDumper - --name /data/skin_events --txTime --rxTime + --name /data/skin/skin_events --txTime --rxTime localhost dataDumperSkinContact @@ -14,49 +14,49 @@ dataDumper - --name /data/skin_tactile_comp_left_hand --txTime --rxTime + --name /data/skin/tactile_comp_left_hand --txTime --rxTime localhost dataDumperSkinLeftHandComp dataDumper - --name /data/skin_tactile_comp_left_forearm --txTime --rxTime + --name /data/skin/tactile_comp_left_forearm --txTime --rxTime localhost dataDumperSkinLeftForearmComp dataDumper - --name /data/skin_tactile_comp_left_arm --txTime --rxTime + --name /data/skin/tactile_comp_left_arm --txTime --rxTime localhost dataDumperSkinLeftArmComp dataDumper - --name /data/skin_tactile_comp_right_hand --txTime --rxTime + --name /data/skin/tactile_comp_right_hand --txTime --rxTime localhost dataDumperSkinRightHandComp dataDumper - --name /data/skin_tactile_comp_right_forearm --txTime --rxTime + --name /data/skin/tactile_comp_right_forearm --txTime --rxTime localhost dataDumperSkinRightForearmComp dataDumper - --name /data/skin_tactile_comp_right_arm --txTime --rxTime + --name /data/skin/tactile_comp_right_arm --txTime --rxTime localhost dataDumperSkinRightArmComp dataDumper - --name /data/skin_tactile_comp_torso --txTime --rxTime + --name /data/skin/tactile_comp_torso --txTime --rxTime localhost dataDumperSkinTorsoComp @@ -64,42 +64,42 @@ dataDumper - --name /data/joints_head --txTime --rxTime + --name /data/joints/head_joints --txTime --rxTime localhost dataDumperHeadJoints dataDumper - --name /data/joints_torso --txTime --rxTime + --name /data/joints/torso_joints --txTime --rxTime localhost dataDumperTorsoJoints dataDumper - --name /data/joints_leftArm --txTime --rxTime + --name /data/joints/leftArm_joints --txTime --rxTime localhost dataDumperLeftArmJoints dataDumper - --name /data/joints_rightArm --txTime --rxTime + --name /data/joints/rightArm_joints --txTime --rxTime localhost dataDumperRightArmJoints dataDumper - --name /data/joints_leftLeg --txTime --rxTime + --name /data/joints/leftLeg_joints --txTime --rxTime localhost dataDumperLeftLegJoints dataDumper - --name /data/joints_rightLeg --txTime --rxTime + --name /data/joints/rightLeg_joints --txTime --rxTime localhost dataDumperRightLegJoints @@ -130,42 +130,42 @@ dataDumper - --name /data/forces_leftArm --txTime --rxTime + --name /data/forces_and_torques/leftArm_forces --txTime --rxTime localhost dataDumperLeftArmForces dataDumper - --name /data/forces_rightArm --txTime --rxTime + --name /data/forces_and_torques/rightArm_forces --txTime --rxTime localhost dataDumperRightArmForces dataDumper - --name /data/forces_leftLeg --txTime --rxTime + --name /data/forces_and_torques/leftLeg_forces --txTime --rxTime localhost dataDumperLeftLegForces dataDumper - --name /data/forces_rightLeg --txTime --rxTime + --name /data/forces_and_torques/rightLeg_forces --txTime --rxTime localhost dataDumperRightLegForces dataDumper - --name /data/forces_leftFoot --txTime --rxTime + --name /data/forces_and_torques/leftFoot_forces --txTime --rxTime localhost dataDumperLeftFootForces dataDumper - --name /data/forces_rightFoot --txTime --rxTime + --name /data/forces_and_torques/rightFoot_forces --txTime --rxTime localhost dataDumperRightFootForces @@ -173,73 +173,73 @@ /skinManager/skin_events:o - /data/skin_events + /data/skin/skin_events udp /icub/skin/left_hand_comp - /data/skin_tactile_comp_left_hand + /data/skin/tactile_comp_left_hand udp /icub/skin/left_forearm_comp - /data/skin_tactile_comp_left_forearm + /data/skin/tactile_comp_left_forearm udp /icub/skin/left_arm_comp - /data/skin_tactile_comp_left_arm + /data/skin/tactile_comp_left_arm udp /icub/skin/right_hand_comp - /data/skin_tactile_comp_right_hand + /data/skin/tactile_comp_right_hand udp /icub/skin/right_forearm_comp - /data/skin_tactile_comp_right_forearm + /data/skin/tactile_comp_right_forearm udp /icub/skin/right_arm_comp - /data/skin_tactile_comp_right_arm + /data/skin/tactile_comp_right_arm udp /icub/skin/torso_comp - /data/skin_tactile_comp_torso + /data/skin/tactile_comp_torso udp /icub/head/state:o - /data/joints_head + /data/joints/head_joints udp /icub/torso/state:o - /data/joints_torso + /data/joints/torso_joints udp /icub/left_arm/state:o - /data/joints_leftArm + /data/joints/leftArm_joints udp /icub/right_arm/state:o - /data/joints_rightArm + /data/joints/rightArm_joints udp /icub/left_leg/state:o - /data/joints_leftLeg + /data/joints/leftLeg_joints udp /icub/right_leg/state:o - /data/joints_rightLeg + /data/joints/rightLeg_joints udp @@ -262,32 +262,32 @@ /icub/left_arm/analog:o - /data/forces_leftArm + /data/forces_and_torques/leftArm_forces udp /icub/right_arm/analog:o - /data/forces_rightArm + /data/forces_and_torques/rightArm_forces udp /icub/left_leg/analog:o - /data/forces_leftLeg + /data/forces_and_torques/leftLeg_forces udp /icub/right_leg/analog:o - /data/forces_rightLeg + /data/forces_and_torques/rightLeg_forces udp /icub/left_foot/analog:o - /data/forces_leftFoot + /data/forces_and_torques/leftFoot_forces udp /icub/right_foot/analog:o - /data/forces_rightFoot + /data/forces_and_torques/rightFoot_forces udp diff --git a/app/scripts/iCub_dataSetPlayer.xml b/app/scripts/bonus/iCub_dataSetPlayer.xml similarity index 100% rename from app/scripts/iCub_dataSetPlayer.xml rename to app/scripts/bonus/iCub_dataSetPlayer.xml diff --git a/app/scripts/ppsAndReactControl_LyonIntegrated.xml b/app/scripts/bonus/ppsAndReactControl_LyonIntegrated.xml similarity index 100% rename from app/scripts/ppsAndReactControl_LyonIntegrated.xml rename to app/scripts/bonus/ppsAndReactControl_LyonIntegrated.xml diff --git a/app/scripts/ppsAndReactControl_icub_Lyon.xml b/app/scripts/bonus/ppsAndReactControl_icub_Lyon.xml similarity index 100% rename from app/scripts/ppsAndReactControl_icub_Lyon.xml rename to app/scripts/bonus/ppsAndReactControl_icub_Lyon.xml diff --git a/app/scripts/ppsAndReactCtrl_log_icub.xml b/app/scripts/bonus/ppsAndReactCtrl_log_icub.xml similarity index 100% rename from app/scripts/ppsAndReactCtrl_log_icub.xml rename to app/scripts/bonus/ppsAndReactCtrl_log_icub.xml diff --git a/app/scripts/pps_skinAndiCubGuis_Lyon.xml b/app/scripts/bonus/pps_skinAndiCubGuis_Lyon.xml similarity index 100% rename from app/scripts/pps_skinAndiCubGuis_Lyon.xml rename to app/scripts/bonus/pps_skinAndiCubGuis_Lyon.xml From 85c88cdf29cfad7bf038a34094751f43f3b5e2bb Mon Sep 17 00:00:00 2001 From: Matej Hoffmann Date: Wed, 14 Sep 2016 16:05:53 +0200 Subject: [PATCH 15/24] updating master script --- app/scripts/ppsAndReactControl_icub.xml | 206 +++++++++++++++--------- 1 file changed, 133 insertions(+), 73 deletions(-) diff --git a/app/scripts/ppsAndReactControl_icub.xml b/app/scripts/ppsAndReactControl_icub.xml index 0f172d7..459684b 100644 --- a/app/scripts/ppsAndReactControl_icub.xml +++ b/app/scripts/ppsAndReactControl_icub.xml @@ -4,70 +4,98 @@ - - reactController - + + pf3dTracker + --from pf3dTracker.ini + localhost + + + yarpview + --name /PF3DT_viewer --RefreshTime 33 --x 980 --y 620 --w 320 --h 260 --compact localhost - - reactController + + visuoTactileWrapper + --noDoubleTouch + localhost + + + + visuoTactileRF + --taxelsFile taxels1D_learnedAll.ini --rate 20 + localhost + + + skinEventsAggregator general::robot icub localhost - skinEventsAggreg - ppsAggregEventsForiCubGui localhost - aggregEvForiCubGui - pf3dTracker - --from pf3dTracker.ini + reactController + localhost - PF3DTracker + - visuoTactileWrapper - --noDoubleTouch + iCubGui + --xpos 1300 --ypos 330 --width 450 --height 550 localhost - - + - visuoTactileRF - --taxelsFile taxels1D_learnedAll.ini --rate 20 + iCubSkinGui + + --from left_forearm.ini --useCalibration --xpos 0 --ypos 0 --width 300 --height 300 localhost - + skinGuiLF - - yarpview - --name /vtRF/left --RefreshTime 33 --x 0 --y 0 --w 400 --h 400 --compact + iCubSkinGui + + --from left_hand_V2_1.ini --useCalibration --xpos 320 --ypos 0 --width 300 --height 300 localhost - + skinGuiLH + iCubSkinGui + + --from right_forearm.ini --useCalibration --xpos 640 --ypos 0 --width 300 --height 300 + localhost + skinGuiRF + + + iCubSkinGui + + --from right_hand_V2_1.ini --useCalibration --xpos 960 --ypos 0 --width 300 --height 300 + localhost + skinGuiRH + + + + - - /reactController/gui:o - /iCubGui/objects - udp + + /pf3dTracker/data:o + /visuoTactileWrapper/pf3dTracker:i + tcp + + + /icub/camcalib/left/out + /pf3dTracker/video:i + tcp + + + /pf3dTracker/video:o + /PF3DT_viewer + tcp + + + + /visuoTactileWrapper/events:o + /visuoTactileRF/events:i + tcp + + + /skinManager/skin_events:o + /visuoTactileRF/skin_events:i + tcp + + + + /visuoTactileRF/pps_events_aggreg:o + /reactController/pps_events_aggreg:i + udp @@ -94,75 +149,70 @@ udp - - /visuoTactileRF/pps_events_aggreg:o - /reactController/pps_events_aggreg:i - udp - - - /skinEventsAggregator/skin_events_aggreg:o - /ppsAggregEventsForiCubGui/skin_events_aggreg:i + /ppsAggregEventsForiCubGui/skin_events_aggreg:i udp - /visuoTactileRF/pps_events_aggreg:o - /ppsAggregEventsForiCubGui/pps_events_aggreg:i + /ppsAggregEventsForiCubGui/pps_events_aggreg:i udp - - + /ppsAggregEventsForiCubGui/contacts:o - /iCubGui/forces + /iCubGui/forces udp - - - - /skinManager/skin_events:o - /visuoTactileRF/skin_events:i + + + + /visuoTactileWrapper/gui:o + /iCubGui/objects tcp + - /icub/camcalib/left/out - /pf3dTracker/video:i - tcp + /reactController/gui:o + /iCubGui/objects + udp + - /pf3dTracker/video:o - /PF3DT_viewer - tcp + /icub/head/state:o + /iCubGui/head:i + udp - /pf3dTracker/data:o - /visuoTactileWrapper/pf3dTracker:i - tcp + /icub/inertial + /iCubGui/inertial:i + udp - - /visuoTactileWrapper/gui:o - /iCubGui/objects - tcp + /icub/left_arm/state:o + /iCubGui/left_arm:i + udp - - /icub/camcalib/left/out - /visuoTactileRF/imageL:i + /icub/right_arm/state:o + /iCubGui/right_arm:i udp - /icub/camcalib/right/out - /visuoTactileRF/imageR:i + /icub/left_leg/state:o + /iCubGui/left_leg:i udp - - /visuoTactileWrapper/events:o - /visuoTactileRF/events:i - tcp + /icub/right_leg/state:o + /iCubGui/right_leg:i + udp - + + /icub/torso/state:o + /iCubGui/torso:i + udp + + /visuoTactileRF/skinGuiForearmL:o /skinGui/left_forearm_virtual:i @@ -183,7 +233,17 @@ /skinGui/right_hand_virtual:i tcp + +