Unified eye-in-hand / eye-to-hand calibration from RGB-D images using robot mesh as calibration target.
Project description
Roboreg
Eye-to-hand calibration from RGB-D images using robot mesh as calibration target.
| Unregistered | Registered |
|---|---|
Table of Contents
Installation
Three install options are provided:
- Pip (Requires CUDA Toolkit Installation)
- Conda (Installs CUDA Toolkit)
- Docker (Comes with CUDA Toolkit)
Pip (Requires CUDA Toolkit Installation)
[!NOTE] During runtime, CUDA Toolkit is required for the differentiable rendering. If you are planning to do differentiable rendering, see CUDA Toolkit Install Instructions. Alternatively, install using
conda, see Conda (Installs CUDA Toolkit).
To pip intall roboreg, simply run
pip3 install roboreg
Conda (Installs CUDA Toolkit)
To install roboreg within an Anaconda environment (ideally Miniconda, or even better, Mamba), do the following:
-
Create an environment
conda create -n rr-0.4.6 python=3.10
-
Clone this repository and install dependencies
git clone git@github.com:lbr-stack/roboreg.git mamba env update -f roboreg/env.yaml # if Anaconda or Miniconda was used, do 'conda env update -f env.yaml'
-
Install
roboregmamba activate rr-0.4.6 # can also use 'conda activate rr-0.4.6' in either case pip3 install roboreg/
Docker (Comes with CUDA Toolkit)
A sample Docker container is provided for testing purposes. First:
- Install Docker, see Docker Install Instructions
- Install NVIDIA Container Toolkit, see NVIDIA Container Toolkit Install Instructions
Next:
-
Clone this repository
git clone git@github.com:lbr-stack/roboreg.git
-
Build the Docker image (currently only runtime support, i.e. no rendering via compiled kernels)
cd roboreg docker build \ -t roboreg:latest \ -f .docker/Dockerfile \ --build-arg PYTORCH_VERSION=2.10.0 \ --build-arg CUDA_VERSION=13.0 \ .
For CUDA 12.4, use:
docker build \ -t roboreg:latest \ -f .docker/Dockerfile \ --build-arg PYTORCH_VERSION=2.6.0 \ --build-arg CUDA_VERSION=12.4 \ .
-
Run container (on Linux host with NVIDIA Container Toolkit)
docker run -it \ --gpus all \ --network host \ --ipc host \ --volume /tmp/.X11-unix:/tmp/.X11-unix \ --volume /dev/shm:/dev/shm \ --volume /dev:/dev --privileged \ --env DISPLAY \ --env QT_X11_NO_MITSHM=1 \ roboreg:latest
Command Line Interface
[!TIP] Examples use sample data under test/assets/lbr_med7_r800. Data is stored via Git Large File Storage (LFS). Data is cloned automatically when
git-lfsis installed. To clone in retrospect:sudo apt install git-lfs git lfs fetch --all git lfs checkout
Segment
This is a required step to generate robot masks.
rr-sam2 \
--path test/assets/lbr_med7_r800/samples \
--pattern "left_image_*.png" \
--n-positive-samples 5 \
--n-negative-samples 5 \
--device cuda
Hydra Robust ICP
The Hydra robust ICP implements a point-to-plane ICP registration on a Lie algebra. It does not use rendering and can also be used on CPU.
rr-hydra \
--camera-info-file test/assets/lbr_med7_r800/samples/left_camera_info.yaml \
--path test/assets/lbr_med7_r800/samples \
--mask-pattern mask_sam2_left_image_*.png \
--depth-pattern depth_*.npy \
--joint-states-pattern joint_states_*.npy \
--urdf-path test/assets/lbr_med7_r800/description/lbr_med7_r800.urdf \
--root-link-name lbr_link_0 \
--end-link-name lbr_link_7 \
--number-of-points 5000 \
--output-file HT_hydra_robust.npy
Camera Swarm
[!WARNING] On first run,
nvdiffrastcompiles PyTorch extensions. This might use too many resources on some systems (< 16 GB RAM). You can create an environment variableexport MAX_JOBS=1before the first run to limit concurrent compilation. Also refer to this Issue.
The camera swarm optimization can serve for finding an initial guess to Monocular Differentiable Rendering or Stereo Differentiable Rendering.
rr-cam-swarm \
--collision-meshes \
--n-cameras 1000 \
--min-distance 0.5 \
--max-distance 3.0 \
--angle-range 3.141 \
--w 0.7 \
--c1 1.5 \
--c2 1.5 \
--max-iterations 100 \
--display-progress \
--urdf-path test/assets/lbr_med7_r800/description/lbr_med7_r800.urdf \
--root-link-name lbr_link_0 \
--end-link-name lbr_link_7 \
--target-reduction 0.8 \
--scale 0.1 \
--n-samples 1 \
--camera-info-file test/assets/lbr_med7_r800/samples/left_camera_info.yaml \
--path test/assets/lbr_med7_r800/samples \
--image-pattern left_image_*.png \
--joint-states-pattern joint_states_*.npy \
--mask-pattern mask_sam2_left_image_*.png \
--output-file HT_cam_swarm.npy
Monocular Differentiable Rendering
[!WARNING] On first run,
nvdiffrastcompiles PyTorch extensions. This might use too many resources on some systems (< 16 GB RAM). You can create an environment variableexport MAX_JOBS=1before the first run to limit concurrent compilation. Also refer to this Issue.
This monocular differentiable rendering refinement requires a good initial estimate, as e.g. obtained from Hydra Robust ICP or Camera Swarm
rr-mono-dr \
--optimizer SGD \
--lr 0.01 \
--max-iterations 100 \
--display-progress \
--urdf-path test/assets/lbr_med7_r800/description/lbr_med7_r800.urdf \
--root-link-name lbr_link_0 \
--end-link-name lbr_link_7 \
--camera-info-file test/assets/lbr_med7_r800/samples/left_camera_info.yaml \
--extrinsics-file test/assets/lbr_med7_r800/samples/HT_hydra_robust.npy \
--path test/assets/lbr_med7_r800/samples \
--image-pattern left_image_*.png \
--joint-states-pattern joint_states_*.npy \
--mask-pattern mask_sam2_left_image_*.png \
--output-file HT_dr.npy
Stereo Differentiable Rendering
[!WARNING] On first run,
nvdiffrastcompiles PyTorch extensions. This might use too many resources on some systems (< 16 GB RAM). You can create an environment variableexport MAX_JOBS=1before the first run to limit concurrent compilation. Also refer to this Issue.
This stereo differentiable rendering refinement requires a good initial estimate, as e.g. obtained from Hydra Robust ICP or Camera Swarm
rr-stereo-dr \
--optimizer SGD \
--lr 0.01 \
--max-iterations 100 \
--display-progress \
--urdf-path test/assets/lbr_med7_r800/description/lbr_med7_r800.urdf \
--root-link-name lbr_link_0 \
--end-link-name lbr_link_7 \
--left-camera-info-file test/assets/lbr_med7_r800/samples/left_camera_info.yaml \
--right-camera-info-file test/assets/lbr_med7_r800/samples/right_camera_info.yaml \
--left-extrinsics-file test/assets/lbr_med7_r800/samples/HT_hydra_robust.npy \
--right-extrinsics-file test/assets/lbr_med7_r800/samples/HT_right_to_left.npy \
--path test/assets/lbr_med7_r800/samples \
--left-image-pattern left_image_*.png \
--right-image-pattern right_image_*.png \
--joint-states-pattern joint_states_*.npy \
--left-mask-pattern mask_sam2_left_image_*.png \
--right-mask-pattern mask_sam2_right_image_*.png \
--left-output-file HT_left_dr.npy \
--right-output-file HT_right_dr.npy
Render Results
[!WARNING] On first run,
nvdiffrastcompiles PyTorch extensions. This might use too many resources on some systems (< 16 GB RAM). You can create an environment variableexport MAX_JOBS=1before the first run to limit concurrent compilation. Also refer to this Issue.
Generate renders using the obtained extrinsics:
rr-render \
--batch-size 1 \
--num-workers 0 \
--urdf-path test/assets/lbr_med7_r800/description/lbr_med7_r800.urdf \
--root-link-name lbr_link_0 \
--end-link-name lbr_link_7 \
--camera-info-file test/assets/lbr_med7_r800/samples/left_camera_info.yaml \
--extrinsics-file test/assets/lbr_med7_r800/samples/HT_left_dr.npy \
--images-path test/assets/lbr_med7_r800/samples \
--joint-states-path test/assets/lbr_med7_r800/samples \
--image-pattern left_image_*.png \
--joint-states-pattern joint_states_*.npy \
--output-path /tmp/renders/lbr_med7_r800
Testing
For testing on the xarm data, follow Docker (Comes with CUDA Toolkit). Inside the container, do
Hydra Robust ICP
To run Hydra robust ICP on provided xarm and realsense data, run
rr-hydra \
--camera-info-file test/assets/xarm_7/samples/camera_info.yaml \
--path test/assets/xarm_7/samples \
--mask-pattern mask_*.png \
--depth-pattern depth_*.npy \
--joint-states-pattern joint_state_*.npy \
--urdf-path test/assets/xarm_7/description/xarm_7.urdf \
--root-link-name link_base \
--end-link-name link7 \
--number-of-points 5000 \
--output-file HT_hydra_robust.npy
Render Results
Generate renders using the obtained extrinsics:
rr-render \
--batch-size 1 \
--num-workers 0 \
--urdf-path test/assets/xarm_7/description/xarm_7.urdf \
--root-link-name link_base \
--end-link-name link7 \
--camera-info-file test/assets/xarm_7/samples/camera_info.yaml \
--extrinsics-file test/assets/xarm_7/samples/HT_hydra_robust.npy \
--images-path test/assets/xarm_7/samples \
--joint-states-path test/assets/xarm_7/samples \
--image-pattern img_*.png \
--joint-states-pattern joint_state_*.npy \
--output-path /tmp/renders/xarm_7
Acknowledgements
Organizations and Grants
We would further like to acknowledge following supporters:
| Logo | Notes |
|---|---|
| This work was supported by core and project funding from the Wellcome/EPSRC [WT203148/Z/16/Z; NS/A000049/1; WT101957; NS/A000027/1]. | |
| This project has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreement No 101016985 (FAROS project). | |
| Built at RViMLab. | |
| Built at CAI4CAI. | |
| Built at King's College London. |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file roboreg-0.5.0.tar.gz.
File metadata
- Download URL: roboreg-0.5.0.tar.gz
- Upload date:
- Size: 199.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3efa62e7f7ac6b6c029c982cc46c931913e5c9be7db952c5f06394cb474bd4e
|
|
| MD5 |
ad9beb965ee1225c54c04a71e4135d94
|
|
| BLAKE2b-256 |
176b898ad830504ee53237ae501c2ecbf099c9e092c35a413b02cd6246a7c4e3
|
Provenance
The following attestation bundles were made for roboreg-0.5.0.tar.gz:
Publisher:
publish.yaml on lbr-stack/roboreg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
roboreg-0.5.0.tar.gz -
Subject digest:
e3efa62e7f7ac6b6c029c982cc46c931913e5c9be7db952c5f06394cb474bd4e - Sigstore transparency entry: 910495792
- Sigstore integration time:
-
Permalink:
lbr-stack/roboreg@552d3fbcd38107f52f3ab462af9a1d1dd32c7305 -
Branch / Tag:
refs/tags/0.5.0 - Owner: https://github.com/lbr-stack
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@552d3fbcd38107f52f3ab462af9a1d1dd32c7305 -
Trigger Event:
push
-
Statement type:
File details
Details for the file roboreg-0.5.0-py3-none-any.whl.
File metadata
- Download URL: roboreg-0.5.0-py3-none-any.whl
- Upload date:
- Size: 56.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b74741afbaa99a36f5f8076d70d20741037f70039aa119d2e8f45ff4e6a68ea
|
|
| MD5 |
17d262918462d1811dcfb89aba9897ae
|
|
| BLAKE2b-256 |
70475b862ae53b5e9c8dc6918b085874e624d75fb434fa8ab854790ad6b0ee1f
|
Provenance
The following attestation bundles were made for roboreg-0.5.0-py3-none-any.whl:
Publisher:
publish.yaml on lbr-stack/roboreg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
roboreg-0.5.0-py3-none-any.whl -
Subject digest:
3b74741afbaa99a36f5f8076d70d20741037f70039aa119d2e8f45ff4e6a68ea - Sigstore transparency entry: 910495793
- Sigstore integration time:
-
Permalink:
lbr-stack/roboreg@552d3fbcd38107f52f3ab462af9a1d1dd32c7305 -
Branch / Tag:
refs/tags/0.5.0 - Owner: https://github.com/lbr-stack
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@552d3fbcd38107f52f3ab462af9a1d1dd32c7305 -
Trigger Event:
push
-
Statement type: