Hello Guest it is April 23, 2024, 03:43:23 PM

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 - karcher

Pages: 1
1
Mach4 General Discussion / Re: Shift Z-axis workshift with scale on knee
« on: November 08, 2021, 09:48:13 PM »
Thanks Bill,  I was able to get it working although I wasn't able to use the "Aux Position" function of Mach4 V2.  Instead I set up a dummy axis and used the API calls that are documented.

Unfortunately, with the release of V2 and all the updates it brings there doesn't seem to be much in the way of documentation, the Core API help file included in the installation seems to be from 2017, long before V2.

This is the code I added to the PLC script;
---------------------------------------------------------------
-- Check for Table move and update Table Position
---------------------------------------------------------------
local Cpos = mc.mcAxisGetMachinePos(inst, 5)
local ZheadShift = mc.mcCntlGetPoundVar(inst, mc.SV_HEAD_SHIFT_Z)
local TablePosReg = mc.mcRegGetHandle(inst, 'iRegs0/TablePosition')
local homedC=mc.mcAxisIsHomed(inst,mc.C_AXIS)

if  (homedC ~= 0) and (Cpos ~= ZheadShift) then
    mc.mcCntlSetPoundVar(inst, mc.SV_HEAD_SHIFT_Z, Cpos)
    mc.mcRegSetValue(TablePosReg, Cpos)
end
---------------------------------------------------------------
-- End of Check for Table move and update Table Position
---------------------------------------------------------------


And this code to the refAllHome() function in the screen load script;
---------------------------------------------------------------
-- Load Previous Table Position
---------------------------------------------------------------
local TablePosReg = mc.mcRegGetHandle(inst, 'iRegs0/TablePosition')
local TablePos = mc.mcRegGetValue(TablePosReg)
mc.mcCntlSetPoundVar(inst, mc.SV_HEAD_SHIFT_Z, TablePos)
mc.mcAxisSetHomeOffset(inst, 5, TablePos)
---------------------------------------------------------------
-- End of Load Previous Table Position
---------------------------------------------------------------



2
Mach4 General Discussion / Re: Shift Z-axis workshift with scale on knee
« on: November 06, 2021, 02:03:52 PM »
So I have the knee scale configured for the "C" axis (motor 5) Aux position.  I've created a DRO on the screen to display the C Aux position and it's reading properly.

What I need now and I am having an issue finding the right API calls is a script to do the following.

When C axis Aux position changes
     (read C aux position and write new position to Z head shift)

On screen load
     (read Z head shift and write position to C aux position)

Is Z head shift retained upon Mach4 restarts?  If not I would need to do this;

When C axis Aux position changes
     (read C aux position and write new position to Z head shift and also write to reg file)

On screen load
     (read reg file and write position to C aux position and also to Z head shift)

Can someone help me write this script?  Or at least get me close reading the aux position change and API calls to read/write aux position, head shift and reg file.

3
Mach4 General Discussion / Re: Shift Z-axis workshift with scale on knee
« on: November 01, 2021, 06:22:24 PM »
With the Z-axis on the quill and only having 5" of travel I am limited to similar length tools, the difference in a facemill and drill can easily take up the entire travel of the Z-axis.  When I move the knee up or down to accommodate for the difference in tool lengths the calibration for the tool setter (mounted on the table) is no longer viable.

What I would like to do is to update the work offsets (using head shift or ext workoffset will shift all work offsets) automatically and in realtime as the table is moved up or down.  I suppose a script that reads encoder 6 (the knee scale), converts the position in pulses to either inch or metric and updates the ext work offset or another register of some sort.

This way as the table gets moved the work offset is updated automatically

4
Mach4 General Discussion / Shift Z-axis workshift with scale on knee
« on: November 01, 2021, 03:46:54 PM »
Hello,

I have a three axis knee mill retrofitted with Mach4.  The Z-axis is on the quill and has only 5" of travel.

What I would like to do is use the scale that is on the knee (already interfaced to the DSPMC) to update the work shift when it is moved that way as the table is moved up and down the work offsets are still relevent.

The scale is interfaced to scale 6 of the DSPMC, what would be the most robust way to have it update the workshift when moved?

5
I have resolved the issue, the default polling frequency of 10Hz is too slow but the recommended speed of 100Hz works well.

6
I've also tried the latest dev build of Mach4 but same issue exists.

I have sent the profile

7
Thanks Mike,

I've tried moves up to 10" in the plugin and the movement is smooth.  Also I've adjusted the acc in M4 to several settings down to 1u/s2.  Obviously the motion appears different due to such a low acc but still jumpy when commanded by M4 and smooth from the plugin.

Ken

8
Yes, I have restarted M4 several times, verified the settings in M4 config screen and profile .ini file flashed the latest firmware to the dspMC (it was already at latest but flashed anyway)

9
I have tuned my axis well in the dspMC plugin and the test motion is very smooth and stable but when I command a move from Mach4 either jogging or g-code the axis has a considerable studder, the machine shakes and will trip on following error.

I have used the same max velocity and acceleration settings on Mach4 as the dspMC plugin and even tried adjusting these settings in M4 very dramatically but to no avail.


10
Mach4 Videos / Re: Mach4 Quicky #2 Keyboard Plugin
« on: January 01, 2018, 10:03:57 PM »
Very nice solution Daz and an excellent video.

I am considering building a complete USB interfaced operator panel and will need over 60 inputs, as I didn't want to tie up almost all the inputs in M4 I found a way to read from the keyboard plugin directly rather than mapping the inputs to the I/O table.

I realized that the PMC script could read directly from the keyboard plugin but was limited as what I could write to so I borrowed the code from the PMC script and put it in the PLC script in the same place you added yours.

Here it is;

Code: [Select]
local hIo, hReg, hSig, rc
local mInst = 0

local function Read_Io(path)
    hIo = 0
    rc = mc.MERROR_NOERROR
    hIo, rc = mc.mcIoGetHandle(mInst, path)
    if (rc == mc.MERROR_NOERROR) then
        local state = 0
        state, rc = mc.mcIoGetState(hIo)
        if (rc == mc.MERROR_NOERROR) then
            return state
        end
    end
    return 0
end

if(Read_Io("Keyboard/input0") == 1) then -- "input0" is the name of the mapped key in the keyboard plugin
  scr.SetProperty('slideFRO', 'Value', tostring(100)); -- Sets federate override to 100%
end


Pages: 1