Bug Algorithms Shmuel Wimer Bar Ilan Univ., School of Engineering April 2011 1 Bug1 and Bug2 Algorithm • Move towards the goal, unless an obstacle is encountered. • Circumnavigate the obstacle until motion toward the goal is again allowable. • Robot is assumed to be a point with perfect positioning. • Robot has a contact sensor which detects the obstacle boundary if it touches it. • The robot can measure the distance d(x,y) between any two points. • The workspace is bounded. April 2011 2 The Bug1 algorithm successfully finds the goal. April 2011 3 • Bug1 exhibits two behaviors: – motion to goal, and – boundary following. • The robot moves along a line from qstart to qgoal until it hits an obstacle at a hit point - q1,hit. • It circumnavigate the obstacle until it returns the hit point. • It then determines the nearest point to qgoal and traverses along the boundary to that leave point - q1,leave. • From q1,leave it heads straight to qgoal again. • The algorithm terminates when qgoal is reached or the planner determines that qgoal is not reachable. April 2011 4 The Bug1 algorithm reports the goal is unreachable. April 2011 5 The Bug2 algorithm successfully finds the goal. April 2011 6 The Bug2 algorithm reports the goal is unreachable. April 2011 7 • Bug2 also exhibits two behaviors: – motion to goal, and – boundary following. • The motion line is fixed, connecting qstart to qgoal. • From a hit point qi,hit it circumnavigate an obstacle until it reaches a new point along the motion line, closer to qgoal. • If it returns to qi,hit the goal is not reachable. • At first glance it seems that Bug1 is more effective than Bug2, yielding a shorter path. • This is not always the case. April 2011 8 April 2011 9 For Bug1, when the robot hits an obstacle it completely circumnavigate the boundary and then returns to the leave point, traversing it 1.5 times in the worst case. If there are n obstacles then: LBug1 d qstart , qgoal 1.5 i 1 pi n Let the motion line connecting qstart to qgoal intersects and obstacle ni times. Bug2 may perform a complete traversal of the boundary on half of those point. Therefore: LBug2 1 n d qstart , qgoal i 1 ni pi 2 LBug2 can be arbitrarily longer than LBug1. April 2011 10 Tangent Bug The robot has an azimuth distance sensor with infinitesimal angular resolution. For every point of an obstacle, azimuth distance is defined: : R 2 0,360 R.. For cos ,sin T i WO i , . define x, min d x cos ,sin . 0, T The range of the sensor is usually limited. x, , if x, R R x, , otherwise. April 2011 11 ρR is piecewise continuous. The tangent Bug planner assumes that the robot can detect discontinuities in ρR. April 2011 Intervals of continuity: [O1,O2] , [O3,O4], [O5,O6] and [O7,O8] 12 • Like Bug1 and Bug2, Tangent Bug has motion-to-goal and boundary-following behaviors. • Unlike Bug1 and Bug2, its motion-to-goal behavior may have both straight and boundary following phases. Similarly, in boundary-following behavior it may have a straight motion phase. • The robot starts in a motion-to-goal by moving straight towards the goal until it senses an obstacle at distance of R units. • By definition, the line connecting the robot to the goal must intersect an interval of continuity. April 2011 13 The robot is sensing WO1 and WO2, but ignores WO1. After touching WO2 the first time, an interval [O1,O2] of continuity is defined. The robot then moves towards Oi that maximally decreases a heuristic distance to goal, for example, d(x,Oi)+d(Oi,qgoal). April 2011 14 t 1 t2 t 3 Motion-to-goal is also following boundary April 2011 15