Skip to content

Create Cylinder Mesh

SUMMARY

Create Cylinder Mesh generates a 3D cylinder mesh aligned along the Z-axis and centered at the origin, using Open3D.

This Skill is primarily used for pose estimation and 3D detection of cylindrical objects, such as rods, pipes, or cans. By providing an accurate cylindrical mesh, it allows perception algorithms to detect these objects and estimate their orientation in 3D scenes.

Use this Skill when you want to develop or test 3D detection and pose estimation pipelines involving cylindrical shapes.

The Skill

python
from telekinesis import vitreous
import numpy as np

cylinder_mesh = vitreous.create_cylinder_mesh(
    radius=0.01,
    height=0.02,
    radial_resolution=20,
    height_resolution=4,
    retain_base=False,
    vertex_tolerance=1e-6,
    transformation_matrix=np.eye(4),
    compute_vertex_normals=True,
)

API Reference

Performance Note

Current Data Limits: The system currently supports up to 1 million points per request (approximately 16MB of data). We're actively optimizing data transfer performance as part of our beta program, with improvements rolling out regularly to enhance processing speed.

Example

Visualisation

The Code

python
from telekinesis import vitreous
from datatypes import datatypes, io
import pathlib
import numpy as np

# Optional for logging
from loguru import logger

# Execute operation
cylinder_mesh = vitreous.create_cylinder_mesh(
  radius=0.01,
  height=0.02,
  radial_resolution=20,
  height_resolution=4,
  retain_base=False,
  vertex_tolerance=1e-6,
  transformation_matrix=np.eye(4, dtype=np.float32),
  compute_vertex_normals=True,
)
logger.success("Created cylinder mesh")

Running the Example

Runnable examples are available in the Telekinesis examples repository. Follow the README in that repository to set up the environment. Once set up, you can run this specific example with:

bash
cd telekinesis-examples
python examples/vitreous_examples.py --example create_cylinder_mesh

The Explanation of the Code

We start by importing the necessary modules, including vitreous for 3D operations and numpy to handle transformations. Logging with loguru is optional but useful for workflow feedback.

python
from telekinesis import vitreous
from datatypes import datatypes, io
import pathlib
import numpy as np

# Optional for logging
from loguru import logger

Next, we execute the create_cylinder_mesh Skill. This generates a 3D cylinder mesh with a specified radius, height, and resolution. Parameters like radial_resolution and height_resolution control the mesh detail, while retain_base and vertex_tolerance manage the mesh geometry precision.

python

# Execute operation
cylinder_mesh = vitreous.create_cylinder_mesh(
  radius=0.01,
  height=0.02,
  radial_resolution=20,
  height_resolution=4,
  retain_base=False,
  vertex_tolerance=1e-6,
  transformation_matrix=np.eye(4, dtype=np.float32),
  compute_vertex_normals=True,
)
logger.success("Created cylinder mesh")

The resulting cylinder mesh can be used in industrial robotics pipelines for 6D pose estimation or detection, representing cylindrical objects like pipes, rods, or containers. Creating a synthetic cylinder helps in testing perception, collision checking, or calibration workflows.

How to Tune the Parameters

The create_cylinder_mesh Skill has several parameters that control the cylinder's geometry and mesh quality:

radius (default: 0.01):

  • The radius of the cylinder
  • Units: Uses the same units as your point cloud (e.g., if point cloud is in meters, radius is in meters; if in millimeters, radius is in millimeters)
  • Increase to create a wider cylinder
  • Typical range: 0.001-1.0 in point cloud units

height (default: 0.02):

  • The height of the cylinder along its axis
  • Units: Uses the same units as your point cloud
  • Increase to create a taller cylinder
  • Typical range: 0.001-10.0 in point cloud units

