Skip to content
Snippets Groups Projects
Commit 1e4563d5 authored by Oleksandr Maksymets's avatar Oleksandr Maksymets
Browse files

Switched code to heading and GPS sensors using single array wrapping.

parent c928734f
Branches
No related tags found
No related merge requests found
...@@ -95,7 +95,7 @@ def shortest_path_example(mode): ...@@ -95,7 +95,7 @@ def shortest_path_example(mode):
observations, reward, done, info = env.step(best_action) observations, reward, done, info = env.step(best_action)
im = observations["rgb"] im = observations["rgb"]
top_down_map = draw_top_down_map( top_down_map = draw_top_down_map(
info, observations["heading"], im.shape[0] info, observations["heading"][0], im.shape[0]
) )
output_im = np.concatenate((im, top_down_map), axis=1) output_im = np.concatenate((im, top_down_map), axis=1)
images.append(output_im) images.append(output_im)
......
...@@ -78,7 +78,7 @@ def test_state_sensors(): ...@@ -78,7 +78,7 @@ def test_state_sensors():
obs = env.reset() obs = env.reset()
heading = obs["heading"] heading = obs["heading"]
assert np.allclose(heading, random_heading) assert np.allclose(heading, [random_heading])
assert np.allclose(obs["compass"], [0.0], atol=1e-5) assert np.allclose(obs["compass"], [0.0], atol=1e-5)
assert np.allclose(obs["gps"], [0.0, 0.0], atol=1e-5) assert np.allclose(obs["gps"], [0.0, 0.0], atol=1e-5)
...@@ -241,7 +241,7 @@ def test_pointgoal_with_gps_compass_sensor(): ...@@ -241,7 +241,7 @@ def test_pointgoal_with_gps_compass_sensor():
obs = env.step(sample_non_stop_action(env.action_space)) obs = env.step(sample_non_stop_action(env.action_space))
pointgoal = obs["pointgoal"] pointgoal = obs["pointgoal"]
pointgoal_with_gps_compass = obs["pointgoal_with_gps_compass"] pointgoal_with_gps_compass = obs["pointgoal_with_gps_compass"]
compass = obs["compass"] compass = float(obs["compass"][0])
gps = obs["gps"] gps = obs["gps"]
# check to see if taking non-stop actions will affect static point_goal # check to see if taking non-stop actions will affect static point_goal
assert np.allclose( assert np.allclose(
...@@ -252,6 +252,7 @@ def test_pointgoal_with_gps_compass_sensor(): ...@@ -252,6 +252,7 @@ def test_pointgoal_with_gps_compass_sensor():
).inverse(), ).inverse(),
pointgoal - gps, pointgoal - gps,
), ),
atol=1e-5,
) )
env.close() env.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment