Hello Guest it is April 25, 2024, 07:50:22 AM

Author Topic: Crash after tool change  (Read 2000 times)

0 Members and 1 Guest are viewing this topic.

Offline Azalin

*
  •  181 181
    • View Profile
Re: Crash after tool change
« Reply #10 on: April 03, 2022, 03:17:05 PM »
Hi,

Still the same.

Are you able to do a test for me? I just wonder if it works for you.

Run the code,
on M6 jog the Z axis down then ZERO Z.
Hit cycle start and see if Z axis goes and stops at -1.

Thanks in advance,
Suat
Re: Crash after tool change
« Reply #11 on: April 03, 2022, 03:53:25 PM »
Hi,
look at the diagnostics page. If a tool length offset is applied it will be listed.

Clearly you have a problem with offsets.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Azalin

*
  •  181 181
    • View Profile
Re: Crash after tool change
« Reply #12 on: April 03, 2022, 04:00:37 PM »
Hi,

No offset output in the log:

2022-04-03 22:54:49.638 - Logging Enabled.
2022-04-03 22:54:51.586 - API: mcCntlCycleStart(inst = 0) (unknown caller)
2022-04-03 22:54:51.698 - Attempt transition from "Macro Hold" on event "Cycle Start" machapi.cpp:3085
2022-04-03 22:54:51.699 - S_FILE_MACRO_HOLD_on_exit
2022-04-03 22:54:51.699 - ACTION_start_cycle
2022-04-03 22:54:51.699 - S_FILE_RUNNING2_on_entry
2022-04-03 22:54:51.713 - Signal id 1121, (Tool Change), changed from HIGH to LOW.
2022-04-03 22:54:51.714 - Spindle speed capped by current range!
2022-04-03 22:54:51.716 - Signal id 1142, (Spindle Fwd), changed from LOW to HIGH.
2022-04-03 22:54:51.716 - Signal id 1141, (Spindle On), changed from LOW to HIGH.
2022-04-03 22:54:51.717 - Waiting 0.000000 seconds for spindle at speed... spindle.cpp:300
2022-04-03 22:54:51.717 - Done. spindle.cpp:305
2022-04-03 22:54:51.718 - Signal id 1144, (Coolant On), changed from LOW to HIGH.
2022-04-03 22:55:30.202 - WaitOnMacro() thisTc = 0, isDone = 1
2022-04-03 22:55:30.266 - Waiting on planner to drain before waiting on SetStill... runcanon.cpp:92
2022-04-03 22:55:30.266 - Waiting on SetStill...
2022-04-03 22:55:30.266 - Controller::RunCanonBuffer called AddStopReportRequest() runcanon.cpp:101
2022-04-03 22:55:30.266 - Requesting a stopped report for axis 0 motors.
2022-04-03 22:55:30.266 - Requesting a stopped report for motor 0.
2022-04-03 22:55:30.266 - Requesting a stopped report for axis 1 motors.
2022-04-03 22:55:30.266 - Requesting a stopped report for motor 1.
2022-04-03 22:55:30.266 - Requesting a stopped report for axis 2 motors.
2022-04-03 22:55:30.266 - Requesting a stopped report for motor 2.
2022-04-03 22:55:30.266 - Requesting a stopped report for axis 3 motors.
2022-04-03 22:55:30.267 - Requesting a stopped report for motor 3.
2022-04-03 22:55:30.267 - API: mcMotionSetStill(inst = 0, motor = 0) (Sim)
2022-04-03 22:55:30.267 - SetStill(): Motor 0 last position reported = -7873.6220 controller.cpp:1400
2022-04-03 22:55:30.267 - Axis 1 reports that it is still moving! controller.cpp:1407
2022-04-03 22:55:30.267 - API: mcMotionSetStill(inst = 0, motor = 1) (Sim)
2022-04-03 22:55:30.267 - SetStill(): Motor 1 last position reported = 41.7323 controller.cpp:1400
2022-04-03 22:55:30.267 - Axis 2 reports that it is still moving! controller.cpp:1407
2022-04-03 22:55:30.267 - API: mcMotionSetStill(inst = 0, motor = 2) (Sim)
2022-04-03 22:55:30.268 - SetStill(): Motor 2 last position reported = 9065.9727 controller.cpp:1400
2022-04-03 22:55:30.268 - Axis 3 reports that it is still moving! controller.cpp:1407
2022-04-03 22:55:30.268 - API: mcMotionSetStill(inst = 0, motor = 3) (Sim)
2022-04-03 22:55:30.268 - SetStill(): Motor 3 last position reported = 0.0000 controller.cpp:1400
2022-04-03 22:55:30.268 - All motors marked as still.
2022-04-03 22:55:30.268 - Waiting on SetStill is Done!
2022-04-03 22:55:30.283 - API: mcMotionSetStill(inst = 0, motor = 0) (Sim)
2022-04-03 22:55:30.283 - SetStill(): Motor 0 last position reported = -7873.6220 controller.cpp:1400
2022-04-03 22:55:30.283 - All motors marked as still.
2022-04-03 22:55:30.283 - API: mcMotionSetStill(inst = 0, motor = 1) (Sim)
2022-04-03 22:55:30.283 - SetStill(): Motor 1 last position reported = 41.7323 controller.cpp:1400
2022-04-03 22:55:30.283 - All motors marked as still.
2022-04-03 22:55:30.283 - API: mcMotionSetStill(inst = 0, motor = 2) (Sim)
2022-04-03 22:55:30.283 - SetStill(): Motor 2 last position reported = 9065.9727 controller.cpp:1400
2022-04-03 22:55:30.284 - All motors marked as still.
2022-04-03 22:55:30.284 - API: mcMotionSetStill(inst = 0, motor = 3) (Sim)
2022-04-03 22:55:30.284 - SetStill(): Motor 3 last position reported = 0.0000 controller.cpp:1400
2022-04-03 22:55:30.284 - All motors marked as still.
2022-04-03 22:55:30.298 - Signal id 1121, (Tool Change), changed from LOW to HIGH.
2022-04-03 22:55:30.314 - API: mcCntlToolChangeManual(inst = 0) (unknown caller)
2022-04-03 22:55:30.314 - Attempt transition from "File Running" on event "Macro Hold" controller.cpp:4657
2022-04-03 22:55:30.314 - S_FILE_RUNNING2_on_exit
2022-04-03 22:55:30.314 - ACTION_start_macro_hold
2022-04-03 22:55:30.314 - S_FILE_MACRO_HOLD_on_entry
2022-04-03 22:55:37.648 - Attempt transition from "Macro Hold" on event "Jog" axis.cpp:753
2022-04-03 22:55:37.649 - S_FILE_MACRO_HOLD_on_exit
2022-04-03 22:55:37.649 - ACTION_start_jogging
2022-04-03 22:55:37.649 - S_FILE_MACRO_JOGGING_on_entry
2022-04-03 22:55:37.664 - API: mcJogVelocityStart(inst = 0, axis = 2, dir = -1) = 0 (Mach4GUI Button)
2022-04-03 22:55:41.144 - API: mcJogVelocityStop(inst = 0, axis = 2) = 0 (Mach4GUI Button)
2022-04-03 22:55:41.967 - Attempt transition from "Macro Hold Jogging" on event "Stop Jog" controller.cpp:1815
2022-04-03 22:55:41.967 - S_FILE_MACRO_JOGGING_on_exit
2022-04-03 22:55:41.967 - S_FILE_RUNNING_stop_jogging
2022-04-03 22:55:41.967 - Signal id 1127, (Jog Enabled), changed from LOW to HIGH.
2022-04-03 22:55:41.968 - S_FILE_MACRO_HOLD_on_entry
2022-04-03 22:55:53.057 - API: mcCntlCycleStart(inst = 0) (unknown caller)
2022-04-03 22:55:53.171 - Attempt transition from "Macro Hold" on event "Cycle Start" machapi.cpp:3085
2022-04-03 22:55:53.172 - Signal id 1127, (Jog Enabled), changed from HIGH to LOW.
2022-04-03 22:55:53.173 - S_FILE_MACRO_HOLD_on_exit
2022-04-03 22:55:53.173 - ACTION_start_cycle
2022-04-03 22:55:53.173 - S_FILE_RUNNING2_on_entry
2022-04-03 22:55:53.202 - Signal id 1121, (Tool Change), changed from HIGH to LOW.
2022-04-03 22:55:53.203 - Spindle speed capped by current range!
2022-04-03 22:55:53.204 - Signal id 1142, (Spindle Fwd), changed from HIGH to LOW.
2022-04-03 22:55:53.205 - Signal id 1142, (Spindle Fwd), changed from LOW to HIGH.
2022-04-03 22:55:53.205 - Waiting 0.000000 seconds for spindle at speed... spindle.cpp:300
2022-04-03 22:55:53.205 - Done. spindle.cpp:305
2022-04-03 22:55:58.070 - WaitOnMacro() thisTc = 0, isDone = 1
2022-04-03 22:55:58.133 - Waiting on planner to drain before waiting on SetStill... runcanon.cpp:92
2022-04-03 22:55:58.133 - Waiting on SetStill...
2022-04-03 22:55:58.133 - Controller::RunCanonBuffer called AddStopReportRequest() runcanon.cpp:101
2022-04-03 22:55:58.133 - Requesting a stopped report for axis 0 motors.
2022-04-03 22:55:58.133 - Requesting a stopped report for motor 0.
2022-04-03 22:55:58.133 - Requesting a stopped report for axis 1 motors.
2022-04-03 22:55:58.133 - Requesting a stopped report for motor 1.
2022-04-03 22:55:58.133 - Requesting a stopped report for axis 2 motors.
2022-04-03 22:55:58.133 - Requesting a stopped report for motor 2.
2022-04-03 22:55:58.133 - Requesting a stopped report for axis 3 motors.
2022-04-03 22:55:58.133 - Requesting a stopped report for motor 3.
2022-04-03 22:55:58.134 - API: mcMotionSetStill(inst = 0, motor = 0) (Sim)
2022-04-03 22:55:58.134 - SetStill(): Motor 0 last position reported = -5845.6693 controller.cpp:1400
2022-04-03 22:55:58.134 - Axis 1 reports that it is still moving! controller.cpp:1407
2022-04-03 22:55:58.134 - API: mcMotionSetStill(inst = 0, motor = 0) (Sim)
2022-04-03 22:55:58.135 - SetStill(): Motor 0 last position reported = -5845.6693 controller.cpp:1400
2022-04-03 22:55:58.135 - Axis 1 reports that it is still moving! controller.cpp:1407
2022-04-03 22:55:58.135 - API: mcMotionSetStill(inst = 0, motor = 1) (Sim)
2022-04-03 22:55:58.135 - SetStill(): Motor 1 last position reported = -5804.3307 controller.cpp:1400
2022-04-03 22:55:58.135 - Axis 2 reports that it is still moving! controller.cpp:1407
2022-04-03 22:55:58.135 - API: mcMotionSetStill(inst = 0, motor = 1) (Sim)
2022-04-03 22:55:58.135 - SetStill(): Motor 1 last position reported = -5804.3307 controller.cpp:1400
2022-04-03 22:55:58.135 - Axis 2 reports that it is still moving! controller.cpp:1407
2022-04-03 22:55:58.135 - API: mcMotionSetStill(inst = 0, motor = 2) (Sim)
2022-04-03 22:55:58.135 - SetStill(): Motor 2 last position reported = -13957.7281 controller.cpp:1400
2022-04-03 22:55:58.135 - Axis 3 reports that it is still moving! controller.cpp:1407
2022-04-03 22:55:58.136 - API: mcMotionSetStill(inst = 0, motor = 2) (Sim)
2022-04-03 22:55:58.136 - SetStill(): Motor 2 last position reported = -13957.7281 controller.cpp:1400
2022-04-03 22:55:58.136 - Axis 3 reports that it is still moving! controller.cpp:1407
2022-04-03 22:55:58.136 - API: mcMotionSetStill(inst = 0, motor = 3) (Sim)
2022-04-03 22:55:58.136 - SetStill(): Motor 3 last position reported = 0.0000 controller.cpp:1400
2022-04-03 22:55:58.136 - All motors marked as still.
2022-04-03 22:55:58.136 - Waiting on SetStill is Done!
2022-04-03 22:55:58.136 - API: mcMotionSetStill(inst = 0, motor = 3) (Sim)
2022-04-03 22:55:58.136 - SetStill(): Motor 3 last position reported = 0.0000 controller.cpp:1400
2022-04-03 22:55:58.136 - All motors marked as still.
2022-04-03 22:55:58.137 - Signal id 1142, (Spindle Fwd), changed from HIGH to LOW.
2022-04-03 22:55:58.137 - Signal id 1141, (Spindle On), changed from HIGH to LOW.
2022-04-03 22:55:58.138 - Waiting 0.000000 seconds for spindle to stop... spindle.cpp:348
2022-04-03 22:55:58.138 - Done. spindle.cpp:353
2022-04-03 22:56:00.193 - WaitOnMacro() thisTc = 0, isDone = 1
2022-04-03 22:56:00.257 - Waiting on planner to drain before waiting on SetStill... runcanon.cpp:92
2022-04-03 22:56:00.257 - Waiting on SetStill...
2022-04-03 22:56:00.257 - Controller::RunCanonBuffer called AddStopReportRequest() runcanon.cpp:101
2022-04-03 22:56:00.257 - Requesting a stopped report for axis 0 motors.
2022-04-03 22:56:00.257 - Requesting a stopped report for motor 0.
2022-04-03 22:56:00.257 - Requesting a stopped report for axis 1 motors.
2022-04-03 22:56:00.257 - Requesting a stopped report for motor 1.
2022-04-03 22:56:00.257 - Requesting a stopped report for axis 2 motors.
2022-04-03 22:56:00.257 - Requesting a stopped report for motor 2.
2022-04-03 22:56:00.257 - Requesting a stopped report for axis 3 motors.
2022-04-03 22:56:00.258 - Requesting a stopped report for motor 3.
2022-04-03 22:56:00.258 - API: mcMotionSetStill(inst = 0, motor = 0) (Sim)
2022-04-03 22:56:00.258 - SetStill(): Motor 0 last position reported = 0.0000 controller.cpp:1400
2022-04-03 22:56:00.259 - Axis 1 reports that it is still moving! controller.cpp:1407
2022-04-03 22:56:00.259 - API: mcMotionSetStill(inst = 0, motor = 0) (Sim)
2022-04-03 22:56:00.259 - SetStill(): Motor 0 last position reported = 0.0000 controller.cpp:1400
2022-04-03 22:56:00.259 - Axis 1 reports that it is still moving! controller.cpp:1407
2022-04-03 22:56:00.259 - API: mcMotionSetStill(inst = 0, motor = 1) (Sim)
2022-04-03 22:56:00.259 - SetStill(): Motor 1 last position reported = 0.0000 controller.cpp:1400
2022-04-03 22:56:00.259 - Axis 2 reports that it is still moving! controller.cpp:1407
2022-04-03 22:56:00.259 - API: mcMotionSetStill(inst = 0, motor = 1) (Sim)
2022-04-03 22:56:00.259 - SetStill(): Motor 1 last position reported = 0.0000 controller.cpp:1400
2022-04-03 22:56:00.259 - Axis 2 reports that it is still moving! controller.cpp:1407
2022-04-03 22:56:00.259 - API: mcMotionSetStill(inst = 0, motor = 2) (Sim)
2022-04-03 22:56:00.259 - SetStill(): Motor 2 last position reported = -13957.7281 controller.cpp:1400
2022-04-03 22:56:00.260 - Axis 3 reports that it is still moving! controller.cpp:1407
2022-04-03 22:56:00.260 - API: mcMotionSetStill(inst = 0, motor = 2) (Sim)
2022-04-03 22:56:00.260 - SetStill(): Motor 2 last position reported = -13957.7281 controller.cpp:1400
2022-04-03 22:56:00.260 - Axis 3 reports that it is still moving! controller.cpp:1407
2022-04-03 22:56:00.260 - API: mcMotionSetStill(inst = 0, motor = 3) (Sim)
2022-04-03 22:56:00.260 - SetStill(): Motor 3 last position reported = 0.0000 controller.cpp:1400
2022-04-03 22:56:00.260 - All motors marked as still.
2022-04-03 22:56:00.260 - Waiting on SetStill is Done!
2022-04-03 22:56:00.260 - API: mcMotionSetStill(inst = 0, motor = 3) (Sim)
2022-04-03 22:56:00.260 - SetStill(): Motor 3 last position reported = 0.0000 controller.cpp:1400
2022-04-03 22:56:00.260 - All motors marked as still.
2022-04-03 22:56:00.261 - Signal id 1144, (Coolant On), changed from HIGH to LOW.
2022-04-03 22:56:00.262 - Waiting for motions to complete: MC_CANON_REWIND. gcodeexec.cpp:883
2022-04-03 22:56:00.273 - Attempt transition from "File Running" on event "Stop" gcodeexec.cpp:903
2022-04-03 22:56:00.273 - S_FILE_RUNNING2_on_exit
2022-04-03 22:56:00.273 - S_FILE_RUNNING_on_exit
2022-04-03 22:56:00.273 - Signal id 1114, (Gcode Running), changed from HIGH to LOW.
2022-04-03 22:56:00.274 - ACTION_stop
2022-04-03 22:56:00.306 - S_IDLE_on_entry
2022-04-03 22:56:00.310 - Signal id 1172, (Machine Idle), changed from LOW to HIGH.

