Are Soft Limits relative not absolute?

Moderators: TomKerekes, dynomotion

Post Reply
epicycloid
Posts: 7
Joined: Thu Feb 22, 2018 12:47 am

Are Soft Limits relative not absolute?

Post by epicycloid » Thu May 10, 2018 6:32 pm

I couldn't find much info on Soft Limits in the docs, but I spent an hour or so sorting out the travels on my machine, and experimenting with reasonable distances (in counts) off of the physical limit switches (e.g. off by 100 counts +/-), then edited my Home routine, to include values for Soft Limits.

Then I jogged around, tested them, and all seemed good.

Then I loaded a program, moved to a work offset, which created a local 0 for X & Y, then used my touch off block to set Z0 (top of material).

Then I tried to jog Z up and out of the way before running the program... I forget the error now, but it was essentially telling me I hit the Z upper (positive) limit, and couldn't jog any further. I could however still jog down. So the limits were working, but had apparently shifted / reset relative to the local zeros for the current work offset.

I have a routine that lets me cancel the Soft Limits, so I ran that, and then the program could run.

But I'm baffled now. I expected Soft Limits to be absolute, and not change with local offsets.

What am I missing? Is there a way to set the Soft Limits in absolute for the entire machine travels?

Here's the code snippet that I used to set the Soft Limits in my Home routine:

Code: Select all

	
	// Set up soft limits - these were all set to +/- 1e+030
        ch0->SoftLimitPos=89950;
	ch0->SoftLimitNeg=-390;
	ch1->SoftLimitPos=89950;
	ch1->SoftLimitNeg=-390;
	ch2->SoftLimitPos=180690;
	ch2->SoftLimitNeg=-1380;
	ch3->SoftLimitPos=2870;
	ch3->SoftLimitNeg=-63630;
Thanks,
--Jon
Last edited by epicycloid on Sat May 12, 2018 2:04 am, edited 1 time in total.

User avatar
TomKerekes
Posts: 111
Joined: Mon Dec 04, 2017 1:49 am

Re: Are Soft Limits relative not absolute?

Post by TomKerekes » Thu May 10, 2018 6:41 pm

Hi Jon,

The Soft Limits are in absolute machine coordinates. But you must take care to set/zero machine coordinates in your Home program and then never do anything to shift or change them. Setting GCode offsets should not change machine coordinates. There is an option to display Machine Coordinates in KMotionCNC to help determine if they have changed.
then used my touch off block to set Z0 (top of material).
What do you mean by this. How do you do this?
Regards,

Tom Kerekes
Dynomotion, Inc.

epicycloid
Posts: 7
Joined: Thu Feb 22, 2018 12:47 am

Re: Are Soft Limits relative not absolute?

Post by epicycloid » Thu May 10, 2018 7:45 pm

Thanks Tom. I will double check, and pay attention to the Machine Coordinates and the Position(s) in the KMotion Axis window, when I'm done running this job.

Ah, I think I know where the problem may lie... I think my touch-off routine is resetting the Machine Z, not just a local offset Z.

My machine is one of Carl Bruce's and he includes an aluminum touch-off block, connected to KFLOP I/O 19. The routine Carl supplied didn't work right, so I "borrowed" a routine from a friend with another Carl machine, and tweaked it to work on my machine. Here's the code I'm using for that.

Code: Select all

// New Touch Off.c
// Edited version of touch off routine for Jon's & Fred's routers.
// Modified from Randy's version, with sign changes and pin numbers.
// Mic'ed block was 0.514" thick, desired back off total of 1"
// v1 4-7-18  jpm
// 
// 

#include "KMotionDef.h"
#define TMP 10
#include "KflopToKMotionCNCFunctions.c"


#define PIN 19              // I/O pin 19 for the touch off block
#define Z 3                 // Channel 3 is Z axis
#define TICKS 5081.3        // 5081.3 'ticks' per inch on Z axis
#define PUCK_THICKNESS .514   // Thickness of touch off block in inches
#define BACKOFF .486          // Difference between touch off block thickness and desired back off in inches
#define SLOW 2000
#define FAST 5000

main()
{
    
    // KStepPresent=TRUE;  // enable KSTEP input multiplexing - I don't think this applies to our machines?
    
    FPGA(STEP_PULSE_LENGTH_ADD) = 63 + 0x80;
 
    EnableAxis(Z); 
  
    Jog(Z,-SLOW);               // jog slowly negative
    while (ReadBit(PIN));      // loop until IO bit goes low
    Jog(Z,0);                   // stop the axis
    while (!CheckDone(Z));       // loop until motion completes 
 
    MoveRelAtVel(Z,BACKOFF*TICKS,FAST);    // move the backoff distance
    while (!CheckDone(Z));
   
    DisableAxis(Z);
    chan[Z].Position=(PUCK_THICKNESS+BACKOFF)*TICKS;
    EnableAxis(Z);
    
    DoPCFloat(PC_COMM_SET_Z,PUCK_THICKNESS+BACKOFF);
	
	printf("Puck thickness is = %f\n",PUCK_THICKNESS);
	printf("Back off is = %f\n",BACKOFF);
	printf("Total back off is = %f\n",PUCK_THICKNESS+BACKOFF);

        
    }
