Hello Guest it is April 18, 2024, 11:38:24 PM

Author Topic: Cant get MPG smooth incremental jogging  (Read 698 times)

0 Members and 1 Guest are viewing this topic.

Offline Azalin

*
  •  181 181
    • View Profile
Cant get MPG smooth incremental jogging
« on: September 26, 2021, 05:14:18 PM »
Hi,

I've made an Arduino MPG with pulse generator which is connected to Mach4 via serial. Everything works. Sends and receives data. However I can't get Mach4 to jog smooth and continuous jogging. When I turn the wheel the axis moves the amount of the increment and stops then again. What I want is, when I turn the wheel slow I want the selected axis move slow but continuously. And wise versa: as when I accelerate spinning the wheel I want the axis act the same and move fast. You know, I just want what we all want :)

The code is simple. When mach receives "I" or "D" from serial pendant mach gets the selected axis and jog increment then jogs the axis with it.

How can I change the to have a nice and smooth jog? I'm open to all suggestions.

Thanks.

Code: [Select]
    elseif Command == "I" then
--mc.mcCntlSetLastError(inst, "Jog INC")
        JogInc=mc.mcJogGetInc(inst,0)
MPGAxis = mc.mcMpgGetAxis(inst, 0)
if(mc.mcAxisIsStill(inst,MPGAxis)) then
mc.mcJogIncStart(inst, MPGAxis, JogInc)
end

    elseif Command == "D" then
--mc.mcCntlSetLastError(inst, "Jog DEC")
        JogInc=mc.mcJogGetInc(inst,0)
MPGAxis = mc.mcMpgGetAxis(inst, 0)
if(mc.mcAxisIsStill(inst,MPGAxis)) then
mc.mcJogIncStart(inst, MPGAxis, -1 * JogInc)
end
    end

Offline Azalin

*
  •  181 181
    • View Profile
Re: Cant get MPG smooth incremental jogging
« Reply #1 on: September 27, 2021, 03:59:06 AM »
I tested the predefined keyboard jog functions. mcJogVelocityStart with mcJogSetRate method looks more like what I want.

Code: [Select]
2021-09-27 10:52:16.410 - Logging Enabled.
2021-09-27 10:52:17.214 - Jog Rapid: keydown = true, axis = 0, dir = -1 mckeyboard.cpp:740
2021-09-27 10:52:17.214 - API: mcJogSetRate(inst = 0, axis = 0, percent = 100.0000) (mcKeyboard)
2021-09-27 10:52:17.214 - Attempt transition from "Idle" on event "Jog" axis.cpp:753
2021-09-27 10:52:17.214 - Signal id 1127, (Jog Enabled), changed from HIGH to LOW.
2021-09-27 10:52:17.214 - S_IDLE_on_exit
2021-09-27 10:52:17.214 - Signal id 1172, (Machine Idle), changed from HIGH to LOW.
2021-09-27 10:52:17.214 - ACTION_start_jogging
2021-09-27 10:52:17.214 - S_JOGGING_on_entry
2021-09-27 10:52:17.229 - API: mcJogVelocityStart(inst = 0, axis = 0, dir = -1) = 0 (mcKeyboard)
2021-09-27 10:52:17.284 - Jog Rapid: keydown = false, axis = 0, dir = -1 mckeyboard.cpp:740
2021-09-27 10:52:17.284 - API: mcJogSetRate(inst = 0, axis = 0, percent = 100.0000) (mcKeyboard)
2021-09-27 10:52:17.284 - API: mcJogVelocityStop(inst = 0, axis = 0) = 0 (mcKeyboard)
2021-09-27 10:52:17.352 - Attempt transition from "Jogging" on event "Stop Jog" controller.cpp:1815
2021-09-27 10:52:17.352 - S_JOGGING_on_exit
2021-09-27 10:52:17.352 - S_FILE_RUNNING_stop_jogging
2021-09-27 10:52:17.352 - S_IDLE_on_entry
2021-09-27 10:52:17.352 - Signal id 1127, (Jog Enabled), changed from LOW to HIGH.
2021-09-27 10:52:17.352 - Signal id 1172, (Machine Idle), changed from LOW to HIGH.
Re: Cant get MPG smooth incremental jogging
« Reply #2 on: September 28, 2021, 10:44:36 PM »
Hi,

Quote
How can I change the to have a nice and smooth jog? I'm open to all suggestions.

When Mach jogs in incremental mode it jogs number of complete steps, if those steps are large but with long time intervals between them the motion appears
rough its not, it just stopping between small increments. If you spin the heel fast then it does not happen. The only solution is to use small incremental steps.
This is nice for slow, smooth and precise touch offs say, but is a PITA if you need to traverse a significant distance. That's why there is Velocity mode.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'