
\chapter{Hal User Interface\label{cha:Hal-User-Interface}}


\section{\label{sec:HaluiIntroduction}Introduction}

Halui is a HAL based user interface for EMC, it connects HAL pins
to NML commands. Most of the functionality (buttons, indicators etc.)
that is provided by a traditional GUI (mini, Axis, etc.), is provided
by HAL pins in Halui.

The easiest way to add halui is to add the following to the {[}HAL{]}
section of the ini file.
\begin{quote}
HALUI = halui
\end{quote}
An alternate way to invoke it (especially when using a stepconf generated
config file) is to include the following in your custom.hal file.
Make sure you use the actual path to your ini file.
\begin{quote}
loadusr halui -ini /path/to/inifile.ini
\end{quote}
in your custom.hal file.


\section{\label{sec:Halui-pin-reference}Halui pin reference}


\subsection{Abort}
\begin{itemize}
\item halui.abort (bit, in) - pin to send an abort message (clears out most
errors)
\end{itemize}

\subsection{Axis}
\begin{itemize}
\item halui.axis.n.pos-commanded (float, out) - Commanded axis position
in machine coordinates
\item halui.axis.n.pos-feedback (float, out) - Feedback axis position in
machine coordinates
\item halui.axis.n.pos-relative (float, out) - Commanded axis position in
relative coordinates
\end{itemize}

\subsection{E-Stop}
\begin{itemize}
\item halui.estop.activate (bit, in) - pin for requesting E-Stop
\item halui.estop.is-activated (bit, out)- indicates E-stop reset
\item halui.estop.reset (bit, in) - pin for requesting E-Stop reset
\end{itemize}

\subsection{Feed Override}
\begin{itemize}
\item halui.feed-override.count-enable (bit, in) - must be true for counts
to work.
\item halui.feed-override.counts (s32, in) - counts from an encoder to change
FO
\item halui.feed-override.decrease (bit, in) - pin for decreasing the FO
(-=scale)
\item halui.feed-override.increase (bit, in) - pin for increasing the FO
(+=scale)
\item halui.feed-override.scale (float, in) - pin for setting the scale
for increase and decrease
\item halui.feed-override.value (float, out) - current FO value
\end{itemize}

\subsection{Flood}
\begin{itemize}
\item halui.flood.is-on (bit, out) - indicates flood is on
\item halui.flood.off (bit, in) - pin for requesting flood off
\item halui.flood.on (bit, in) - pin for requesting flood on
\end{itemize}

\subsection{Homing}
\begin{itemize}
\item halui.home-all (bit, in) - pin for requesting all axis to home. This
pin will only be there is HOME\_SEQUENCE is set in the ini file.
\item 
\end{itemize}

\subsection{Jog}

<n> is a number between 0 and 8 and 'selected'.
\begin{itemize}
\item halui.jog-deadband (float, in) - deadband for analog jogging (smaller
jogging speed requests are not performed)
\item halui.jog-speed (float, in) - pin for setting jog speed for minus/plus
jogging
\item halui.jog.<n>.analog (float, in) - analog velocity input for jogging
(usefull with joysticks or other analog devices)
\item halui.jog.<n>.minus (bit, in)- pin for jogging axis <n> in negative
direction at the halui.jog.speed velocity
\item halui.jog.<n>.plus (bit, in) - pin for jogging axis <n> in positive
direction at the halui.jog.speed velocity
\item halui.jog.selected.minus (bit, in) - pin for jogging the selected
axis in negative direction at the halui.jog.speed velocity
\item halui.jog.selected.plus (bit, in) - pin for jogging the selected axis
in positive direction at the halui.jog.speed velocity
\end{itemize}

\subsection{Joint}

<n> is a number between 0 and 8 and 'selected'.
\begin{itemize}
\item halui.joint.<n>.has-fault (bit, out) - status pin telling the joint
has a fault
\item halui.joint.<n>.home (bit, in) - pin for homing the specific joint 
\item halui.joint.<n>.is-homed (bit, out) - status pin telling that the
joint is homed
\item halui.joint.<n>.is-selected bit (bit, out) - status pin a joint is
selected - internal halui
\item halui.joint.<n>.on-hard-max-limit (bit, out) - status pin telling
joint <n> is on the positive hardware limit switch
\item halui.joint.<n>.on-hard-min-limit (bit, out) - status pin telling
joint <n> is on the negative hardware limit switch
\item halui.joint.<n>.on-soft-max-limit (bit, out) - status pin telling
joint <n> is at the positive software limit
\item halui.joint.<n>.on-soft-min-limit (bit, out) - status pin telling
joint <n> is at the negative software limit
\item halui.joint.<n>.select (bit, in) - select joint (0..7) - internal
halui
\item halui.joint.<n>.unhome (bit, in) - unhomes this joint
\item halui.joint.selected (u32, out) - selected joint (0..7) - internal
halui
\item halui.joint.selected.has-fault (bit, out) - status pin telling that
the joint <n> has a fault
\item halui.joint.selected.home (bit, in) - pin for homing the selected
joint 
\item halui.joint.selected.is-homed (bit, out) - status pin telling that
the selected joint is homed
\item halui.joint.selected.on-hard-max-limit (bit, out) - status pin telling
that the selected joint is on the positive hardware limit
\item halui.joint.selected.on-hard-min-limit (bit, out) - status pin telling
that the selected joint is on the negative hardware limit
\item halui.joint.selected.on-soft-max-limit (bit, out) - status pin telling
that the selected joint is on the positive software limit
\item halui.joint.selected.on-soft-min-limit (bit, out) - status pin telling
that the selected joint is on the negative software limit
\item halui.joint.selected.unhome (bit, in) - pin for unhoming the selected
joint
\end{itemize}

