XHC-HB04(1)

NAME
xhc-hb04 - HAL non-realtime component for the xhc-hb04 pendant.

DESCRIPTION
The xhc-hb04 component supports a common USB pendant that provides a number of pushbuttons, a manual pulse generator (mpg or jog wheel), and a selector switch for the wheel.

There are at least two hardware versions -- one with 16 buttons and a more common one with 18 buttons. The information herein is based on the 18 button device with a USB Vendor:Product code of 10CE:EB70.

In addition to buttons, the pendant provides an LCD display for the current stepsize multiplier (from a set of available integer values), position (absolute and relative, labeled MC and WC respectively), feedrate (override percent and value in units per minute), and spindle speed (override percent and value in revolutions per minute (RPM)). The display is managed by a rotary switch that selects one of four axes for wheel positioning, feed override, spindle override, or OFF.

The pendant display, its rotary selector switch, and the component pin names use designators x,y,z,a. While this arrangement presumes a machine configured as XYZA, the pins can be assigned independently as required in a HAL configuration.

UDEV
The xhc-hb04 executable needs permission for reading the pendant's USB device. Debian package installs (debs) handle this automatically but Run-In-Place (RIP) builds may need a udev rules file. This file should be created (using sudo and a text editor) as:

/etc/udev/rules.d/99-xhc-hb04.rules with the single line:

ATTR{idProduct}=="eb70", ATTR{idVendor}=="10ce", MODE="0666", OWNER="root", GROUP="plugdev"

Standalone Usage
The xhc-hb04 program can be run from the command line without LinuxCNC to test a pendant in a simulation mode. This standalone mode is used to identify the button codes produced for each button press and to verify proper counting of the jog wheel. The identified button codes can be used to create a button-cfg-file. When a button-cfg-file exists, pendant operation can be verified using the -I option to specify the file.

Usage:

$ xhc-hb04 [options]

Options

-h    list command line options and exit

-I button-cfg-file (see below for file format)

-H    run in real-time HAL mode (simulation mode is default)

-x    wait for pendant detection before creating HAL pins.

-s   n  n is one of the following stepsize sequences

      1: 1,10,100,1000 (default)
      2: 1,5,10,20
      3: 1,10,100
      4: 1,5,10,20,50,100
      5: 1,10,50,100,1000
      The stepsize selected is always multiplied by 0.001

button-cfg-file format
Standard configuration files are provided in the distribution for known button configurations:
   /usr/share/linuxcnc/hallib/xhc-hb04-layout1.cfg
   /usr/share/linuxcnc/hallib/xhc-hb04-layout2.cfg
or for a RIP build:
   rip_base_dir/lib/hallib/xhc-hb04-layout1.cfg
   rip_base_dir/lib/hallib/xhc-hb04-layout2.cfg

layout1 describes the 16 button pendant, layout2 describes the more common 18 button pendant.

The button configuration file follows the same format as INI files but should use a file suffix of .cfg.

File format:
  [XHC-HB04]
  BUTTON=X1:button-thename1
  BUTTON=X2:button-thename2
  BUTTON=X3:button-thename3
  etc.

XN is the code reported for a button press and button-thenameN is the name to be assigned to the pin created for the button.

HAL Usage
Use the -H option to specify HAL mode and other options as required:

loadusr -W xhc-hb04 -H [Options]

Example: loadusr -W xhc-hb04 -H -I path_to_cfg_file -s 2

Input Pins (Control)

(bit in) xhc-hb04.stepsize-up
    A 1 pulse on this pin changes the stepsize to the next higher stepsize in the stepsize sequence specified in the xhc-hb04 (loadusr) command.

(bit in) xhc-hb04.stepsize-down
    A 1 pulse on this pin changes the stepsize to the next lower stepsize in the stepsize sequence specified in the xhc-hb04 (loadusr) command.

Input Pins (to the pendant LCD display)

(float in) xhc-hb04.[xyza].pos-absolute
    Absolute position display. The LCD display for pos-absolute is fixed format with a sign, 4 number digits and 3 fraction digits (+XXXX.XXX), require: -9999.999 <= value <= 9999.999 (typically connect to: halui.axis.N.pos-feedback).

(float in) xhc-hb04.[xyza].pos-relative
    Relative position display (typically connect to: halui.axis.N.pos-relative). The LCD display for pos-relative is fixed format with a sign, 4 number digits and 3 fraction digits (+XXXX.XXX), require: -9999.999 <= value <= 9999.999.

(float in) xhc-hb04.feed-override
    Feed-override value. The float value is converted to a 16 bit integer and multiplied by 100 in order to display as percent, require: 0 <= pinvalue <= 655 (typically connect to: halui.feed-override.value).

(float in) xhc-hb04.feed-value
    Current Feed-value (units/sec). The float value is converted to a 16 bit integer and multiplied by 60 in order to display as units-per-minute, require: 0 <= pinvalue <= 1092 (65520 units-per-minute) (typically connect to: motion.current-vel).

(float in) xhc-hb04.spindle-override
    Spindle-override value. The float value is converted to a 16 bit integer and multiplied by 100 in order to display as percent, require: 0 <= pinvalue <= 655) (typically connect to: halui.spindle-override.value).

(float in) xhc-hb04.spindle-rps
    Spindle speed in RPS (revolutions per second). The float value is converted to a 16 bit integer and multiplied by 60 in order to display as RPMs, require: 0 <= pinvalue <= 1092 (65520 RPM) (typically connect to: spindle.N.speed-out-rps-abs).

(bit in) xhc-hb04.inch-icon
    Use inch icon (default is mm):

Output Pins (Status)

