Skip to content
Snippets Groups Projects
Commit cea7a753 authored by Theo Brockmann's avatar Theo Brockmann
Browse files

Update main_test.py

parent 47641a7c
Branches
No related tags found
No related merge requests found
......@@ -26,14 +26,27 @@ async def main():
print(reward)
print(done)
total_reward = 0
while done and total_reward > -80 and reward[1] < 50:
# Here could be conditions to determine which actions to take
actions = "accelerate"
# For example:
if observation[2][2] < 4: # observation[2][2] is the sensor to the right and 4 is in meters
actions += "steer_left"
# Makes 1 step only driving straight
observation, reward, done, info = await env.step("accelerate,screen_on", 0.17)
observation, reward, done, info = await env.step(actions, 0.17)
print(observation)
# Obeservation is an array with the following information:
# [speed, steering-angle, [length of all sensors (starting straight and then clockwise around the car)]]
print(reward)
print(done)
total_reward -= reward[1]
actions = ""
print(total_reward)
try:
# Test show Image
si.show_image(image_mode,info['thumbnail']['width'],info['thumbnail']['height'],info['thumbnail']['image'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment