RobotStudio event

Rapid code is not executed

Hello,
I am having a problem in the execution of my code. I am using multitasking but the controller does not run it all the time, it's like it gets stuck in the start without a clear reason (it's blocked, as shown in the picture, in the line with WaitTime as shown in the picture). The fact is that the code was working and I did not change, then I am sure it is correct but it stops to work. Maybe someone has some idea or had similar problems? Could it be related in some way to multitasking option?
I have noticed also that sometimes if I stop the simulation and I start it again (even after doing reset) then the controller does not run the code from the start of main().
Thank you.

Lorenzo

Comments

  • lemster68
    lemster68 ✭✭✭
    Is the task Normal, Static or Semi-static?
    Lee Justice
  • I have tried both Normal and Semistatic, but the result is the same
  • lemster68
    lemster68 ✭✭✭
    Is it a motion task or non?  Also, what version of robotware?
    Lee Justice
  • No it's not motion task. Basically I have a conveyor and on this conveyor a box is moved. The box can be of 3 different type and it is generated randomly (according to some probability). I want to use the secondary task only to generate this box randomly. And it was working good but then suddenly it stops.
    Robotware version: 6.10.1039
  • lemster68
    lemster68 ✭✭✭
    Is it showing that it is stopped, or does it appear stopped to you because you see the program pointer appears always on the WaitTime?  It could be possible that none of the following conditions are true so it immediately returns to wait.  You could check that by adding an incremental num data variable.
    Lee Justice
  • You are right but the fact is that i paused the simulation and checked the values of the condition and it is true. So should work and generate a random box, but it doesn't. Now I solved it creating not randomly the first box and after that it works and create it randomly, but this is an adaptation to make the station to work.
  • dragolollo
    edited April 2020
    Maybe do you have other ideas? I have noticed this: I did again the project from the beginning and I put the code in the secondary task; again it does not run it. Then I moved the code to the main one and it was running; and I moved it back to the second one and now it's working at the moment. But I know it will stop again in future; I think it's a problem related to multitasking but I don't know what. And I don't think it is related to semistatic or normal issue because with both it can work or not.
    PS: I put a counter to see if it was stopped or just skipping the IF and it was stopped because it stays at 0.
  • lemster68
    lemster68 ✭✭✭
    One of the best ways to troubleshoot in times like this is to Step forward line by line, rather than just pressing the start button.  If you make it a normal task you can step in this way.  That gives you the time to see data change, which instructions are executing as the logic evaluates to TRUE or not, I do so whenever I get into situations like yours.
    Lee Justice