What is the "proper way" to set the Z for the current work offset? Save the "real" Z into a variable, and then put the touch-off Z into a work offset somehow?

(BTW, I'm new to KMotion / KMotionCNC and really confused by the why's and wherefore's of when G92 gets changed in the Fixture Offsets Edit box. I'd like to save 5-6 specific fixture locations on my bed, and not have them change with homing or things like this tool touch-off. I'm learning slowly, but it's a lot to take in.)

--Jon

User avatar
TomKerekes
Posts: 111
Joined: Mon Dec 04, 2017 1:49 am

Re: Are Soft Limits relative not absolute?

Post by TomKerekes » Thu May 10, 2018 8:02 pm

Hi Jon,

Yes that is changing the Machine Coordinate Position.

You might read this Thread on how to use the "Set DRO" function.

I don't fully understand your process but you can configure KMotionCNC to modify Fixture or G92 offsets. See Here.

HTH
Regards
Regards,

Tom Kerekes
Dynomotion, Inc.

epicycloid
Posts: 7
Joined: Thu Feb 22, 2018 12:47 am

Re: Are Soft Limits relative not absolute?

Post by epicycloid » Thu May 10, 2018 10:16 pm

Sorry Tom, feeling a little dense here...

My c touch off routine is making two specific calls, first:

Code: Select all

    chan[Z].Position=( ... setting to 1" with math... );
Which I think is the "offending" call that is actually re-setting Machine Z to 1". Is that indeed what that does?

And then, as your first link / thread suggests:

Code: Select all

    DoPCFloat( ...also set to 1" using math... );
Which it sounds like only resets local Z and the Z displayed on the DRO, but (pardon my ignorance here) maybe also changes what's (saved?) in G92 in the process?

I don't understand the context for the second link? Is the second call (DoPCFloat) impacted by the "Zero Using Fixture Offsets" check box in the Trajectory Planner? Or does that check box only pertain to the "Zero" & "Set" buttons by the DRO's on the KMotionCNC screen?

FYI, my process is something like this (open to feedback / suggestions):

1) Fire up the PC, the router / KFLOP, and KMotionCNC (and sometimes KMotion if I want to see KFLOP info).
2) Click user button for my Init routine (which defines I/O bits, axes and coordinate system, and zeros wherever it is, e.g. calling Zero(n); etc.).
3) Click user button for my Home routine (repeats most of Init plus, homes and squares machine, set axes to zero at home position, saves soft limits, then loops to watch for halt bit).
4) Secure a work piece somewhere on the table, perhaps located by a jig at a known fixture offset, let's say G55.
5) Select G55 from the Fixture Offset dropdown and click "Set".
6) Use MDI to do a G0 X0 Y0 to get to the G55 jig location & work piece, and maybe jog a bit to be over work piece.
7) Put the touch off block on top of the work piece and run my touch off routine (which backs off the touch off block and attempts to save / set the tool 1" above the top of the work piece).
8) Load intended g-code program if not already loaded (which will default to using the currently selected fixture offset, not necessarily make an explicit call to set G55, but usually starts with a G0 X0 Y0).
9) Run.

--Jon

User avatar
TomKerekes
Posts: 111
Joined: Mon Dec 04, 2017 1:49 am

Re: Are Soft Limits relative not absolute?

Post by TomKerekes » Fri May 11, 2018 1:00 am

Hi Jon,
chan[Z].Position=( ... setting to 1" with math... );

Which I think is the "offending" call that is actually re-setting Machine Z to 1". Is that indeed what that does?
Yes
And then, as your first link / thread suggests:

DoPCFloat( ...also set to 1" using math... );

Which it sounds like only resets local Z and the Z displayed on the DRO, but (pardon my ignorance here) maybe also changes what's (saved?) in G92 in the process?
Yes it adjusts either the G92 global offset or Selected Fixture offset to make the DRO read what you requested depending on which one is configured to be changed by the "Zero/Set" operation. See also here.
5) Select G55 from the Fixture Offset dropdown and click "Set".
I don't understand what you mean by "click set". What? XY? Why would you have a fixture if you are going to set the XY position anyway?

Regards
Regards,

Tom Kerekes
Dynomotion, Inc.

epicycloid
Posts: 7
Joined: Thu Feb 22, 2018 12:47 am

Re: Are Soft Limits relative not absolute?

Post by epicycloid » Fri May 11, 2018 3:29 pm

Tom -- I commented out the chan[Z].Position and it works as you described now.
I don't understand what you mean by "click set". What? XY? Why would you have a fixture if you are going to set the XY position anyway?
Sorry, brain fart, just choosing the offset from the dropdown selects it. I wasn't actually clicking "Set."

Thanks... back to tweaking the soft limits now that that I'm over that hump.

--Jon

Post Reply