Python wrapper module to interact with SensoGloves.
It handles for you the socket connection and the raw payload parsing, only leaving to you the fun parts of the job !
$ pip install sensoglove
Import the SensoGlove class in your python code
from sensoglove import SensoGloveThen, instantiate a new SensoGlove object and connect
glove = SensoGlove('127.0.0.1', 53451)
glove.connect()Now, you just have to create a loop to continuously fetch data from gloves and the data is yours !
while 1:
gloves.fetch_data()
print(gloves.hand.fingers.index.pinch)
print(gloves.hand.fingers.middle.pinch)
print(gloves.hand.fingers.third.pinch)
print(gloves.hand.fingers.little.pinch)host{String} - Glove's listener hostport{Integer} - Glove's listener port
-
host{String} - Host passed in -
port{Integer} - Port passed in -
src{String} - Glove's source mac address -
name{String} - Glove's name -
battery{Integer} - Glove's battery level -
temperature{Integer} - Glove's temperature -
hand{Hand Object} - Hand Object containing hand's informations
connect()- Connect the script to the glovefetch_data()- Fetch data to be parsed by the module. (Has to be put in a loop, so the fetching is continuous)send_vibration(fingers, [duration], [strength])fingers{List of String} - List of fingers you want to vibrateduration{Integer} - Duration of the vibration <0-65536>strength{Integer} - Strength of the vibration <0 - 10>
type{String} - Hand type (lh/rhfor left-hand/right-hand)palm{Palm Object} - Palm Object containing palm's informationswrist{Wrist Object} - Wrist Object containing wrist's informationsfingers{Fingers Object} - Fingers Object containing fingers' informations
rotation{Rotation Object} - Rotation of the Palmspeed{Speed Object} - Speed of the Palmacceleration{Speed Object} - Acceleration of the Palmdata{Dictionary} - Raw Palm data (shouldn't be needed)
x{Integer} - Speed/Acceleration on x axisy{Integer} - Speed/Acceleration on y axisz{Integer} - Speed/Acceleration on z axis
rotation{Rotation Object} - Rotation of the Wristdata{Dictionary} - Raw Wrist data (shouldn't be needed)
thumb{Thumb Object} - Thumb Object containing Thumb informationsmiddle{Rotation Object} - Rotation of the middle fingerthird{Rotation Object} - Rotation of the third fingerlittle{Rotation Object} - Rotation of the little fingerdata{Dictionary} - Raw Fingers data (shouldn't be needed)
Roll property is not set in Rotation Object that represent finger rotation, as usually human cannot rotate finger in that axis.
rotation{Rotation Object} - Rotation of the thumbbend{Integer} - Bending of the distal phalanx of the thumb
pitch{Integer} - Pitch Rotationroll{Integer} - Roll Rotation (not set for finger representation)yaw{Integer} - Yaw Rotation
See something that could be improved ? Open an issue or contribute !
- Fork it
- Create your feature branch
- Commit your changes and push them to your branch
- Create a new Pull Request
MIT