custom item for tracking XY joystick/mouse movements
custom item for tracking XY joystick/mouse movements
Hi,
This is a topic I have brought up before, so I am sorry for raising it again. I am looking to capture joystick or mouse movements continuously every second or at an even finer distinction. I know DirectRT does this very well. However, DirectRT does not seem to allow me to provide the graphical feedback real time to the subject. In other words, the subject cannot see the scales on which s/he is evaluating an item. Ideally, I would like to present an image on one side and a graphical window on the other that shows the mouse/joystick movement as a moving cursor in the XY plane. Medialab has the custom item feature, so I am not sure whether a possible option is for me to embed the image in an HTML form and have a javascript to capture the continuous movements. I have a consultant who is willing to write a java script program for me, but he needs some guidance. Specifically, if I designate the HTML form as a custom item, will Medialab be able to store the XY coordinates from the javascript program? Or, does the programmer have to also enable writing of the data to a separate csv file?
Would greatly appreciate a prompt reply!!!!
I think this ought to be do-able, especially if you have a javascript programmer who is will to help you. You can tell the programmer that if they can get the script to work in IE then it ought to work just fine in MediaLab. You need to tell them that the data need to be passed like form data using the method=post command. Because you could have a LOT of variables if you are sampling once per second (or even more frequently), you might consider having the data merged into fewer variables which can be sorted out later. E.g., instead of coordinates x=457, y=1036, at time 3050ms representing 3 separate variables, you could have this be a single string variable with a value of "457-1036-3050" or something like that.
See also: www.empirisoft.com/support/showthread.php?t=536
And ps., I'll be happy to help if you need it. See how far you can get with the javascript and then let me know if you run into any trouble with it. Sounds like a great custom item!
Thanks! I have forwarded your message to the programmer and he has indicated that he is thinking along the same lines. He sent me a prototype that worked ok, except for one problem - the javascript did not sample the position at the same intervals of time. I had asked him to try a 15-16 ms resolution, but the program wrote data anywhere between every 16 ms to 64 ms over the course of the sampling. I have asked him to try a 100 ms resolution - hopefully that should work!
This code sample might help--it's a simple example of some javascript rt code. Never used it myself but thought it might help in your case.