Canada
Asked — Edited

Some Code Help Please

Hello, I need some code help. I realize this is super simple but can't get my head around it.
In the following code once "Master" or "Milady" has been identified and the ControlCommand has been executed, I would like the CameraObjectName subject to be ignored for say, 1/2 hour.

To try and be clear, once it sees you it won't execute the ControlCammand repeatedly .

Thanks in advance. Tony

SayEZB(("I see " + $CameraObjectName))

if ($CameraObjectName = "Master")

  sleep(2000)

  ControlCommand("Script Manager", ScriptStart, "Fist Bump")


elseif ($CameraObjectName = "Milady")

  sleep(2000)

  ControlCommand("Script Manager", ScriptStart, "Royal Wave")


else


endif

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.

PRO
Synthiam
#1  

You got it! I have a few questions to get started...

  1. where does this script live? Is it in the camera control OnTracking event?

  2. What do the scripts "Fist Bump" and "royal wave" look like? A lot of the script you're asking to be reviewed is missing

  3. What do you mean the ControlCommand() executes repeatedly? I think this question would be answered with question #1, because we're not sure where this script lives

  4. Lastly, i'm not sure i'm following the goal because I'm confused by the mention of repeatedly ControlCommand() and waiting 30 minutes for something - but i see no reason why either of those things would happen in the partial code snippet posted. To clarify, are you wanting the script to WAIT 30 minutes before reacting to the detected object?

#2  

Try this one below. You need to declare your $CameraObjectName varable somewhere first like in your startup script or this script. You may be able to leave $CameraObjectName out of this script if it's declared somewhere else.

($CameraObjectName = #Master or Milady)


:Start

WaitForChange($CameraObjectName)

SayEZB("I see " + $CameraObjectName)

if ($CameraObjectName = "Master")
  sleep(2000) #you may be able to remove this wait
  ControlCommand("Script Manager", ScriptStart, "Fist Bump")

ELSE ($CameraObjectName = "Milady")
  sleep(2000) #you may be able to remove this wait
  ControlCommand("Script Manager", ScriptStart, "Royal Wave")

endif

Goto(Start)

PRO
Synthiam
#3  

Dave, the $CameraObjectName is automatically declared and populated by the camera device. The variable holds the object name that has been detected by the camera. Find out more using this the robot program episode: https://synthiam.com/Tutorials/Lesson/106

#4  

After rereading your first post I see my script may not help. How about this one: By placing a Pause( ) near the end of this script it will stop the script and hold it until another script calls this script to resume by using a ControlCommand Resume function. It will then loop back the the beginning and start again.


:Start

SayEZB(("I see " + $CameraObjectName))

if ($CameraObjectName = "Master")

  sleep(2000) #you may be able to remove this wait

  ControlCommand("Script Manager", ScriptStart, "Fist Bump")


ELSE ($CameraObjectName = "Milady")

  sleep(2000)#you may be able to remove this wait

  ControlCommand("Script Manager", ScriptStart, "Royal Wave")

endif

Pause( )

Goto(Start)

#5  

Oh, thanks DJ. That makes it easy. I know nothing about the camera control.

I think my last script should work. However to make it simpler you should find a way to pause the script for your wanted 30 minutes in place of the Pause() command I show. Maybe have the script use the computer's clock?

PRO
Synthiam
#6  

The original poster cannot "pause a script for 30 minutes" unless it is in the right place. That's what my question #1 is about - where does this script live?

You see, the sleep() command can delay for a period of time, but 30 minutes is a long time - specifically if the script is in the camera control On Tracking Start event. There's no reason to hold an event active in the compiler. Having a stand-alone script would be fine, it can wait for ever... but in an event, such as Tracking Start, is a bad idea.

The original poster needs to explain a bit more about what they're trying to do because there's too many unanswered questions at this time.

#7  

I assumed from the original post that he wanted a Stand alone script triggering other scripts when a face was recognized. That's why I suggested figuring out how to pause the script 30 minutes after a face was recognized. I thought that's what the OP was wanting to do. I was thinking that the script could check the system clock after a face was recognized, run the wanted script depending who it was, then loop back to the beginning then wait till another face was recognized.

Canada
#8  

Thanks Dave and DJ,

Sorry for the confusion. Writing English is difficult for me and the use of proper terminology eludes me. Perhaps I will just say what I want to do:

When someone enters the room and is recognized by the camera object tracking and is spoken to, and waved to, I would like that to happen only once. Then (their face but not other objects) ignored for awhile. So the same person isn't being continually spoken to, and waved to.

But after that event, I would like other objects to be recognized in the within the same script and acted upon.

I hope this is clear enough.

To answer the below questions, 1, this is a script in the camera control. like in this episode https://synthiam.com/Tutorials/Lesson/106 2, fist bump and royal way are a script to activate an auto positions from different ezb's. 3, I really don't know I meant. 4, i hope the explanation above answers this.

  1. where does this script live? Is it in the camera control OnTracking event?

  2. What do the scripts "Fist Bump" and "royal wave" look like? A lot of the script you're asking to be reviewed is missing

  3. What do you mean the ControlCommand() executes repeatedly? I think this question would be answered with question #1, because we're not sure where this script lives

  4. Lastly, i'm not sure i'm following the goal because I'm confused by the mention of repeatedly ControlCommand() and waiting 30 minutes for something - but i see no reason why either of those things would happen in the partial code snippet posted. To clarify, are you wanting the script to WAIT 30 minutes before reacting to the detected object?