User Defined Function Example icon User Defined Function Example Add custom EZ-Script functions in C# or JS; intercept unknown calls, parse parameters and return values via AdditionalFunctionEvent. Try it →
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

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#17  

Here you go.... it keeps a list of 10 historical objects and doesn't alert on them for 30 minutes. Put this in the Camera Device TRACKING START script


$numberOfPeopleInHistory = 10

DefineArray($peopleScene, $numberOfPeopleInHistory, "unknown")

DefineArray($lastscene, $numberOfPeopleInHistory, $date)

repeat ($cnt, 0, $numberOfPeopleInHistory - 1, 1)

  if ($CameraObjectName = $peopleScene[$cnt])

    if (AddMinutes($lastScene[$cnt], 30) < $date)

      # haven't seen this object in 30 minutes
      # store this time update and run action

      $lastScene[$cnt] = $date

      goto(doAction)

    endif

      # no need to continue looping since this detected object
      # didn't pass the time check condition

    halt()

  endif

endrepeat ()

  # If we get here, there was no prior detect stored
  # Now we store the detection and run the action
  # Find an index that is empty and populate it

repeat ($cnt, 0, $numberOfPeopleInHistory - 1, 1)

  if ($peopleScene[$cnt] = "unknown")

    $peopleScene[$cnt] = $CameraObjectName
    $lastScene[$cnt] = $date

    goto(doAction)

  endif

endrepeat

:doAction

if ($CameraObjectName = "DJ")
  ControlCommand("Auto Position", AutoPositionAction, "Bow")
ELSEif ($CameraObjectName = "Holy")
  ControlCommand("Auto Position", AutoPositionAction, "Wave")
ELSEif ($CameraObjectName = "Tony")
  ControlCommand("Auto Position", AutoPositionAction, "Fist Bump")
endif

halt()
Author Avatar
Canada
#18  

Thanks Gentlemen. I'll chew on that for a bit. There is hope.

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#19  

No need to chew:)

  1. Copy the code that i posted

  2. load ARC

  3. PASTE the code into the camera device TRACKING START

voila:D