Hello Guest it is April 27, 2024, 02:10:19 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Screwie Louie

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 »
81
Mach4 General Discussion / Re: Custom Signal Event Handler?
« on: June 09, 2015, 01:26:42 PM »
Modbus?

I was looking at the same typology kinda (publisher -> server -> subscriber) but having a signal from the mill be the publisher to a "channel" on a MQTT server and m4 being the subscriber (using a PLC script to ping the channel). That way I can control m4 from anywhere there is a Internet connection if I am away from the area. Well, theoretically anyway.

I know, your thinking, why go through an external server for signal processing when I can just send the signal straight to m4.....just trying to look a things from all directions. That's all.  I'm really interested in learning more about TCP/IP config & comms with m4. I get where you are coming from. That's neat!

82
Mach4 Videos / Re: Mach4 - Arduino and Touchscreen
« on: June 09, 2015, 05:58:29 AM »
I hear ya. I'm all in this by myself. It would be so much better if there was someone else close by. Well, I'm moving to Rock Island Arsenal in two weeks...wonder who I will find there? Maybe I'll just walk in and ask if they machined an M65 Atomic Cannon lately. :)

83
thanx Dan!

84
No worries guys! I appreciate the feedback in doing the right thing the right way. No matter how much it takes or how many times I rewrite something, it doesn't mean anything to me unless it's #1 safe, #2 effective, #3 effecient (albeit calculated risks need to be accepted at times, if not assessed or mitigated -> your manager/supervisor is not looking out for you;  they are looking out for their own best interests). Especially dealing with automation. Hey, the Terminator is going to my b!t(h when I'm done learning from y'all!

On a side note....don't look at the code as a "SoftLimitsOn" function, but look at it in a way in which Mach 4 operates, communicates, and synchronizes events across multiple environments....that is the beauty and elegance of m4. Freakin pure genius;  them m4 programmers. They designed a core that is a system, or a core system of systems (multiple environments spread across multiple instances) I didn't even to start to think like this until I dug into m4.

--j

ps. gotta screenSet coming for you guys soon. (so a person posted  a "blue screen" thread. As in blue screen of death. I gotta a "black screen" of death coming!" ...it's cheesy and I'm sure has been done before...all black background, full screen toolpath with led's outputs/signal status, DRO's, gCode file ops, etc. The intent is to show what m4 can do WITHOUT any coding. That's the kicker. No coding! The built in functions and capabilities are great. Sorry, no naked ladies with boobies as MPG's...although...???...

85
Mach4 General Discussion / Re: Custom Signal Event Handler?
« on: June 09, 2015, 04:30:58 AM »
fudge! I just realized I'm a nerd!!!!!  NERDZ!!!! >:D   computerized NERD control


lmao haha...ok, I'll quit now.

maybe.

86
Mach4 General Discussion / Re: Custom Signal Event Handler?
« on: June 09, 2015, 04:30:24 AM »
so...   who is the client and who is the server   ...or... should I say....who is the

publisher....to the 'event handler'...to which, whom has subscribed to?

sorry, may be speaking greek....it's all TCP, lol.



87
Mach4 Videos / Re: Mach4 - Arduino and Touchscreen
« on: June 09, 2015, 04:26:01 AM »
aww, c'mon Daniel. You just need to look at it like Linux as another avenue of approach. Python is actually similar to Lua....and Python has an extensive library that is available to us. I would venture to say....your's, Simpson's, and Daz's approach is another opportunity for all of us on this forum :o)


88
Mach4 Toolbox / Re: Soft Limits toggle
« on: June 08, 2015, 06:30:03 AM »
nevermind that function, I re-wrote something else for you in the other thread.

