I am new to block programming with EXP.
I have two different students who are having similar issues with their robot running what it has been told, up to a certain point of their code. In both situations, the code is fairly lengthy and runs 75% of what they have, correctly. But the program will just stop and not continue the remaining portion of their program. At times, the program will run fine at times and at other times, it will stop and not run the entire program.
We have tried replacing batteries, deleting all programs from the brain of the robot and downloading the programs back to the brain, but I can’t find any pattern as to why this is happening. Does anyone have any ideas of what to try?
To disagnose cose related issues, we’d need to see the code. Can you share it here?
Posting samples of the programs for troubleshooting by members of the community will help.
Most often, a program “appears to stop running” when there is a line of code that is unable to be completed. For example, a typical “mistake” might be a command to close a claw by moving a motor 60 degrees; however, when the claw picks up an object, the motor might not be able to close a full 60 degrees, so the program just stops to wait forever, because it can’t continue until the command is complete. Telling the motor to close for .5 seconds, for example, would not cause a stop in the execution.
I have tried to post the “blocks” code, am unable to do so. I have tried adding in a ‘wait time’ right after the command that won’t run. Doesn’t seem to help. Everything above this point in the code runs fine and runs each time.
I am going to try to add a screenshot.
The problem occurs with the last motion commands given at the bottom of the code, right about the ‘wait 15 seconds’ control.
At the very top of your code, add the set arm timeout to 1 second block, and also add a set claw timeout to 1 second.
Try that and then let us know what happens.
Your suggestions fixed our issue. Thank you.
Can you explain to me why it was necessary to insert those timeout blocks?
It fixed it because of what @kmmohn was saying above.
If you command a motor to do something (e.g. spin to 90 degrees) but it can never make it to 90, only 88, the blocks never completes, and the program never moves on.
In yout case, either the arm or claw, most likely the claw, can get to the position you are asking it to.
Without a timeout, it never gives up. With the timeout, if it gets jammed for 1 second, the code moves on anyway, even though the motor never reached it’s target.