FLEX: Framework for Learning Robot-Agnostic Force-based Skills Involving Sustained Contact Object Manipulation
This repository contains the codebase for FLEX, a framework for learning force-based reinforcement learning (RL) skills that are robot-agnostic and generalizable to various objects with similar joint configurations. Below, you will find instructions on how to install the dependencies and run FLEX. If you have any questions or wish to contribute or connect, please contact the authors.
This code is tested on Ubuntu 20.02 and Ubuntu 22.04, with RTX30 and RTX40 series GPU.
Clone the repository and its submodules (FLEX includes a submodule called contact_graspnet
for generating grasp proposals). Please ensure that you only clone the main branch; the website
branch is for the project website.
git clone --recurse-submodules https://github.com/tufts-ai-robotics-group/FLEX.git --single-branch
Clone our version of AO-GRASP repository into a separate directory. Do not clone their version of contact_graspnet
, as it is known to have compatibility issues with newer GPUs (RTX 30 series onwards).
git clone https://github.com/WenchangGaoT/ao-grasp.git
There are two environments to set up to run FLEX: the main FLEX environment and a separate environment for contact_graspnet
due to different CUDA versions.
- Install Conda: We recommend Miniconda. Follow the Miniconda installation instructions.
- Create the FLEX Environment:
conda env create --name flex --file=environment.yml
- Create the
contact_graspnet
Environment:contact_graspnet
relies on a different version of CUDA, so a separate environment is required.cd flex/grasps/aograsp/contact_graspnet/ conda env create --name cgn --file cgn_env_rtx30.yml
Note: The environment must be named
cgn
because a script automatically launches this environment when running the grasp module.
-
Install AO-GRASP: Navigate to the root directory of the cloned AO-GRASP package and run:
conda activate flex pip install -e .
You do not need to reinstall AO-GRASP's dependencies, as they are included in the
flex
environment's requirements. -
Install PointNet++ for AO-GRASP:
conda activate flex cd aograsp/models/Pointnet2_PyTorch/ pip install -e . cd pointnet2_ops_lib/ pip install -e .
-
Install FLEX: Navigate to the root directory of the cloned FLEX package and run:
conda activate flex cd flex/ pip install -e .
If you encounter rendering issues with Robosuite (the robot simulator used in this project), set the following environment variable before running the code:
export MUJOCO_GL="osmesa"
To make this change permanent, add the above line to your ~/.bashrc
file.
You can test the trained policies or train a new policy using the commands below:
-
Test the Trained Policies:
conda activate flex cd flex/ python scripts/parallel_test.py --render=true --run_id=$(run_id)
-
Train the Policy:
conda activate flex cd flex/ python scripts/parallel_train.py
For any questions regarding the paper or the code, please contact us at: