XHC-HB04 wireless MPG pendant HAL module

More
07 Jun 2014 22:26 - 07 Jun 2014 22:31 #47775 by dgarrett
Adding your own custom hal logic is the simplest way as the tcl files may
be changed with linuxcnc updates.

First study the existing hal connections using (for example):
$ halcmd show > hal_info.txt
This creates a text file (hal_info.txt) that shows existing hal setup.

You will see that the xhc-hb04 driver provides pins corresponding to the rotary switch position:

xhc-hb04.jog.enable-off
xhc-hb04.jog.enable-x
xhc-hb04.jog.enable-y
xhc-hb04.jog.enable-z
xhc-hb04.jog.enable-feed-override
xhc-hb04.jog.enable-spindle-override


You can add hal components and connections to acitvate specific mdi commands for the selsected axis:
New file: zerobutton.hal:
# zerobutton.hal
loadrt and2 names=and_x,and_y,and_z
addf and_x servo-thread
addf and_y servo-thread
addf and_z servo-thread

# connect to pendant '=0' button
net zero_selected_axis:button <= xhc-hb04.button-zero
net zero_selected_axis:button => and_x.in0
net zero_selected_axis:button => and_y.in0
net zero_selected_axis:button => and_z.in0

# add connections to preexisting signals:
net pendant:jog-x <= xhc-hb04.jog.enable-x => and_x.in1
net pendant:jog-y <= xhc-hb04.jog.enable-y => and_y.in1
net pendant:jog-z <= xhc-hb04.jog.enable-z => and_z.in1

# activate mdi command according to select switch on pendant
# your mdi-command-nn numbers may be different
net x:set_to_0 <= and_x.out => halui.mdi-command-16
net y:set_to_0 <= and_y.out => halui.mdi-command-17
net z:set_to_0 <= and_z.out => halui.mdi-command-18

To use this halfile, modify the ini file to:
1) remove any existing connection for the =0 button (zero)
2) add new mdi-commands
3) load new halfile (zerobutton.hal)

Modifications to ini file:
[XHC_HB04_BUTTONS]
# zero button is connected now in zerobutton.hal
zero = "" 
...

[HALUI]
# new mdi commands for use with zerobutton.hal (your numbers may be different)
# mdi #16
MDI_COMMAND =  G10 L20 P0 X0 
# mdi #17
MDI_COMMAND =  G10 L20 P0 Y0
# mdi #18
MDI_COMMAND =  G10 L20 P0 Z0
...

[HAL]
# new halfile (place after other HALFILE items):
HALFILE = zerobutton.hal

The above example adds mdi commands 16,17,18 and uses G10 L20 to set coordinates but
you can make them do what ever you want -- modify as required.
Last edit: 07 Jun 2014 22:31 by dgarrett. Reason: clarify mdi command examples

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

More
08 Jun 2014 22:18 #47792 by vgraves
Thank you for that excellent information! With that I was able to configure both the GOTO_ZERO and ZERO buttons to function as I want.
# zerobuttons.hal
loadrt and2 names=and_x1,and_y1,and_z1,and_x2,and_y2,and_z2
addf and_x1 servo-thread
addf and_y1 servo-thread
addf and_z1 servo-thread
addf and_x2 servo-thread
addf and_y2 servo-thread
addf and_z2 servo-thread

# connect and1 to pendant '=0' button
net zero_selected_axis:button <= xhc-hb04.button-zero
net zero_selected_axis:button => and_x1.in0
net zero_selected_axis:button => and_y1.in0
net zero_selected_axis:button => and_z1.in0

# connect and2 to pendant 'goto zero' button
net goto_zero_selected_axis:button <= xhc-hb04.button-goto-zero
net goto_zero_selected_axis:button => and_x2.in0
net goto_zero_selected_axis:button => and_y2.in0
net goto_zero_selected_axis:button => and_z2.in0

# add and1,and2 connections to preexisting signals:
net pendant:jog-x <= xhc-hb04.jog.enable-x => and_x1.in1
net pendant:jog-y <= xhc-hb04.jog.enable-y => and_y1.in1
net pendant:jog-z <= xhc-hb04.jog.enable-z => and_z1.in1
net pendant:jog-x <= xhc-hb04.jog.enable-x => and_x2.in1
net pendant:jog-y <= xhc-hb04.jog.enable-y => and_y2.in1
net pendant:jog-z <= xhc-hb04.jog.enable-z => and_z2.in1

# activate mdi command according to select switch on pendant
net x:set_to_0 <= and_x1.out => halui.mdi-command-08
net y:set_to_0 <= and_y1.out => halui.mdi-command-09
net z:set_to_0 <= and_z1.out => halui.mdi-command-10

