PROGRAM STOP BUTTON - ERROR

More
03 Feb 2019 20:50 #125608 by Askjerry
Here is an interesting one...

I have two buttons programmed on a pyVCP panel... PROGRAM RUN and PROGRAM STOP.

I figured out quickly that the PROGRAM RUN button could ONLY be triggered in AUTO mode... so I did this...

CUSTOM_POST_GUI.HAL
net panel-pg-run    <= halui.program.run   <= halui.mode.auto   <= pyvcp.PRGM-RUN

That works great...

Now the stop button... it stops... but with an error...

CUSTOM_POST_GUI.HAL
net panel-pg-stop   <= halui.program.stop  <= pyvcp.PRGM-STOP

I get the following...
can't do that (EMC_TRAJ_SET_TELOP_ENABLE)
in auto mode with the interpreter idle


So what am I missing??
Thanks,
Jerry

Please Log in or Create an account to join the conversation.

More
03 Feb 2019 22:24 - 03 Feb 2019 22:29 #125615 by Grotius
Replied by Grotius on topic PROGRAM STOP BUTTON - ERROR
Maybe, you can try one of this below :

#real mode :
#net estop-out <= iocontrol.0.user-enable-out
#net estop-ext => iocontrol.0.emc-enable-in
#net estop-ext => halui.program.stop

==> net estop-ext => your i/0 pin for emergency brake circuit, i changed to halui for you, but better is choosing a real hardware circuit pin for real machines without simulation. Fail safe.

#simulation mode :
net estop iocontrol.0.emc-enable-in iocontrol.0.user-enable-out
Last edit: 03 Feb 2019 22:29 by Grotius.

Please Log in or Create an account to join the conversation.

More
03 Feb 2019 22:47 #125618 by Askjerry
It is not an ESTOP button... we do not want to put the machine in ESTOP mode... although i suppose that is one way to do it.

We simply want to do the same thing as hitting the square stop button at the top of the screen...


If a program is running and you hit this... the program stops. That is what i am attempting to replicate.

Thanks,
Jerry
Attachments:

Please Log in or Create an account to join the conversation.

More
03 Feb 2019 23:03 - 03 Feb 2019 23:13 #125619 by Grotius
Replied by Grotius on topic PROGRAM STOP BUTTON - ERROR
Hi Jerry,

Why don't you use a gscreen gui? It makes life easy for you... You can say
"program stop" in python.

Hal.ui command's alway's worked for me. I don't use them because i alway's program in python or c.
I only couple my ethercat side in hal and some stuff that are hal button's from glade without defining them in the gui first, that is more a lazy action. But Gmocappy is more accurate in that way.

Maybe you can try : halui.abort
it does the same as program stop, it's only more written to top level.
Last edit: 03 Feb 2019 23:13 by Grotius.

Please Log in or Create an account to join the conversation.

More
03 Feb 2019 23:29 #125622 by cmorley
Replied by cmorley on topic PROGRAM STOP BUTTON - ERROR

Askjerry wrote:
I get the following...

can't do that (EMC_TRAJ_SET_TELOP_ENABLE)
in auto mode with the interpreter idle


So what am I missing??
Thanks,
Jerry


My thought:
EMC_TRAJ_SET_TELOP_ENABLE indicates to me that the machine was in joint mode when you pressed stop.
that is a mode that you can't run a program in - so pressing stop is useless - but I would say linuxcnc should ignore it rather then error on it.
Does this sound likely? (could probably test by keeping track what mode linuxcnc is in with the status program)
If I'm right it would require code changes either in HALUI or better in linuxcnc's motion controller.
In gladevcp we would disable the stop button to limit this possibility, PyVCP can not IIRC.

My 2 cents

Chris M

Please Log in or Create an account to join the conversation.

