bool approach_grab::moveTowardTarget(){ float vx=0; float vy=0; float omega=0; // if we see the target in between the left and right tolerances we apprach the object. if(targetPos[0]>turnLeftTol && targetPos[0]desiredPosError[1]) vx=distToTarget[1]*posGain; if(abs(distToTarget[0])>desiredPosError[0]) vy=distToTarget[0]*posGain; } // if the object is to the left of our tolerance zone turn left to look for it if(targetPos[0]turnRightTol){ omega=-.5; } // set the velocity of the robotino setRobotinoVelocity(vx,vy,omega); // we want to return ture while we are still approaching the ball. return (abs(distToTarget[0])>desiredPosError[0] || (distToTarget[1])>desiredPosError[1]); // return true while we still need to move }