add option to calibrate individual fingers for the vr glove
This commit is contained in:
@@ -22,8 +22,13 @@ hand=objects[0]
|
||||
#clamp in range 400-600
|
||||
#minV = 400
|
||||
#maxV = 600
|
||||
minV = 250
|
||||
maxV = 400
|
||||
minVarray = [275,280,350,290]
|
||||
maxVarray = [450,550,500,400]
|
||||
|
||||
pinkId = 0
|
||||
middleId = 1
|
||||
indexId = 2
|
||||
thumbId = 3
|
||||
|
||||
p.setRealTimeSimulation(1)
|
||||
|
||||
@@ -33,7 +38,10 @@ def getSerialOrNone(portname):
|
||||
except:
|
||||
return None
|
||||
|
||||
def convertSensor(x):
|
||||
def convertSensor(x, fingerIndex):
|
||||
minV = minVarray[fingerIndex]
|
||||
maxV = maxVarray[fingerIndex]
|
||||
|
||||
v = minV
|
||||
try:
|
||||
v = float(x)
|
||||
@@ -70,10 +78,10 @@ if (ser is not None and ser.isOpen()):
|
||||
line = str(ser.readline())
|
||||
words = line.split(",")
|
||||
if (len(words)==6):
|
||||
pink = convertSensor(words[1])
|
||||
middle = convertSensor(words[2])
|
||||
index = convertSensor(words[3])
|
||||
thumb = convertSensor(words[4])
|
||||
pink = convertSensor(words[1],pinkId)
|
||||
middle = convertSensor(words[2],middleId)
|
||||
index = convertSensor(words[3],indexId)
|
||||
thumb = convertSensor(words[4],thumbId)
|
||||
|
||||
p.setJointMotorControl2(hand,7,p.POSITION_CONTROL,pi/4.)
|
||||
p.setJointMotorControl2(hand,9,p.POSITION_CONTROL,thumb+pi/10)
|
||||
|
||||
Reference in New Issue
Block a user