Hello Guest it is May 14, 2021, 03:20:45 AM

Author Topic: MACH4 #5071-5073 variables values 2000x smaller than DRO  (Read 1660 times)

0 Members and 1 Guest are viewing this topic.

Offline smurph

*
  • *
  •  1,402 1,402
  • "That there... that's an RV."
    • View Profile
Re: MACH4 #5071-5073 variables values 2000x smaller than DRO
« Reply #10 on: May 26, 2018, 05:47:32 PM »
The motion controller plugin should only deal in counts (or steps) so that it remains unit agnostic.  So this is usually an integer number, but it can be a real number as well (micro stepping, etc..).  All of the conversion to the native machine units is done in Mach.  The position (in counts) is then divided by the counts per unit in the motor tuning tab to derive a position in the native units of the machine.  

For the case of a probe strike, the motion controller should:

1. Latch the probed strike position (in ABS counts) for each motor.
2. Decelerate all of the motors involved in the probe operation to a stop.
3. Report the probed positons (in ABS counts) to Mach.
4. Report its' current positions to Mach (because Mach doesn't know where it all stopped!)
5. Tell Mach that the probe operations is complete. (This will sync the real world position to Mach's planners.)
6. Ack the stop report requests.  

All of this is documented in the API manual if you want a more technical explanation with the API calls that are to be used.  

Anyway, the Mach 4 motion control plugin paradigm is designed to be dumb as a rock.  All a motion plugin needs to do. basically, is follow the ball.  And tell mach when the requested movement is done, in most cases.  Homing and probing as about as complex as it needs to get, as these are real-time processes that just can't be handled in Mach.  

What is reported by the motion plugin ends up in 5071-5076.  The actual machine positions with no offsets applied.  Then the current offsets are applied to those and they go in 5061-5066.  So Michael is correct in stating that if what ends up in 5071-5076 will affect what is in 5061-5066.

Steve
Re: MACH4 #5071-5073 variables values 2000x smaller than DRO
« Reply #11 on: May 26, 2018, 06:11:12 PM »
Hi Steve,
kool I follow that. I was reading the probing.txt file in the docs trying to follow the process. I have become confused over a couple of APIs.

This is from probing.txt:
Quote
b.  Report the latched positions via mcMotionSetProbePos() for
       each motor.

And this is from the API.chm:
Quote
mcMotionSetPos
C/C++ Syntax:
int mcMotionSetPos(
      MINSTANCE mInst,
      int motorId
      double val);

LUA Syntax:
N/A

Description:
Report the position in counts to the core for the given motor.

My confusion is the terminology.... the API includes the word 'Set' but the description says 'report'. When I first saw that I assumed it was a typo.
I imagined the correct API would be:
Quote
mcMotionGetPos
C/C++ Syntax:
int mcMotionGetPos(
      MINSTANCE mInst,
      int motorId,
      double *pos);

LUA Syntax:
pos, rc = mc.mcMotionGetPos(
      number mInst,
      number motorId)

Description:
Retrieves the current motor pos in counts.

Still in either event it does say plainly that the report is in counts. Also the C++ value is  of type double.

Craig
My wife left with my best friend...
     and I miss him!

Offline smurph

*
  • *
  •  1,402 1,402
  • "That there... that's an RV."
    • View Profile
Re: MACH4 #5071-5073 variables values 2000x smaller than DRO
« Reply #12 on: May 26, 2018, 06:32:51 PM »
The motion controller plugin will always "set" the positions.  The mcMotionGetPos() is for OTHER plugins to get the positions, if needed.  Things like the ModuleWorks cut simulator, etc...  The counts are doubles because to some controllers use real numbers for their counts!  To me, a count is a count is a count.  There is no in between.  As in, you will never see a quadrature encoder give a count like 1024.765!

But the world of stepper motors begs to differ.  The Ethernet Smooth Stepper is one that uses real numbers for counts.  And it DOES smooth out the pulse train.  Somehow.  I haven't quite figured out how and honestly don't want to hurt my brain trying to.  :)

Probing.txt is old and the gospel should be the one in the API manual under the plugin development category. 

Steve
Re: MACH4 #5071-5073 variables values 2000x smaller than DRO
« Reply #13 on: May 29, 2018, 05:09:49 PM »
Thank you guys for help.

I have updated Mach4 to the latest version and CSMIO-IPS firmware to 3.0.14 (from 3.0.5). Unfortunately, I have a same f*c**** problem with the ethernet connection to a controller as I had an older firmware (I think it was 3.0.4 half year ago). CSMIO keeps disconnecting randomly. It even doesn't hold settings in plugin after mach4 closes. I have to go to my previous version 3.0.5 which was working fine except those probing variables. :(