net x:goto_0 <= and_x2.out => halui.mdi-command-11
net y:goto_0 <= and_y2.out => halui.mdi-command-12
net z:goto_0 <= and_z2.out => halui.mdi-command-13

I would highly recommend that the instructions you provided for this be included in the README file. But even better would be to actually implement this axis-specific functionality in the configuration files provided in 2.6. I think this is generic functionality that would make the pendants more useful "out-of-the-box" and would provide a better foundation for those who may wish to modify their pendant's behavior.

Thanks again!

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

More
09 Jun 2014 21:59 #47815 by dgarrett

But even better would be to actually implement this axis-specific functionality in the configuration files


A new commit for linuxcnc2.6 synthesizes axis-specific buttons for
the pendant buttons named button-zero, button-goto-zero, button-half.

These can be specified when using xhc-hb04.tcl in the ini file with no additional hal components:
...
[XHC_HB04_BUTTONS]
...
zero        = ""
# synthesized per-axis buttons for zero button:
zero-x      = halui.mdi-command-12
zero-y      = halui.mdi-command-13
zero-z      = halui.mdi-command-14
zero-a      = halui.mdi-command-15
...

See the README and the updated ini file demos for example usage.

The git commit:
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...1269a04a51307c2152f9
will be available in new buildbot 2.6 debs.

Thanks for the suggestion.
~

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

More
27 Jul 2014 07:09 - 27 Jul 2014 07:21 #49179 by Swapper
Hi!
i am running with a xhc-hb04 pendant on master (2.7.0-pre0-680-gc72834b)
Its been running OK for some time but i have to be doing something wrong regarding the "Max. Velocity" together with the xhc-hb04.
When the pendant config is active the "Max. Velocity" gets put to 0 and i can't change it (slider locked).
This have happened before at times and then i messed with the pendant before starting linuxcnc and it worked.
Now i can't get it to work (after updating to above build) seems it would be possible to link some function on the pendant to the slider and set it to the DEFAULT_VELOCITY = 83.33 ini default value?
Attached is my configs if anyone have some ideas.
Greatfull for any tips.

Edit:
Seems like a race condition since it works some of the time when starting linuxcnc.


This is how its looking.
Attachments:
Last edit: 27 Jul 2014 07:21 by Swapper.

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

More
28 Jul 2014 22:04 #49221 by dgarrett
I haven't been able to reproduce the described behavior in a simulator -- If you can reproduce with a config that requires no special hardware or parport, please post a complete config.

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

