Use Camera As A Button

Description

You can use a Camera in ARC as a button without any external code. I created a custom multicolor named "Dark" and set it a orange/red range and I set it to the maximum size for detection. This is what worked best for me as I discovered the orange/red color range was reflected off my hand as it moved toward the camera to block the view.

I started out using the darkest shade of blue possible but...

Step 1

You can use a Camera in ARC as a button without any external code. I created a custom multicolor named "Dark" and set it a orange/red range and I set it to the maximum size for detection. This is what worked best for me as I discovered the orange/red color range was reflected off my hand as it moved toward the camera to block the view.

I started out using the darkest shade of blue possible but that color did not perform as well for me. I encourage you to experiment as skin tone, lighting conditions and even the type of camera will very from user to user.

Below is my script which I named CamBlocked It only looks for the $CameraObjectColor value to change and so this scripts acts as a sort of "hair trigger".


#updated 7/21/14
$CameraObjectColor = ""

:Start
IF ($CameraObjectColor = "Dark")
    ControlCommand("Bender Sounds", Track_19)
sleep(500)
ENDIF 

$CameraObjectColor = ""
sleep(500)

goto(start)

The line below is the action I have chosen to perform when my "Dark" multicolor object is detected.

ControlCommand("Bender Sounds", Track_19)

Video Tutorial:

Here is an alternative take on the script. Rich's modified script uses the WaitForChange function and $CameraIsTracking value. My tests showed that I had to wave my hand slowly more closely in front of the camera for 1-3 seconds in order to trigger the event.


#from Rich 7/21/2014
$CameraObjectColor = ""
WaitForChange($CameraObjectColor)

:Start
IF ($CameraObjectColor = "Dark")
ControlCommand("Bender Sounds", Track_19)
EndIf

WaitForChange($CameraIsTracking)

$CameraObjectColor = ""

WaitForChange($CameraObjectColor)

Goto(start)

If you test the two scripts, please let us know the results.


ARC Pro

Upgrade to ARC Pro

Elevate your robot's capabilities to the next level with Synthiam ARC Pro, unlocking a world of possibilities in robot programming.