Skip to main content

GPU Accelerated Implementation of the Taxim Tactile Simulator

GPU accelerated implementation of the optical simulation of the Taxim Simulator. Both PyTorch and JAX backends are available. Note that this project is not the official implementation by the authors, which can be found here. Because of efficient use of vectorization and GPU acceleration, this implementation achieves significant speed-ups for image generation with and without shadows compared to the official implementation.

Here is a comparison of the render times for a single frame for the different implementations:

Implementation Without shadow With shadow
Original 67.08ms 120.99ms
Torch CPU 28.46ms 114.06ms
Torch GPU 3.29ms 8.24ms
JAX CPU 45.01ms 180.19ms
JAX GPU 0.72ms 1.69ms

The speed-up is around x21 for image generation without shadow and around x25 with shadow.

Installation

Taxim can be installed via

pip install taxim[OPTIONS]

where OPTIONS can be any subset of the following:

  • torch: Install the PyTorch backend.
  • jax: Install the JAX backend with CUDA 12 support.
  • jax-cpu: Install the JAX backend without GPU support.
  • examples: Install dependencies for running the examples.
  • all: Install all of the above.

Note that either torch, jax, or jax-cpu has to be chosen as a backend for Taxim to work.

Depending on the installed CUDA version, PyTorch, torch-scatter, and JAX might have to be installed manually. Follow the instructions on their respective websites to do so.

Usage

To use the tactile simulator, first create an instance of the Taxim class:

from taxim import Taxim

taxim = Taxim(device="cuda")

Optionally, you can pass the constructor a path to a calibration folder if you wish to use a different calibration.

Now you can use this instance to render a height map into a tactile image:

# Generate some arbitrary heightmap
height_map = torch.zeros((taxim.height, taxim.width), device=dev)
height_map[200:300, 200:500] = -10.0

# Render an image using this height map
img = taxim.render(height_map, with_shadow=True, press_depth=1.0)

The values of the height map correspond to the distance of the object to the highest (furthest from the camera) point of the gel in mm. Hence, a value of 0 means that the corresponding point is at the same height as the highest point of the gel. The smaller the values of the height map are, the closer are the corresponding points to the camera. For a point to be in contact with the gel, it has to have a value smaller or equal to zero.

Note that this definition of the height map differs from the original definition by the authors, who assume that higher values mean that points are closer, and use a different reference point. If you want to recover the original behavior of Taxim, just pass orig_hm_fmt=True when calling taxim.render:

# Render an image using this height map
img = taxim.render(height_map, with_shadow=True, press_depth=1.0, orig_hm_fmt=True)

For a usage example refer to example/taxim_visualize.py.

Using a different calibration

To use a different calibration, you must create a folder with the following files and pass its path as an argument to the Taxim constructor:

  1. dataPack.npz: contains the recorded data. Actually only the first frame is needed for generating the background, but we keep it like it is to be compatible to the original Taxim calibration files.
  2. gelmap.npy: contains the height map of the gel pad.
  3. params.json: contains parameters for the simulator. For an example, refer to taxim/calib/params.json
  4. polycalib.npz: contains the polynomial coefficients for the gel simulation.
  5. shadowTable.npz: contains the shadow table.

For further explanation on how to obtain these files, please refer to the original implementation.

Metadata

Release files for taxim 1.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for taxim 1.4.1
File Size Uploaded Provenance
taxim-1.4.1.tar.gz 27.4 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for taxim 1.4.1
File Interpreter ABI Platform
taxim-1.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 54.7 MB

Release files / taxim-1.4.1.tar.gz

Download URL taxim-1.4.1.tar.gz
Size 27.4 MB
Tags Source
SHA-256 checksum
How to use checksums
cbf0820d8430dc387d8e08cf8e48ba247095c0ac8a9974b30d5977d600499331
BLAKE2b-256 checksum
How to use checksums
db037d3fe711606117cb053074d43585abc6b647b10f52d760abda2f44112448
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2025.

Transparency log

Release files / taxim-1.4.1-py3-none-any.whl

Download URL taxim-1.4.1-py3-none-any.whl
Size 27.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
dba5b71468631781ed9e9339bcb3f7a6cd8e070402b3664320ec9f19b26a06f3
BLAKE2b-256 checksum
How to use checksums
f85e7096ceffbfed4c3d4727d3f3c20fa46af79504dd093dd1c0ed709cb72bd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2025.

Transparency log

Security for taxim 1.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for taxim-1.4.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page