Best Python code snippet using tempest_python
AgentClass.py
Source:AgentClass.py
...57 y1 = self.y58 x2 = self.x + self.LINEAR * np.math.cos(self.theta)59 y2 = self.y + self.LINEAR * np.math.sin(self.theta)60 return [(x1, y1), (x2, y2)]61 def show_agent(self, counter):62 # A function to show the agent in the environment and the direction its facing63 # Requires:64 # Counter: to track the steps of the agent65 # Returns:66 # Nothing67 heading = self.make_heading()68 rays = self.env.get_rays(self.x, self.y, self.theta, self.FOV)69 self.env.show_env(lines=np.concatenate([rays, [heading]]), point=(self.x, self.y), step=counter)70if __name__ == "__main__":71 env = Base(num_obstables=10, box_h=50, box_w=50)72 fov = []73 for i in range(-45, 45):74 fov.append(i * np.pi / 180)75 agent = Manual(200, 200, 0, fov, 25, np.math.radians(5), env)76 agent.show_agent(counter=None)77 move_list = [0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]78 for i, j in enumerate(move_list):79 agent.move(j)80 agent.show_agent(i)81 # command = int(input("Pick a direction to move: "))82 # counter = 083 # while command != -1:84 # agent.move(command)85 # agent.show_agent(counter=counter)86 # counter+=1...
app.py
Source:app.py
...31 # print('action:', action)32 if action == 99:33 break34 elif action == 98:35 world.flip_show_agent()36 show_agent = not show_agent37 elif action == 97:38 pass39 # plot()40 else:41 obs, reward, done = world.take_action(action)42 agent.get_feedback(obs, action, reward, done)43 draw()44 if done:...
show_agent.py
Source:show_agent.py
...3from pbt import PBTAgent4from utils import load_model5AGENT_PATH = '/home/acmc/repos/projet-recherche-lu3in013-2022/saved_agents/agent_71.pickle'6@hydra.main(config_path=".", config_name="pbt.yaml")7def show_agent(cfg):8 agent = PBTAgent(cfg)9 agent.load(AGENT_PATH, cfg)10 simulated_workspace = agent.run_simulation()11 renders = simulated_workspace['env/rendering']12 import matplotlib.pyplot as plt13 for (i, render) in enumerate(renders):14 nparray = render.numpy()15 plt.imsave('/home/acmc/repos/projet-recherche-lu3in013-2022/renders/{}.png'.format(i), nparray)16if __name__ == "__main__":...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!