loading
 
Kinect, Python Programing, and More
Paul Miller  [2 posts]
12 year
What I would like to do in the future is possible make, using the Microsoft Kinect, a sound playing device just be depth sensing a Roborealm. I am currently just conquering the big step of being able to set up the ability to detect the body, or possible better, a body part, that as it moves, to hit different key frequencies, not like a slide whistle, but possible implement a keyboard idea and develop farther from there.

Cropping: Is there a better way I can only take the COG from a designated region?

Python: When I would try to use the GetVariable function in Python ""cogX = GetVariable("COG_X")"", I get a ""name 'GetVariable' is not defined
I only have a slight knowledge in Python, not even sure about the other programs.

Exporting Text: Trying many different tactics to get the program to work, I tried just export the COG's coordinates to a .txt file then just using a Python program there, but I could not get the program to work due to my lack of skill
Here is my error filled attempt at that
------------------
import fileinput, winsound, sys, string;flup = open('plpp', 'r'); n=flup.readline();p=n.strip();o=p.split();[x,y]=o

if 0<x:
    if x<='100':
        winsound.PlaySound('Sound1.wav',1)
    elif x>'100':
        if x<='200':
            winsound.PlaySound('Sound2.wav',1)
        elif x>'200':
            if x<='300':
                winsound.PlaySound('Sound3.wav',1)
            elif x>'300':
                if x<='400':
                    winsound.PlaySound('Sound4.wav',1)
                else:
            else:
        else:
    else:
else:
#restart_program()
----------------------
If there is any way I could be using the Kinect better, please let me know.
I have also made some comments on each of my steps.

 

program.robo
Anonymous 12 year
Paul,

Cropping: Yes, see the Crop module

http://www.roborealm.com/help/Crop.php

Note that you can use something like

[COG_X-10]
[COG_X+10]
[COG_Y-10]
[COG_Y+10]

in the start and end boxes (literal as typed above) as those fields are processed and interpreted [] signal it as an expression. See

http://www.roborealm.com/help/Expressions.php

Python: Try

cogX = rr.GetVariable("COG_X")

that's what that

import rr

is for. The rr object is needed to access all the internal RR functions.

Exporting Text: You could also try using the

If_statement

module to surround a

PlayWav

module and get that to work right in RR ...

Your external python script seems right assuming that newlines got added into the file.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index