intuitive-robots / irl_polymetis

fork of monometis for real robot controll at IRL
MIT License
0 stars 2 forks source link

Polymetis for Newer PyTorch

This is a "fork" of Monometis. It is further developed by the Intuitive-Learning-Robots Lab to enhance their Robot handling.

Install & Compile

On NUC

1) Create a cpu environment with dependencies.

2) Build libfranka to communicate with the robot.

3) Build & install polymetis

# clone & create env
git clone git@github.com:intuitive-robots/irl_polymetis.git
cd monometis/
mamba env create -f polymetis/environment_cpu.yml
conda activate robo

# compile stuff
./scripts/build_libfranka.sh
mkdir -p ./polymetis/build
cd ./polymetis/build
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_FRANKA=ON
make -j
cd ../..

# inside the project root
pip install -e ./polymetis

On Workstation

1) Create a gpu environment with dependencies. It assumes that cuda11.8 is installed on the machine. Modify polymetis/environment.yml if a different version is desired. The relevant dependencies for pytorch are pytorch=2.0.1=py3.9_cuda11.8_cudnn8.7.0_0 and pytorch-cuda=11.8.

2) Build & install polymetis

# clone & create *gpu* env
git clone git@github.com:intuitive-robots/irl_polymetis.git
cd monometis/
mamba env create -f polymetis/environment.yml
conda activate robo

# compile stuff, no need to build libfranka on this machine
mkdir -p ./polymetis/build
cd ./polymetis/build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j
cd ../..

# inside the project root
pip install -e ./polymetis

for irl users, try this cmake + downgrade mkl

conda install mkl==2024.0.0
CUDACXX=/usr/local/cuda-12.4/bin/nvcc /usr/bin/cmake .. -DCMAKE_BUILD_TYPE=Release

Launch Polymetis (IRL)

To launch the robot or gripper server:

# start robot server
./scripts/start_robot.sh 101

# start gripper server
./scripts/start_gripper.sh 201

You need to specify the robots id. It is the same as the last part if the robots ip address (10.10.10.101).

Additional arguments for the commands can be seen in the table below.

Argument Description
-h, --help Display a help message.
-i, --pc-ip [IP] Change the ip address, where the server is running. Default is localhost.
-p, --port [PORT] Change the port of the server. Default is 50051.
-c, --conda [CONDA_ENV] Change the conda environment, where polymetis is installed. Default is poly.
-r, --readonly Starts the server in readonly mode. For usage with the robots white mode. Only for the robot server.

Polymetis: A real-time PyTorch controller manager

Write PyTorch controllers for robots, test them in simulation, and seamlessly transfer to real-time hardware.

Polymetis powers robotics research at Facebook AI Research. If you want to write your robot policies in PyTorch for simulation and immediately transfer them to high-frequency (1kHz) policies on real-time hardware (e.g. Franka Panda), read on!

Features

Get started

To get started, you only need one line:

conda install -c pytorch -c fair-robotics -c aihabitat -c conda-forge polymetis

You can immediately start running the example scripts in both simulation and hardware. See installation and usage documentation for details.

Documentation

All documentation on the website. Includes:

Benchmarking

To run benchmarking, first configure the script to point to your hardware instance, then run

asv run --python=python --set-commit-hash $(git rev-parse HEAD)

To update the dashboard, run:

asv publish

Commit the result under .asv/results and docs/; it will show up under the benchmarking page in the documentation.

Citing

If you use Polymetis in your research, please use the following BibTeX entry.

@misc{Polymetis2021,
  author =       {Lin, Yixin and Wang, Austin S. and Sutanto, Giovanni and Rai, Akshara and Meier, Franziska},
  title =        {Polymetis},
  howpublished = {\url{https://facebookresearch.github.io/fairo/polymetis/}},
  year =         {2021}
}

Note: Giovanni Sutanto contributed to the repository during his research internship at Facebook Artificial Intelligence Research (FAIR) in Fall 2019.

Contributing

See the CONTRIBUTING file for how to help out. Make an issue for bugs and feature requests, or contribute a new robot controller by making a pull request!

License

Polymetis is MIT licensed, as found in the LICENSE file.