Hello Guest it is April 29, 2024, 12:12:16 PM

Author Topic: mpg "Velocity mode"  (Read 279 times)

0 Members and 1 Guest are viewing this topic.

mpg "Velocity mode"
« on: March 18, 2023, 11:50:22 AM »
I'm just starting to try Mach4 moving from Mach3.
I have an mpg connected to Pokeys57U.
In Mach4 I don't see any way of running mpg with "Velocity mode" per Mach3, which I found to be a very useful mode of operation for larger moves and rough positioning before switching to incremental mode for slow fine positioning.
As far as I can tell Mach4 only works with mpg in incremental mode which will easily "wind up" causing potential long continuation of motion after mpg stopped.
Is there a way to implement the Mach3 mpg Velocity mode in Mach4?

Thanks Peter 
Re: mpg "Velocity mode"
« Reply #1 on: March 18, 2023, 07:00:59 PM »
Hi,

Quote
Is there a way to implement the Mach3 mpg Velocity mode in Mach4?

Yes there is but its not straight forward.

If you have an MPG, that is connected to your breakout board and thence to your motion controller. Your motion controller then passes the numeric number of clicks to Mach
which then issues the move instructions depending on the selected current increment. It works fine....proivided you don't spin wheel too fast and end up with a whole bunch of after-run,
that can ruin your day!

That describes how incremental mode works, but what about velocity mode.? For this purpose I would suggest you experiment with Mach by writing some macros that do
velocity jogging using the API's:

Code: [Select]
LUA Syntax:
rc = mc.mcJogVelocityStart(
number mInst,
number axisId,
number dir);

Description:
Start a velocity jog on the given axis.

and:
Code: [Select]
LUA Syntax:
mcJogVelocityStop(
number mInst,
number axisId)

Description:
Stop a velocity jog on an the given axis.


Basically you start a velocity jog and then some time later you stop it, usually by lifting your finger off the jog button on your keyboard.

This does not work with an MPG, it sends a series of pulses which are ALWAYS interpreted by Mach as incremental moves.

What I did is modify my pendant, I made it so I figure that I can do what I like with it, such that when I want Velocity mode jogging I hold a sprung loaded
toggle switch, and then the microprocessor inside my pendant issues a continuous signal but ONLY WHILE I spin the MPG at at least one click per second.

If you like the MPG becomes the logical equivalent of a keyboard button, when the MPG is spinning (above some minimum rate) the button is pressed, and when its not spinning
the button is released. Thereafter its simply a matter of writing jog scripts to match the 'button presses'. The axis select switch works per normal.

Note that this relies on a small microprocessor in my pendant, and that you can program it. This is the complication that I refer to.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: mpg "Velocity mode"
« Reply #2 on: March 19, 2023, 08:52:21 AM »
Thanks joeaverage,

I will definitely experiment with the Mach API's.
I guess the Mach3 Velocity mpg functionality was quite similar (more correctly I was using "Step & Velocity" mode). It worked in mpg incremental mode until axis velocity was maxing out (and mpg could then potentially get ahead of motion) it would then switch to velocity move until mpg rate was below max speed again at which point it would drop back to mpg controlled moves, starting from the position the velocity jog stopped.
It's probably cleverer than that in Mach3 and probably takes any cause for mpg windup including acceleration and velocity limits into account. It probably also employed some filtering/hysteresis on mpg speed so that it wouldn't rapidly jump back and forth between modes. Even if I could only implement a simplified version it may prove to be functional.

Knowing very little about the Mach4 API at this point I'll take a look and see if it is possible to do something similar. If not then potentially look at the options back at the mpg encoder end.
I could potentially see a couple of approaches. Have to find out more about what's feasible to read and control in the API.

A quick look for other options appears to show that custom functionality can be programmed in the Pokeys device using Poblocks so that may give another option to try and achieve some functionality without resorting to making my own microcontroller pcb, although again I currently have no experience of Pokeys/Poblocks programming.