Setting up MPG with per-axis jog scale
05 Apr 2016 00:41 #72753
by Sparky961
Setting up MPG with per-axis jog scale was created 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?
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?
Please Log in or Create an account to join the conversation.
05 Apr 2016 01:06 #72757
by Sparky961
Replied by Sparky961 on topic Setting up MPG with per-axis jog scale
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.
05 Apr 2016 03:35 - 05 Apr 2016 03:36 #72763
by cmorley
Replied by cmorley on topic Setting up MPG with per-axis jog scale
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.
Chris M
pretty easy actually.
switches-----+--mux-----output ----axis x,y,z
|---mux----output-----axis a
Last edit: 05 Apr 2016 03:36 by cmorley.
Please Log in or Create an account to join the conversation.
05 Apr 2016 04:36 #72766
by Sparky961
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.
Replied by Sparky961 on topic Setting up MPG with per-axis jog scale
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.
05 Apr 2016 11:32 #72777
by andypugh
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.
Replied by andypugh on topic Setting up MPG with per-axis 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.
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.
09 Apr 2016 22:58 - 09 Apr 2016 22:58 #73015
by Sparky961
Replied by Sparky961 on topic Setting up MPG with per-axis jog scale
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.]
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.]
Last edit: 09 Apr 2016 22:58 by Sparky961.
Please Log in or Create an account to join the conversation.
11 Apr 2016 13:10 #73100
by andypugh
Replied by andypugh on topic Setting up MPG with per-axis jog scale
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.
13 Apr 2016 00:31 #73208
by Sparky961
Replied by Sparky961 on topic Setting up MPG with per-axis jog scale
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.
13 Apr 2016 11:34 #73219
by andypugh
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.
Replied by andypugh on topic Setting up MPG with per-axis jog scale
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.
15 Apr 2016 01:58 #73330
by Sparky961
Replied by Sparky961 on topic Setting up MPG with per-axis jog scale
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.
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.096 seconds