Skip to content

Commit

Permalink
--clean up imports
Browse files Browse the repository at this point in the history
Apparently python 3 doesn't like class-scope imports.
  • Loading branch information
jturner65 committed Nov 18, 2024
1 parent 938a057 commit 0c0f847
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src_python/habitat_sim/utils/sim_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

import magnum as mn
import numpy as np
from habitat.articulated_agents.robots.spot_robot import SpotRobot
from habitat.datasets.rearrange.navmesh_utils import get_largest_island_index
from omegaconf import DictConfig

import habitat_sim
from habitat_sim import physics as HSim_Phys
Expand All @@ -18,10 +21,6 @@
# Class to instantiate and maneuver spot from a viewer
# DEPENDENT ON HABITAT-LAB -
class SpotAgent:
from habitat.articulated_agents.robots.spot_robot import SpotRobot
from habitat.datasets.rearrange.navmesh_utils import get_largest_island_index
from omegaconf import DictConfig

SPOT_DIR = "data/robots/hab_spot_arm/urdf/hab_spot_arm.urdf"
if not os.path.isfile(SPOT_DIR):
# support other layout
Expand Down Expand Up @@ -255,10 +254,8 @@ def __init__(self, sim: habitat_sim.Simulator):
def load_and_init(self):
# add the robot to the world via the wrapper
robot_path = SpotAgent.SPOT_DIR
agent_config = SpotAgent.DictConfig({"articulated_agent_urdf": robot_path})
self.spot: SpotAgent.SpotRobot = SpotAgent.SpotRobot(
agent_config, self.sim, fixed_base=True
)
agent_config = DictConfig({"articulated_agent_urdf": robot_path})
self.spot: SpotRobot = SpotRobot(agent_config, self.sim, fixed_base=True)
self.spot.reconfigure()
self.spot.update()
self.spot_action: SpotAgent.ExtractedBaseVelNonCylinderAction = (
Expand Down Expand Up @@ -323,7 +320,7 @@ def base_pos(self):

def place_on_navmesh(self):
if self.sim.pathfinder.is_loaded:
self.largest_island_ix = SpotAgent.get_largest_island_index(
self.largest_island_ix = get_largest_island_index(
pathfinder=self.sim.pathfinder,
sim=self.sim,
allow_outdoor=False,
Expand Down

0 comments on commit 0c0f847

Please sign in to comment.