Skip to main content

Library and CLI tool to convert Denavit-Hartenberg parameters to an X3D model

Project description

dh2vrml

dh2vrml is a utility for converting Denavit–Hartenberg parameters into X3D models, with a particular focus on creating outputs suitable for use as a MATLAB Simulink VR Sink.

Installation

pip install dh2vrml

Usage

dh2vrml -f <file_name>

Parameters

  • type: Joint type, either revolute or prismatic
    • This refers to the joint at index i - 1, (i.e. the first joint is the base joint)
  • d, theta, r, alpha: DH parameters as specified on Wikipedia
    • Angles are specified in radians, use theta_deg or alpha_deg to specify values in degrees
  • color: Color of the joint and link at index i, in RGB format
    • Values are floats ranging from 0 to 1
    • The end effector is always colored (0, 1, 1), (cyan)
  • scale: The relative size of joints and links
    • Links are scaled cross sectionally (position is not affected)
    • Joints are scaled volumetrically
    • The first value scales both the base joint and the joint after it
    • If no value is provided, the last provided value is used
      • Scale of the model can be set globally by only providing scale for the first set of parameters
  • offset: Location to render joint relative to coordinate system (X, Y, Z)
    • This value is NOT affected by scale
    • Defaults to (0, 0, 0)
    • Revolute joints can only have a Z offset

Supported file types

YAML

- type: revolute
  d: 1.5
  theta: 0
  r: 3
  alpha: 0
  color: [1, 0, 0]

- type: revolute
  d: 2
  theta: 0
  r: 4
  alpha: 3.14159265359
  color: [0, 0, 1]

- type: prismatic
  d: 3
  theta: 0
  r: 0
  alpha: 0
  color: [1, 0, 1]

CSV

d ,theta ,r ,alpha        ,type     , color
2 ,0     ,0 ,1.5707963268 ,revolute , 1 0 0
0 ,0     ,2 ,0            ,revolute , 0 1 0

Python

For the sake of making calculations involving pi easier, Python files are supported.

Beware: dh2vrml will blindly import and run whatever code is provided, always inspect the contents of the file before importing

from math import pi

params = [
    {
        "type": "revolute",
        "d": 2,
        "theta": pi/2,
        "r": 0,
        "alpha": pi/2
    },
    {
        "type": "revolute",
        "d": 2,
        "theta": pi/2,
        "r": 0,
        "alpha": -pi/2
    },
    {
        "type": "revolute",
        "d": 2,
        "theta": pi/2,
        "r": 2,
        "alpha": 0
    },
]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dh2vrml-0.1.12.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dh2vrml-0.1.12-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file dh2vrml-0.1.12.tar.gz.

File metadata

  • Download URL: dh2vrml-0.1.12.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.5 Windows/10

File hashes

Hashes for dh2vrml-0.1.12.tar.gz
Algorithm Hash digest
SHA256 2ac31d149293b3064197adec6b620fc4d83582746616fc40aa2292a6a52d2b3f
MD5 2803cde880731113ae6b3544e93cdce0
BLAKE2b-256 b9e9cd611369a6a1ed09eaddda8d584a377204826d5bfed71d7ef21f0cc330bc

See more details on using hashes here.

File details

Details for the file dh2vrml-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: dh2vrml-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.5 Windows/10

File hashes

Hashes for dh2vrml-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 5d2c4fd154f9366c3b42a0697c571ea583157cdc29a8791eea86cedd3002789b
MD5 ce16986784198d304eaad4063eb0e5c5
BLAKE2b-256 baab96dbdbb00f322ca79e0543c0b88b1d4046db0dd2d8a21a5dbfcd5d957472

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page