XHC-HB04 wireless MPG pendant HAL module

More
12 years 4 months ago #47734 by Muzzer
Thanks Dewey

My initial installation was created by running an image that (I think) contained both Ubuntu 10.04(?) and LinuxCNC 2.4 (possibly 2.3). There is note on the front page of linuxcnc.org that says "Note: Do Not upgrade Ubuntu from the installed version as it will prevent LinuxCNC from working.", so I was wary of upgrading to v12. Similarly, I didn't upgrade to the latest version of LinuxCNC..

However, I upgraded to 12.04 and 2.6.0 and the pendant worked immediately. This wasn't a step-by-step methodical approach, so I could only speculate what the differences are that allow the pendant to work. Presumably a variety of updates have been incorporated along the way and it may also be cleaner ie without any unauthorised changes from me.

Thanks again!

Murray

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

More
12 years 4 months ago #47740 by vgraves
Dewey,

I was able to successfully run the layout2 simulation...pendant worked correctly.

When I start my configuration from a terminal, I get these messages:

xhc-hb04.tcl: !!! <hal.mdi-command-00> target pin does not exist, continuing
xhc-hb04.tcl: using std_start_pause_button

I also noticed that the XYZ positions in AXIS did not update when actually jogging the machine with the keyboard. But the pendant did not work either.

I've attached my ini and hal files. Any help you could provide would be appreciated.

Van

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

More
12 years 4 months ago - 12 years 4 months ago #47760 by dgarrett

xhc-hb04.tcl: !!! <hal.mdi-command-00> target pin does not exist, continuing

typo: hal.mdi-command-00 should be halui.mdi-command-00

I've attached my ini and hal files. Any help you could provide would be appreciated.


Your configuration uses non-trivkins kinematics (gantrykins).
It is not clear to me which jogging features actually work for non-trivkin configurations in linuxcnc2.6 and earlier releases (and current git master). Maybe it will get better with a joints-axis branch that folks are working on -- I have not investigated.

You should probably use the halui plus-minus jogmode -- I think you will be able to use the pendant to jog at variable rates but without exact step increments.

README

jogmodes:
normal: postion mode, the axis will move exactly regardless of how long it takes. Beware: the machine may keep moving after you stop rotating the jog wheel.

vnormal: velocity mode, the axis will stop when the wheel stops. Beware: the amount moved per wheel detent may be less than specified if the machine velocity and acceleration cannot accomplish the move in time.

plus-minus: halui plus-minus jogging (may be useful for world-mode jogging in non-trivkins machines).


To set up plus-minus jogmode in the ini file:
Code:
#jogmode = vnormal jogmode = plus-minus
Last edit: 12 years 4 months ago by dgarrett.
The following user(s) said Thank You: vgraves

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

More
12 years 4 months ago #47772 by vgraves
The change to using plus-minus jogmode worked -- thanks for that tip! However, changing the values in the step sequence parameter did not affect the jogging speed or the scale values displayed on the pendant, nor did changing the scale factors in the ini file. What did work was changing from inch mode to mm mode. This gave me the same scale values on the pendant that I saw before - 1, 10, 100, 1000.

I notice the coordinate positions don't continuously update in the pendant while a program is running. If I change the axis switch during the program, the pendant display resets, and the values update for about 5 seconds, then they freeze. Is this the expected behavior since a pendant isn't usually needed while running a part program?

Now that the basic jog functionality is working, I'm curious as to how to change the behavior of the pendant. For instance, the GOTO-ZERO button run is configured to run an MDI command to move to 0,0,0. I'd like that to be axis-specific, depending on the position of the axis switch (i.e., only move one axis at a time to its zero). I'd also like the ZERO button to set the selected axis' current position to 0.

Would this have to be done in the tcl files, or are there things I would do in the ini/hal files?

Thanks.

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

More
12 years 4 months ago - 12 years 4 months ago #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):
Code:
$ 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:
Code:
# 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:
Code:
[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: 12 years 4 months ago by dgarrett. Reason: clarify mdi command examples

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

More
12 years 4 months ago #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.
Code:
# 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.

Time to create page: 0.087 seconds
Powered by Kunena Forum