""if 'timeoutin actionremaining action['timeout'elseremaining - will never reach target_pos action['go_to'arrived self close_enough(target_poswhile not arrived and remaining ! self percepts self env do({"steer":self steer(target_pos)}remaining - arrived self close_enough(target_posreturn {'arrived':arrivedthis determines how to steer depending on whether the goal is to the right or the left of where the robot is facing agentmiddle py -(continued def steer(self,target_pos)if self percepts['whisker']self display( ,'whisker on'self perceptsreturn "leftelsegx,gy target_pos rx,ry self percepts['rob_x_pos'],self percepts['rob_y_pos'goal_dir math acos((gx-rx)/math sqrt((gx-rx)*(gx-rx+(gy-ry)*(gy-ry)))* /math pi if ry>gygoal_dir -goal_dir goal_from_rob (goal_dir self percepts['rob_dir']+ )% - assert - goal_from_rob < if goal_from_rob self straight_anglereturn "leftelif goal_from_rob -self straight_anglereturn "rightelsereturn "straight def close_enough(self,target_pos)gx,gy target_pos rx,ry self percepts['rob_x_pos'],self percepts['rob_y_pos'return (gx-rx)** (gy-ry)** <self close_threshold_squared top layer the top layer treats the middle layer as its environment note that the top layer is an environment for us to tell it what to visit agenttop py -top layer from agentmiddle import rob_middle_layer version june