Ejemplo n.º 1
0
calcB_cross = [[0.,0.,0.]]
calcB_dot = [[0.,0.,0.]]


cnt=0
for i in pos:
    calcB_cross = np.append(calcB_cross, modE.evalfuncMag(i,s0), axis=0)
    calcB_dot = np.append(calcB_dot, modE.evalfuncMagDot(i,s0), axis=0)
    cnt+=1

calcB_cross = calcB_cross[1:]
calcB_dot = calcB_dot[1:]

calc_cross=np.zeros(shape=[len(calcB_cross),1])
calc_cross=np.append(calc_cross,calcB_cross,axis=1)
calc_cross=datAcM.sortData(calc_cross)
calc_dot=np.zeros(shape=[len(calcB_dot),1])
calc_dot=np.append(calc_dot,calcB_dot,axis=1)
calc_dot=datAcM.sortData(calc_dot)

# fitting the data to the model
#offset = [30.,0.,-33.37]
#scale = [2.4505,0.,3.7334]
#bla = middleOff[0][110:370]
#bla = (bla * scale) + offset
#bla=modE.fitMeasurements(calc[0],middleOff[0],(0,110))      # GREAT! the fitting things work here!
#data=np.zeros(shape=[len(bla),1])
#data=np.append(data,bla,axis=1)
#data=datAcM.sortData(data)

# estimating the position from the measurments
Ejemplo n.º 2
0
"""
the sensor is below the middle finger and the magnet is on the middle finger
"""

"""
    acquiring data...
"""
#print "t:"
#fingDat=datAcM.pipeAcquisition("gatttool -t random -b E3:C0:07:76:53:70 --char-write-req --handle=0x000f --value=0300 --listen", 
#                               "150825_MidPin", measNr=500, offset=100)
fingDat=datAcM.textAcquistion("150825_MidPin")
# applying average filter
avg=modE.moving_average(fingDat[0], 10)
t=np.zeros(shape=[len(avg),1])
t=np.append(t,avg,axis=1)
t=datAcM.sortData(t)
fingDat=None
fingDat=t
"""
    the artificial data...
"""
angInd = [-0.02037, 0.02272, 0.01087]         # to wooden-angle(index) (from sensor)
angMid = [0., 0.02272, 0.01087]         # to wooden-angle(middle) (from sensor)
angRin = [-0.01939, 0.02272, 0.01087]    # to wooden-angle(ring) (from sensor)
angPin = [-0.03840, 0.02272, 0.01087]     # to wooden-angle(pinky) (from sensor)
            # position of sensor
s0 = [0.00920 , 0.06755, 0.]    # sensor beneath middle
s1 = [-0.0292, 0.06755, 0.]      # sensor beneath pinky
rInd = 0.08                      # length of index finger (from angle)
rMid = 0.08829                    # length of middle finger (from angle)
rRin = 0.07979                    # length of ring finger (from angle)
Ejemplo n.º 3
0
from timeit import default_timer as timer

""" acquiring data... """
#dat=datAcM.pipeAcquisition("gatttool -t random -b E3:C0:07:76:53:70 --char-write-req --handle=0x000f --value=0300 --listen",
#                               "150820_boardLSM1", measNr=400, offset=100)
dat=datAcM.textAcquistion("150820_boardLSM1")                       
#tmp = dat[0][45:245]
#t=np.zeros(shape=[len(tmp),1])
#t=np.append(t,tmp,axis=1)
#t=datAcM.sortData(t)
#dat=None
#dat=t
avg=modE.moving_average(dat[0], 10)
t=np.zeros(shape=[len(avg),1])
t=np.append(t,avg,axis=1)
filtered=datAcM.sortData(t)
#dat=None
#dat=t
""" the artificial data... """
angle = [0.02, 0., 0.02]    # position of the nail in the board
s0=[0.,0.,0.]               # the sensor is the origin
#r = 0.04705                      # length of index finger (from angle)
r = 0.05100
# values for the half circle
t = np.arange(0, np.pi, 0.015707963267948967)  
pos = [[0.,0.,0.]]      # representing the real positions (shifted!)
pos2 = [[0.,0.,0.]]
y=[[0.]]
cnt = 0
for i in t:
    pos = np.append(pos, [[s0[0]+angle[0],