HAL HID consumer device

More
11 Feb 2018 00:10 #105726 by JDona
Hello,

Newbie here, that is to HAL/LinuxCNC though i develop low-level board drivers in Windows planet.

I am working on a control system project for a custom machine. Basically to provide an Instructor/Trainee stations. The trainee station or control panel is the one next to the machine. The instructor station is fitted a little further away. The instructor station is basically the current LinuxCNC controller flavor, everything is opened, while the trainee station is subset of that.

I am considering using HAL & USB HID as the communication mechanism for the Trainee station, this gives us the flexibility to use various devices or panels for the Trainee station like Windows PC, MAC or custom panel with knobs/LCDs/buttons.

I have downloaded LinuxCNC, prepared the dev environment for HAL and libc and ready to dig in.

Thought I check in first with you guys if there is already a generic HID driver example, or even pre-built binary which takes parameters to interact with custom HID consumer devices (not keyboard) to send/receive bytes.

The initial screen is going to be simple, I am certain that it's been done before on HAL. We need the DROs to be sent to that station, Jog 4 axis, Zeros, start/hold/stop buttons.

If no generic HID driver that can work directly, can you point me to the right track/files/setup to do the above?

From my initial research, i think user space program is sufficient which I understand it's probably 100 ms or so delay getting the DROs back to the station? This is OK, and probably even getting the DROs values while the machine running is not even needed.

Would Virtual/COM be better? Faster?

Any comment, links, samples, previous work starting point is highly appreciated.


Jim.

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

More
11 Feb 2018 05:12 #105732 by InMyDarkestHour
You may want to look at this project. I'm not too sure if this is exactly what you are after.


generichid.sourceforge.net/
This part provides the framework to build a USB device

&

hidcomp.sourceforge.net/
This part provides the driver for Linuxcnc.

The project hasn't had a lot of activity recently but I am currently using it on my own machine ( the hidcomp component) with a custom "box of buttons".

It requires a bit of tinkering with the makefile to get going but I have successfully compiled it for Linuxcnc on a x86 platform and Machinekit running on a Beaglebone Black which controls my machine.

I'm not bagging Linuxcnc but have you looked at Machinekit ? The developers over there are working towards distributed (networked) control interfaces.
It's not something I would delve into, I just prefer one computer as controller of the machine. In my "meat head view" it seems to be something the "maker scene" would be interested in. But for your situation it could be just the thing you are looking for.
Anyhow good luck and report back on how you are going.

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

More
11 Feb 2018 07:14 - 11 Feb 2018 07:16 #105737 by JDona
Replied by JDona on topic HAL HID consumer device
Thank you ozzyrob. Appreciate your reply. I built a proof of concept with an interface hardware on MACH3 as HID consumer device and its working. But now i am looking to build the HAL part to get the data in/out to LinuxCNC as it seems the project changed direction and they don't want MACH3 anymore, probably for licenses

Will take a look at Machinekit. Though I think they are pretty set on LinuxCNC, It will be indeed one machine for control. The Trainee or Visitor station is just to get data in like LEDs/DROs and status information. And it will also to send back 'allowed' commands/buttons to the single controller through HID USB board. This station does not have fix controls, the controls shown depend on the session.

If it was group of 7-graders, they like to hit feedhold/run many times and inspect, so these are the two buttons that they will see next to the machine, all other feed/speed/spindle rpm and such are away at the Instructor station. While if the session is for Technical college visitors then we may show more controls with another pre-built screen setup/commands/controls. Then there is the actual machinist training with more controls before they take over the whole thing. Actually giving these kids buttons to press and such makes them more interested in this field and hopefully a lightbulb! Far more effective than having them stand 3 feet behind and not allowed touching buttons.

I was hoping LinuxCNC could have a pre-built HAL component that just can be defined with different pins in/out and it works on any HID USB if we provide the VID/PID to the component. Will dig into the HAL example and docs.

Jim
Last edit: 11 Feb 2018 07:16 by JDona.

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

More
11 Feb 2018 07:55 #105738 by InMyDarkestHour
There is a component called hal_input
linuxcnc.org/docs/2.7/html/man/man1/hal_input.1.html

The only output it can give is via LEDs and these are limited to the number of keyboard LEDs supported via the linux kernel, which isn't a large amount, 11 at max, if I recall (it maybe less).

GenericHID & hidcomp allow a richer source of inputs & ouputs and builds the code used to run on the usb microcontroller, which takes some of the development out of the process. The only down side is hidcomp's dependency on Qt5.

Hidcomp can be used with a custom device if you have a USB device designed and running.

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

Time to create page: 0.093 seconds
Powered by Kunena Forum