= Moveoff Component

The moveoff Hal component is a Hal-only method
for implementing offsets.  See the manpage (man moveoff)
for the IMPORTANT limitations and warnings.

Sim configurations that demonstrate the component and a
gui (moveoff_gui) are located in:

* configs/sim/axis/moveoff     (axis-ui)
* configs/sim/touchy/ngcgui    (touchy-ui)


== Modifying an existing configuration

An existing configuration can be modified to use moveoff_gui
as follows:

. Make inifile entries for HALUI and LIB:hookup_moveoff.tcl.
  The entry for hookup_moveoff.tcl should follow HALFILES
  that connect the pins for axis.N.motor-pos-cmd, axis.N.motor-pos-fb,
  and components connected to these pins (pids and encoders
  typically).

----
[HAL]
HALUI = halui
...
HALFILE = LIB:hookup_moveoff.tcl
----

. Add inifile entries for the per-axis settings for
  each axis in use (If an entry is not defined, the
  corresponding entry from the [AXIS_n} section
  will be used, if no entry is found, then the moveoff
  component default is used(NOT RECOMMENDED)):

----
[MOVEOFF_n]
MAX_LIMIT =
MIN_LIMIT =
MAX_VELOCITY =
MAX_ACCELERATION =
----

. Add inifile entries for moveoff component settings
  (omit to use moveoff defaults):

----
[MOVEOFF]
EPSILON =
WAYPOINT_SAMPLE_SECS =
WAYPOINT_THRESHOLD =
----

. Add inifile entries to start the gui:

----
[APPLICATIONS]
# Note: a delay may be required if there are [HAL]POSTGUI_HALFILE dependencies
DELAY = 0
APP = moveoff_gui option1 option2 ...
----

For details on available Options, Use:

----
$ moveoff_gui --help

Usage:
moveoff_gui [Options}

Options:
   [--help | -? | -- -h ]  (This text)

   [-mode [onpause | always]]  (default: onpause)
                                 (onpause: show gui when program paused)
                                 (always:  show gui always)

   [-axes axisnames]       (default: xyz (no spaces))
                             (letters from set of: x y z a b c u v w)
                             (example: -axes z)
                             (example: -axes xz)
                             (example: -axes xyz)
   [-inc incrementvalue]   (default: 0.001 0.01 0.10 1.0 )
                             (specify one per -inc (up to 4) )
                             (example: -inc 0.001 -inc 0.01 -inc 0.1 )
   [-size integer]         (default: 14
                             (Overall gui popup size is based on font size)
   [-loc center|+x+y]      (default: center)
                             (example: -loc +10+200)
   [-autoresume]           (default: not used)
                             (resume program when move-enable deasserted)
   [-delay delay_secs]     (default: 5 (resume delay))

Options for special cases:
   [-noentry]              (default: not used)
                             (don't create entry widgets)
   [-no_resume_inhibit]    (default: not used)
                             (do not use a resume-inhibit-pin)
   [-no_pause_requirement] (default: not used)
                             (no check for halui.program.is-paused)
----

The moveoff_gui will provide a display and and control for
enabling offsetting if the pin mv.move-enable is NOT connected
when moveoff_gui is started.

If the mv.move-enable pin is connected when moveoff_gui
is started, the gui will provide a display but no controls.
This mode supports Hal connections for a jog wheel or other
methods of controlling the enable and offset input pins
(mv.move-enable, mv.offset-M, mv.backtrack-enable).

If the halfile LIB:hookup_moveoff.tcl is used to load and connect the
moveoff component, the mv.move-enable pin is not connected and
local controls provided by moveoff_gui will be used.  To enable external
controls, subsequent halfiles should connect the mv.move-enable pin.
For example, the configs/sim/* demo configurations use a simple halfile
to connect the mv.move-enable,mv.offset-in-M, and  mv.bactrack-enable
pins to signals:

----
[HAL]
HALUI = halui
...
HALFILE = LIB:hookup_moveoff.tcl
HALFILE = LIB:moveoff_external.hal
----
