[Tutorial] How to make XHC-HB04 working with PathPilot

More
8 years 6 months ago #109862 by emptyhb
First of all, thank you all other people share their knowledge and make community great!

Here it my first tut in this community, and english is not my language so if i mistake, please let me know

To make XHC working with PathPilot you need add rules for access usb devices
You must add the file /etc/udev/rules.d/90-xhc.rules with the following content to get access to USB without root privileges
Code:
SYSFS{idProduct}=="eb70", SYSFS{idVendor}=="10ce", MODE="666", OWNER="root", GROUP="users" ATTRS{idVendor}=="10ce", ATTRS{idProduct}=="eb70", MODE="666", OWNER="root", GROUP="users"
Need restart for take effect!

Then you need re-complie xhc-hb04.cc componet in kernel pathpilot using method: forum.linuxcnc.org/pathpilot/34463-compi...h-pathpilot-2Compile kernel, and linuxcnc for pathpilot

You can igrone build kernel step (take along time and other machine to compile) if you going to desktop environment of PathPilot - Mint

After build Linuxcnc in what kernel Pathpilot used, copy xhc-hb04 execute file from bin folder of compiled linuxcnc to ~/tmc/bin

Copy two file i've attach here to config folder (tormach_mill or tormach_lathe depend on you)

Attachment not found

Attachment not found



Edit your INI config file, in HAL section, add HALFILE = xhc-hb04.hal, like:
Code:
[HAL] HALUI = halui HALFILE = emptyhb.hal HALFILE = xhc-hb04.hal POSTGUI_SHUTTLEXPRESS_HALFILE = millshuttlexpress.hal POSTGUI_HALFILE = postgui_tormach_mill.hal

Add HALUI command for implement other function as you need
Code:
[HALUI] MDI_COMMAND=... MDI_COMMAND=... MDI_COMMAND=... MDI_COMMAND=... MDI_COMMAND=... MDI_COMMAND=G0 Z5 MDI_COMMAND=G10 L20 P0 X0 MDI_COMMAND=G10 L20 P0 Y0 MDI_COMMAND=G10 L20 P0 Z0 MDI_COMMAND=G0 Z5 X0 Y0

Please note: line index in HALUI section start with 0, and you need this after. In my case: index 5 for goto Safe Z, index 6 for set X = 0, index 7 for Y=0 ...

#
This section for detail about hal file
#
Most function working, few function i'm not done

This code for display positon, and select Jog axis
Code:
# Absolute position LCD net pos-x halui.axis.0.pos-feedback => xhc-hb04.x.pos-absolute net pos-y halui.axis.1.pos-feedback => xhc-hb04.y.pos-absolute net pos-z halui.axis.2.pos-feedback => xhc-hb04.z.pos-absolute net pos-a halui.axis.3.pos-feedback => xhc-hb04.a.pos-absolute # Relative position LCD net pos-rel-x halui.axis.0.pos-relative => xhc-hb04.x.pos-relative net pos-rel-y halui.axis.1.pos-relative => xhc-hb04.y.pos-relative net pos-rel-z halui.axis.2.pos-relative => xhc-hb04.z.pos-relative net pos-rel-a halui.axis.3.pos-relative => xhc-hb04.a.pos-relative # Jog axis selection button net sxp.xen-button axis.0.jog-enable <= xhc-hb04.jog.enable-x net sxp.yen-button axis.1.jog-enable <= xhc-hb04.jog.enable-y net sxp.zen-button axis.2.jog-enable <= xhc-hb04.jog.enable-z net sxp.aen-button axis.3.jog-enable <= xhc-hb04.jog.enable-a # Jog wheel for world mode net jog-max-velocity halui.max-velocity.value => xhc-hb04.jog.max-velocity net jog-speed xhc-hb04.jog.velocity => halui.jog-speed net jog-plus-x xhc-hb04.jog.plus-x => halui.jog.0.plus net jog-minus-x xhc-hb04.jog.minus-x => halui.jog.0.minus net jog-plus-y xhc-hb04.jog.plus-y => halui.jog.1.plus net jog-minus-y xhc-hb04.jog.minus-y => halui.jog.1.minus net jog-plus-z xhc-hb04.jog.plus-z => halui.jog.2.plus net jog-minus-z xhc-hb04.jog.minus-z => halui.jog.2.minus net jog-plus-a xhc-hb04.jog.plus-a => halui.jog.3.plus net jog-minus-a xhc-hb04.jog.minus-a => halui.jog.3.minus

This code for adjust Feed Rate Override and Spindle Override
Code:
# Wheel for feedrate and spindle setp halui.feed-override.scale 0.01 net jog-counts halui.feed-override.counts net jog-feed halui.feed-override.count-enable <= xhc-hb04.jog.enable-feed-override net jog-feed2 halui.feed-override.value => xhc-hb04.feed-override setp halui.spindle-override.scale 0.01 net jog-counts xhc-hb04.jog.counts => halui.spindle-override.counts net jog-spindle halui.spindle-override.count-enable <= xhc-hb04.jog.enable-spindle-override net jog-spindle2 halui.spindle-override.value => xhc-hb04.spindle-override net spindle-rps motion.spindle-speed-cmd-rps => xhc-hb04.spindle-rps
Note: it not Update PathPilot UI, it can be done by edit PathPilot UI file, so i'm not talking here
Here it my demo, not smooth but it working, next time I can improve it


This code for set step size
Code:
net sxp.step-button xhc-hb04.button-step xhc-hb04.stepsize-up
It update one way from XHC to Pathpilot, if you want update other side, you need edit both PathPilot UI file and xhc-hb04.cc file
I've get it working as demo above, but it have some bug after modify, so i will fix it in feature

This code for buttons
Code:
# Program control # I'm not implement this function, so i comment this out for feauture use #net button-start-pause xhc-hb04.button-start-pause net button-stop xhc-hb04.button-stop => halui.program.stop net step-run xhc-hb04.button-rewind => halui.program.step net spindle-start xhc-hb04.button-spindle halui.spindle.start # activate mdi command according to select switch on pendant # your mdi-command-nn numbers may be different net x_set_to_0 xhc-hb04.button-zero-x => halui.mdi-command-06 net y_set_to_0 xhc-hb04.button-zero-y => halui.mdi-command-07 net z_set_to_0 xhc-hb04.button-zero-z => halui.mdi-command-08 # RESET/ESTOP button #net estop-out xhc-hb04.button-reset # Home button net home xhc-hb04.button-home => halui.mdi-command-09 # Safe-Z button net safe-z xhc-hb04.button-safe-z => halui.mdi-command-05

Are you remember HALUI section above? in hal file call halui.mdi-comman-index for execute MDI comand in HALUI

Button Start/Pause and Estop: i'm not implement yet

Please Log in to join the conversation.

Time to create page: 0.221 seconds
Powered by Kunena Forum