89
ok...two hours later but I gott'er done the way you suggested. I left all the messages for flag tracking purposes so anyone can see how the flags are changed from btn script / PLC scan & global function calls / and screen load up script.
Attached is the StatusList history report. You can see how the PLC, GUI, and global variables and functions interact and will not execute unless conditions are met (as if there are three different states with interlacing conditional statements that are nested to synchronize gCode, Lua, GUI, and signal events. Remember, this is only "a" way to do this. There are many more ways to accomplish the same endstate. Add to it, subtract whatever you like. I'm tired. forgot the following:" for i=0, 11 do if mc.mcAxisIsHoming(inst, i) then mc.mcSoftLimitSetState(inst, i, 0) end end" and mc.mcSignalSetState(mc.mcSignalGetHandle(inst, mc.OSIG_SOFTLIMITS_ON),0) signal is turned off while homing in case you deref your axes and need to re-reference. G'nite.

Task: auto set soft limits after homing for all enabled axes

Conditions: set soft limit state to on 'after' referencing all axes is complete, continue to use soft limit button toggle to turn on/off soft limits manually

Standard: use lua scripting in a emulated PLC environment

Assumptions: you must have soft enable checked for your axes in mach config, homing order: Zaxis = 1, Xaxis = 2, Yaxis = 2

CONOPS:

flagON     SignalOFF     =     SignalON
    1               0                         1      

flagOFF    SignalON      =     SignalOFF
    1               1                         0

flagOFF     SignalOFF     =     SignalON
    1               0                         1

Button script: "btnSoftLimits"
--take the SoftLimits Toggle option off; we will code our own toggle button
--Left Down Script

   flagSoftLimitsOff = 1

Button script: "btnRefAll"

    local inst = mc.mcGetInstance();
    mc.mcAxisHomeAll(inst);
    flagSoftLimitsOn = 1

Screen Load Up script:

--Define global variables.
    flagSoftLimitsOn = 0
    flagSoftLimitsOff = 0

--Soft limits set for all referenced axes after homing.
    function setMySoftLimits()
        local inst = mc.mcGetInstance()
        local a = 0
        local b = 0
        for i = 0, 11 do if mc.mcAxisIsEnabled(inst, i) == 1 then a = a + 1 end end
            mc.mcCntlSetLastError (inst, tostring(a) .." axes enabled.")
        for i = 0, a do if mc.mcAxisIsHomed (inst, i) == 1 then b = b + 1 end end
            mc.mcCntlSetLastError (inst, tostring(b) .." axes homed.")
        if flagSoftLimitsOn == 1 then
            if a == b and b ~= 0 then
                for i = 0, b-1 do
                    mc.mcSoftLimitSetState(inst, i, 1)  
                    mc.mcCntlSetLastError (inst, "Axis " ..tostring(i) .." soft limit value is " ..tostring(mc.mcSoftLimitGetState(inst, i)))
                end
                flagSoftLimitsOn = 0
            end
        elseif flagSoftLimitsOff == 1 then
            for i = 0, b-1 do
                mc.mcSoftLimitSetState(inst, i, 0)
                mc.mcCntlSetLastError (inst, "Axis " ..tostring(i) .." soft limit value is " ..tostring(mc.mcSoftLimitGetState(inst, i)))
            end
            flagSoftLimitsOff = 0
        end
    end

PLC script:
--SoftLimts scan    
if  machState == mc.MC_STATE_IDLE and mc.mcSignalGetState(mc.mcSignalGetHandle(inst, mc.OSIG_SOFTLIMITS_ON)) == 0 and flagSoftLimitsOn == 1 then
    mc.mcCntlSetLastError (inst, "(PLC send, btnRefAllHome) flagSoftLimitsOn = " ..tostring(flagSoftLimitsOn) .."   flagSoftLimitsOff = " ..tostring(flagSoftLimitsOff))
    setMySoftLimits()
    mc.mcCntlSetLastError (inst, "(PLC return) flagSoftLimitsOn = " ..tostring(flagSoftLimitsOn) .."   flagSoftLimitsOff = " ..tostring(flagSoftLimitsOff))
elseif machState == mc.MC_STATE_IDLE and mc.mcSignalGetState(mc.mcSignalGetHandle(inst, mc.OSIG_SOFTLIMITS_ON)) == 1 and flagSoftLimitsOff == 1 then
    mc.mcCntlSetLastError (inst, "(PLC send, btnSoftLimits toggle off) flagSoftLimitsOn = " ..tostring(flagSoftLimitsOn) .."   flagSoftLimitsOff = " ..tostring(flagSoftLimitsOff))
    setMySoftLimits()
    mc.mcCntlSetLastError (inst, "(PLC return) flagSoftLimitsOn = " ..tostring(flagSoftLimitsOn) .."   flagSoftLimitsOff = " ..tostring(flagSoftLimitsOff))  
elseif machState == mc.MC_STATE_IDLE and mc.mcSignalGetState(mc.mcSignalGetHandle(inst, mc.OSIG_SOFTLIMITS_ON)) == 0 and flagSoftLimitsOff == 1 then
    flagSoftLimitsOn = 1
    flagSoftLimitsOff = 0
    mc.mcCntlSetLastError (inst, "(PLC send, btnSoftLimits toggle on) flagSoftLimitsON = " ..tostring(flagSoftLimitsOn) .."   flagSoftLimitsOff = " ..tostring(flagSoftLimitsOff))
    setMySoftLimits()
    mc.mcCntlSetLastError (inst, "(PLC return) flagSoftLimitsOn = " ..tostring(flagSoftLimitsOn) .."   flagSoftLimitsOff = " ..tostring(flagSoftLimitsOff))
end

--j


90
you set your homing order in mach config. the function mcAxisIsHomed is asking "is the axis homed?" before setting the soft limits on. I am not homing the axis. That is mc.mcAxisHome or mc.mcAxixHomeAll.

---oh, mc.mcAxisHomeCompleteWithStatus. Yes, you are right. That is a reporting function by the motion controller. Good catch. My mind is on something else on other functions to stop the motor, sync it's position, before moving onto the next chunk of lua code.

we want to use a conditional if statement with 'mc.mcAxisIsHomed' (after referencing is complete)---as the condition. If 'Is homed' = true then set soft limits on.....
 
Orginally I was just asking if the axis was enabled and setting the soft limits to on (assuming the softlimits are just any homing offsets) which would take effect after referencing machine coordinates (0,0,0). But it makes more sense to reference the machine first, then set the soft limits on 'after' finding (0,0,0). Yep.

gotta place it in the plc, but do it in such a way that when you toggle the SL button the plc call doesn't reactivate it; as so to give you the user the choice to turn off the soft lmits....hold on. give me fifeteen minutes and I'll figure it out. Only been doing this lua stuff for two weeks and I'm stuck on something simple. I have yet to get to screensets and stuff. Although I can toggle a full screen toolpath display. That was fun figuring out. I'm stuck on this motor stopping, position syncing, before going to next chunk of lua code bit. Hold on...I'll be back.

Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 »