loading
 
GetVariable from Geometric Statistics in Python API
Loren John Presley from United States  [4 posts]
13 year
Hello.

I'm trying to get the variable "AREA" from Geometric statics in the pipeline using the python API. What I'm trying to do is a variant of the "Wave Hello" example of the delta frequency feature. Instead of speaking "Hello" by using the Speak feature in the pipeline, I want to use the python API to say a list of different greetings using the python random module and TTS.

My problem right now is I can't seem to get the "AREA" variable from Geometric Statistics. It prints as a blank line in my script. I'm trying to get it like so:

area = rr.GetVariable("AREA")
print area

I tried printing a list of all variables in a test python script, and I got the variables in the roborealm pipeline, but the Geometric Statistics variables weren't listed.

How would I successfully accomplish this. Eventually, I'd like to do something like:

area = rr.GetVariable("AREA")
if area >= 200:
  say(random.choice(["Hello", "Hi", "Greetings"]))

I also notice that right now, whenever I run the script like so in the pipeline through the API, the random greeting is stated automatically without me waving my hand in front of the camera, but after that, nothing happens.
Anonymous 13 year
Loren,

We just tried that script and it seems to work. See the attached robofile and see if you can see the area printed in the bottom of the Python script GUI dialog.

Perhaps there is something wrong elsewhere in the pipeline that you are using? Can you include it here?

STeven.
program.robo

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