From c928734ff2c035fad4c37163aacacd4370da0af5 Mon Sep 17 00:00:00 2001
From: Oleksandr Maksymets <maksymets@gmail.com>
Date: Wed, 5 Feb 2020 20:32:39 -0800
Subject: [PATCH] Fixed for sensors test

---
 habitat/sims/habitat_simulator/habitat_simulator.py |  8 --------
 habitat/tasks/nav/nav.py                            | 11 +++--------
 test/test_sensors.py                                |  4 ++--
 3 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/habitat/sims/habitat_simulator/habitat_simulator.py b/habitat/sims/habitat_simulator/habitat_simulator.py
index cb7ca7761..244258270 100644
--- a/habitat/sims/habitat_simulator/habitat_simulator.py
+++ b/habitat/sims/habitat_simulator/habitat_simulator.py
@@ -288,14 +288,6 @@ class HabitatSim(Simulator):
             position_b[0], np.ndarray
         ):
             path.requested_ends = np.array(position_b, dtype=np.float32)
-            # TODO(erikwijmans) Remove next line as soon as multi goal shortest
-            # path passes the tests.
-            return np.min(
-                [
-                    self.geodesic_distance(position_a, position)
-                    for position in position_b
-                ]
-            )
         else:
             path.requested_ends = np.array(
                 [np.array(position_b, dtype=np.float32)]
diff --git a/habitat/tasks/nav/nav.py b/habitat/tasks/nav/nav.py
index 007ecbc06..49d835d2d 100644
--- a/habitat/tasks/nav/nav.py
+++ b/habitat/tasks/nav/nav.py
@@ -272,7 +272,7 @@ class HeadingSensor(Sensor):
         heading_vector = quaternion_rotate_vector(quat, direction_vector)
 
         phi = cartesian_to_polar(-heading_vector[2], heading_vector[0])[1]
-        return np.array(phi)
+        return np.array([phi], dtype=np.float32)
 
     def get_observation(
         self, observations, episode, *args: Any, **kwargs: Any
@@ -299,13 +299,8 @@ class EpisodicCompassSensor(HeadingSensor):
         rotation_world_agent = agent_state.rotation
         rotation_world_start = quaternion_from_coeff(episode.start_rotation)
 
-        return np.array(
-            [
-                self._quat_to_xy_heading(
-                    rotation_world_agent.inverse() * rotation_world_start
-                )
-            ],
-            dtype=np.float32,
+        return self._quat_to_xy_heading(
+            rotation_world_agent.inverse() * rotation_world_start
         )
 
 
diff --git a/test/test_sensors.py b/test/test_sensors.py
index 6f68d4e35..205aa7e37 100644
--- a/test/test_sensors.py
+++ b/test/test_sensors.py
@@ -241,14 +241,14 @@ def test_pointgoal_with_gps_compass_sensor():
         obs = env.step(sample_non_stop_action(env.action_space))
         pointgoal = obs["pointgoal"]
         pointgoal_with_gps_compass = obs["pointgoal_with_gps_compass"]
-        comapss = obs["compass"]
+        compass = obs["compass"]
         gps = obs["gps"]
         # check to see if taking non-stop actions will affect static point_goal
         assert np.allclose(
             pointgoal_with_gps_compass,
             quaternion_rotate_vector(
                 quaternion.from_rotation_vector(
-                    comapss * np.array([0, 1, 0])
+                    compass * np.array([0, 1, 0])
                 ).inverse(),
                 pointgoal - gps,
             ),
-- 
GitLab