Giter Club home page Giter Club logo

pyuhand's Introduction

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)

pyuhand's People

Contributors

peteh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.