Received: from cs.utah.edu by karazm.math.UH.EDU with SMTP id AA27697 (5.65c/IDA-1.4.4 for ); Sat, 12 Oct 1991 23:44:36 -0500 Received: from peruvian.utah.edu by cs.utah.edu (5.65/utah-2.18-cs) id AA22960; Sat, 12 Oct 91 22:40:42 -0600 Received: by peruvian.utah.edu (5.65/utah-2.12s-leaf) id AA23053; Sat, 12 Oct 91 22:40:41 -0600 Date: Sat, 12 Oct 91 22:40:41 -0600 From: galt%peruvian@cs.utah.edu (Greg Alt) Message-Id: <9110130440.AA23053@peruvian.utah.edu> To: glove-list@karazm.math.uh.edu Subject: simple code to get simple gestures ------------- cut here for pwrglove.h ---------------- typedef struct _glove_data { signed char dum0,x,y,z,rot,fingers,keys,dum7,dum8,dum9,dumA,dumB; } glove_data; void init_glove (void); void query_glove (glove_data *); ------------- end of pwrglove.h ---------------------- ------------- cut here for fingers.c ----------------- #include #include "pwrglove.h" #include "pwrglove.c" #define F1(x) ((x>>6)&3) #define F2(x) ((x>>4)&3) #define F3(x) ((x>>2)&3) #define F4(x) (x&3) #define HAND(x) (((x&2)>>1)|((x&8)>>2)|((x&32)>>3)|((x&128)>>4)) static char gesture[16][8]={ "Open ", "Dbl Gun", "0010 ", "Gun ", "0100 ", "0101 ", "0110 ", "Thumb ", "Three ", "Dbl Pnt", "1010 ", "Point ", "O.K. ", "Birdie ", "1110 ", "Fist "}; void main () { glove_data glov; int hand,dir; init_glove(); while(1) { query_glove(&glov); hand=HAND(glov.fingers); printf("%s (%x) (%d,%d,%d)\n", gesture[hand],glov.rot,glov.x,glov.y,glov.z); } } ------------- end of fingers.c ----------------------- I'm working on something that will strip some of the noise out of the positional data by possibly predicting movement. does anyone know if there are any books/papers that discuss a decent way of doing this without having a lag most of the time? My first goal is to make a game of rock/paper/scissors (once I get vogle up and running). Anyway, have fun with this code... Greg