France
Asked — Edited

Script With Controlcommand And Camera - Error Message

Hi,

I have written a script using the camera for face tracking, which used to work ok. But now, at the begining of the script I have the following error message : "ControlCommand" is not supported for this control (Camera). When i click OK, the script continues, but face tracking is not activated.

I think that the ControlCommand sentence is ok, so i don't unserstand the issue.

Here is a screen copy with the script and the error:

User-inserted image

Edit: copy of the script :

ControlCommand("Camera", CameraFaceTrackingEnable) ServoSpeed(d10, 4) ServoSpeed(d11, 4)

:LOOP IF ($CameraIsTracking = 0) ServoRandom(d10, 30, 70) ServoRandom(d11, 40, 75) Sleep(1000) ELSEIF ($CameraIsTracking = 1) ControlCommand("Camera", CameraSnapshot) MP3TriggerPlayTrack(d5, 38400, 5, 2000) ServoSpeed(d10, 1) ServoSpeed(d11, 1) Servo(d10, 50) Servo(d11, 60) ControlCommand("Camera", CameraFaceTrackingDisable) Halt() ENDIF Goto(LOOP)


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.

#1  

It's hard to see that script with this screen capture. Can you post it by it's self?

Did you try to activate the face tracking and then try the script? You may have to have it active for the script to run properly.

Install the DeBug control and then run the script. Watch the readout in the window and it will tell you what line the problem is on and maybe what the problem is.

#2  

Dave,

I have edit my first post with a copy of the script.

If I activate face tracking I have the same message. In fact there is no error, neither in the script debug console, neither in a Debug Control... just this message and then the script continues, but the ControlCommand function don't work.

#3  

How are you sending the $CameraIsTracking variable to the script? You need to get that info to the script somehow.

I installed your script in my ARC and it ran without error once I placed $CameraIsTracking = 0 or $CameraIsTracking = 1 above the :Loop

#4  

Ok, so I think the problem is more complicated than i thought, because when I close and open ARC many times, sometimes (but rarely) the script works perfectly (with face tracking activation), without no message. So it seems that it is a random issue...

@dave The $CameraIsTracking variable is present in the "Variables" tab of script settings, so I think it's ok. Nevertheless, I tried to place $CameraIsTracking = 0 or $CameraIsTracking = 1 above the :Loop, but no effect.

#5  

OK, that variable thing makes sense.

Maybe you have a Windows problem? Your script works nicely on my laptop using it's built in web cam. However I was not connected to the EZ-B board.

#6  

In fact, I think that it is a problem with my ARC project. I have created a new test project with only the script, the camera and the mp3 Trigger and everything works well.

So it seems that there is some control or something in my project that enter in conflict with the ControlCommand & Camera in my scripts....

#7  

I have found where is the issue :

I have a Digital Control to swith-on the camera and I have called it: "Camera". It seems that the script confuses the real Camera Control with the Digital Control called "Camera"... Since I have renamed the Digital control "Camera01", everything is OK.

Maybe it happens since the last update, with the new feature: "Digital Controls display custom text instead of ON/OFF", but I am not sure...

PRO
Synthiam
#8  

For future refence, here is the help from the manual regarding ControlCommand() or CC(). I marked the parts in bold that are of interest to you:)

Quote:

ControlCommand( windowName, ControlCommandParameter, [values])

. Sends a command to the window by its name. Look further down in this document for available ControlCommand() parameters under the ControlCommand Parameter section.

. This command has a shorthand alias which is "CC" (See examples below). . Example: ControlCommand( "ADC Graph", pauseOn ) . Example: ControlCommand( "SoundBoard", Track_3 ) . Example: ControlCommand( "Camera", CameraTweet, "This is an Image Description" ) . Example: ControlCommand( "Script Manager", ScriptStart, "MyScript" ) . Example: ControlCommand( "Speech Recognition", PauseMS, 3000) . Example: cc("Auto Position", AutoPositionAction, "Action Name") . Example: cc("Auto Position", AutoPositionFrame, "Frame Name") . Example: cc("Auto Position", AutoPositionFrame, "Frame Name", 50, 3) . Example: cc("Speech Recognition", PauseMS, 2000)

#9  

Great! I had a problem something like that a while ago. I had variables named the same in a few scripts and things seemed broken.

Glad it worked out.

#10  

@DJ: I read the help from the manual a lot (in fact, everytime I try a new feature) but I didn't make the link between my problem and this aspect of the ControlCommand feature.:)

So I have a question: when there is 2 or more windows with the same name (like in my case), which one is chosen by the ControlCommand function ?

Maybe it would be interresting to add an alert in ARC when trying to re-use a name for a new window, to prevent this kind of issue for beginners like me...

In any case, thanks for your help and for the EZ-Script, I really love to use it....

PRO
Synthiam
#11  

No alert - because you may want two windows with the same name to perform the same function with one line of code.

If there are two or more controls with the same name, all are used until an error is received.

#12  

Oh, I see now the interrest !

Just one more question, and I stop bothering you:

In my case, I have the Camera window and the Digital called "Camera". I try to initiate face recognition with ControlCommand("Camera", CameraFaceTrackingEnable). So, I see now why ControlCommand don't recognize the Digital (and give me the error message), but I don't understand why, in the same time, face tracking is not activated in the Camera windows. Is ControlCommand function blocked for all the windows when one send an error?

PRO
Synthiam
#13  

For future reference, here is the bit about ControlCommand() from the manual in case you missed my earlier post:)

Also, reference the last sentence if my most previous post.

Quote:

ControlCommand( windowName, ControlCommandParameter, [values])

. Sends a command to the window by its name. Look further down in this document for available ControlCommand() parameters under the ControlCommand Parameter section.

. This command has a shorthand alias which is "CC" (See examples below). . Example: ControlCommand( "ADC Graph", pauseOn ) . Example: ControlCommand( "SoundBoard", Track_3 ) . Example: ControlCommand( "Camera", CameraTweet, "This is an Image Description" ) . Example: ControlCommand( "Script Manager", ScriptStart, "MyScript" ) . Example: ControlCommand( "Speech Recognition", PauseMS, 3000) . Example: cc("Auto Position", AutoPositionAction, "Action Name") . Example: cc("Auto Position", AutoPositionFrame, "Frame Name") . Example: cc("Auto Position", AutoPositionFrame, "Frame Name", 50, 3) . Example: cc("Speech Recognition", PauseMS, 2000)