Habitat-Lab
repository·main·Indexed 25 days ago
https://github.com/facebookresearch/habitat-labA modular high-level library for end-to-end development in embodied AI, focused on training agents in indoor environments and human-robot interaction tasks. It includes various Human-in-the-Loop (HITL) applications such as basic_viewer, sim_viewer, and VR-enabled tools like Pick_throw_vr and XR reader for Quest headsets. The library also features Variable Experience Rollout (VER) to mitigate the straggler effect during experience collection.
What's inside habitat-lab
- Habitat Lab is a modular high-level library designed for training embodied AI agents. It provides a unified interface to work across various tasks, environments, and simulators.
Use ROS-X-Habitat to bridge Habitat with ROS
mainROS-X-Habitat is a framework that bridges Habitat Lab and Habitat Sim with other robotics resources via ROS. It allows leveraging Habitat Sim v2's physics-based simulation and accessing simulation assets from ROS.
Note: This framework is maintained by the Lab for Computational Intelligence at UBC and is not officially supported by the Habitat Lab team. Refer to the ROS-X-Habitat repository for documentation.
Understand the HITL Framework Architecture
mainThe Human-in-the-Loop (HITL) framework is composed of three main parts: the
habitat-hitlPython library, desktop application examples, and a Unity-based VR client.The library architecture is split into three primary functional components:
LabDriver: A Habitat environment wrapper. It creates ahabitat.Envinstance and handles simulation updates viasim_update. It receives agui_inputobject (encapsulating keyboard/mouse) and anAppState(containing application-specific logic like controls and help text). It returns apost_sim_update_dictcontaining rendering info (keyframes, camera transforms) and optional debug images.GuiApplication: Manages the OS window (currently via GLFW), handles OS-level input, and updates the display by invoking the renderer.ReplayGuiAppRenderer: An application-agnostic renderer. It consumes thepost_sim_update_dictfromLabDriverto render the scene from the requested camera pose, supporting 3D model rendering, 3D debug lines, 2D debug images, and 2D on-screen help text.
Use Batch Rendering to save GPU memory
mainBatch rendering is an experimental system in Habitat 2.0 designed to centralize rendering. Instead of each simulator instance having its own renderer and graphics context, a single renderer on the main training process aggregates simulation states and renders them simultaneously. This reduces GPU memory usage, decreases episode loading time, and improves rendering efficiency by pre-loading assets once.Understand the Habitat Stack
mainHabitat is an embodied AI research platform composed of two primary components:
- Habitat-Sim: A high-performance 3D simulator that handles agents, sensors, and 3D datasets (like MatterPort3D and Gibson).
- Habitat Lab: A modular library for end-to-end development, including defining tasks (navigation, instruction following, etc.), configuring agents, training (RL or imitation learning), and benchmarking performance.
To use Habitat, you must install both
habitat-simandhabitat-lab.Understand Articulated Agent Design in Habitat
mainHabitat represents agents (robots or humanoids) as articulated objects. These objects consist of multiple rigid parts (links) connected by joints that allow for rotational or translational motion.
Implementation locations:
- Robots: Found in the
robotsfolder. - Humanoids: Found in the
humanoidsfolder.
Agents inherit from articulated agent modules to implement their specific morphologies.
- Robots: Found in the
Understand the Habitat-Lab Configuration System transition to Hydra
mainHabitat-Lab and Habitat-Baselines have migrated their configuration system from YACS to Hydra. For detailed information regarding the changes, new functionality, and practical examples of how to work with configurations, refer to the core configuration documentation in the mainhabitat-labrepository.Understand the Habitat-Lab Configuration System
mainHabitat-Lab uses Hydra for its configuration system, replacing the previous YACS-based system. The final configuration (Output Config) is dynamically composed at runtime from multiple Input Configs specified in a
defaultslist and overridden via the primary YAML file or command-line arguments.Key components include:
- Structured Configs: Used as validation schemas to ensure required fields are present and match the correct types. These are registered in the
ConfigStore. - Config Groups: Grouped configurations located in the Config Search Path (e.g.,
habitat/task). - Package: Defines the path/node where a configuration is placed in the final Output Config (e.g., task configs in
habitat/taskdefault to thehabitat.taskpackage). - Config Search Path: Habitat-Lab extends the search path using the
HabitatConfigPluginto ensure allhabitat/configpaths are visible to Hydra.
- Structured Configs: Used as validation schemas to ensure required fields are present and match the correct types. These are registered in the
Understand Robot Design and Component Hierarchy
mainHabitat supports three primary robot types: Fetch (Fetch Robotics), Stretch (Hello Robot), and Spot (Boston Dynamics).
Component Hierarchy
fetch_robot.pyandstretch_robot.pyandspot_robot.pyare built uponmobile_manipulator.py.franka_robot.pyis built uponstatic_manipulator.py.
Initialization and Parameters
- Parameters: Robot-specific parameters (camera transformations, end-effector positions, control gains, etc.) are defined within their respective robot classes (e.g.,
stretch_robot.py). - Initialization Flow: Robots are imported by
habitat/tasks/rearrange/articulated_agent_manager.py, which is then imported and initialized byhabitat/tasks/rearrange/rearrange_sim.py.
Run the TopdownMap Visualization tutorial script
mainYou can run the TopdownMap visualization examples directly as a Python script or use the provided Jupyter notebook.
$ python path/to/habitat-lab/examples/tutorials/nb_python/Habitat_Lab_TopdownMap_Visualization.pyInstall HITL applications
mainFor instructions on installing and using HITL (Human-in-the-Loop) applications, refer to the main HITL documentation athabitat-hitl/README.md.Download test assets for debugging
mainTo verify if a problem is related to specific scenes, download the standard test assets using the following command from the root of your
habitat-laborhabitat-simrepository:python -m habitat_sim.utils.datasets_download --uids habitat_test_scenes --data-path data/