Hal file to enhace MPG pendant USB wireless
14 Feb 2013 20:43 - 14 Feb 2013 20:52 #30056
by casetero
Hal file to enhace MPG pendant USB wireless was created by casetero
Hi,
I bought this pendant and it´s been a little bit complicated to enhace it to Linuxcnc:
www.aliexpress.com/store/product/Wireles...07877_541049382.html
Finally i used hidcomp (thank you Frank) to enhace it, the pins hidcomp creates are these:
Doing all this stuff you will have a very well feedback of your pendant, and you can change the PINs of the buttons for doing what you want.
I´m begginer doing hal code so for sure you can optimize the code to make things better, but this way it works really well. I don´t know if it will be suitable for someone, but i hope so!
I haven´t try to enhace the LCD, i have to try. If i get it i will tell you how.
Thank you very much and sorry for my english!
I bought this pendant and it´s been a little bit complicated to enhace it to Linuxcnc:
www.aliexpress.com/store/product/Wireles...07877_541049382.html
Finally i used hidcomp (thank you Frank) to enhace it, the pins hidcomp creates are these:
hidcomp.0.PIN1.raw
hidcomp.0.PIN1.ivalue
hidcomp.0.PIN1.fvalue
hidcomp.0.PIN2.raw
hidcomp.0.PIN2.ivalue
hidcomp.0.PIN2.fvalue
hidcomp.0.PIN3.raw
hidcomp.0.PIN3.ivalue
hidcomp.0.PIN3.fvalue
hidcomp.0.PIN4.raw
hidcomp.0.PIN4.ivalue
hidcomp.0.PIN4.fvalue
hidcomp.0.PIN5.raw
hidcomp.0.PIN5.ivalue
hidcomp.0.PIN5.fvalue
The problem is they aren´t bits, so i used two comp.0 and one and2.0 to convert a float value into a bit value, this is the hal code i wrote:
# Include your customized HAL commands here
# This file will not be overwritten when you run stepconf again
loadusr -W hidcomp -ini smartstep2.ini Mando.hid
loadrt wheel
loadrt mux4 count=2
loadrt and2 count=20
loadrt comp count=34
loadrt or2 count=2
addf or2.0 servo-thread
addf or2.1 servo-thread
addf wheel.0 servo-thread
addf comp.0 servo-thread
addf comp.1 servo-thread
addf comp.2 servo-thread
addf comp.3 servo-thread
addf comp.4 servo-thread
addf comp.5 servo-thread
addf comp.6 servo-thread
addf comp.7 servo-thread
addf comp.8 servo-thread
addf comp.9 servo-thread
addf comp.10 servo-thread
addf comp.11 servo-thread
addf comp.12 servo-thread
addf comp.13 servo-thread
addf comp.14 servo-thread
addf comp.15 servo-thread
addf comp.16 servo-thread
addf comp.17 servo-thread
addf comp.18 servo-thread
addf comp.19 servo-thread
addf comp.20 servo-thread
addf comp.21 servo-thread
addf comp.22 servo-thread
addf comp.23 servo-thread
addf comp.24 servo-thread
addf comp.25 servo-thread
addf comp.26 servo-thread
addf comp.27 servo-thread
addf comp.28 servo-thread
addf comp.29 servo-thread
addf comp.30 servo-thread
addf comp.31 servo-thread
addf comp.32 servo-thread
addf comp.33 servo-thread
addf and2.0 servo-thread
addf and2.1 servo-thread
addf and2.2 servo-thread
addf and2.3 servo-thread
addf and2.4 servo-thread
addf and2.5 servo-thread
addf and2.6 servo-thread
addf and2.7 servo-thread
addf and2.8 servo-thread
addf and2.9 servo-thread
addf and2.10 servo-thread
addf and2.11 servo-thread
addf and2.12 servo-thread
addf and2.13 servo-thread
addf and2.14 servo-thread
addf and2.15 servo-thread
addf and2.16 servo-thread
addf and2.17 servo-thread
addf and2.18 servo-thread
addf and2.19 servo-thread
addf mux4.0 servo-thread
addf mux4.1 servo-thread
#Boton x=0
setp comp.1.in0 -0.9297
setp comp.0.in1 -0.9295
net zerox hidcomp.0.PIN1.fvalue comp.0.in0 comp.1.in1 comp.2.in1 comp.3.in0 comp.4.in0 comp.5.in1 comp.12.in0 comp.13.in1 comp.14.in0 comp.15.in1 comp.16.in0 comp.17.in1 comp.18.in0 comp.19.in1 comp.22.in0 comp.23.in1
net zerox hidcomp.0.PIN1.fvalue comp.24.in0 comp.25.in1 comp.28.in0 comp.29.in1 comp.30.in0 comp.31.in1 comp.32.in0 comp.33.in1
net zerox3 and2.0.in0 comp.0.out
net zerox4 and2.0.in1 comp.1.out
net zerox5 halui.joint.0.home <= and2.0.out
#Boton y=0
setp comp.2.in0 -0.9217
setp comp.3.in1 -0.9215
net zeroy and2.1.in0 comp.2.out
net zeroy2 and2.1.in1 comp.3.out
net zeroy3 halui.joint.1.home and2.1.out
#Boton z=0
setp comp.4.in1 -0.9137
setp comp.5.in0 -0.9139
net zeroz and2.2.in0 comp.4.out
net zeroz2 and2.2.in1 comp.5.out
net zeroz3 halui.joint.2.home and2.2.out
#Spring-wheel. Selector de ejes.
#Eje x
setp comp.6.in1 -0.8667
setp comp.7.in0 -0.8669
net ejex and2.3.in0 comp.6.out
net ejex2 and2.3.in1 comp.7.out
net ejex3 axis.0.jog-enable halui.joint.0.select and2.16.in1 and2.3.out
net ejex4 hidcomp.0.PIN3.fvalue comp.6.in0 comp.7.in1 comp.8.in0 comp.9.in1 comp.10.in0 comp.11.in1
#Eje y
setp comp.8.in1 -0.858
setp comp.9.in0 -0.860
net ejey and2.4.in0 comp.9.out
net ejey2 and2.4.in1 comp.8.out
net ejey3 axis.1.jog-enable halui.joint.1.select and2.17.in1 and2.4.out
#Eje z
setp comp.10.in1 -0.850
setp comp.11.in0 -0.852
net ejez and2.5.in0 comp.10.out
net ejez2 and2.5.in1 comp.11.out
net ejez3 axis.2.jog-enable halui.joint.2.select and2.18.in1 and2.5.out
#Para diferentes longitudes por pulso
#Para Media (la lenta la coge sin pulsar nada) Lenta 0.005 Media 0.05 Rapida 0.1
setp mux4.0.in0 0.0001234335
setp mux4.0.in1 0.001234335
setp mux4.0.in2 0.00246867
setp comp.13.in0 -0.8983
setp comp.12.in1 -0.8981
net velmed and2.6.in0 comp.12.out
net velmed2 and2.6.in1 comp.13.out
net velmed3 mux4.0.sel0 and2.6.out
#Para Rapida
setp comp.14.in1 -0.8901
setp comp.15.in0 -0.8903
net velrapid and2.7.in0 comp.14.out
net velrapid2 and2.7.in1 comp.15.out
net velrapid3 mux4.0.sel1 and2.7.out
net velmed4 axis.0.jog-scale axis.1.jog-scale axis.2.jog-scale mux4.0.out
#Para movimiento por avance
setp mux4.1.in0 200
setp mux4.1.in1 500
setp mux4.1.in2 900
#Para el medio (el lento se acciona solo)
setp comp.16.in1 -0.905
setp comp.17.in0 -0.907
net jogmed and2.8.in0 comp.16.out
net jogmed2 and2.8.in1 comp.17.out
net jogmed3 mux4.1.sel0 and2.8.out
#Para el rapido
setp comp.18.in1 -0.952
setp comp.19.in0 -0.954
net jogfast and2.9.in0 comp.18.out
net jogfast2 and2.9.in1 comp.19.out
net jogfast3 mux4.1.sel1 and2.9.out
net jogmed4 halui.jog-speed mux4.1.out
#Jog por avance, botones mas y menos para eje seleccionado
#boton plus
setp comp.20.in1 -0.9687
setp comp.21.in0 -0.9689
net plus and2.10.in0 comp.21.out
net plus2 and2.10.in1 comp.20.out
setp comp.22.in1 -0.9687
setp comp.23.in0 -0.9689
net plus4 and2.11.in0 comp.22.out
net plus5 and2.11.in1 comp.23.out
net plus7 or2.0.in1 and2.10.out
net plus6 or2.0.in0 and2.11.out
net plus3 halui.jog.selected.plus or2.0.out
#boton minus
setp comp.24.in1 -0.9373
setp comp.25.in0 -0.9375
net minus and2.12.in0 comp.24.out
net minus2 and2.12.in1 comp.25.out
setp comp.26.in1 -0.9373
setp comp.27.in0 -0.9375
net minus3 and2.13.in0 comp.26.out
net minus4 and2.13.in1 comp.27.out
net minus5 or2.1.in1 and2.12.out
net minus6 or2.1.in0 and2.13.out
net minus7 halui.jog.selected.minus or2.1.out
net pulsed hidcomp.0.PIN2.fvalue comp.20.in0 comp.21.in1 comp.26.in0 comp.27.in1
#Para seleccionar el eje esta hecho antes en la seleccion de la jogwheel
#Boton Estop
setp comp.28.in1 -0.8197
setp comp.29.in0 -0.8199
net estop and2.14.in1 comp.28.out
net estop1 and2.14.in0 comp.29.out
net estop3 halui.estop.activate and2.14.out
#Para MDI-command = ir a 0 en cada eje, segun selector.
#Eje x
setp comp.30.in1 -0.9607
setp comp.31.in0 -0.9609
net gozerox and2.15.in1 comp.30.out
net gozerox2 and2.15.in0 comp.31.out
net gozerox3 and2.16.in0 and2.17.in0 and2.18.in0 and2.15.out
net gozerox4 halui.mdi-command-00 and2.16.out
#Eje y
net gozery halui.mdi-command-01 and2.17.out
#Eje z
net gozeroz halui.mdi-command-02 and2.18.out
#Todos los ejes a la vez
setp comp.32.in1 -0.8823
setp comp.33.in0 -0.8825
net axis and2.19.in0 comp.32.out
net axis2 and2.19.in1 comp.33.out
net axis3 halui.mdi-command-03 and2.19.out
#Para jog-wheel
net bazura wheel.0.raw-val hidcomp.0.PIN4.raw
net x-jog wheel.0.jog-counts axis.0.jog-counts axis.1.jog-counts axis.2.jog-counts
#Faltan 4 botones para poder unir mas pines en un futuro.
Buttons do not do what the picture of the buttons show, but i think is better organized. You can test it like that and if you don´t like it you can change the buttons modifying the hal code.
To make this hal code works, you have also to compile this fantastic component that Andy Pugh wrote for me (thank you andy)
component wheel "pendant jogwheel thingy";
pin in signed raw-val;
pin out signed jog-counts;
function _;
author "andy pugh";
license "GPL";
;;
FUNCTION(_){
char v;
v=raw_val;
jog_counts += v;
}
The component file is called wheel.comp
Also you have to add to the file.ini of your system these lines:
[HALUI]
MDI_COMMAND = G0 X0
MDI_COMMAND = G0 Y0
MDI_COMMAND = G0 Z0
MDI_COMMAND = G0 X0 Y0
Doing all this stuff you will have a very well feedback of your pendant, and you can change the PINs of the buttons for doing what you want.
I´m begginer doing hal code so for sure you can optimize the code to make things better, but this way it works really well. I don´t know if it will be suitable for someone, but i hope so!
I haven´t try to enhace the LCD, i have to try. If i get it i will tell you how.
Thank you very much and sorry for my english!
Last edit: 14 Feb 2013 20:52 by casetero.
Please Log in or Create an account to join the conversation.
15 Feb 2013 00:28 #30061
by Rick G
Replied by Rick G on topic Hal file to enhace MPG pendant USB wireless
Cool, be neat to see it with the LCD working!
Rick G
Rick G
Please Log in or Create an account to join the conversation.
09 Apr 2013 16:32 #32468
by bjames28
Replied by bjames28 on topic Hal file to enhace MPG pendant USB wireless
Hi Casetero
Do you have progress with the LCD ?
All other functions work correctly?
Regards:
James
Do you have progress with the LCD ?
All other functions work correctly?
Regards:
James
Please Log in or Create an account to join the conversation.
15 Apr 2013 18:21 #32739
by casetero
Replied by casetero on topic Hal file to enhace MPG pendant USB wireless
I have no progress with the LCD. I ´ve been busy with other things and i havent been able to progress.
All the other functions works perfectly. But they dont match with the things it is supossed to do, i mean i changed what buttons supossed to do instead of what i want they do. The axis selector and the jog wheel are the only things that work as they were designed. All the other buttons have been changed, if you dont like this configuration you just to have to link to the function you like.
If you have any other question dont doubt to ask it!
Sorry for my english.
Regards.
All the other functions works perfectly. But they dont match with the things it is supossed to do, i mean i changed what buttons supossed to do instead of what i want they do. The axis selector and the jog wheel are the only things that work as they were designed. All the other buttons have been changed, if you dont like this configuration you just to have to link to the function you like.
If you have any other question dont doubt to ask it!
Sorry for my english.
Regards.
The following user(s) said Thank You: bjames28
Please Log in or Create an account to join the conversation.
20 Jun 2013 05:34 #35819
by f1oat
Replied by f1oat on topic Hal file to enhace MPG pendant USB wireless
I have developed a HAL module that should work for you, including LCD support.
wiki.linuxcnc.org/cgi-bin/wiki.pl?Using_...Wireless_MPG_Pendant
Frederic.
wiki.linuxcnc.org/cgi-bin/wiki.pl?Using_...Wireless_MPG_Pendant
Frederic.
The following user(s) said Thank You: bjames28
Please Log in or Create an account to join the conversation.
15 Jul 2013 17:17 #36661
by casetero
Replied by casetero on topic Hal file to enhace MPG pendant USB wireless
Thank you very much!!
I´ll try it as soon as i can. How does work the jogwheel whit this component??
Regards.
I´ll try it as soon as i can. How does work the jogwheel whit this component??
Regards.
Please Log in or Create an account to join the conversation.
09 Sep 2013 23:25 #38572
by casetero
Replied by casetero on topic Hal file to enhace MPG pendant USB wireless
Hi,
F1oat, im going to install your component.
Do i need to install the 3 files of your post, or just one??
Thank you.
F1oat, im going to install your component.
Do i need to install the 3 files of your post, or just one??
Thank you.
Please Log in or Create an account to join the conversation.
10 Sep 2013 00:44 #38573
by f1oat
Replied by f1oat on topic Hal file to enhace MPG pendant USB wireless
Hello, only the last one.
Frederic.
Frederic.
The following user(s) said Thank You: casetero
Please Log in or Create an account to join the conversation.
10 Sep 2013 17:05 #38598
by casetero
Replied by casetero on topic Hal file to enhace MPG pendant USB wireless
Hi Frederic,
I have installed your hal component.
The instalation of usb packages seems to be good, and the xhc-hb04-V05.tgz seems to have been installed nice too.
I have attached into a hal file this line:
loadusr xch-hb04
Linuxcnc starts nice too, but i cant see nothing in the LCD or send a movement through the jogwheel, its like the pendant wouldn´t be connected.
How can i know if its linked?
Whay pins does the Hal component creates??
Thank you.
I have installed your hal component.
The instalation of usb packages seems to be good, and the xhc-hb04-V05.tgz seems to have been installed nice too.
I have attached into a hal file this line:
loadusr xch-hb04
Linuxcnc starts nice too, but i cant see nothing in the LCD or send a movement through the jogwheel, its like the pendant wouldn´t be connected.
How can i know if its linked?
Whay pins does the Hal component creates??
Thank you.
Please Log in or Create an account to join the conversation.
10 Sep 2013 17:28 #38601
by casetero
Replied by casetero on topic Hal file to enhace MPG pendant USB wireless
Sorry,
Didn´t see that you included the hal file on the zip.
Im going to try with it.
Thank you.
Didn´t see that you included the hal file on the zip.
Im going to try with it.
Thank you.
Please Log in or Create an account to join the conversation.
Time to create page: 0.147 seconds