More
30 Oct 2014 06:51 #52560 by mario_rl
Hy, I purchased reciently a HB04 (the model who has several "macro-n" buttons), but it`s behaviour is weird. When attached to the PC the first time and once edited hal and ini files, some features worked, but only for the first 3 - 4 times I launched Linuxcnc (2.6.1)... due to a unknown reason the device no more worked later, and the config is the same...

Then I ported the HB04 to a vmware Linuxcnc 2.6.3 (I readed there's bug fixes with HB04 ) but the result was the same, worked only for the first time :huh:

- Have anybody experience about reciving a defective HB04?
- Did anybody experiencied with loos connection with the HB04? The mine only shows 0.0000 in all DRO's

I tried to use the stand alone vers. of xhc-hb04 from the samples selection dialog, but nothing happens when I doble click on the launcher. I also noted that lsusb command doesn't work, and the HW GUI info utility shwows none USB devices attached all the time... :sick:

Thanks for everybody

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

More
30 Oct 2014 08:11 - 30 Oct 2014 08:43 #52561 by dgarrett
For reference, with my working xhc-hb04, when the usb dongle is plugged in, /var/log/syslog shows:
$ uname -r
3.5.0-19-generic

$ tail -f /var/log/syslog
...
usb 6-2: new full-speed USB device number 3 using uhci_hcd
usb 6-2: New USB device found, idVendor=10ce, idProduct=eb70
usb 6-2: New USB device strings: Mfr=1, Product=0, SerialNumber=0
usb 6-2: Manufacturer: KTURT.LTD
mtp-probe: checking bus 6, device 3: "/sys/devices/pci0000:00/0000:00:1d.0/usb6/6-2"
mtp-probe: bus: 6, device: 3 was not an MTP device
hid-generic 0003:10CE:EB70.0002: hiddev0,hidraw0: USB HID v1.10 Device [KTURT.LTD] on usb-0000:00:1d.0-2/input0

And the details reported by lsusb -v are:
$ lsusb -v
...
Bus 006 Device 002: ID 10ce:eb70 Silicon Labs 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x10ce Silicon Labs
  idProduct          0xeb70 
  bcdDevice            0.00
  iManufacturer           1 KTURT.LTD
  iProduct                0 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      46
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               2
Device Status:     0x0000
  (Bus Powered)
...
Last edit: 30 Oct 2014 08:43 by dgarrett. Reason: typo
The following user(s) said Thank You: mario_rl

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

More
30 Oct 2014 16:07 #52567 by mario_rl
my syslog shows similar
Oct 30 09:37:37 debian kernel: [ 1101.184033] usb 4-2: new full-speed USB device number 2 using uhci_hcd
Oct 30 09:37:37 debian kernel: [ 1101.341990] usb 4-2: New USB device found, idVendor=10ce, idProduct=eb70
Oct 30 09:37:37 debian kernel: [ 1101.341997] usb 4-2: New USB device strings: Mfr=1, Product=0, SerialNumber=0
Oct 30 09:37:37 debian kernel: [ 1101.342002] usb 4-2: Manufacturer: KTURT.LTD
Oct 30 09:37:37 debian kernel: [ 1101.349856] generic-usb 0003:10CE:EB70.0002: hiddev0,hidraw1: USB HID v1.10 Device [KTURT.LTD] on usb-0000:00:1d.2-2/input0
Oct 30 09:37:37 debian mtp-probe: checking bus 4, device 2: "/sys/devices/pci0000:00/0000:00:1d.2/usb4/4-2"
Oct 30 09:37:37 debian mtp-probe: bus: 4, device: 2 was not an MTP device
^Cmario@debian:~$ lsusb
bash: lsusb: no se encontrĂ³ la orden ->"command not found"


lsusb doesn't work for me....(regarding my linux experience I'm afraid)

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

More
30 Oct 2014 16:58 #52569 by cncbasher
i presume your using debian wheezy ?
it's worth checking udev
check your entrys in udev /etc/udev/rules.d/99-xhc.rules
mode = "0666" owner = "root" ="plugdev"

this is different to Ubuntu
if you are still having problems archive your config directory and attach , so we can look it over
also make comment on which version of os and linuxcnc version your using would help
The following user(s) said Thank You: mario_rl

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

More
30 Oct 2014 18:46 - 30 Oct 2014 19:29 #52574 by mario_rl
Hi there, I'm running linuxcnc 2.6.1 who came with the live CD.
Kernel		: Linux 3.4-9-rtai-686-pae (i686)
Compiled		: #1 SMP PREEMPT Debian 3.4.55-3linuxcnc

(I also did the same tests with a linuxcnc 2.6.3 live CD. in a VMware machine)
# xhc-hb04 mpg pendant
ATTR{idProduct}=="eb70", ATTR{idVendor}=="10ce", MODE="666", owner = "root", GROUP="users"
SYSFS{idProduct}=="eb70", SYSFS{idVendor}=="10ce", MODE="666", OWNER="root", GROUP="users"

This hapens when I plug the USB receiver:
Oct 30 13:25:01 debian kernel: [ 6577.956032] usb 4-2: new full-speed USB device number 6 using uhci_hcd
Oct 30 13:25:01 debian kernel: [ 6578.113986] usb 4-2: New USB device found, idVendor=10ce, idProduct=eb70
Oct 30 13:25:01 debian kernel: [ 6578.113993] usb 4-2: New USB device strings: Mfr=1, Product=0, SerialNumber=0
Oct 30 13:25:01 debian kernel: [ 6578.113998] usb 4-2: Manufacturer: KTURT.LTD
Oct 30 13:25:01 debian kernel: [ 6578.122790] generic-usb 0003:10CE:EB70.0006: hiddev0,hidraw1: USB HID v1.10 Device [KTURT.LTD] on usb-0000:00:1d.2-2/input0
Oct 30 13:25:01 debian mtp-probe: checking bus 4, device 6: "/sys/devices/pci0000:00/0000:00:1d.2/usb4/4-2"
Oct 30 13:25:01 debian mtp-probe: bus: 4, device: 6 was not an MTP device
Oct 30 13:26:50 debian wpa_supplicant[2878]: wlan0: WPA: Group rekeying completed with d0:ae:ec:c5:d1:fc [GTK=TKIP]

and that's my config directory

File Attachment:

File Name: oerlikon2.tar.gz
File Size:26 KB


Thanks for everybody
Attachments:
Last edit: 30 Oct 2014 19:29 by mario_rl.

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

Time to create page: 0.269 seconds
Powered by Kunena Forum