Offline Azalin

*
  •  181 181
    • View Profile
Re: Crash after tool change
« Reply #13 on: April 03, 2022, 06:06:22 PM »
OK guess what! I downloaded an earlier version from here https://www.machsupport.com/ftp/Mach4/DevlopmentVersions/Mach4Hobby_Installer-4.2.0.4385.exe

And it works as it should. So is this a bug in newer versions?

Offline Azalin

*
  •  181 181
    • View Profile
Re: Crash after tool change
« Reply #14 on: April 03, 2022, 06:26:42 PM »
I uploaded a new video. Mach4 version in the video is 4.2.0.4385 and it works perfect.

So my new question is what is the different between the latest Mach4 and 4.2.0.4385 that causes this problem? Is there a workaround I can apply to the latest version I have in my machine? I need to use the latest because I have lots of custom things in it. I mean I can't simply give up the latest and use 4.2.0.4385.

https://www.youtube.com/watch?v=eO5-Z0OttI0

Offline Azalin

*
  •  181 181
    • View Profile
Re: Crash after tool change
« Reply #15 on: April 04, 2022, 06:57:30 AM »
I tried all these builds. I can confirm that the build 4582 and previous versions are good. I mean removing G43 works on these builds however the problem starts on build 4584 and remains. The latest build is also buggy.


