Trying to figure out how to program hal for a pendant

More
10 May 2023 10:40 #271098 by beefy
I watched this video by the Feral Engineer on Youtube 


I have a Gamepad / Xbox controller and as per the video tutorial, found out which buttons belong to which button names.

Used PnCConf to generate the hal file and extracted the code I needed to add to my Qtplasmac hal file.

This is what I added to my Qtplasmac hal file:

loadusr -W hal_input -KRAL DragonRise

loadrt mux16 names=jogspeed
addf jogspeed  servo-thread


net jog-x-pos      halui.axis.x.plus
net jog-x-neg      halui.axis.x.minus

net jog-y-pos      halui.axis.y.plus
net jog-y-neg      halui.axis.y.minus

net jog-z-pos      halui.axis.z.plus
net jog-z-neg      halui.axis.z.minus

net jog-speed             halui.axis.jog-speed


=================================================================================
# ---USB device jog button signals---

# connect selectable mpg jog speeds 
net jog-speed-a           =>  jogspeed.sel0               # (Connects to Xbox input.0.btn-base )
net jog-speed-b           =>  jogspeed.sel1               # (Connects to Xbox input.0.btn-top2 )
net jog-speed             <=  jogspeed.out-f                # (Connects to halui.axis.jog-speed )

setp    jogspeed.in00          20.000000
setp    jogspeed.in01          100.000000
setp    jogspeed.in02          1000.000000
setp    jogspeed.in03          10000.000000

net jog-speed-a           <=  input.0.btn-base     # (Connects to MUX16 jogspeed.sel0 )
net jog-speed-b           <=  input.0.btn-top2      # (Connects to MUX16 jogspeed.sel1 )

net jog-x-pos            input.0.btn-thumb            # (Connects to HALUI halui.axis.x.plus )
net jog-x-neg            input.0.btn-top                 # (Connects to HALUI halui.axis.x.minus )

net jog-y-pos            input.0.btn-thumb2          # (Connects to HALUI halui.axis.y.plus )
net jog-y-neg            input.0.btn-trigger            # (Connects to HALUI halui.axis.y.minus )

net jog-z-pos            input.0.btn-pinkie             # (Connects to HALUI halui.axis.z.plus )
net jog-z-neg            input.0.btn-base2            # (Connects to HALUI halui.axis.z.minus )


I kind of expected it wouldn't work and it didn't. In fact, when checking the Xbox controller button presses with Halmeter, I found really weird things happening like the mouse moving left and right, the pin list in Halmeter scrolling, etc.
So basically a complete disaster LOL.
I'm a relative beginner to this deeper understanding of Linuxcnc / hal, but am studying and slowly gaining some ground.

My guess is that HALUI pins don't work for connecting to the pin signals from a remote pendant.
Does anyone know of any examples of hal coding for remote pendants, that specifically work with Qtplasmac. I did a search in the Plasmac section of the forum for both "pendant" and "remote" and pretty much got zippo results. Surprising as plasma without a pendant is a real pain.

I would like to get to the stage where I understand how to have the typical buttons plus some extra goodies on a pendant:
  • Axis selection for jogging
  • Various selections of jog speed from rapid to very slow for precise positioning
  • Custom code buttons, like where you can run a custom MDI command from the INI file
  • Cycle start, pause, continue, stop
  • Limit over-ride
  • Home each axis
  • Zero XY work offset
  • Estop
I can see me building my own custom pendant to provide all the buttons, but at present I just don't know how to "communicate" with the internals of Qtplasmac.

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

More
10 May 2023 11:06 #271099 by phillc54
FWIW this is the pendant related stuff from my table. It is for a xhc-hb04 pendant so may not be relevant...

 
Attachments:
The following user(s) said Thank You: Clive S

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

More
10 May 2023 11:28 - 10 May 2023 11:41 #271100 by Aciera
Last edit: 10 May 2023 11:41 by Aciera.

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

More
10 May 2023 12:31 #271105 by beefy
Thanks Phill & Aciera,

that's certainly great for helping me understand the interfacing code needed.

Heck I might even just go and buy the same pendant you use Phill.

Keith.

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

Moderators: snowgoer540
Time to create page: 0.093 seconds
Powered by Kunena Forum