Skip to main content

A small library to use uhand2 in python

Project description

pyuhand

About pyuhand

Pyhand is a python library to control uhand2 produced by Shenzhen company HiWonder.

I wrote it to allow simple control of the hand using python applications.

I am in now way affilliated with the company and this is purely a hobby project of mine.

The library provides an abstraction of the hand in which each axis can be commanded the range [0, 100].

Installation

From Git Repository

To install, clone the repository and run

git clone https://github.com/peteh/pyuhand.git
cd pyuhand
python setup.py install

Moving Fingers and Wrist

First create an instant of your uhand by giving it the correct serial connection address.

import pyuhand
uhand = pyuhand.UHand("/dev/ttyUSB0") # on Windows you must use COMx as address

To set a finger to a specific position, just command a value of 0 (closed) to 100 (open) to it. To command the hand to move, you need to call execute after you set the axes you want to move to your target positions.

# Axis
#  1: thumb
#  2: index finger
#  3: middle finger
#  4: ring finger
#  5: pinky
#  6: wrist

uhand.setTargetPercent(1, 100) # open thumb
uhand.setTargetPercent(2, 0) # close index finger
# all other fingers will stay in their original position

uhand.execute(200) # reach the goal position for all fingers in 200ms

Complex Motions

Uhand2 comes with a Windows application that can create complex motions and save them to xml files. The pyuhand library provides you with the ability to replay these recorded motions as well. Some samples can be found in the motions folder.

import pyuhand
uhand = pyuhand.UHand("/dev/ttyUSB0")

# read the motion from the file into the Motion class
motionFile = "motions/01 1 Finger.xml"):
motion = pyuhand.Motion.fromFile(motionFile)

# execute the motion on the hand, the method will block 
# until the motion is finished
uhand.executeMotion(motion)

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

pyuhand-0.0.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

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

pyuhand-0.0.1-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file pyuhand-0.0.1.tar.gz.

File metadata

  • Download URL: pyuhand-0.0.1.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for pyuhand-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f47fab7fb43a6e49a7122a5a43fe4efe86e8d2d61c18e2563ca63bf51ca0cc0b
MD5 fc01346e4739d911cba7b423efccebd3
BLAKE2b-256 b4ef4aa5fd466c283384532240431f89af22b3dbfd50a996c504f4a08739517f

See more details on using hashes here.

File details

Details for the file pyuhand-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyuhand-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for pyuhand-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e4098c077832741be4717849add7d1fd39d16ae5496558bdf972d43ede19584
MD5 f437be4047e32582cd023dde326b0eda
BLAKE2b-256 73f2efaea4c88d8983c5f1c96acd7e7c16e581d1abc7301f6c5bfd045f2bad24

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