4385 good
4524 good
4543 good
4559 good
4566 good
4563 good
4580 good
4582 good

4584 bad
4596 bad
4682 bad
4744 bad
.....
4824 bad (latest build)

Offline Rob G

*
  •  16 16
    • View Profile
Re: Crash after tool change
« Reply #16 on: April 04, 2022, 09:04:45 AM »
Please open the docs folder within Mach4.  Read the document called "Tool Offsets Mach4 Mill"
This goes into extreme detail on setting up single and multiple tool for use while running G code files.

Rob

Offline Azalin

*
  •  181 181
    • View Profile
Re: Crash after tool change
« Reply #17 on: April 04, 2022, 09:15:17 AM »
Hi,

The doc says:
"Once the tool change is complete in the MDI tab, enter G43 H1, and hit Cycle Start. This will activate the tool offset for tool 1. These
commands can also be on the same line."

I do the tool changing manually so I don't use G43 but Mach4 keeps behaving there is G43 in the code. When there is no G43 in the code Mach4 moves the Z axis down and crashes.

Have you watched the two videos I posted?

Offline Azalin

*
  •  181 181
    • View Profile
Re: Crash after tool change
« Reply #18 on: April 04, 2022, 02:44:13 PM »
Am I the only one having this problem?

Offline Azalin

