Skip to content

facebookresearch/home-robot

Repository files navigation

GitHub license Python 3.9 CircleCI pre-commit Code style: black Imports: isort

Your open-source robotic mobile manipulation stack!

HomeRobot lets you get started running a range of robotics tasks on a low-cost mobile manipulator, starting with Open Vocabulary Mobile Manipulation, or OVMM. OVMM is a challenging task which means that, in an unknown environment, a robot must:

  • Explore its environment
  • Find an object
  • Find a receptacle -- a location on which it must place this object
  • Put the object down on the receptacle.

Check out the CVPR 2024 HomeRobot Open-Vocabulary Mobile Manipulation Challenge!

When you're ready, follow these instructions to participate.

Important note for new OVMM challenge participants: If you are participating in the challenge and starting now, please use the current home-robot-ovmm-challenge-2024 tag. You can start out by cloning home-robot via:

git clone https://github.com/facebookresearch/home-robot --branch home-robot-ovmm-challenge-2024

Core Concepts

This package assumes you have a low-cost mobile robot with limited compute -- initially a Hello Robot Stretch -- and a "workstation" with more GPU compute. Both are assumed to be running on the same network.

This is the recommended workflow for hardware robots:

  • Turn on your robot; for the Stretch, run stretch_robot_home.py to get it ready to use.
  • From your workstation, SSH into the robot and start a ROS launch file which brings up necessary low-level control and hardware drivers.
  • If desired, run rviz on the workstation to see what the robot is seeing.
  • Start running your AI code on the workstation - For example, you can run python projects/real_world_ovmm/eval_episode.py to run the OVMM task.

We provide a couple connections for useful perception libraries like Detic, Grounded-SAM and Contact Graspnet, which you can then use as a part of your methods.

Installation

Preliminary

HomeRobot requires Python 3.9. Installation on a workstation requires conda and mamba. Installation on a robot assumes Ubuntu 20.04 and ROS Noetic.

To set up the hardware stack on a Hello Robot Stretch, see the ROS installation instructions in home_robot_hw.

You may need a calibrated URDF for our inverse kinematics code to work well; see calibration notes.

Spot installation instructions are experimental but are also available.

Network Setup

Follow the network setup guide to set up your robot to use the network, and make sure that it can communicate between workstation and robot via ROS. On the robot side, start up the controllers with:

roslaunch home_robot_hw startup_stretch_hector_slam.launch

Workstation Instructions

To set up your workstation, follow these instructions. HomeRobot requires Python 3.9. These instructions assume that your system supports CUDA 11.7 or better for pytorch; earlier versions should be fine, but may require some changes to the conda environment.

If on Ubuntu, ensure some basic packages are installed:

sudo apt update
sudo apt install build-essential zip unzip

Then clone home-robot locally:

git clone https://github.com/facebookresearch/home-robot.git
cd ./home-robot

1. Create Your Environment

If necessary, install mamba in your base conda environment. Optionally: install ROS noetic on your workstation.

# If using ROS - make sure you don't have PYTHONPATH set
unset PYTHONPATH

# Otherwise, use the version in src/home_robot
mamba env create -n home-robot -f src/home_robot/environment.yml

# Activate the environment
conda activate home-robot

# Optionally, update this environment to install ROS
mamba env update -f src/home_robot_hw/environment.yml

These should install pytorch; if you run into trouble, you may need to edit the installation to make sure you have the right CUDA version. See the pytorch install notes for more.

Optionally, setup a catkin workspace to use improved ROS visualizations.

2. Run Install Script

Make sure you have the correct environment variables set: CUDA_HOME should point to your cuda install, matching the one used by your python environment. We recommend 11.7, and it's what will be automatically installed above as a part of the conda environment.

To build some third-party dependencies, you also need the full cuda toolkit with its compiler, nvcc. You can download it from nvidia's downloads page. Download the runfile, and make sure to check the box NOT to install your drivers or update your system cuda version. It will be installed at a separate location.

Then make sure the environment variables are set to something reasonable, for example:

export HOME_ROBOT_ROOT=$USER/home-robot
export CUDA_HOME=/usr/local/cuda-11.7

Finally, you can run the install script to download submodules, model checkpoints, and build Detic for open-vocabulary object detection:

conda activate home-robot
cd $HOME_ROBOT_ROOT
./install_deps.sh

If you run into issues, check out the step-by-step instructions.

As of 2023-10-31, you may see some issues with the version of ros-numpy installed via pip; try installing it directly from source.

3. Simulation Setup

To set up the simulation stack with Habitat, train DDPPO skills and run evaluations: see the installation instructions in home_robot_sim. As with other components, the simulation assumes that you have Python 3.9, conda, mamba, and CUDA 11.7 or greater, although other CUDA versions may work.

For more details on the OVMM challenge, see the Habitat OVMM readme. You can start by running the install script to download all the necessary data:

$HOME_ROBOT_ROOT/projects/habitat_ovmm/install.sh

4. Run Open Vocabulary Mobile Manipulation on Stretch

You should then be able to run the Stretch OVMM example.

Run a grasping server; either Contact Graspnet or our simple grasp server. We recommend starting with our grasp server:

# For simple grasping server
cd $HOME_ROBOT_ROOT
conda activate home-robot
python src/home_robot_hw/home_robot_hw/nodes/simple_grasp_server.py

# For contact graspnet
cd $HOME_ROBOT_ROOT/src/third_party/contact_graspnet
conda activate contact_graspnet_env
python contact_graspnet/graspnet_ros_server.py  --local_regions --filter_grasps

Then you can run the OVMM example script:

cd $HOME_ROBOT_ROOT
python projects/real_world_ovmm/eval_episode.py

# Alternate test - heuristic agent only
python projects/real_world_ovmm/tests/test_heuristic_policies.py

5. Troubleshooting

See our troubleshooting doc for some common errors.

Code Contribution

We welcome contributions to HomeRobot.

There are two main classes in HomeRobot that you need to be concerned with:

Generally, new methods will be implemented as Agents.

Developing on Hardware

See the robot hardware development guide for some advice that may make developing code on the Stretch easier.

Organization

HomeRobot is broken up into multiple different packages:

Resource Description
home_robot Core package containing agents and interfaces
home_robot_sim OVMM simulation environment based on AI Habitat
home_robot_hw ROS package containing hardware interfaces for the Hello Robot Stretch
home_robot_spot Minimal package for using the Boston Dynamics Spot

The home_robot package contains embodiment-agnostic agent code, such as our ObjectNav agent (finds objects in scenes) and our hierarchical OVMM agent. These agents can be extended or modified to implement your own solution.

Importantly, agents use a fixed set of interfaces which are overridden to provide access to

The home_robot_sim package contains code for interface

Style

We use linters for enforcing good code style. The lint test will not pass if your code does not conform.

Install the git pre-commit hooks by running

python -m pip install pre-commit
cd $HOME_ROBOT_ROOT
pre-commit install

To format manually, run: pre-commit run --show-diff-on-failure --all-files

License

Home Robot is MIT licensed. See the LICENSE for details.