Germany
Asked — Edited

2 Questions With Scripting

Hello from Germany, I have 2 problems when programming scripts and hope someone can help me.

Problem 1: Speech Recognition at Low Confidence, I want that the robot at low Cinfidence says he did not hear me, for that I have written the following script, which unfortunately will cause it always says he did not understand me correctly:


: start

WaitForChange($SpeechConfidence)

$SpeechConfidence < = ( 0.69 )

sayEZBWait("Entschuldigung, ich habe Dich nicht richtig verstanden")

GoTo(start)

Problem 2: I would like to start a script when the robot speaks, this, I wrote the following script but does not work:


:start

$sayEZBWait = "eingabe"

WaitForChange SayEZBWait("text to speech") 

if(SayEZBWait = ("true")

$z = 1

ElseIf (SayEZBWait = ("false")

$z = 0

EndIf 

if($z = 1)

ControlCommand("Script Manager", ScriptStart, "Start Körpersprache")

ElseIf ($z = 0)

ControlCommand("Script Manager", ScriptStart, "Stop Körpersprache")

endif

Goto (start)

Thanks for your Help

*edited by DJ Sures to put code in proper UBB tags so people can read it.


ARC Pro

Upgrade to ARC Pro

ARC Pro is your passport to a world of endless possibilities in robot programming, waiting for you to explore.

#9  

Quote:

Locate Low Confidence script and press the EDIT button on the far right to open multiline editor
Well darn. I feel stupid. I've probably run across that too. Totally forgot about it.

#10  

Quote:

Well darn. I feel stupid. I've probably run across that too. Totally forgot about it.
Happens to me all the time. There is SO much functionality in ARC that I can't keep up with it all and come up with complex solutions to simple problems that have already been solved.

Alan

PRO
Synthiam
#11  

lol - don't feel dumb - tell you a story that happens often. I think of a great idea, load ARC source code and begin creating it.... only to realize that it's already there! Happens all the time lol

that's why the plugin system comes in handy:D

Germany
#12  

I have apparently made after a rather silly question or I did not realize that there is such a simple solution to my problem 1 which is already integrated into the ARC.

In Problem 2 I test tonight and give you a return info.

Thanks once.

Germany
#13  

Okay, i have testet, Problem 1 is solved, many thanks at all.

Problem 2: @MazeHorizon0-Techno Thank you for your script. Really it does not work, I have made the following changes: $z = "Eingabe"

:start

WaitForChange ($z)

if ($z = 1)

ControlCommand("Script Manager", ScriptStart, "Start Körpersprache")

ELSEif ($z = 0)

ControlCommand("Script Manager", ScriptStart, "Stop Körpersprache")

endif

Goto (Start)

Now it works, but actually I wanted to have it even easier. I did not want to manually set the variables in all voice instructions.

@WBS00001

Thanks for your help, but I think you have not understood what I want or I interpret your help wrong.

I want to start a script automatically when the robot speaks. Just as in the script of "MazeHorizon0-techno" but before and without entering them manually after each "SayEZBWait" command variable.

Greetings Sven

PRO
Synthiam
#14  

Why are you not following the tutorial? Simply add ONE single command to the Confidence script. The additional logic of a loop, second script, etc is inefficient and introduces room for error. Specifically since it doesn't make any sense.

Revisit the previous posts of this forum and follow the tutorial.

#15  

@lizpoir

Quote:

I want to start a script automatically when the robot speaks. Just as in the script of "MazeHorizon0-techno" but before and without entering them manually after each "SayEZBWait" command variable.
That's the problem. There is nothing that executes automatically when the robot speaks. The robot can speak one of two ways:

  1. Executing a SayEZB() or SayEZBWait() instruction.
  2. Playing a selection from a Soundboard

To my knowledge, there is nothing which triggers when either of those things happen. And, in a script, they can only happen when you put in a line of code which will send something to the robot for it to say. There is nothing which monitors when the robot is speaking and can be used to trigger something else at that moment. You have to do that with other coding that you enter yourself. My example was one way to do that.

#16  

Quote:

That's the problem. There is nothing that executes automatically when the robot speaks. The robot can speak one of two ways:

  1. Executing a SayEZB() or SayEZBWait() instruction.
  2. Playing a selection from a Soundboard

To my knowledge, there is nothing which triggers when either of those things happen. And, in a script, they can only happen when you put in a line of code which will send something to the robot for it to say. There is nothing which monitors when the robot is speaking and can be used to trigger something else at that moment. You have to do that with other coding that you enter yourself. My example was one way to do that.

Actually....

Two ways. if the only sound the EZ-B will be making is speech (ie, not playing MP3s) you can add a "sound servo (EZB Playback)" object to the project. Don't define a servo for it. Than have a script that waits for change in the $Soundv4Value variable, and it will execute whenever that value changes. I use the following script to vary the brightness of an LED when my Roli is speaking or playing music:


$Soundv4Value = 0
:loop
waitforchange($Soundv4Value)
PWM(D11,$Soundv4Value)
goto(loop)

If you will have other sounds, but only want to react to speech, you can similarly add a "talk servo" object. This one doesn't have a default variable you can act on, but if you define the servo as a Virtual servo, and then do a WaitForServoMove (servoPort, [timeout MS]) using the virtual servo port you defined as the servo port, the script will trigger any time the EZ-B speaks.

Alan