Cancel a macro

If you have a question about the software please ask it here.

Re: Cancel a macro

Postby Derek » Thu Apr 26, 2018 1:51 am

Terry is working on this for my new ATC that he and I designed. It works great except if there is a problem and I hit stop, ESC or estop all of the outputs go off and depending what position it is in can be either as simple as the main slide going back to park position or as violent as an arm holding a tool slamming into the mill head then dragging across it until it slams into the splash shield. If the macro would stop running and leave all the outputs in the state they were in I could then manually control the system and return it a move at a time back to their respective positions. My non programing mind would think this should be something basic but I guess not.

My non programing minds solution is to hook a solenoid air valve to an output that the stop button will control and it will kill the main air supply to the system. No air, no movement. Problem solved cave man style:)
Derek
 
Posts: 341
Joined: Mon Sep 05, 2016 9:57 am

Re: Cancel a macro

Postby cncdrive » Thu Apr 26, 2018 9:50 am

As I wrote the programmer can handle this situation. Example code with explanation is in my previous posts.
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Re: Cancel a macro

Postby ger21 » Thu Apr 26, 2018 10:50 am

There are lots of things that mach3 does that we wouldn't want UCCNC to do.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2663
Joined: Sat Sep 03, 2016 2:17 am

Re: Cancel a macro

Postby cncdrive » Thu Apr 26, 2018 12:57 pm

Terry,

The problem is that if it will work like it is in Mach3 then it will likely to become unreliable like macros often are in Mach3.
The issue is that we can't just stop a running code, we could kill (abort) the thread, but as I wrote it can cause unexpected results, because Microsoft is not guaranteing that it will stop the thread and if it will then when it will exactly happen, also they are not guaranteeing that it will not mess something up.
Even on the Abort function description page they describe the function as "it usually stops the thread".
Well, that it usually stops it is not good enough for what we want to do. We would need a function which immediately and always stops it in a controlled manner, but that type of function does not exist unfortunately.
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Re: Cancel a macro

Postby dezsoe » Thu Apr 26, 2018 9:13 pm

Vmax549 wrote:Can you not make it ignore all other outputs as well??

(;-) TP

Please, DO NOT KILL UCCNC! It is one of the powerful features in UCCNC that if you write a macro well then you can handle a stop condition correctly. If UCCNC ignores all outputs after a stop is pressed, then the possibility of handling the outputs is over.

Vmax549 wrote:GERRY , I remember when UCCNC was first getting started up EVERYONE said we want it to work like MACH3 does. Well it is my turn ;) I want this to work like mach3 did. :(

If UCCNC starts to work like Mach3 then it will be an other program that I'll never use.
dezsoe
 
Posts: 2049
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Cancel a macro

Postby Dan911 » Fri Apr 27, 2018 1:35 am

Vmax549 wrote:Hi Dan , Teh ATC macro is not as simple as teh test piece of code. The atc is not a simple sliding carrousel. It is basically a 1 armed bandit style tool changer that when parked is tucked in out of teh way.

We ran into teh macro problem when testing out HOW to sec from a sequence. Much to our surprise it when all wrong.

The atc has to operate in a defined sequence of movements to avoid collisions. Each stage of an output defines a movement. Output 5,1 OFF is one directional move of one element. Output 5,1 OFF is the opposite directional move of that element. And there is a detection switch for both limits of travel for that element. There are 14 motion events and 28 detection events per cycle and 2 cycles per tool change. When a cancel is applied ALL outputs HAVE to state in teh same state as when the {ESC} was applied. Then the operator will back the order of events up to a safe position to resume if needed or STOP all together

When we hit {Esc} to see how it would react to a macro cancel we were surprised that everything went wacky and ALL elements tried to move at teh same time because all teh outputs reset themselves. THAT was a BIG surprise as I have NEVER seen a controller do that on stop or esc. DIY or commercial.



Now can I write around that SURE I can but I should not have to. To me this is a safety issue. It would seem that IF teh {ESC} can allow certain things like cancel all motion it SHOULD be able to cancel all output toggling as well. There should be a warning put in teh UCCNC manuals describing what happens on an {ESC} or {Stop} and specifically how to deal with it when programming a function. As it will be required for all macros that make use of outputs.

GERRY , I remember when UCCNC was first getting started up EVERYONE said we want it to work like MACH3 does. Well it is my turn ;) I want this to work like mach3 did. :(

I am done with MY soapbox session and rant and am returning to normal space :twisted:

(;-) TP



Like I said it IS what it is and we have to deal with it.

(;-) TP



Hi Terry,
Definitely seems like a complicated macro to write :shock: and GOOOOOOD LUCK!!! lol

I must add though, any time writing a macro/plugin it's your responsibility to make safe by utilizing functions available. I think if UCCNC made the changes you suggest there will be other complaints soon to follow.

I don't have much experience with ports/pins since using a UC100, but with my experimenting induced by this thread this simple line with a created bool for each port/pin regardless how many, would set port/pin to it's state before escaped pressed and not change to end of macro.


if(!exec.Ismacrostopped()){exec.Setoutpin(5,16); Set516 = true;}

// end of macro

if (exec.Ismacrostopped())
{
if(Set516 == true) {exec.Setoutpin(5,16);} else {exec.Clroutpin(5,16); return;}
}

Most times when reading your post/thread I learn something new!

Thanks,
Dan
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Cancel a macro

Postby Robertspark » Fri Apr 27, 2018 6:28 am

Wow bit heated.

I can't read it all.

Crux of the matter as I understand it..

You press the ESC key and you are pissed that all ports and pins reset and clear, with the potential of dropping expensive tools ($1200 probe).

Don't shoot the messenger...

But why are you relying on software to protect or hold your tools?

What would happen under a power failure?

Would the software enabled ports and pins not drop out?

Why don't you use a fail safe arrangement with 2-stage electro mechanical interlocks which can still be driven by ports and pins but there is zero chance of disengaging the tool then or whatever other important iOS .

In simple terms, use I output to trigger a relay , which is then latched, and requires a second output to be high to toggle a second relay which will disengage the first

The same way push button motor starters work.

You may require a third port and pin to drive a mechanical unlock / release bolt.... No chance of dropping the tool.

If it's pneumatics then that is another matter but can be done given the tool should be fail safe locked in position. Again just use a two stage interlock arrangement for your electrical side
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Cancel a macro

Postby Dan911 » Fri Apr 27, 2018 9:09 am

Vmax549 wrote:Hi Dan. It is actually easier than that.


Yes it is, taking another quick deeper look there is no need for a bool. Just using exec.Ismacrostopped() before any Setoutpin, Clroutpin like Deszoe previously posted is going to the job!

Dan
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Cancel a macro

Postby andrewbishop66 » Fri Apr 27, 2018 9:46 am

Hi Terry

would love to see this in operation just in case I get inspired to add ATC to my knee mill any chance of a video
sounds like an awesome system and have found this thread very informative without it getting silly as they sometimes do on the larger forums

thanks everyone

Andrew
andrewbishop66
 
Posts: 103
Joined: Mon Dec 19, 2016 9:05 pm

Re: Cancel a macro

Postby Derek » Fri Apr 27, 2018 10:04 am

But why are you relying on software to protect or hold your tools?


The same reason I'm relying on software to machine my cylinder heads. Trust.


any chance of a video


I should have the carousel finished early next week. The arm assembly has been finished and I've done 200 or more tool out tool in cycles without a single miss.

Derek
Derek
 
Posts: 341
Joined: Mon Sep 05, 2016 9:57 am

PreviousNext

Return to Ask a question from support here

Who is online

Users browsing this forum: No registered users and 6 guests