==== assumptions ==== treat muscles pairwise. ==== comments ==== * General notes: See http://www.zero-th.org/lyta/communication/FunctionalOverview/ * There is a max patch from prototype 1 that implemented a simple muscle pair as described below. See http://www.zero-th.org/lyta/MaxMSPLytaProto.zip * One issue that was encountered with this scheme is that a light contact over time creates a depression. * A solution is to include a term which relates the applied force to the displacement (see general notes above) ==== run loop ==== === wake loop === for each pair, read FSR value from each side of pair calculate new delta for output value apply positive delta to one side, negative to the other. if delta is less than threshold, increment sleep counter. if sleep counter is higher than threshhold, set muscle output to 0, go to sleep. === sleep loop === for each pair read FSR value if value is higher than threshold, wake up / otherwise, set muscle output to 0 (if it isn't already). ==== calculating delta: ==== delta depends on four values: * current output value of each muscle, M1 and M2. * FSR value of each muscle, F1 and F2. Mx''==''0 is maximum extension Mx''==''1 is maximum retraction Fx''==''0 is no force Fx''==''1 is maxumum force delta consists of three components which are added to M1 (and subtracted from M2) ) * d1. force equalisation * d2. rest position * d3. inverse position equalisation d1 = (F1-F2) // increase M1 (back off) proportionally if F1 is greater than F2 // d2 = (0.5-M1) // increase M1 proportionally if M1 is less than 0.5 // d3 = ((1-M2)-M1) // increase M1 proportionally if M1 is less than 1-M2 // the three delta components are multiplied by three coefficients and applied to M1 and M2: * M1 = M1 + (d1*c1 + d2*c2 + d3*c3) * M2 = M2 - (d1*c1 + d2*c2 + d3*c3) M1 and M2 are clipped to [0,1] and stored as 'current output value'. * M1 = fmin(fmax(M1,0),1); * M2 = fmin(fmax(M2,0),1); before sending as output values, M1 and M2 are scaled to [0,100]. ==== tuning: ==== if c1 is too high, the muscles will bounce away when touched, when it is too low the muscles will be hard to move. c2 should affect how firm the surface is. if it is high, it will be hard to move the musles beyond the midpoint. if it is low, impressions will fade away very slowly. ==== further thinking: ==== so.. * delta is determined by three values * force on this muscle Fs (self) * force on paired muscle, Fp (pair) * position of this muscle M M = M + (d1*c1 + d2*c2) M = fmin(fmax(M,0),1); M1 is set to M*100; M2 is set to (1-M)*100; ==== effects of membrane: ==== i think the force effect of the membrane can generally be ignored. if the membrane is exerting a big force, then reduce c2. if the force is very strong, perhaps making c2 slightly negative to compensate, but this is very risky. probably better to increase c1 to make users artificially stronger. ===== functions used in max prototype ===== delta_x = (s1 - s2) * (delta_t / tau) where * s1 * sensor 1 voltage * s2 * sensor 2 voltage * delta_t * sample period (ms) * tau * movement timescale (ms, 300) y = y0 + dy + (T_Samp / T_Relax) * (0.5 - y0) where * y * new muscle position * y0 * current muscle position * T_Samp * sample period (ms, 30) * T_Relax * relaxation timescale (ms, 350) --[[pix]] - 09 Apr 2005