United Kingdom
Asked — Edited

Running Script Stuck In A Loop

Hi. I'm looking for a little help. I have a script I just wrote, but when it executes It doesn't fully run and the audio file the script has gets stuck in a loop and I have do disconnect the EZ-B's power to get it to stop. Closing ARC doesn't stop the loop. What could be causing this?

Cheers.


ARC Pro

Upgrade to ARC Pro

Your robot can be more than a simple automated machine with the power of ARC Pro!

United Kingdom
#1  

Without seeing the script it's difficult to say, there is a lot that could be causing it. You are, in effect, phoning a garage and "my car doesn't work, what's wrong with it?" and expecting that to be enough information for an answer.

Post the script and we can see where it's going wrong.

United Kingdom
#2  

Oops, sorry about that. I thought I posted the script. Had an internet connection problem and it obviously didn't like the script I copied over mad. Here it is...


ControlCommand("Soundboard v4", Track_35)
sleep(5500)
servo(d20,60)
servospeed(d20,2)
sleep(1200)
servo(d20,0)
servospeed(d20,2)
sleep(2000)
ControlCommand("Soundboard v4", Track_36)
servo(d13,90)
servo(d18,155)
servospeed(d18,1)
sleep(2000)
servo(d18,38)
servospeed(d18,1)
sleep(2000)
ControlCommand("Soundboard v4", Track_37)
ControlCommand("RGB Animator", AutoPositionAction, "Scan test")
servo(d16,1)
servospeed(d16,1)
servo(d17,180)
servospeed(d17,1)
sleep(1000)
servo(d16,180)
servospeed(d16,1)
servo(d17,1)
servospeed(d17,1)
sleep(1500)
servo(d16,90)
servospeed(d16,1)
servo(d17,90)
servospeed(d17,1)
ControlCommand("Soundboard v4", Stop)

sleep(3000)
ControlCommand("RGB Animator", AutoPositionAction, "round eye blink")
ControlCommand("Soundboard v4", Track_38)

United Kingdom
#3  

Do any of the Auto Position actions, RGB Animator or sounds have any scripts assigned to them too?

There is no code there which would loop, there are a lot of redundant or unnecessary lines of code though which may not help, mainly the servospeed() lines, some are duplicated, some are changed after the servo moves and no other servo movements on that port afterwards...

You may be better off adding the movements for the servos as frames and actions, it's a much simpler method than scripting servo movements. Since trying the Auto Position control and adding frames and actions I have removed a large portion of the scripts which I have in my projects. New projects I don't even contemplate scripting movement of servos any more.

United Kingdom
#4  

No, the sound files and animator are stand alone and have no scrips assigned to them. I will try out the Auto Position control as I've not tried this yet. I thought the servospeed lines I had were necessary as when a servo turns one way at a set speed, they return a faster speed without another servospeed line.

The script was working fine until I got towards the end when the audio started repeating itself then the battery needed charging. I will have another play a little later.

United Kingdom
#5  

Figured out what the problem is. Running a sound file and the animator at the same time freezes the EZ-B. I added a short RGB animation script to a sound file, executed the new script, then the red LED on the EZ-B comes on, and stays on and then unable to use it unless I do a power cycle. Has anyone else expearianced this bug? Funny thing, it worked a couple of days ago.

United Kingdom
#6  

Running the animator and sound file at the same time does not cause the EZ-B to freeze. The video of JD dancing which DJ posted at the weekend shows the animator working and sound files. Also, I did not experience any issues when creating and testing the dance routine I'm working on.

Is the RGB animator connected properly? Is the address in the control OK? If an I2C command is sent and the I2C device is not connected, doesn't understand the command etc. then it will cause the EZ-B to hang, this is how the manufacturers of the EZ-B's processor designed the processor.

United Kingdom
#7  

Well it caused mine to freeze, every time I tried it today. Everything is connected ok, battery is fully charged, and the address is ok. They both work fine seperatly, just not together. And as I mentioned it worked yesterday no problems. The only change was I started a new project and deleted the old one. But both scripts were the same. I think the EZ-B has reset itself as it has kicked me out if client mode now. Not having a good day. mad mad

United Kingdom
#8  

Does it do it on a new project with only the animator and the soundboard added?

United Kingdom
#9  

I haven't tried it on a new project yet, but here's the thing. I have a script using another sound file and another RGB action and they play nice together...


ControlCommand("RGB Animator 2", AutoPositionAction, "KITT 1")
sleep(13000)
ControlCommand("RGB Animator 2", AutoPositionStop)
sleep(800)
ControlCommand("RGB Animator", AutoPositionAction, "round eye blink")

The following script works absolutely fine...


ControlCommand("Soundboard v4", Track_35)
sleep(5500)
servo(d20,60)
servospeed(d20,2)
sleep(1200)
servo(d20,0)
servospeed(d20,2)
sleep(2000)
ControlCommand("Soundboard v4", Track_36)
servo(d13,90)
sleep(400)
servo(d18,155)
servospeed(d18,1)
sleep(2000)
servo(d18,38)
servospeed(d18,1)
sleep(2000)
ControlCommand("Soundboard v4", Track_37)
servo(d16,1)
servospeed(d16,1)
servo(d17,180)
servospeed(d17,1)
sleep(1000)
servo(d16,180)
servospeed(d16,1)
servo(d17,1)
servospeed(d17,1)
sleep(1500)
servo(d16,90)
servospeed(d16,1)
servo(d17,90)
servospeed(d17,1)
sleep(1000)
ControlCommand("Soundboard v4", Track_38)

