69
« on: July 14, 2018, 02:43:57 PM »
Did you look in the History window to see if an error such as "Probe obstructed" or "No contact with probe" immediately preceded "Can't transition from PROBING to OPERATION"? The latter may well have occurred simply because Mach4 had by then been disabled.
The controller is bound fairly closely with probing, and I don't use the ESS, but I have found that with certain probes the technique used in the mcProbing.lua module to determine the success of a probe strike does not work. This might explain why approach speed etc. seems to be a factor for some users. The correct way to test for a strike is to compare the commanded destination with the reported strike point. If a strike occurs within the commanded distance, these will differ. If no strike occurs, they will be (approximately) equal. I say approximately because I have found that they can be subject to small rounding errors such that testing for equality will invariably fail.
If you would like to try this approach, here is the code I personally have found reliable:
function Probing.CheckProbeStrike(ok, ProbeTo, ProbeReg, Hit)
-- AW Test for strike using position data as Probe signal can give the wrong indication
-- AW ProbeTo is commanded probe position
-- AW ProbeReg is the register containing the recorded strike point.
-- AW Units of ProbeTo and @ProbeReg must match i.e. user or machine units
-- AW Hit = non-zero indicates that a strike is expected,Hit = 0 that probe should remain clear
if not ok then; do return false; end; end
local inst = mc.mcGetInstance()
local EndPoint = mc.mcCntlGetPoundVar(inst, ProbeReg)
--local probeHit, rc = mc.mcCntlProbeGetStrikeStatus(inst) -- This doesn't work
--if (EndPoint == ProbeTo) then -- This doesn't work
if (math.abs(EndPoint - ProbeTo) < 0.0001) then
-- Probe failed to strike
if (Hit ~= 0) then
mc.mcCntlSetLastError(inst, "ProbeTo: " .. tostring(ProbeTo) .. " EndPoint: " .. tostring(EndPoint))
mc.mcCntlSetLastError(inst, "Probe: No contact with probe")
ok = false
end
elseif (Hit == 0) then
-- Probe struck
mc.mcCntlSetLastError(inst, "ProbeTo: " .. tostring(ProbeTo) .. " EndPoint: " .. tostring(EndPoint))
mc.mcCntlSetLastError(inst, "Probe: Probe was obstructed")
ok = false
end
return ok
end
My probing module is highly customised, so you would need to adapt this and the existing CheckProbe function calls but it should suffice to give you the general idea of what is needed. Take note that this must only be used where a G31 has been issued: at other times it is appropriate to simply test the probe signal as is done in the standard module. You could initially try this approach for the calibration functions and expand it to others if you have any success with it.
Allan