Hello Guest it is April 29, 2024, 12:11:48 AM

Author Topic: Turn Backlash OFF in a script?  (Read 921 times)

0 Members and 1 Guest are viewing this topic.

Turn Backlash OFF in a script?
« on: September 09, 2021, 01:28:07 AM »
Hi everyone,
  I need to turn backlash compensation off programmatically, preferably in Lua but I'm desperate enough to try binding code into mcLua  or something else if I have to. :(
Any ideas would be very appreciated!

Cheers,

Chris.
Re: Turn Backlash OFF in a script?
« Reply #1 on: September 09, 2021, 03:12:16 AM »
Backlash compensation is handled by the motion controller so you will probably have to speak to the manufacturer of the one you use to see if there is a register or something that turns it on/off
Re: Turn Backlash OFF in a script?
« Reply #2 on: September 09, 2021, 03:29:36 AM »
Hi SwiftyJ,
  That was a very quick reply! :)
It's Mach4 that's sending bad backlash commands to my ESS when jogging.

Mach4 decides when a backlash move is needed the ESS only does what it's told.  Have a look at the attached log file to see what I mean.
I'm told that lines like this in the log file come from Mach4
++++++++ Motor 0: Pick up the Backlash from an ALL STOP before going Positive ++++++++

BTW I'd be happy to just set motorinfo.BacklashAmount to zero as it would have the same effect.

Cheers,  Chris.
Re: Turn Backlash OFF in a script?
« Reply #3 on: September 09, 2021, 05:40:28 PM »
Hi,

Quote
I'm told that lines like this in the log file come from Mach4
++++++++ Motor 0: Pick up the Backlash from an ALL STOP before going Positive ++++++++

Yes, that is Mach4 issuing the command to the ESS however you cannot turn it on or off at will. The ESS when it fires up
gains its firmware from the ESS plugin, and enacts the commands in the firmware for the remainder of the session thereafter. Backlash
compensation enabling, on which axis,and by what amount are programmed into the ESS in the firmware. The only way to change that
behavior would be to re-flash the ESS part way through a session, ie a power cycle of the ESS.

Check the Control plugin....it does not have any parameters for backlash. The ESS plugin does. The only programmatic control Mach has over
backlash is:

Code: [Select]
mcMotionGetBacklashAbs
C/C++ Syntax:
int mcMotionGetBacklashAbs(
MINSTANCE mInst,
int motorId,
double *pos);

LUA Syntax:
N/A

Description:
Retrieves the last planned backlast amount for the given motor.

and:

Code: [Select]
mcMotionGetBacklashInc
C/C++ Syntax:
int mcMotionGetBacklashInc(
MINSTANCE mInst,
int motorId,
double *pos);

LUA Syntax:
N/A

Description:
Retrieves the last planned backlast amount for the given motor.


and note NEITHER of these has any Lua syntax, they have C syntax only. It's clear therefore that while Mach issues, or rather
Machs trajectory planner,' issues the command to take up the lash it's the ESS that does it, and that is not scriptable behavior.
If you want to turn off backlash on a given axis then you must do so in the ESS plugin.

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

Offline smurph

*
  • *
  •  1,546 1,546
  • "That there... that's an RV."
    • View Profile
Re: Turn Backlash OFF in a script?
« Reply #4 on: September 09, 2021, 06:15:52 PM »
It's Mach4 that's sending bad backlash commands to my ESS when jogging.

Mach4 decides when a backlash move is needed the ESS only does what it's told.  Have a look at the attached log file to see what I mean.
I'm told that lines like this in the log file come from Mach4
++++++++ Motor 0: Pick up the Backlash from an ALL STOP before going Positive ++++++++

Sorry guys, but there must be a misunderstanding somewhere.  Mach4 doesn't send backlash commands.  All Mach 4 does is provide a place to put the backlash into the motor settings.  It is up to the motion controller 100% to implement the backlash compensation.

SwiftyJ hit the nail on the head with this one: 
Backlash compensation is handled by the motion controller so you will probably have to speak to the manufacturer of the one you use to see if there is a register or something that turns it on/off

One more thing...  It may look like Mach is controlling the backlash because that message appeared in the Mach diagnostics log.  But plugins can and do write to that log as well.  Even scripts can write to the log with the mc.mcCntlLog() API function. 

Steve
« Last Edit: September 09, 2021, 06:17:43 PM by smurph »