HALUI description: MDI-command

More
15 Oct 2014 02:55 #52103 by HolgerT
Hi,

in HALUI documentation in chapter 1.2.12 MDI, there is written:
halui.mdi-command-<nn> (bit, in) - halui will try to send the MDI command defined in the ini. This will not always succeed, depending on the operating mode emc2 is in (e.g. while in AUTO halui can't successfully send MDI commands). If the command succeeds then it will place EMC in the MDI mode and then back to Manual mode.

Last sentence I do not understand in connection with sentence before. When exactly the command will not be successful? If the mode is AUTO - o.k. So I have to change the mode to MDI before - o.k. But last sentence assumes, mode is changed automatically.

My root problem in a HAL code file:
After pressing a button, I change to halui.mode.mdi and then I execute some M1xx command file to go to some certain position.
#!/bin/sh
# Rapid to Machine tool changer
# anheben
axis-remote -m G53G0Z110
# zum Toolchanger
axis-remote -m G53G0X500Y200
# absenken
axis-remote -m G53G0Z100
exit 0
After that I like to change back to halui.mode.manual to be able to move machine by joystick. But I need to know, when movement to G0Z100 has finished, to not give halui.mode.manual to early. It would be better, EMC changes mode by itself.

Any ideas are welcome.

thank you
br
Holger

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

More
15 Oct 2014 05:22 - 15 Oct 2014 05:23 #52109 by jtc
Replied by jtc on topic HALUI description: MDI-command
you can call a subroutine from axis-remote.
axis-remote -m o9999call

and put these codes with some logic, please see

linuxcnc.org/docs/html/gcode/o-code.html

and

linuxcnc.org/docs/html/gcode/overview.ht...ub:system-parameters

the pseudo-code should be something like that.
o9999sub

G53G0Z110
G53G0X500Y200
G53G0Z100

o9999 if [#5422 EQ 100]
  M100
o9999 endif


o9999endsub

the M100 you can do something like
setp halui.mode.manual true

maybe you should set the pin to false after a while...

João
Last edit: 15 Oct 2014 05:23 by jtc.
The following user(s) said Thank You: HolgerT

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

More
15 Oct 2014 23:19 #52120 by andypugh

When exactly the command will not be successful? If the mode is AUTO - o.k. So I have to change the mode to MDI before


AUTO mode == G-code program running.
Manual and MDI mode is related to, and linked to, the manual and MDI tabs in Axis. I don't entirely know how it works in other GUIs.

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

More
22 Oct 2014 01:06 - 22 Oct 2014 01:10 #52252 by HolgerT
Hi,
Sorry for late answer. Follow your hints, I could check and solve the problem last weekend.

It seems using o-code, each command is executed one by one (next command is started, after movement initiated by command before has finished). This also means, subroutine is ended only, when last G-Command is executed. In that context, I think it makes no sense to use
if [#5422 EQ 100]  .. endif
statement, because M100 will be executed not before movement of G53G0Z100 has finished.

Other the behavior using bash file and "axis-remote -m G53..." commands (like I did before). In that case all commands are sent one by one to axis, regardless whether moving has ended or not.

My solution is like below:

File M105, called by halui.mdi-command-05:
#!/bin/sh
# Rapid to Machine tool changer
axis-remote -m "o9105 call"
exit 0

File 9105.ngc, called from M105:
(goto machine tool change position 500 200 100)
o9105 sub

G53G0Z110
G53G0X500Y200
G53G0Z100

(change halui mode to manual)
M190

o9105 endsub

File M190, called from o9105:
#! /bin/bash
#
# kurzes Aktivieren des halcmd_setHaluiModeManual signals ueber meine Logik
# M90 wird aus den o-subroutines aufgerufen, um in den Manual-Mode zurueckzuschalten
# 
#
halcmd sets halcmd_setHaluiModeManual TRUE
sleep 0.4
halcmd sets halcmd_setHaluiModeManual FALSE
exit 0

halcmd_setHaluiModeManual is a self-defined hal-signal, which sets/resets halui.mode.manual behind some hal-logic.

Thank you for your support.
-Holger
Last edit: 22 Oct 2014 01:10 by HolgerT.
The following user(s) said Thank You: jtc

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

Moderators: HansU
Time to create page: 0.086 seconds
Powered by Kunena Forum