agents and control import math from agents import environment class rob_env(environment)def __init__(self,walls {})"""walls is set of line segments where each line segment is of the form (( , ),( , )""self walls walls body the body defines everything about the agent body agentenv py -(continued import math from agents import environment import matplotlib pyplot as plt import time class rob_body(environment)def __init__(selfenvinit_pos=( , , ))""env is the current environment init_pos is triple of ( -positiony-positiondirectiondirection is in degrees is to right is straight-upetc ""self env env self rob_xself rob_yself rob_dir init_pos self turning_angle degrees that left makes self whisker_length length of the whisker self whisker_angle angle of whisker relative to robot self crashed false the following control how it is plotted self plotting true whether the trace is being plotted self sleep_time time between actions (for real-time plottingthe following are data structures maintainedself history [(self rob_xself rob_y)history of ( ,ypositions self wall_history [history of hitting the wall def percepts(self)return {'rob_x_pos':self rob_x'rob_y_pos':self rob_y'rob_dir':self rob_dir'whisker':self whisker('crashed':self crashedinitial_percepts percepts use percept function for initial percepts too def do(self,action)""action is {'steer':directionversion june