Award
Congratulations thetechguru, for answering the question and has received an EZ-Credit award! Share what you have learned and create a tutorial to help others by clicking here.

Help With Simple Script To Restart Camera

Assistance Requested

Help Jayutmb with their question and receive $10 of EZ-Credit to get more robots and parts from our store. The following information was provided about their previous efforts searching tutorials for a resolution.

Jayutmb claims to have checked these sources:
 
#1

So I am trying to get my camera to restart automatically when connection is lost and reestablished... I have script running just fine to get connection back.. however I cant get the script to restart camera back up after connection is back.. I am trying this with no luck..

:loopcam
if(IsCameraActive=0)
repeatuntil(iscameraactived=1)
ControlCommand("Camera", CameraStart)
sleep(1000)
endrepeatuntil
endif
sleep(10000)
goto(loopcam)

I have found a few conversations, tutorials and activities that may help with your question. Take a look at these links. I've sorted them by what I believe to be most relevant but that is not always the case as I'm still learning.


Also, consider reviewing the Learn section for informative lessons and activities. Check it out!


#2

Two issues. You need to identify iscameraactive as a variable, so you need "$" before it, and you also have a typo in your repeatuntil ("d" at the end)

This should work:

Code:


:loopcam
if($IsCameraActive=0)
repeatuntil($iscameraactive=1)
ControlCommand("Camera", CameraStart)
sleep(1000)
endrepeatuntil
endif
sleep(10000)
goto(loopcam)



In my init script, I actually stop and restart the camera because it is a workaround to the grid lines bug.

My script is:

Code:


if ($IsCameraActive = 1)
ControlCommand("Camera", CameraStop)
endif
sleep(1000)
if ($IsCameraActive = 0)
ControlCommand("Camera", CameraStart)
endif



Since this runs any time I re-connect to the EZ-B, I don't need to loop it.

Alan

#3

Thanks!