From: clement r. <kl...@us...> - 2006-01-18 23:20:31
|
Update of /cvsroot/robotflow/RobotFlow/Behaviors/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31823/src Modified Files: AvoidUtil.cc Log Message: modify behavior when going backward. We need to avoid if an obstacle is in the reverse security margin even if we are going backward. Index: AvoidUtil.cc =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/Behaviors/src/AvoidUtil.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AvoidUtil.cc 20 Dec 2005 21:22:42 -0000 1.3 --- AvoidUtil.cc 18 Jan 2006 23:20:22 -0000 1.4 *************** *** 260,264 **** else { ! // If position == 9 (straight forward) if(position == 9) { --- 260,264 ---- else { ! // If position == 9 (straight backward) if(position == 9) { *************** *** 383,387 **** else { ! return false; } } --- 383,398 ---- else { ! // if we are going backward because we are too near from an obstacle ! findSmallestProximityMarginAndPosition(1, 4, minMargin1, minMarginPos1); ! if (minMargin1 <= m_reverseVelSecurityMargin) ! { ! pos = minMarginPos1; ! margin = minMargin1; ! return true; ! } ! else ! { ! return false; ! } } } *************** *** 404,411 **** //Reverse velocity vel = static_cast<int>(m_reverseSlope * margin + m_reverseB); - if(velocity<0) - { - vel *= -1; - } } else if(margin <= m_zeroVelSecurityMargin) --- 415,418 ---- *************** *** 418,425 **** // Evaluate linear approximation variable vel = static_cast<int>(m_velSlope * margin + m_velB); - if(velocity<0) - { - vel *= -1; - } } return vel; --- 425,428 ---- *************** *** 434,438 **** } ! // Evaluation de rotational velocity according to the margin int rot=0; --- 437,441 ---- } ! // Evaluation of rotational velocity according to the margin int rot=0; |