From: Fernyqc <fe...@us...> - 2005-12-12 18:20:32
|
Update of /cvsroot/robotflow/RobotFlow/Sensors/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18036/Sensors/src Modified Files: RangeFashion.cc Log Message: Refactoring to start the belt at 0 degree; Deactivate the IR and Sonar support Index: RangeFashion.cc =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/Sensors/src/RangeFashion.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RangeFashion.cc 27 Oct 2005 18:02:18 -0000 1.1 --- RangeFashion.cc 12 Dec 2005 18:20:23 -0000 1.2 *************** *** 104,108 **** // Priority #1 // IRs ! if(!irValue->isNil()){ Vector<int> &irReading = object_cast<Vector<int> >(getInput(irID,count)); --- 104,108 ---- // Priority #1 // IRs ! /*if(!irValue->isNil()){ Vector<int> &irReading = object_cast<Vector<int> >(getInput(irID,count)); *************** *** 115,119 **** ++i; } ! } /*Vector<int>::iterator iterA; --- 115,119 ---- ++i; } ! }*/ /*Vector<int>::iterator iterA; *************** *** 126,136 **** // Priority #2 // Lasers ! if(!laserValue->isNil()){ Vector<int> &laserReading = object_cast<Vector<int> >(getInput(laserID,count)); ! int ind_vectPercept = 3; // For each position in the range of the laser ! for(int i=0; i<7; ++i){ // Determine the range for the position int begin = 60 * i - 10; --- 126,138 ---- // Priority #2 // Lasers ! if(!laserValue->isNil()) ! { Vector<int> &laserReading = object_cast<Vector<int> >(getInput(laserID,count)); ! int ind_vectPercept = 0; // For each position in the range of the laser ! for(int i=0; i<7; ++i) ! { // Determine the range for the position int begin = 60 * i - 10; *************** *** 142,155 **** int min1=m_maxDistLaser, min2=m_maxDistLaser, min3=m_maxDistLaser; for(int j=begin; j<end; ++j){ ! if(laserReading[j] <= min1){ min3 = min2; min2 = min1; min1 = laserReading[j]; } ! else if(laserReading[j] <= min2){ min3 = min2; min2 = laserReading[j]; } ! else if(laserReading[j] <= min3){ min3 = laserReading[j]; } --- 144,160 ---- int min1=m_maxDistLaser, min2=m_maxDistLaser, min3=m_maxDistLaser; for(int j=begin; j<end; ++j){ ! if(laserReading[j] <= min1) ! { min3 = min2; min2 = min1; min1 = laserReading[j]; } ! else if(laserReading[j] <= min2) ! { min3 = min2; min2 = laserReading[j]; } ! else if(laserReading[j] <= min3) ! { min3 = laserReading[j]; } *************** *** 159,183 **** int x_min = (min1+min2+min3)/3; ! // Transform of the data according to the physical dimension of the robot ! int offset = 0; ! /*switch (ind_vectPercept){ ! case 0: offset = 200; break; ! case 1: offset = 150; break; ! case 2: offset = 150; break; ! case 3: offset = 300; break; ! case 9: offset = 300; break; ! case 10: offset = 150; break; ! case 11: offset = 150; break; ! }*/ ! ! // Save the value ! if(((*vectPercept)[ind_vectPercept] == -1) && (x_min < m_maxDistLaser)){ ! (*vectPercept)[ind_vectPercept] = x_min - offset; ! } ! // Next position ! --ind_vectPercept; ! if(ind_vectPercept<0) ! ind_vectPercept = 11; } } --- 164,183 ---- int x_min = (min1+min2+min3)/3; ! // Transform of the data according to the physical dimension of the robot ! int offset = 0; ! /*switch (ind_vectPercept){ ! case 0: offset = 200; break; ! case 1: offset = 150; break; ! case 2: offset = 150; break; ! case 3: offset = 300; break; ! case 9: offset = 300; break; ! case 10: offset = 150; break; ! case 11: offset = 150; break; ! }*/ ! // Save the value ! if(((*vectPercept)[i] == -1) && (x_min < m_maxDistLaser)){ ! (*vectPercept)[i] = x_min - offset; ! } } } *************** *** 191,195 **** // Priority #3 // Sonars ! if(!sonarValue->isNil()){ Vector<int> &sonarReading = object_cast<Vector<int> >(getInput(sonarID,count)); --- 191,195 ---- // Priority #3 // Sonars ! /*if(!sonarValue->isNil()){ Vector<int> &sonarReading = object_cast<Vector<int> >(getInput(sonarID,count)); *************** *** 202,206 **** ++i; } ! } /*std::cout << "Sonar -> "; --- 202,206 ---- ++i; } ! }*/ /*std::cout << "Sonar -> "; |