More
04 Feb 2019 01:23 - 04 Feb 2019 01:27 #125627 by Askjerry
Grotius - That may work... but at the moment I know how to make panels in GLADE and pyVCP... I have not used, and I am not familiar with gscreen gui so I'll have to research it... but most likely I'll go a different route for now. (I'm patching an existing machine.)

The halui.abort may work... and it is easy to try... that will be my first attempt.

cmorley - It is just a standard insttall of LinuxCNC with an X-Y-Z configuration running a typical G-Code file... nothing special.

Thanks,
Jerry
Last edit: 04 Feb 2019 01:27 by Askjerry.

Please Log in or Create an account to join the conversation.

More
04 Feb 2019 02:05 - 04 Feb 2019 02:29 #125628 by phillc54
You could try something like:
loadrt and2 count=1
loadrt or2 count=1
addf and2.0 servo=thread
addf or2.0 servo=thread
net is-running-flag halui.program.is-running => or2.0.in0
net is-paused-flag halui.program.is-paused => or2.0.in1
net run-or-pause-flag or2.0.out => and2.0.in0
net stop-button pyvcp.PRGM-STOP => and2.0.in1
net stop-signal and2.0.out => halui.program.stop

Cheers, Phill
Last edit: 04 Feb 2019 02:29 by phillc54.

Please Log in or Create an account to join the conversation.

More
04 Feb 2019 02:59 #125629 by Askjerry
phillc54 - I could be reading what you have incorrectly... but it looks like you are tying is-running and is-paused as two inputs... which will be true when running... so the stop command would be applied... but I see that as till hitting the error fail as it is going to be in the same state as without checking.

Here is the actual code as it is now...
net panel-spindle-on    <= halui.spindle.start     <= pyvcp.SPINDLE-START
    net panel-spindle-off   <= halui.spindle.stop      <= pyvcp.SPINDLE-STOP

    net panel-pg-pause      <= halui.program.pause     <= pyvcp.PRGM-PAUSE    
    net panel-pg-resume     <= halui.program.resume    <= pyvcp.PRGM-RESUME
    net panel-pg-step       <= halui.program.step      <= pyvcp.PRGM-STEP

    net panel-led-spindle   <= halui.spindle.is-on     => pyvcp.LED-SPINDLE
    net panel-led-program   <= halui.program.is-idle   => pyvcp.LED-PGM-RUN
    
    net panel-pg-run        <= halui.program.run       <= halui.mode.auto     <= pyvcp.PRGM-RUN                               
    net panel-pg-stop       <= halui.program.stop                             <= pyvcp.PRGM-STOP

As you can see... the pyvcp.PRGM-RUN button pushes halui.mode.auto and and the halui.program.run signals... likely in that order. So it gets pushed to AUTO mode, then gets the RUN command... works beautifully.

If I hit the PAUSE button, then hit the STOP button... it works.

So what I would love to do is...
net panel-pg-stop       <= halui.program.stop    <= halui.program.pause    <= pyvcp.PRGM-STOP

But even removing the PAUSE button and trying it... I still get the error.
I also tried the suggested halui.abort which also failed.

It appears that I need to trigger a pause... then trigger a stop afterward... not sure how to do that. Or figure out what mode the system expects to be in... then do it.

Or... and I don't know if this is possible... fake it out so it thinks the user pressed the ESC key... because that works fine.

Is that possible... point the pyvcp.PRGM-STOP to trigger a keystroke???

Jerry

Please Log in or Create an account to join the conversation.

More
04 Feb 2019 04:36 - 04 Feb 2019 04:42 #125632 by phillc54
The intention was to only send a stop command if the program is either running or paused and the stop button (in your panel) is pressed.

I tried the following on both 2.7 and master.

If a program is either running or paused then issue:
setp halui.program.stop 1
The program stops without errors.

If a program is stopped then issue:
setp halui.program.stop 1
No error messages.

I also found that:
setp halui.program.run 1
Runs the program, halui.mode auto was NOT required, even if the MDI tab was active.

The only way I could get your original error message was:
If the program is running:
setp halui.program.run 1
Gives the error message:
can't do that (EMC_TRAJ_SET_TELOP_ENABLE)
in auto mode with the interpreter idle

Also:
If the program is paused:
setp halui.program.run 1
Gives the error message:
can't do that (EMC_TRAJ_SET_TELOP_ENABLE)
in auto mode with the interpreter paused

I think the above two error messages are to be expected.

Cheers, Phill

PS You need to setp back to 0 after each time.

Which version are you using and could you post your xml and postgui_hal file
Last edit: 04 Feb 2019 04:42 by phillc54.

Please Log in or Create an account to join the conversation.

More
04 Feb 2019 05:38 - 04 Feb 2019 05:41 #125634 by Askjerry
Not sure how I would tie a SETP to a pyvcp button... let alone how to make it set then reset on a single button press.

The ZIP file for it all is attached... I'm writing it for a friend in Brazil... and he speaks Portuguese... you know... just to make the project more interesting... :blink:

File Attachment:

File Name: RENERCNC.zip
File Size:431 KB


The bottom two rows...

[ PROGRAM RUN ] [ LED INDICATOR ] [ PROGRAM STOP ]
[ PROGRAM PAUSE ] [ PROGRAM STEP ] [ PROGRAM RESUME ]

... I should really swap the RED and GREEN... hummm... :whistle:

That is the layout...if that helps... :)
Attachments:
Last edit: 04 Feb 2019 05:41 by Askjerry.

Please Log in or Create an account to join the conversation.

Time to create page: 0.114 seconds
Powered by Kunena Forum