*
  •  181 181
    • View Profile
Re: Crash after tool change
« Reply #19 on: April 14, 2022, 03:29:30 PM »
This M6 function seems to be working fine. I found this code from this video: https://www.youtube.com/watch?v=tCU1bzuDNvI. I simplified and removed some unnecessary (for me) code.


function m6()
 local inst = mc.mcGetInstance() ;
 
 local currentTool = mc.mcToolGetCurrent(inst)
 local selectedTool = mc.mcToolGetSelected(inst)
 local posmode = mc.mcCntlGetPoundVar(inst, mc.SV_MOD_GROUP_3) --get the current mode so we can return to it when macro ends
         
  --Get positions before moving to do tool change
 local valX, rc = mc.mcAxisGetMachinePos(inst, mc.X_AXIS) --Get the position of the X axis in Machine Position
 local valY, rc = mc.mcAxisGetMachinePos(inst, mc.Y_AXIS) --Get the position of the Y axis in Machine Position
 local valZ, rc = mc.mcAxisGetMachinePos(inst, mc.Z_AXIS) --Get the position of the Z axis in Machine Position
 
 
 if selectedTool == currentTool then
  return
  mc.mcCntlSetLastError(inst, "Current tool == Selected tool so there is nothing to do")
 else
  mc.mcCntlSetLastError(inst, "Change to tool " .. tostring(selectedTool) .. " and press start to continue") --Message at beginning of tool change
  mc.mcCntlToolChangeManual(inst, true) --This will pause the tool change here and wait for a press of cycle start to continue

  mc.mcCntlSetLastError(inst, "Current tool == " .. tostring(selectedTool) .. "   Previous Tool == " .. tostring(currentTool)) --Message that shows after Cycle Start
  mc.mcToolSetCurrent(inst, selectedTool) --sets the current tool displayed in mach to the selected tool

  local probedz = mc.mcCntlGetPoundVar(inst, 5073) --this retreives the Saved varible of the z position (#5073) in machine coordinates and assigns it to the name probedz
   local ToolLength = math.abs(9.5238 + probedz)  -- this calculates the value of the tool lenght by using a gage line off of my spindle to the tool setter.  uses the absolute value fuction
 
  mc.mcToolSetData(inst, mc.MTOOL_MILL_HEIGHT, selectedTool, ToolLength)  --- this sets the tool length value into the tool table into the selected tool position number, Note - i havent reassigned current tool varible so i have to use the "selectedTool" name

  mc.mcCntlGcodeExecute(inst, string.format('G ' .. posmode))--return to pre macro mode G90, or G91
     
 end
 
end

if (mc.mcInEditor() == 1) then
 m6()
enda