(bit out) xhc-hb04.sleeping
    True when the driver receives a pendant inactive (sleeping) message.

(bit out) xhc-hb04.jog.enable-off
    True when the pendant rotary selector switch is in the OFF position or when the pendant is sleeping.

(bit out) xhc-hb04.enable-[xyza]
    True when the pendant rotary selector switch is in the [xyza] position and not sleeping.

(bit out) xhc-hb04.enable-spindle-override
    True when the pendant rotary selector switch is in the Spindle position and not sleeping (typically connect to: halui.spindle-override-count-enable).

(bit out) xhc-hb04.enable-feed-override
    True when the pendant rotary selector switch is in the feed position and not sleeping (typically connect to: halui.feed-override-count-enable).

(bit out) xhc-hb04.connected
    True when connection to the pendant is established over the USB interface.

(bit out) xhc-hb04.require_pendant
    True if driver started with the -x option.

(s32 out) xhc-hb04.stepsize
    Current stepsize in the stepsize sequence as controlled by the stepsize-up and/or stepsize-down pins.

Output Pins (for jogging using axis.N.jog-counts)

(s32 out) xhc-hb04.jog.counts
    Number of counts of the wheel since start-up (50 counts per wheel revolution) (typically connect to axis.N.jog-counts (lowpass filtering may be helpful)).

(s32 out) xhc-hb04.jog.counts-neg
    The value of the xhc-hb04.jog.counts multiplied by -1.

(float out) xhc-hb04.jog.scale
    Value is the current stepsize multiplied by 0.001 (typically connect to axis.N.jog-scale).

Experimental: Pins for halui plus/minus jogging.
These pins provide some support for non-trivkins, world mode jogging.

(float in) xhc-hb04.jog.max-velocity
    Connect to halui.max-velocity.value.

(float out) xhc-hb04.jog.velocity
    Connect to halui.jog-speed.

(bit out) xhc-hb04.jog.plus-[xyza]
    Connect to halui.jog.N.plus.

(bit out) xhc-hb04.jog.minus-[xyza]
    Connect to halui.jog.N.minus.

(float out) xhc-hb04.jog.increment
    Debug pin -- abs(delta_pos).

Button output pins (for the 18 button, layout2 pendant)
The output bit type pins are TRUE when the button is pressed.

ROW 1
    (bit out) xhc-hb04.button-reset
    (bit out) xhc-hb04.button-stop

ROW 2
    (bit out) xhc-hb04.button-goto-zero
    (bit out) xhc-hb04.button-rewind
    (bit out) xhc-hb04.button-start-pause
    (bit out) xhc-hb04.button-probe-z

ROW 3
   (bit out) xhc-hb04.button-spindle
   (bit out) xhc-hb04.button-half
   (bit out) xhc-hb04.button-zero
   (bit out) xhc-hb04.button-safe-z

ROW 4
   (bit out) xhc-hb04.button-home
   (bit out) xhc-hb04.button-macro-1
   (bit out) xhc-hb04.button-macro-2
   (bit out) xhc-hb04.button-macro-3

ROW 5
   (bit out) xhc-hb04.button-step
   (bit out) xhc-hb04.button-mode
   (bit out) xhc-hb04.button-macro-6
   (bit out) xhc-hb04.button-macro-7

Synthesized button pins
Additional buttons are synthesized for buttons named zero, goto-zero, and half. These synthesized buttons are active when the button is pressed AND the selector-switch is set to the corresponding axis [xyza].

   (bit out) xhc-hb04.button-zero-[xyza]
   (bit out) xhc-hb04.button-goto-zero-[xyza]
   (bit out) xhc-hb04.button-half-[xyza]

DEBUGGING
For debugging USB activity, use environmental variable LIBUSB_DEBUG:

export LIBUSB_DEBUG=[2 | 3 | 4]; xhc-hb04 [options]
    2:warning, 3:info, 4:debug

Sim Configs
The distribution includes several simulation configurations in the directory:
   /usr/share/doc/linuxcnc/examples/sample-configs/sim/axis/xhc-hb04/
or for a RIP build:
   rip_base_dir/configs/sim/axis/xhc-hb04/

These configurations use a distribution-provided script (xhc-hb04.tcl) to configure the pendant and make necessary HAL connections according to a number of INI file settings. The script uses an additional HAL component (xhc_hb04_util) to provide common functionality and includes support for a standard method for the start-pause button.

The settings available include:
  1) specify button-cfg-file for standard layout1 or layout2
  2) select axes (up to 4 axes from set of x y z a b c u v w)
  3) implement per-axis filtering coefficients
  4) implement per-axis acceleration for mpg jogging
  5) implement per-axis scale settings
  6) select normal or velocity based jog modes
  7) select stepsize sequence
  8) option to initialize pin for inch or mm display icon
  9) option to require pendant on startup

The sim configs illustrate button connections that:
  1) connect pendant stepsize-up button to the step input pin.
  2) connect buttons to halui.* pins
  3) connect buttons to motion.* pins

Another script is included to monitor the pendant and report loss of USB connectivity. See the README and .txt files in the above directory for usage.

Note: The sim configs use the AXIS GUI but the scripts are available with any HAL configuration or GUI. The same scripts can be used to adapt the xhc-hb04 to existing configurations provided that the halui, motion, and axis.N pins needed are not otherwise claimed. Instructions are included in README file in the directory named above.

Use halcmd to display the pins and signals used by the xhc-hb04.tcl script:
  halcmd show pin xhc-hb04       (show all xhc-hb04 pins)
  halcmd show pin pendant_util   (show all pendant_util pins)
  halcmd show sig pendant:       (show all pendant signals)

AUTHOR
Frederick Rible (frible@teaser.fr)