Trying to get the Robot to react to a sensor only when necessary

I have a Proximity sensor set up to my part dispenser. To tell the robot to stop if there is no part. The problem is it does this at all times, the dispenser takes about 8s to reload, I cant have the robot waiting around for that long, I’ve tried everything I can think of short of writing code.

Hi Slapit,

Which model do you use? Do you use Blockly? Can you share the Blockly project?
Please show me details of the workflow, which step is getting the problem?

Best regards,
Minna

Model
I am using the xArm 5

Work Flow
I designed a mechanical dispenser to present a part to the robot with custom grips. The robot then needs to place the parts in a washing tray with 330 separate pins. If the dispenser quits working I want the robot to know about it and stop too, so I am not sending half empty trays to the washer.
The robot will also be controlling a conveyor and a gentle alarm, and 2 external tools but that’s not very relevant I’ve got those working.

I have improved the code slightly since the other day. Now as you can see the their is a pause right at the end of the code. and a trigger to resume anytime the prox gets flip to positive. but if there was a part already there it would not move and my attempt to put the pause just before the pick results in the program not starting since there is a part already there and the robot seams to only sense changes to DI0 not on or off.

Also I’m realizing I will need some kind of timer (preferably code) that if the robot does stop for more than say 40 seconds I want to to trigger a light and alarm.

Unfortunately I have to assume this robot will be maintained by idiots in day to day operations… because it will. lol You wouldn’t believe the crap I’ve seen.

PS is there a better way to upload files here? Also is there a way to run the robot without a PC connected?

Thank very much Slapit.

Hi Slapit,

Please don’t put ‘when’ into ‘forever’ block, ‘when’ is a forever loop itself, and you miss an ‘edit’ block.
I am still confused about your working flow, you can tell me exactly which step/motion needs to be done. I modified the program just for your reference, when DI is in low level, it will stop the motion for 5s, and resume the motion and go to the washer.
Blockly project: 2024/10/08 - Google ドライブ

Best regards,
Minna

How did you modify it? The file I opened in your link apears the same.

Is there away to trigger actions from Digital Inputs DIs with out it running forever. I’m running into new issues where I cant start a new process or repeat a program becuse i guess it still running the DI programs.

My proces is now pick up part from dispensor (sensor here to trigger dispensor and let robotknow its ok to proceed)

Move

Run to tool 1

Move

Run tool 2

Move place in tray
X330
Triger conveyor (sensor here to trigger lock and let robot know it ok to proceed.)