mankental
Hi guys,
I am trying to run an object detection script:
$CameraObjectName = ("Unknown")
ControlCommand("Camera", CameraObjectTracking) SayEZBWait("Let me look for an object") Sleep(1000)
If($CameraHorizontalQuadrant = "Unknown") SayEZBWait("No, I do not see an object") ControlCommand("Auto Position", AutoPositionAction, "Left") ControlCommand("Auto Position", AutoPositionAction, "Left") EndIf
If($CameraHorizontalQuadrant != "Unknown") SayEZB("Yes, yes I do see a " + $CameraObjectName) SayEZBWait("The object is in" +$CameraVerticalQuadrant+ "row" + $CameraHorizontalCamera+ "column") ControlCommand("Auto Position", AutoPositionAction, "Forward") ControlCommand("Auto Position", AutoPositionAction, "Forward") ControlCommand("Auto Position", AutoPositionAction, "Forward") ControlCommand("Auto Position", AutoPositionAction, "Forward") ControlCommand("Auto Position", AutoPositionAction, "Forward") ControlCommand("Auto Position", AutoPositionAction, "Forward")
EndIf
in the midst of some Auto Position actions in a script. The script doesn't run after doing those actions. Is there anything I could add to make it work smoothly?
Thanks in advance!
You're auto ControlCommands will virtually all run at the same time...you should set the action to repeat instead... Or set it to run once and use another goto loop or a repeatuntil loop with a sleep/wait command after each Forward action... You'll also need to check the location of the object again after each forward/left/right movements as no doubt the object will have changed postion (as the camera sees it) relative to the robot....
Hi @Richard R,
thanks for the quick reply. However, my problem is that other dance auto-position actions are running together with the object detection script. How do I make it such that the object detection only runs after the actions are done. Below is the full script:
ControlCommand("Auto Position", AutoPositionAction, "Forward" )
ControlCommand("Auto Position", AutoPositionAction, "Hands Dance" )
ControlCommand("Auto Position", AutoPositionAction, "Thinking" )
ControlCommand("Auto Position", AutoPositionAction, "YMCA Dance" )
ControlCommand("Auto Position", AutoPositionAction, "Forward" )
$CameraObjectName = ("Unknown" )
ControlCommand("Camera", CameraObjectTracking ) SayEZBWait("Let me look for an object" ) Sleep(1000)
If($CameraHorizontalQuadrant = "Unknown" ) SayEZBWait("No, I do not see an object" ) ControlCommand("Auto Position", AutoPositionAction, "Left" ) ControlCommand("Auto Position", AutoPositionAction, "Left" ) EndIf Goto(loop ) If($CameraHorizontalQuadrant != "Unknown" ) SayEZB("Yes, yes I do see a " + $CameraObjectName ) SayEZBWait("The object is in" +$CameraVerticalQuadrant+ "row" + $CameraHorizontalCamera+ "column" ) ControlCommand("Auto Position", AutoPositionAction, "Forward" ) ControlCommand("Auto Position", AutoPositionAction, "Forward" ) ControlCommand("Auto Position", AutoPositionAction, "Forward" ) ControlCommand("Auto Position", AutoPositionAction, "Forward" ) ControlCommand("Auto Position", AutoPositionAction, "Forward" ) ControlCommand("Auto Position", AutoPositionAction, "Forward" ) EndIf
Thanks.
Hmmm good question.... There is no ControlCommand("Auto Position", AutoPositionActionWait command.... There has to be a way (I am sure there is) to pause the script until all the actions are completed before continuing to the camera tracking.... For now a long sleep command may be a stop gap...
I will try to continue figuring it out...thanks for helping anyway!
You do realize that all of your control commands are going to run all at the same time. Is this what you wanted to do or did you want one to finish before starting the next?
Check this out in auto positioner.... This will allow you to run a script when the auto-position commands are completed... In your case put your camera tracking in the last action before the camera tracking starts... Put your camera tracking code in the "position end script" as below...
Better yet, you can also use this variable to check and see whether auto positioner is still running or not..
Thanks a lot for the help!