Hello Guest it is April 16, 2024, 01:17:08 AM

Author Topic: understanding Jog and signals?  (Read 3075 times)

0 Members and 1 Guest are viewing this topic.

understanding Jog and signals?
« on: May 27, 2017, 09:33:25 AM »
Hi,

I try to synchronize on-screen buttons and external switches (not mpg) for jogging purpose.
Therefore I tried to watch signals during jogging - but I could not see any signal changes.

I placed a LED on the screen and attached it to input-sigal "jogX+".
I have an on-screen button with down-action "jogX+" and up-action "stop X-jogging", which works as expected: the x-coordinate increments as long as I press the button.
I have another on-screen button with down-script that executes mcJogIncStart(...) and up-script that executes mcJogIncStop(...). That button does not work as expected. The increment-interval is applied only once - no matter how long I press the button.

But worse for synchronization matter, the signal "jogX+" does not reflect the state of jogging, when using on-screen buttons.

So if I want to use a switch attached to "jogX+", how can I get the same action (as the button with up/down-actions), no matter whether I touch the onscreen button or the external switch?
Is there a signal (I thried the most obvious ones, but did not see any changes) that reflects the jogging state of motion control?

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: understanding Jog and signals?
« Reply #1 on: May 27, 2017, 10:11:10 AM »
Personaly myself I use the signals such as
Code: [Select]
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGYP), 1) --Turns on Y++
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGYP), 0) --Turns off Y++

and ofcoarse all other axis needs the same, this way they serve as both inc and velocity dependingt on what you have set.

DazTheGas
New For 2022 - Instagram: dazthegas
Re: understanding Jog and signals?
« Reply #2 on: May 27, 2017, 10:17:58 AM »
Hi,

thank you for your attention and support!

my code differs in formatting but substantially should be the same (body of a button script):
Code: [Select]
        -- X++
        local sh = mc.mcSignalGetHandle(inst, mc.ISIG_JOGXP)

        if (sh ~= nil) then
            mc.mcSignalSetState(sh, true)
        end
--        mc.mcJogIncStart(inst, 0, 0.1)
so I don't see my error :(
Re: understanding Jog and signals?
« Reply #3 on: May 27, 2017, 11:38:21 PM »
Hi DazTheGaz,

I beg your pardon - I found my mistake!
I had a typo in the lines before the event functions, so that it never became executed. Therefore I searched for the bug at the wrong locations :(

Thanks to your help I found my error and now the signal handling works as expected. Thanks!
Re: understanding Jog and signals?
« Reply #4 on: May 28, 2017, 02:10:44 AM »
Quote
this way they serve as both inc and velocity dependingt on what you have set.
Hm, I did some more tests and I don't see, how jog velocity can be influenced that way.
The jog-increment is not taken into account, so what did you mean by inc and velocity can be handled?

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: understanding Jog and signals?
« Reply #5 on: May 28, 2017, 03:45:16 PM »
When using the jog signals as I stated

Code: [Select]
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGYP), 1) --Turns on Y++
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGYP), 0) --Turns off Y++

you also need to tell mach4 what type of jog you are doing, I do this with

Code: [Select]
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.OSIG_JOG_INC),1)
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.OSIG_JOG_CONT),0)

and toggle the signals depending whether I need Inc or Cont

DazTheGas
New For 2022 - Instagram: dazthegas
Re: understanding Jog and signals?
« Reply #6 on: May 28, 2017, 11:16:34 PM »
Thank you for the additional info.
The point is, I found both variants, when I translated the po-files, the problem is: I have no idea what each one is meaning.
So I have to try, whether I see a difference.
Re: understanding Jog and signals?
« Reply #7 on: May 29, 2017, 08:26:31 AM »
So I tried it and I'm not able to see any difference.

First I thought: may be I did some mistakes and added two leds to visualize the signal state ...
So I tried signal states Jog_inc on and Jog_cont off as well as Jog_inc off and Jog_cont on.

I have to confess, I'm not able to press the mouse-button at exact duration, so it is far from being measured. Just a sort of feeling.
From what I can see, I would state, that jogging happens at rapid-feed-speed and if there is any ramp, it would be the ramp programmed at motor definitions.

... so could you please tell me, what should be different?

With my current settings jogging is so fast, I don't want to manually move the machine by that speed =:O
So yes - would be really nice, if it would be possible, to set a jogging speed :)

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: understanding Jog and signals?
« Reply #8 on: May 29, 2017, 08:38:13 AM »
I really must advise that you read the MachApi found in the docs directory, there is a full section with explaination of all commands for jogging. The command you are looking for is mc.mcJogSetRate(number mInst, number axisId, number percent) this will control the jogging speed.#

DazTheGas
New For 2022 - Instagram: dazthegas
Re: understanding Jog and signals?
« Reply #9 on: May 29, 2017, 09:25:49 AM »
Hi DazTheGas,

I beg your pardon! I'm no native english and I guess, I got you wrong.

Quote
this way they serve as both inc and velocity dependingt on what you have set.
From these words I thought, that you're able to change jogging velocity by signal switching only.
I read a lot about mach4 and of cause, I forget a lot too.
Don't remember where it was, but I read, that some jogging variables are for mpg-jogging only.
... anyway: once walking on the wrong trail, its hard to recognize that on my own.
So thank you very much for your assistance!

Now I tried to use a slider to reduce jogging speed and it works like expected.
I hope you don't get angry about my mistakes.

cheers Reinhard