From: Fernyqc <fe...@us...> - 2005-07-05 23:04:38
|
Update of /cvsroot/robotflow/RobotFlow/Behaviors/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27144 Modified Files: GotoPat.cc RangeFashion.cc SafeVelocityPat.cc Log Message: - Minors revisions Index: RangeFashion.cc =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/Behaviors/src/RangeFashion.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RangeFashion.cc 4 Jul 2005 11:21:11 -0000 1.6 --- RangeFashion.cc 5 Jul 2005 23:04:29 -0000 1.7 *************** *** 65,68 **** --- 65,88 ---- * @parameter_value 0 * + * @parameter_name MAX_DIST + * @parameter_description Distance when no data from sensor (mm) + * @parameter_type int + * @parameter_value 10000 + * + * @parameter_name MAX_DIST_IR + * @parameter_description Max range detection of IR (mm) + * @parameter_type int + * @parameter_value 1000 + * + * @parameter_name MAX_DIST_SONAR + * @parameter_description Max range detection of sonar (mm) + * @parameter_type int + * @parameter_value 10000 + * + * @parameter_name MAX_DIST_LASER + * @parameter_description Max range detection of laser (mm) + * @parameter_type int + * @parameter_value 10000 + * END*/ *************** *** 80,83 **** --- 100,107 ---- //parameters int m_typeFashion; + int m_maxDist; + int m_maxDistIR; + int m_maxDistSonar; + int m_maxDistLaser; void priorityBaseFashion(Vector<int> *vectPercept, ObjectRef &laserValue, ObjectRef &sonarValue, ObjectRef &irValue, int count){ *************** *** 95,99 **** int i=0; for(iterIR = irReading.begin(); iterIR != irReading.end(); ++iterIR){ ! if(*iterIR <= 1000) // Max value IR (*vectPercept)[i]=*iterIR; ++i; --- 119,123 ---- int i=0; for(iterIR = irReading.begin(); iterIR != irReading.end(); ++iterIR){ ! if(*iterIR <= m_maxDistIR) // Max value IR (*vectPercept)[i]=*iterIR; ++i; *************** *** 124,128 **** // Get the 3 mins of the range ! int min1=10000, min2=10000, min3=10000; for(int j=begin; j<end; ++j){ if(laserReading[j] <= min1){ --- 148,152 ---- // Get the 3 mins of the range ! int min1=m_maxDist, min2=m_maxDist, min3=m_maxDist; for(int j=begin; j<end; ++j){ if(laserReading[j] <= min1){ *************** *** 156,160 **** // Save the value ! if(((*vectPercept)[ind_vectPercept] == -1) && (x_min < 10000)){ (*vectPercept)[ind_vectPercept] = x_min - offset; } --- 180,184 ---- // Save the value ! if(((*vectPercept)[ind_vectPercept] == -1) && (x_min < m_maxDistLaser)){ (*vectPercept)[ind_vectPercept] = x_min - offset; } *************** *** 182,186 **** int i=0; for(iterSonar = sonarReading.begin(); iterSonar != sonarReading.end(); ++iterSonar) { ! if(((*vectPercept)[i] == -1) && (*iterSonar<10000)) // Max value Sonar (*vectPercept)[i]=*iterSonar; ++i; --- 206,210 ---- int i=0; for(iterSonar = sonarReading.begin(); iterSonar != sonarReading.end(); ++iterSonar) { ! if(((*vectPercept)[i] == -1) && (*iterSonar<m_maxDistSonar)) // Max value Sonar (*vectPercept)[i]=*iterSonar; ++i; *************** *** 198,202 **** for(iterPercept = vectPercept->begin(); iterPercept != vectPercept->end(); ++iterPercept) { if(*iterPercept < 0) ! *iterPercept = 10000; } --- 222,226 ---- for(iterPercept = vectPercept->begin(); iterPercept != vectPercept->end(); ++iterPercept) { if(*iterPercept < 0) ! *iterPercept = m_maxDist; } *************** *** 223,227 **** // parameters ! m_typeFashion = dereference_cast<int>(parameters.get("TYPE_FASHION")); } --- 247,255 ---- // parameters ! m_typeFashion = dereference_cast<int>(parameters.get("TYPE_FASHION")); ! m_maxDist = dereference_cast<int>(parameters.get("MAX_DIST")); ! m_maxDistIR = dereference_cast<int>(parameters.get("MAX_DIST_IR")); ! m_maxDistSonar = dereference_cast<int>(parameters.get("MAX_DIST_SONAR")); ! m_maxDistLaser = dereference_cast<int>(parameters.get("MAX_DIST_LASER")); } Index: SafeVelocityPat.cc =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/Behaviors/src/SafeVelocityPat.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SafeVelocityPat.cc 4 Jul 2005 11:21:11 -0000 1.6 --- SafeVelocityPat.cc 5 Jul 2005 23:04:29 -0000 1.7 *************** *** 111,114 **** --- 111,123 ---- float m_b; + float getMinMargin(const Vector<float> &vector, int begin, int end){ + float margin = vector[begin]; + for(int i = begin+1; i<=end; ++i){ + if(vector[i] < margin){ + margin = vector[i]; + } + } + } + public: *************** *** 171,209 **** } ! // According to the side of the rotation evaluation de margin of safety int rotation = dereference_cast<int>(rotationRef); float marginFront=1, marginBack=1; ! if (rotation < 0){ ! // Margin at the back of the robot (range 6,7,8,9) ! marginBack = securityMargin[6]; ! for(int i = 7; i<=9; ++i){ ! if(securityMargin[i] < marginBack){ ! marginBack = securityMargin[i]; ! } } ! ! // Margin at front of the robot (range 0,1,2,3) ! marginFront = securityMargin[0]; ! for(int i = 1; i<=3; ++i){ ! if(securityMargin[i] < marginFront){ ! marginFront = securityMargin[i]; ! } } } else{ ! // Margin at the back of the robot (range 3,4,5,6) ! marginBack = securityMargin[3]; ! for(int i = 4; i<=6; ++i){ ! if(securityMargin[i] < marginBack){ ! marginBack = securityMargin[i]; ! } } ! ! // Margin at front of the robot (range 9,10,11,0) ! marginFront = securityMargin[0]; ! for(int i = 9; i<=11; ++i){ ! if(securityMargin[i] < marginFront){ ! marginFront = securityMargin[i]; ! } } } --- 180,215 ---- } ! // According to the side of the rotation evaluate the margin of security int rotation = dereference_cast<int>(rotationRef); float marginFront=1, marginBack=1; ! // Backward or forward motion ! if(signVelIn > 0){ ! if (rotation < 0){ ! // Back margin of the robot (range 6,7,8,9) ! marginBack = getMinMargin(securityMargin, 6, 9); ! // Front margin of the robot (range 0,1,2,3) ! marginFront = getMinMargin(securityMargin, 0, 3); } ! else{ ! // Back margin of the robot (range 3,4,5,6) ! marginBack = getMinMargin(securityMargin, 3, 6); ! // Front margin of the robot (range 9,10,11,0) ! marginFront = getMinMargin(securityMargin, 9, 11); ! if(securityMargin[0] < marginFront) marginFront = securityMargin[0]; } } else{ ! if (rotation < 0){ ! // Back margin of the robot (range 3,4,5,6) ! marginBack = getMinMargin(securityMargin, 3, 6); ! // Front margin of the robot (range 9,10,11,0) ! marginFront = getMinMargin(securityMargin, 9, 11); ! if(securityMargin[0] < marginFront) marginFront = securityMargin[0]; } ! else{ ! // Back margin of the robot (range 6,7,8,9) ! marginBack = getMinMargin(securityMargin, 6, 9); ! // Front margin of the robot (range 0,1,2,3) ! marginFront = getMinMargin(securityMargin, 0, 3); } } Index: GotoPat.cc =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/Behaviors/src/GotoPat.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GotoPat.cc 2 Jul 2005 02:12:43 -0000 1.4 --- GotoPat.cc 5 Jul 2005 23:04:29 -0000 1.5 *************** *** 108,112 **** * @parameter_value 3 * - * * @parameter_name DISCARD_DIST_INTER_GOAL * @parameter_description Distance to discard intermediate goal --- 108,111 ---- |