From: Fernyqc <fe...@us...> - 2005-07-06 01:13:06
|
Update of /cvsroot/robotflow/RobotFlow/Behaviors/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31640 Modified Files: AvoidPat.cc FollowWall.cc Log Message: - Remove logging n the followwall - Minimum range computation in AvoidPat Index: FollowWall.cc =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/Behaviors/src/FollowWall.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FollowWall.cc 18 Jun 2005 15:08:20 -0000 1.4 --- FollowWall.cc 6 Jul 2005 01:12:57 -0000 1.5 *************** *** 38,45 **** * @description Follow a wall if present in the robot environment * - * @input_name PARAMS - * @input_type int - * @input_description Nb of laser samples to consider in the computation. Maximum distance to be considered as a wall - * * @input_name ACTIVATED * @input_type bool --- 38,41 ---- *************** *** 50,57 **** * @input_description All lasers reading. * - * @input_name LOG - * @input_type Vector<int> - * @input_description Log the computation - * * @output_name VELOCITY * @output_type int --- 46,49 ---- *************** *** 167,173 **** //inputs - int paramsID; int laserID; - int logID; //outputs --- 159,163 ---- *************** *** 222,226 **** // Evaluate the std.deviation of a vector ! float computeVariance(vector<float>data) { float sumSquare=0; --- 212,216 ---- // Evaluate the std.deviation of a vector ! float computeStdDev(vector<float>data) { float sumSquare=0; *************** *** 236,240 **** // Compute variance ! return (sumSquare-(sumXi*sumXi/n))/(n-1); } --- 226,230 ---- // Compute variance ! return sqrt((sumSquare-(sumXi*sumXi/n))/(n-1)); } *************** *** 242,246 **** // Compute mean and std.deviation float meanBeta = computeMeanValue(angleBeta); ! float varianceBeta = computeVariance(angleBeta) * RAD_DEGREE; // Compute angular correction and the distance to the wall --- 232,236 ---- // Compute mean and std.deviation float meanBeta = computeMeanValue(angleBeta); ! float varianceBeta = computeStdDev(angleBeta) * RAD_DEGREE; // Compute angular correction and the distance to the wall *************** *** 339,343 **** // Logging ! static std::ofstream laserL("laserLeft.txt"); static std::ofstream cmdL("cmdLeft.txt"); static std::ofstream laserR("laserRight.txt"); --- 329,333 ---- // Logging ! /*static std::ofstream laserL("laserLeft.txt"); static std::ofstream cmdL("cmdLeft.txt"); static std::ofstream laserR("laserRight.txt"); *************** *** 357,367 **** // Compute mean and std.deviation float meanBeta = computeMeanValue(angleBetaLeft)*RAD_DEGREE; ! float varianceBeta = computeVariance(angleBetaLeft); cmdL << "log" << logNumber << "\t" << meanBeta << "\t" << varianceBeta << "\t" << aLeft << "\t" << distWallLeft << "\t" << angularCorrectionLeft << "\t" << wallLeft << std::endl; meanBeta = computeMeanValue(angleBetaRight)*RAD_DEGREE; ! varianceBeta = computeVariance(angleBetaRight); cmdR << "log" << logNumber << "\t" << meanBeta << "\t" << varianceBeta << "\t" << aRight << "\t" << distWallRight << "\t" << angularCorrectionLeft << "\t" << wallRight << std::endl; ++logNumber; ! } } --- 347,357 ---- // Compute mean and std.deviation float meanBeta = computeMeanValue(angleBetaLeft)*RAD_DEGREE; ! float varianceBeta = computeStdDev(angleBetaLeft); cmdL << "log" << logNumber << "\t" << meanBeta << "\t" << varianceBeta << "\t" << aLeft << "\t" << distWallLeft << "\t" << angularCorrectionLeft << "\t" << wallLeft << std::endl; meanBeta = computeMeanValue(angleBetaRight)*RAD_DEGREE; ! varianceBeta = computeStdDev(angleBetaRight); cmdR << "log" << logNumber << "\t" << meanBeta << "\t" << varianceBeta << "\t" << aRight << "\t" << distWallRight << "\t" << angularCorrectionLeft << "\t" << wallRight << std::endl; ++logNumber; ! }*/ } *************** *** 408,414 **** //Inputs - paramsID = addInput("PARAMS"); laserID = addInput("LASERS"); - logID = addInput("LOG"); //Outputs --- 398,402 ---- *************** *** 518,524 **** void calculate_behavior(int output_id, int count, Buffer &out) { - // Get behavior params - ObjectRef paramsValue = getInput(paramsID,count); - // Get laser readings Vector<int> &laserReading = object_cast<Vector<int> >(getInput(laserID,count)); --- 506,509 ---- *************** *** 526,530 **** // Toggle logic to log the sample bool toLog = false; ! static bool log = false; Vector<int> &logValue = object_cast<Vector<int> >(getInput(logID,count)); if (logValue[0] != log) --- 511,515 ---- // Toggle logic to log the sample bool toLog = false; ! /*static bool log = false; Vector<int> &logValue = object_cast<Vector<int> >(getInput(logID,count)); if (logValue[0] != log) *************** *** 532,536 **** toLog = true; log = logValue[0]; ! } //if (!paramsValue->isNil() && laserReading.size() != 0) --- 517,521 ---- toLog = true; log = logValue[0]; ! }*/ //if (!paramsValue->isNil() && laserReading.size() != 0) *************** *** 604,608 **** // Motor cmd debug ! static std::ofstream cmdMotor("motorCmd.txt"); static int logNb = 0; static int header=1; --- 589,593 ---- // Motor cmd debug ! /*static std::ofstream cmdMotor("motorCmd.txt"); static int logNb = 0; static int header=1; *************** *** 614,618 **** cmdMotor << "log" << logNb << "\t" << angularCorrection << "\t" << speedInd << "\t" << velocity << "\t" << rotation << std::endl; ++logNb; ! } // Send motor command --- 599,603 ---- cmdMotor << "log" << logNb << "\t" << angularCorrection << "\t" << speedInd << "\t" << velocity << "\t" << rotation << std::endl; ++logNb; ! }*/ // Send motor command Index: AvoidPat.cc =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/Behaviors/src/AvoidPat.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AvoidPat.cc 4 Jul 2005 22:51:45 -0000 1.8 --- AvoidPat.cc 6 Jul 2005 01:12:57 -0000 1.9 *************** *** 300,303 **** --- 300,305 ---- std::cout << "Backward -> true" << std::endl; std::cout << "backward_iter -> " << backward_iter << std::endl; + std::cout << "backward_vel -> " << backward_vel << std::endl; + std::cout << "backward_rot -> " << backward_rot << std::endl; } else{ |