Hello Guest it is December 07, 2019, 07:03:39 PM

Author Topic: Activate input  (Read 1826 times)

0 Members and 1 Guest are viewing this topic.

Offline DazTheGas

*
  •  750 750
  • DazTheGas
    • View Profile
Activate input
« on: June 29, 2015, 05:03:41 AM »
In the lua examples directory there is an example of activating an output from script, is there a way to activate an input from script, I am setting up a diagnostic screen but really don't want the machine running whilst testing some of the features I am working on.

In particular I want to use mc.ISIG_JOGXN

DazTheGas
Theres always time for a choccy biccy

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Activate input
« Reply #1 on: June 29, 2015, 06:04:40 AM »
it think its the same as output

mc.ISIG_INPUT0

mc.OSIG_OUTPUT0
« Last Edit: June 29, 2015, 06:08:43 AM by daniellyall »
Re: Activate input
« Reply #2 on: June 30, 2015, 01:07:30 AM »
Got this to work in the sim, whereas the DRO's will not move and the button will let you toggle the input signal without actually moving the axis.

Button Down Script:
     local inst = mc.mcGetInstance()
     mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGXN), 1)
     mc.mcJogVelocityStop (inst, 0)

Button Up Script:
     local inst = mc.mcGetInstance()
     mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGXN), 0)

Offline DazTheGas

*
  •  750 750
  • DazTheGas
    • View Profile
Re: Activate input
« Reply #3 on: June 30, 2015, 02:53:34 AM »
Screwie to the rescue :-),

ive tried using the code from example in all different ways to no avail ended up with using mc.mcJogVelocityStart(inst, 0, -1) to start then mc.mcJogVelocityStop (inst, 0) to stop, but this then need a load of if and then statements for jog mode etc, but now its a simple as

Button down evt
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGXN), 1)

Button up evt
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.ISIG_JOGXN), 0)

as you can see theres no need to keep declaring the mach instance as my whole enviroment is now scripted in wxlua without using the editor buttons etc

cheers screwie....

DazTheGas
« Last Edit: June 30, 2015, 02:57:20 AM by DazTheGas »
Theres always time for a choccy biccy

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Activate input
« Reply #4 on: June 30, 2015, 03:06:42 AM »
two ways to do the same thing but whats better

Offline DazTheGas

*
  •  750 750
  • DazTheGas
    • View Profile
Re: Activate input
« Reply #5 on: June 30, 2015, 03:21:24 AM »
two ways to do the same thing but whats better

by using mc.ISIG_JOGXN mach4 will sort out if we are in continuous mode or step, the other way has 2 functions 1 for continuous the other for increment so extra code is needed for each axis to determine what state we are in.

DazTheGas
Theres always time for a choccy biccy
Re: Activate input
« Reply #6 on: June 30, 2015, 04:03:27 AM »
could be mach machine state....changing the state if possible? This may sound like a simple solution but everybody and every machine is different. This is a neat puzzle....
« Last Edit: June 30, 2015, 04:06:30 AM by Screwie Louie »
Re: Activate input
« Reply #7 on: June 30, 2015, 02:23:19 PM »
nevermind my last comment about changing the state...it's retarded.