Setting up MPG with per-axis jog scale

More
05 Apr 2016 00:41 #72753 by Sparky961
Since early on in my LinuxCNC adventure I've had a very simple working MPG HAL file based on the published example. I'm now ready to connect up the other inputs and have it select an axis and set the jog scale.

Where things get interesting, and where I haven't found great examples, is in having a different scale for one axis. X, Y, and Z can share the same common set but it doesn't make much sense for me to jog the rotary table at 0.001 degrees per pulse. At least, not at this point.

My interested was peaked by this recent thread that discussed MPG setup and two slightly different ways of accomplishing it. I was left thinking that the look-up table or bitwise MUX might be the best way to go about it but was having some difficulty moving from the simple example provided to implementing my (condensed) truth table below.



Any hints to get me started?
Attachments:

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

More
05 Apr 2016 01:06 #72757 by Sparky961
Following on my original question, I was thinking about how I'd implement this in hardware and excluding the scale it's actually pretty simple using discrete logic. What are the implications of using lots of logic components chained together to do something like this? It isn't high speed so I'm not concerned about that but what about effects on other things that are time critical?

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

More
05 Apr 2016 03:35 - 05 Apr 2016 03:36 #72763 by cmorley
using two mux components with their inputs tied to the same selector switches, but with different outputs is wat you want to do.
pretty easy actually.
switches-----+--mux-----output ----axis x,y,z
             |---mux----output-----axis a
Chris M
Last edit: 05 Apr 2016 03:36 by cmorley.

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

More
05 Apr 2016 04:36 #72766 by Sparky961

pretty easy actually


So is walking, but try telling that to a toddler. ;)

Thanks for pointing me in the right direction. I'm still trying to get into the mindset of HAL.

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

More
05 Apr 2016 11:32 #72777 by andypugh

Where things get interesting, and where I haven't found great examples, is in having a different scale for one axis. X, Y, and Z can share the same common set but it doesn't make much sense for me to jog the rotary table at 0.001 degrees per pulse. At least, not at this point.


The solution here is probably to have one mux for linear and another for rotary. Drive them both from the same selector and take the output to appropriate axes.

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

More
09 Apr 2016 22:58 - 09 Apr 2016 22:58 #73015 by Sparky961
Success. Again, thanks to all for the help. You were correct that this is actually pretty simple. I find the connection logic in many of the examples hard to follow the way they're written. In the working MPG.HAL file below I've written it the way it works for me, but it doesn't look like this is a popular way to do it.

My selection switches aren't binary coded. It's just one output for each selection, so it requires that I use a MUX rather wastefully in my opinion. If there's a more elegant way to do this, I'd be happy to see it. Otherwise I'm happy to have something that works well.

You'll see I have a "TODO" near the end. I'd like to have the MPG disabled by LinuxCNC during motion and other times where safety might be an issue. I'm not sure where to look to complete that part.

[Side note: I tried to paste the code inside CODE tags but the forum complained that "You have too many links in your message, please decrease it!" - So file is attached.]

File Attachment:

File Name: mpg-2.hal
File Size:3 KB
Attachments:
Last edit: 09 Apr 2016 22:58 by Sparky961.

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

More
11 Apr 2016 13:10 #73100 by andypugh
I think that you will find that LinuxCNC automatically ignores the MPG when it is running in Auto.

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

More
13 Apr 2016 00:31 #73208 by Sparky961
Ok, that's great. Now if I only want the LED on the MPG lit when active, would I use the halui.mode.is-auto pin, inverted? Or would there be other modes where it gets ignored?

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

More
13 Apr 2016 11:34 #73219 by andypugh

Ok, that's great. Now if I only want the LED on the MPG lit when active, would I use the halui.mode.is-auto pin, inverted? Or would there be other modes where it gets ignored?


I am not sure. I would set up a halmeter to watch that pin during operation and see what happens.

I know that, in the Axis GUI, the keyboard and gamepad jog-modes are disabled in MDI mode too (ie, with the MDI tab selected)
You might need to use halui.mode-is-manual.

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

More
15 Apr 2016 01:58 #73330 by Sparky961
After some experimentation, it seems that halui.mode.is-manual does better indicate the ability to use the MPG.

However, I've taken a slightly different approach and instead connected the logic that drives the LED (any axis selected on the MPG = ON) and also connected that to halui.mode.manual so that selecting an axis on the MPG now changes to the manual mode so I don't need to touch the PC.

When I was working on this I also noticed that my indicator would light when the machine "Power" was off, which is undesired. I used the halui.machine.is-on bit to enable the MPG.

I have yet to test what happens when running a program and an axis is selected with the MPG. I'm hoping that it gets ignored, at least until the program is finished executing.

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

Time to create page: 0.247 seconds
Powered by Kunena Forum