but the moment I put the following ControlCommand() at the end of the script (or anywhere within the script too) and run it, the audio plays normally for a couple of seconds the start to play a random small section of the audio over and over.


ControlCommand("RGB Animator", AutoPositionAction, "round eye blink")

The red LED on the EZ-B4 comes on and stays on with a solid light, and becomes unresponsive. I close ARC and the repeating sound byte continues to play. I disconnect and reconnect the power and all is well until I run this one script again. I remove the CC script and the rest of it works. I have never come up against this before and the whole script (above) actually did work yesterday. Just part of my bad day today my original project which had this working somehow managed to lose 80% of the controls (I think that was my fault) so I have had to redo the whole project again from scratch (and saved to the cloud). its annoying that this happens and even more so when the EZ-B freezes. It's weird how my other project script with these 2 controls work. confused

United Kingdom
#10  

I would say it's likely to be some bad code somewhere however I only had a quick scan over the last post you made. When I get chance I'll look closer.

United Kingdom
#11  

Thanks Rich. Another little thing I'm coming across with the first scrip in post #10 is that one action seems to bleed in to another. Adjusting the sleep() seems to solve it (for the most part), but still does it every now and then confused. Again, I appreciate you looking in to this (or anyone else for that matter who might of experienced this.)

This what it should be (just red)

User-inserted image

but this flashes up when the script is running.

User-inserted image

United Kingdom
#12  

Just to quickly mention that I don't seem to have any issues with the RGB Animator and the Soundboard working together (I found time to play a little tonight, something I haven't really had chance to do since getting the V4, robots, animator etc.). This was done using both a script to start the animator and soundboard plus a script on the soundboard to change the animator.

I can only assume your project may have some bad scripts in it. To make life a lot easier feel free to email your project my way (email on my user details) and I'll look at the overall picture to see if I can spot any bad parts in there.

United Kingdom
#13  

@Rich.

Thanks for the offer and video demo. I'll get that sorted and send you the project tomorrow. One thing I have noticed (don't know if it's connected to the issue) is when I play one specific action on the animator, when I hit stop the animation stops but when I exicute another action it will take about 10 seconds to start. Anyway I'll put the details of which one it is in the email. (Btw, liked the Alice Cooper tune in the vid. One of my fav's).

Thanks again. :)

PRO
Synthiam
#14  

steve, what kind of computer are you running this on? It sounds like a performance issue. I also would check how many programs you have running? In your System Tray (that's next to the clock) are a list of programs that are running in the background. Some laptops come with a bunch of bloatware, which affects performance.

United Kingdom
#15  

@DJ.

I'm running a HP 650 notebook. 6g RAM, 320HDD (167 free space) on windows 7 64bit home premium. The only thing running in the system tray is AVG anti virus. I deleated a lot of the bloatware some time ago and did a disk clean up recently. I mentioned before that I have a script which uses an animator action and audio file and both play nice.

In regards to starting animation actions, Other actions I exicute play straight away and stop straight away. But the one I have trouble with has a "repeat action". Don't know if that's causing the exicute delay? Very strange.

United Kingdom
#16  

@Rich.

Emails sent. Good luck. ;)

United Kingdom
#17  

@Rich.

Have you had a chance to have a look at my project I emailed you yet? I just wanted to mention if you haven't had a chance yet, while having a play around with my project last night I deleated the "round eye blink" action from the RGB animator and it has solved the problem of freezing the EZ-B. So I'd love to know what was wrong with that action to have caused that. Im still getting a little bleed through from other actions I have, not as bad but still a little annoying.

United Kingdom
#18  

No I hadn't had chance with being away at the weekend and coming home to a broken boiler (and therefore no heating or hot water).

United Kingdom
#19  

Ouch. Sorry to hear that dude. eek

United Kingdom
#20  

@Rich.

Hey dude. I'm looking to mark this thread as resolved. Just wondering if you had a chance to look at the project I emailed you?

South Africa
#21  

Hello

Please can you help me. I see this thread was not marked as resolved. I am experiencing the same problem. I am running the JD example and then running the dance routine : "Haunt me". This worked for the last week. But , now, I am getting the same problem the user mentioned in the beginning on the thread. The script is stuck in a loop. And I have to turn off my JD robot. An as the user mentioned : "funny thing it worked a couple of days ago". I have checked my system and there is no programs running in the background and there is no "bloatware". I have also fully charged my Robot. I am satisfied that my JD robot is working on other examples. Many thanks, Ian

United Kingdom
#22  

@ianmbrick.

I found out what my problem was but forgot to mention it here. My problem was due to a faulty i2c wire that was causing the EZ-B to freeze (constant red light illuminates). I replaced the ribbon cable at it worked fine after that. The slightest little problem and the i2c port won't play nice. Try reseating the ribbon cable at both ends of the connection and thy again. If you still have problems, try replacing the cable.

South Africa
#23  

Many , many thanks Steve , I reseated the ribbon cable and all is working as expected. The reason why the ribbon cable came loose was because I bought some more spiral wrap this weekend and tidied up the cabling but it seems I was not careful enough and the i2c wire was probably not loose. Thanks for your reply, which is much appreciated. Regards Ian.

United Kingdom
#24  

@Ian.

Your welcome. Glad you got it sorted. :)