\subsection{Lube}
\begin{itemize}
\item halui.lube.is-on (bit, out) - indicates lube is on
\item halui.lube.off (bit, in) - pin for requesting lube off
\item halui.lube.on (bit, in) - pin for requesting lube on
\end{itemize}

\subsection{Machine}
\begin{itemize}
\item halui.machine.is-on (bit, out) - indicates machine on
\item halui.machine.off (bit, in) - pin for requesting machine off
\item halui.machine.on (bit, in) - pin for requestiong machine on
\end{itemize}

\subsection{Max Velocity}

The maximum linear velocity can be adjusted from 0 to the MAX\_VELOCITY
that is set in the {[}TRAJ{]} section of the ini file.
\begin{itemize}
\item halui.max-velocity.count-enable (bit, in) - when TRUE, modify max
velocity when counts changes
\item halui.max-velocity.counts (s32, in) - lets you hook up an encoder
to change the max velocity
\item halui.max-velocity.decrease (bit, in) - pin for decreasing max velocity
\item halui.max-velocity.increase (bit, in) - pin for increasing max velocity
\item halui.max-velocity.scale (float, in) - the amount applied to the current
maximum velocity with each transition from off to on of the increase
or decrease pin in machine units per second.
\item halui.max-velocity.value (float, out) - is the maximum linear velocity
in machine units per second.
\end{itemize}

\subsection{MDI\label{sub:MDI}}

Sometimes the user wants to add more complicated tasks to be performed
by the activation of a HAL pin. This is possible using the following
MDI commands scheme:
\begin{itemize}
\item The MDI\_COMMAND is added to the ini file in the {[}HALUI{]} section. \end{itemize}
\begin{quote}
{[}HALUI{]} \\
MDI\_COMMAND = G0 X0\end{quote}
\begin{itemize}
\item When halui starts it will read the MDI\_COMMAND fields in the ini,
and export pins from 00 to the number of MDI\_COMMAND's found in the
ini up to a maximum of 64 commands.
\item 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.
\end{itemize}

\subsection{Mist }
\begin{itemize}
\item halui.mist.is-on (bit, out) - indicates mist is on
\item halui.mist.off (bit, in) - pin for requesting mist off
\item halui.mist.on (bit, in) - pin for requesting mist on
\end{itemize}

\subsection{Mode}
\begin{itemize}
\item halui.mode.auto (bit, in) - pin for requesting auto mode
\item halui.mode.is-auto (bit, out) - indicates auto mode is on
\item halui.mode.is-joint (bit, out) - pin showing joint by joint jog mode
is on
\item halui.mode.manual (bit, in) - pin for requesting manual mode
\item halui.mode.is-manual (bit, out) - indicates manual mode is on
\item halui.mode.is-mdi (bit, out) - indicates mdi mode is on
\item halui.mode.is-teleop (bit, out) - pin showing coordinated jog mode
is on
\item halui.mode.joint (bit, in) - pin for requesting joint by joint jog
mode
\item halui.mode.manual (bit, in) - pin for requesting manual mode
\item halui.mode.mdi (bit, in) - pin for requesting mdi mode
\end{itemize}

\subsection{Program}
\begin{itemize}
\item halui.program.block-delete.is-on (bit, out) -
\item halui.program.block-delete.off (bit, in) -
\item halui.program.block-delete.on (bit, in) -
\item halui.program.is-idle (bit, out) - status pin telling that no program
is running
\item halui.program.is-paused (bit, out) - status pin telling that a program
is paused
\item halui.program.is-running (bit, out) - status pin telling that a program
is running
\item halui.program.optional-stop.is-on (bit, out) -
\item halui.program.optional-stop.off (bit, in) -
\item halui.program.optional-stop.on (bit, in) -
\item halui.program.pause (bit, in) - pin for pausing a program
\item halui.program.resume (bit, in) - pin for resuming a paused program
\item halui.program.run (bit, in) - pin for running a program
\item halui.program.step (bit, in) - pin for stepping in a program
\item halui.program.stop (bit, in) - pin for stopping a program
\end{itemize}

\subsection{Spindle Override}
\begin{itemize}
\item halui.spindle-override.count-enable (bit, in) - when TRUE, modify
spindle override when counts changes.
\item halui.spindle-override.counts (s32, in) - counts from an encoder for
example to change SO
\item halui.spindle-override.decrease (bit, in)- pin for decreasing the
SO (-=scale)
\item halui.spindle-override.increase (bit, in) - pin for increasing the
SO (+=scale)
\item halui.spindle-override.scale (float, in) - pin for setting the scale
on changing the SO
\item halui.spindle-override.value (float, out) - current SO value
\end{itemize}

\subsection{Spindle}
\begin{itemize}
\item halui.spindle.brake-is-on (bit, out) - indicates brake is on
\item halui.spindle.brake-off (bit, in) - pin for deactivating spindle/brake
\item halui.spindle.brake-on (bit, in) - pin for activating spindle-brake
\item halui.spindle.decrease (bit, in) - decreases spindle speed
\item halui.spindle.forward (bit, in) - starts the spindle with CW motion
\item halui.spindle.increase (bit, in)- increases spindle speed
\item halui.spindle.is-on (bit, out) -
\item halui.spindle.reverse (bit, in)- starts the spindle with a CCW motion
\item halui.spindle.runs-backward (bit, out) -
\item halui.spindle.runs-forward (bit, out) -
\item halui.spindle.start (bit, in) - starts the spindle
\item halui.spindle.stop (bit, in) - stops the spindle
\end{itemize}

\subsection{Tool}
\begin{itemize}
\item halui.tool.length-offset (float, out) - indicates current applied
tool-length-offset
\item halui.tool.number (u32, out) - indicates current selected tool
\end{itemize}

