Hello Guest it is April 16, 2021, 03:27:48 PM

Author Topic: Z probing direction reversed  (Read 386 times)

0 Members and 1 Guest are viewing this topic.

Z probing direction reversed
« on: December 19, 2018, 02:36:52 PM »
This has probably been answered some in a previous post however the search function is not working. So, what happens is that when I go to do a Z probe, it goes up instead of down. jogging, G0, G1 all work correctly in the Z direction. However, executing a probe in the Z axis either from the probe module or the MDI using a G31.1 results in the Z axis going up! Does anyone have any idea what could be causing this?
Re: Z probing direction reversed
« Reply #1 on: December 20, 2018, 02:21:48 AM »
most likely your Z axis direction is contrary to the expected norm.

Most CNC setups the very top of the Z axis is Z Home, ie zero (machine coordinates). Thus any downward motion causes the Z DRO to be increasingly
negative. Does your machine respond that way?

The other possibility is that when the G31 is issued it is already BELOW its expected endpoint. In the API.chm there is  a section about how probing

Motion plugin probing procedure.
The probe moves are really just G01 moves in exeact stop mode with the addition of being marked as EX_PROBE in the execution_t struct from mcMotionCyclePlannerEx().

When executing a G31, the core considers the move as an exact stop move and therefore will request a motor stop report. It waits on one of two conditions:

A probe strike condition where the motion plugin calls mcMotionSetProbeComplete().
An end of move condition where the motion plugin reports the motors as being still.
Until either of these conditions are satisfied, the core will generate no more moves after the EX_PROBE marked moves. In other words, all you will get out of mcMotionCyclePlannerEx() will be EX_NONE type data. In the event of a probe strike, this makes it safe to clear the planner and be sure that future moves are not removed by accident.

A motion plugin should implement probing in the following way:

Upon seeing the first move marked as EX_PROBE, the plugin should arm position latches on the hardware.
Then consume the EX_PROBE marked moves as normal.
If the probe stikes, the plugin should:
Cancel any MSG_REPORT_MOTOR_STOP requests. (see g. VERY important!)
Report the latched positions via mcMotionSetProbePos() for each motor.
Clear the hardware of any additional moves.
Call mcMotionClearPlanner() to clear the Mach planner of any unretrieved EX_PROBE moves.
Update Mach with the hardware's current position via mcMotionSetPos().
Call mcMotionSetProbeComplete().
If a MSG_REPORT_MOTOR_STOP has been received, do not acknowledge it. mcMotionSetProbeComplete() does this for you and a position sync as well.
If no probe strike, then the move continues to it's end point as if it is a regular move.
The plugin should ack the MSG_REPORT_MOTOR_STOP messages with mcMotionSetStill().
The positions latches should be disarmed (if needed) when a MSG_PROBE_DONE is seen.
In the event that the probe move is aborted, the plugin should:
Call mcMotionClearPlanner() to clear the Mach planner of any unretrieved EX_PROBE moves.
Call mcMotorSetPos() for each controlled motor.

Note that its really for people trying to write plugins but the ideas are applicable to you and me. When a G31 is issued Mach executes a regular G1 move
with the end-point the same as the parameters of the G31. If a probe contact is detected while that move is in progress the machine stops, the remainder of
the move is aborted and the actual current (probe) position is reported back to Mach.

So what happens if your G31 move specifies a end Z coordinate higher than where you started......it just moves to the endpoint nominated....ie upwards.
Sound familiar?

My wife left with my best friend...
     and I miss him!
Re: Z probing direction reversed
« Reply #2 on: December 20, 2018, 04:43:20 AM »

Thanks for the info. I can confirm that my Z axis is homed at max positive i.e. fully retracted. So after reading your post I homed all axis and zero'd the DRO. I then issued a G31.1 Z-85 F100 in the MDI and the axis started going down as expected so there is something I'm doing wrong when setting the machine up. Is it normal to have to zero the DRO after homing and before probing?