From 6d593577ce077216701f094e450ee776286c7bb0 Mon Sep 17 00:00:00 2001
From: Erik Wijmans <etw@gatech.edu>
Date: Wed, 5 Jun 2019 17:32:55 -0700
Subject: [PATCH] Fix the broken tests by attr pr (#105)

* Fix the broken tests by attr pr
---
 examples/visualization_examples.py        | 8 ++++----
 habitat_baselines/agents/simple_agents.py | 5 ++++-
 habitat_baselines/agents/slam_agents.py   | 5 ++++-
 test/test_habitat_env.py                  | 8 ++++++--
 test/test_sensors.py                      | 2 +-
 5 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/examples/visualization_examples.py b/examples/visualization_examples.py
index 2a02fe930..863294f10 100644
--- a/examples/visualization_examples.py
+++ b/examples/visualization_examples.py
@@ -21,12 +21,12 @@ if not os.path.exists(IMAGE_DIR):
 
 def example_pointnav_draw_target_birdseye_view():
     goal_radius = 0.5
-    goal = NavigationGoal([10, 0.25, 10], goal_radius)
+    goal = NavigationGoal(position=[10, 0.25, 10], radius=goal_radius)
     agent_position = np.array([0, 0.25, 0])
     agent_rotation = -np.pi / 4
 
     dummy_episode = NavigationEpisode(
-        [goal],
+        goals=[goal],
         episode_id="dummy_id",
         scene_id="dummy_scene",
         start_position=agent_position,
@@ -47,7 +47,7 @@ def example_pointnav_draw_target_birdseye_view():
 
 def example_pointnav_draw_target_birdseye_view_agent_on_border():
     goal_radius = 0.5
-    goal = NavigationGoal([0, 0.25, 0], goal_radius)
+    goal = NavigationGoal(position=[0, 0.25, 0], radius=goal_radius)
     ii = 0
     for x_edge in [-1, 0, 1]:
         for y_edge in [-1, 0, 1]:
@@ -58,7 +58,7 @@ def example_pointnav_draw_target_birdseye_view_agent_on_border():
             agent_rotation = np.pi / 2
 
             dummy_episode = NavigationEpisode(
-                [goal],
+                goals=[goal],
                 episode_id="dummy_id",
                 scene_id="dummy_scene",
                 start_position=agent_position,
diff --git a/habitat_baselines/agents/simple_agents.py b/habitat_baselines/agents/simple_agents.py
index cc979840b..5524eaeda 100644
--- a/habitat_baselines/agents/simple_agents.py
+++ b/habitat_baselines/agents/simple_agents.py
@@ -59,7 +59,10 @@ class RandomForwardAgent(RandomAgent):
                 action = SimulatorActions.MOVE_FORWARD.value
             else:
                 action = np.random.choice(
-                    [SimulatorActions.TURN_LEFT.value, SimulatorActions.TURN_RIGHT.value]
+                    [
+                        SimulatorActions.TURN_LEFT.value,
+                        SimulatorActions.TURN_RIGHT.value,
+                    ]
                 )
 
         return action
diff --git a/habitat_baselines/agents/slam_agents.py b/habitat_baselines/agents/slam_agents.py
index 8afdf6e81..c90ecb5f2 100644
--- a/habitat_baselines/agents/slam_agents.py
+++ b/habitat_baselines/agents/slam_agents.py
@@ -265,7 +265,10 @@ class ORBSLAM2Agent(RandomAgent):
                     .view(4, 4)
                     .to(self.device),
                 )
-                if self.action_history[-1] == SimulatorActions.MOVE_FORWARD.value:
+                if (
+                    self.action_history[-1]
+                    == SimulatorActions.MOVE_FORWARD.value
+                ):
                     self.unseen_obstacle = (
                         previous_step.item() <= 0.001
                     )  # hardcoded threshold for not moving
diff --git a/test/test_habitat_env.py b/test/test_habitat_env.py
index 274b5c0e0..e96a34c8e 100644
--- a/test/test_habitat_env.py
+++ b/test/test_habitat_env.py
@@ -158,7 +158,9 @@ def test_env():
             scene_id=config.SIMULATOR.SCENE,
             start_position=[-3.0133917, 0.04623024, 7.3064547],
             start_rotation=[0, 0.163276, 0, 0.98658],
-            goals=[NavigationGoal([-3.0133917, 0.04623024, 7.3064547])],
+            goals=[
+                NavigationGoal(position=[-3.0133917, 0.04623024, 7.3064547])
+            ],
             info={"geodesic_distance": 0.001},
         )
     ]
@@ -250,7 +252,9 @@ def test_rl_env():
             scene_id=config.SIMULATOR.SCENE,
             start_position=[-3.0133917, 0.04623024, 7.3064547],
             start_rotation=[0, 0.163276, 0, 0.98658],
-            goals=[NavigationGoal([-3.0133917, 0.04623024, 7.3064547])],
+            goals=[
+                NavigationGoal(position=[-3.0133917, 0.04623024, 7.3064547])
+            ],
             info={"geodesic_distance": 0.001},
         )
     ]
diff --git a/test/test_sensors.py b/test/test_sensors.py
index 04488a62a..6b6cc3868 100644
--- a/test/test_sensors.py
+++ b/test/test_sensors.py
@@ -182,7 +182,7 @@ def test_static_pointgoal_sensor():
             scene_id=config.SIMULATOR.SCENE,
             start_position=valid_start_position,
             start_rotation=start_rotation,
-            goals=[NavigationGoal(goal_position)],
+            goals=[NavigationGoal(position=goal_position)],
         )
     ]
 
-- 
GitLab