How to right sequence run - pause -stop

More
11 Jan 2011 11:44 #6612 by aike
Hi!
I use external button for START and STOP programm.
To start programm I use the same HAL code:

net strob-auto <= halui.mode.is-auto => not.5.in
net strob-auto-not <= not.5.out

net is-home-x <= halui.joint.0.is-homed => and2.6.in0
net is-home-z <= halui.joint.2.is-homed => and2.6.in1
net is-home-out <= and2.6.out => and2.7.in0
net start-program-btn <= hm2_5i20.0.gpio.032.in_not => and2.7.in1
net start-program <= and2.7.out
net start-program => and2.5.in0
net strob-auto-not => and2.5.in1
#set auto mode
net set-auto <= and2.5.out
net set-auto => halui.mode.auto
#set oneshot impulse length = 2 sec
setp oneshot.1.width 2
#make impulse lenth 2 sec
net set-auto => oneshot.1.in
net start-program-out => oneshot.1.out
net start-program-out => halui.program.run

but to stop the programm, i send pause first, and after thet the stop signal, but error message appears
here is my code:

net is-running <= halui.program.is-running
net is-paused <= halui.program.is-paused
net is-idle <= halui.program.is-idle

net stop-program-btn <= hm2_5i20.0.gpio.033.in_not => and2.8.in0
net is-running => and2.8.in1
net stop-program <= and2.8.out => halui.program.pause
net is-idle => not.6.in
net is-idle-not <= not.6.out => and2.9.in0
net is-paused => and2.9.in1
net is-stop <= and2.9.out => halui.program.stop

What I need to do to stop programm clear?

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

More
11 Jan 2011 12:15 #6613 by andypugh
I am afraid I don't know the correct way to sequence start and stop.
However, you can probably investigate it by using the command line.

If you open a new terminal while emc2 is running you can type commands like

halcmd setp halui.program.run 1

And experiment with the correct sequencing.
You can also do this from the machine->show hal config window, but:
1) That window doesn't allow tab completion or history (up-arrow) so is rather more tedious.
2) You can's see the text box with the "Watch" window open, and you probably want that open to see what is going on.

Alternatively (and this is even more work) you could create a pycvp panel with checkboxes for the command pins and LEDs for the status pins.

If you do figure it all out, or if you find that there is a definite error (I am sure it used to be easier) then please document it, or post a bug report.

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

More
11 Jan 2011 12:57 #6614 by BigJohnT
This is my external Run button

# External Program Run Button
net program-run-btn halui.mode.auto <= hm2_5i20.0.gpio.031.in_not
net program-run-btn and2.2.in0
net program-is-auto and2.2.in1 <= halui.mode.is-auto
net remote-prg-run halui.program.run <= and2.2.out

I don't think it is as clear as it could be, but if your running you can't set halui.program.run to true or you get an error.

Stop is simpler, simply set halui.program.stop true to stop a program.

A pause/resume button just needs to check the current state of is-paused and is-running.

John

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

More
11 Jan 2011 16:55 #6629 by aike
BigJohnT wrote:

This is my external Run button


Stop is simpler, simply set halui.program.stop true to stop a program.

A pause/resume button just needs to check the current state of is-paused and is-running.

John

Not so
I use pyvcp to test.
Here is code example:

net prog-stop <= pyvcp.prog-stop => halui.program.stop

after the press "stop" button the message:
cannot do it
(EMC_TRAJ_SET_TELEOP_ENABLE) in auto mode with stopped interpr..

and the EMC stay in AUTO mode. None key accepted till I press F5 to switch to MDI mode and back to F3 mode.

The solution you sujested not work. What did I wrong?

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

More
11 Jan 2011 18:53 #6630 by BigJohnT
Not sure what you did wrong but I just made a sim config and added this line to my postgui.hal file

net pyvcp-stop halui.program.stop <= pyvcp.stop-button

my xml file

<pyvcp>
<button>
<halpin>"run-button"</halpin>
<text>"Program Start"</text>
</button>
<button>
<halpin>"stop-button"</halpin>
<text>"Program Stop"</text>
</button>
</pyvcp>

Each time I start Axis with the run button on axis I can stop it with no problem with the pyvcp stop button.

John

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

More
11 Jan 2011 19:07 #6631 by BigJohnT
Here is the start stop hal I used to test.


# External Run Button
loadrt and2 count=1
addf and2.0 servo-thread
net pyvcp-auto halui.mode.auto and2.0.in1 <= pyvcp.run-button
net is-auto and2.0.in0 <= halui.mode.is-auto
net pyvcp-run halui.program.run <= and2.0.out

# External Stop Button
net pyvcp-stop halui.program.stop <= pyvcp.stop-button

You might have to hold the run button for a second to allow time for is-auto to come back as the mode.auto pin is a request not a demand.

John

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

More
11 Jan 2011 20:01 #6632 by aike
The problem solved
I assign the time delay 1 sec after the pause and befor the stop pressed

################
# stop program #
################

net is-running <= halui.program.is-running
net is-running => and2.0.in0
net prog-stop-btn <= pyvcp.prog-stop
net prog-stop-btn => and2.0.in1
net set-pause <= and2.0.out => halui.program.pause

setp timedelay.1.on-delay 1
setp timedelay.1.off-delay 0
net strob-pause <= halui.program.is-paused => timedelay.1.in
net prog-stop <= timedelay.1.out => halui.program.stop
The following user(s) said Thank You: HolgerT

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

More
11 Jan 2011 21:01 #6634 by BigJohnT
Why do you pause then stop?

John

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

More
12 Jan 2011 03:16 #6638 by aike
BigJohnT wrote:

Why do you pause then stop?

John

Because if I send true to hului.program.stop, then the message apeears:

cannot do it
(EMC_TRAJ_SET_TELEOP_ENABLE) in auto mode with stopped interpr..


and the EMC will stop in auto mode!
I have to switch it in manual mode by pressing F5(MDI) then F3(man mode) in AXIS interface.
May be it's EMC internal bug, but I use 2.4.6 version with ubuntu 10.x, in 8.04 is the same problem.

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

More
12 Jan 2011 12:41 #6645 by BigJohnT
I set up a sim with two buttons configured as I posted earlier and I don't get that error when pressing the stop button using 2.4.2 I think... I'll have to try it on a real config to see if I can reproduce your error.

If your not running any special hardware like mesa or pico can you zip up your config and attach it to a message?

John

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

Time to create page: 0.117 seconds
Powered by Kunena Forum