radial_resolution (default: 20):

  • The number of vertices around the circumference (angular resolution)
  • Increase (32-64) for smoother circular cross-section but with more triangles
  • Decrease (8-16) for more faceted appearance but fewer triangles
  • Typical range: 8-64
  • Use 8-16 for low-poly, 20-32 for smooth, 32-64 for very smooth

height_resolution (default: 4):

  • The number of vertices along the height (vertical segments)
  • Increase (4-10) for more vertical subdivisions, useful for curved or deformed cylinders
  • Decrease (2-4) for fewer segments
  • Typical range: 2-20
  • Use 2-4 for simple cylinders, 4-10 for detailed shapes

retain_base (default: False):

  • Whether to include the circular base (bottom cap) of the cylinder
  • True: Cylinder has a closed bottom (solid cylinder)
  • False: Bottom is open (hollow/open cylinder)

vertex_tolerance (default: 1e-6):

  • The minimum distance between vertices to avoid duplicate vertices
  • Units: Uses the same units as your point cloud
  • Increase to allow vertices to be closer together
  • Decrease to merge vertices that are very close
  • Typical range: 1e-8 to 1e-4 in point cloud units
  • Use smaller values (1e-6 to 1e-8) for high precision, larger (1e-4 to 1e-3) for automatic cleanup

transformation_matrix (default: np.eye(4)):

  • The 4x4 transformation matrix to position and orient the cylinder
  • The cylinder's axis is along the Z-axis by default
  • Use this to translate, rotate, and scale the cylinder

compute_vertex_normals (default: True):

  • Whether to compute vertex normals for the mesh
  • True: Normals are calculated, useful for lighting and rendering
  • False: Normals are not computed, acceptable for non-rendering uses

Where to Use the Skill in a Pipeline

Cylinder mesh creation is commonly used in the following pipelines:

  • 6D pose estimation for cylindrical objects
  • Object detection and matching
  • Synthetic data generation for testing
  • Collision checking and simulation

A typical pipeline for pose estimation looks as follows:

python
# Example pipeline using cylinder mesh for pose estimation (parameters omitted).

from telekinesis import vitreous
import numpy as np

# 1. Create reference cylinder mesh matching your object
cylinder_mesh = vitreous.create_cylinder_mesh(
    radius=0.01,
    height=0.02,
    radial_resolution=20,
    height_resolution=4,
    retain_base=False,
    transformation_matrix=np.eye(4),
    compute_vertex_normals=True,
)

# 2. Load or capture point cloud from sensor
point_cloud = vitreous.load_point_cloud(...)

# 3. Preprocess point cloud
filtered_cloud = vitreous.filter_point_cloud_using_statistical_outlier_removal(...)
downsampled_cloud = vitreous.filter_point_cloud_using_voxel_downsampling(...)

# 4. Use cylinder mesh for pose estimation or matching
# (pose estimation code would go here)

Related skills to build such a pipeline:

  • create_plane_mesh: create planar reference meshes
  • create_sphere_mesh: create spherical reference meshes
  • create_torus_mesh: create torus reference meshes
  • filter_point_cloud_using_statistical_outlier_removal: clean input point clouds
  • filter_point_cloud_using_voxel_downsampling: reduce point cloud density

Alternative Skills

Skillvs. Create Cylinder Mesh
create_plane_meshUse plane mesh for planar surfaces. Use cylinder mesh for cylindrical objects.
create_sphere_meshUse sphere mesh for spherical objects. Use cylinder mesh for cylindrical objects.
create_torus_meshUse torus mesh for toroidal objects. Use cylinder mesh for cylindrical objects.

When Not to Use the Skill

Do not use create cylinder mesh when:

  • You need a different shape (use create_plane_mesh, create_sphere_mesh, or create_torus_mesh instead)
  • You have an existing mesh file (load it directly instead of creating a parametric mesh)
  • You need a complex or non-parametric shape (this Skill only creates simple parametric cylinders)
  • You need very high precision geometry (parametric meshes may have limitations compared to CAD models)