Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Canada
Asked — Edited
Resolved Resolved by DJ Sures!

Help Needed With A Code

I have been trying to get this code to work,

Code:


#Power Up
ControlCommand("Script Manager", ScriptStart, "Amp On")
Sleep(500)
ControlCommand("Auto Release", PauseOn)
Sleep(2000)

ControlCommand("Auto Position 3", AutoPositionFrame, "Tilt Straight",100,7,4)
sleep(5000)
ControlCommand("Auto Position", AutoPositionFrame, "Rest",25,10,5)
Sleep(5000)
Sayezbwait("i am ready")
ControlCommand("Script Manager", ScriptStop, "LowPowerMonitoring")
sleep(500)
ControlCommand("Camera", CameraStart)
Sleep(500)
ControlCommand("Script Manager", ScriptStart, "Monitor")

The problem is the Auto PositionFrame "Rest" will not run,however, if I run the the code again, it will. I've played with various sleep duration's between lines in the code. I'm stumped ! Anyone got any ideas?

PRO
Synthiam
#1  
When the code runs, does the Auto Position window show that "rest" was executed but the servos don't move?

its difficult to diagnose without seeing the project. There could be commands delayed from the other scripts that are being called which interfere with the servos being used in the Rest frame.
#2  
I notice you have multiple Auto Position controls open ("Auto Position" and "Auto Position 3"). Is there a reason for this?

Like DJ says, it is very hard to diagnose the issue without knowing what else may be running in conjunction with this script.
#3  
I think he has multiple EZB's. Each control only works with one EZB.
#4  
@DJ, Yes, it show that "rest" was executed. No other scripts are running these servos as they are on board 0. The Auto Position 3 is running servos on board 1.
PRO
Synthiam
#5  
Then I would have to assume the servos were already in their "rest" position - unless you are willing to share the project so I can take a look?

if the auto positioner displays the "rest" in the log, that means it is executing that frame. So, if you see "rest" in the status log and you believe it is not running, something else is having it stop or it's already in position. Post your project and I'll look.
#6  
Project posted. Here's the script I run before the one I'm having problems with;

Code:


#Power Down
ControlCommand("Script Manager", ScriptStop, "Monitor")
ControlCommand("Personality Generator", PauseOn)
sleep(50)
ControlCommand("Script Manager", ScriptStart, "Ring power dn")
sleep(600)
ControlCommand("Script Manager", ScriptStop, "LowPowerMonitoring")
Sleep(1000)
ControlCommand("Auto Position", AutoPositionFrame, "Resting",50,5,2)
Sleep(1000)
ControlCommand("Auto Release", PauseOff)
Sleep(500)
ControlCommand("Auto Position 3", AutoPositionFrame, "Tilt Back",100,7,4)
sleep(500)
sayezbwait(" Ok, the amp is off ")
sleep(1000)
ControlCommand("Script Manager", ScriptStart, "Amp Off")
sleep(500)
ControlCommand("Camera2", CameraStop)
sleep(500)
ControlCommand("Camera", CameraStop)
sleep(500)
ControlCommand("Auto Release", PauseOn)

Basically what i'm doing is - This script powers down the robot, the previous script powers it up.
PRO
Synthiam
#7  
Looks like there's a funny timing conflict with the Auto Release. The Auto Release is set for 5 seconds, and the timing of the sleeps() and code is all landing at the same time. Comment/disable the Auto Release control and try, it will work.

Rather than using Auto Release control because there are so many synchronous things happening at once, use the Release() command in EZ-Script for the servos that you wish to release.

They do not need to be released during startup, which is also what's happening. They only need to be released during shutdown script.


1) remove the Auto Release control

2) remove Auto Release control references from startup script

3) add Release() commands to shut down script
#8  
Ok, did as you said and added;

Code:


ReleaseAll(0)
ReleaseAll(1)

to the end of the power down script and that shuts everything, just what I want.
Now when I run the Power Up script, the auto positions "Rest" and "Tilt Straight" run but the servos don't move.
PRO
Synthiam
#9  
But, they work the second time you run the power up?
#10  
When I run it a second or third time the "Rest" servos run but not the "Tilt Straight" servos. Edit. Other servos on Board 1 work though.
#12  
Thanks DJ, That fixed it up, everything is working great now.