caxis.comp - How to freewheel axis/spindle?

More
1 year 9 months ago #319579 by spumco
I'm using a component authored by Andy Pugh to control my lathe's main spindle as both a C-axis and spindle.  Comp attached, and I believe this was the last version Andy and NoJo worked out via the forum a few years ago.

NOTE - this component treats the spindle as an axis until a spindle command is issued.  This means absent a spindle command, the C-axis is active and trying to maintain a position.  Once the spindle command is done, C-axis re-engages and will return to the last position (within one turn) prior to the spindle command.

I want the ability to disconnect the spindle/axis so I can manually turn it (indicating part/chuck).  Because the spindle motor is a servo, if the drive is enabled and machine is on, the spindle is locked in position when the machine is at rest.

Right now I have a simple enable toggle in HAL that disables the drive directly.  This allows me to turn the spindle by hand for indicating or tightening the chuck.  I can jog the C-axis, but I find being able to manually move the spindle more convenient.

Unfortunately, because I haven't disconnected anything else in HAL, if I rotate the spindle more than about a turn I get a following error and LCNC turns the machine off.  I've had to set the ferror higher than I'd like just to be able to turn it a bit, and I'd really like to tighten it up.

I could use some help figuring out how to disable the motor in such a way that:
  • No following error while disabled, regardless of turns
  • No caxis.comp errors or accumulation of following error upon re-enable (which would result in a potentially violent attempt by the C-axis PID to eliminate the following error)

Is this something I could accomplish in HAL, or does caxis.comp need to be modified/edited in some way?
The following user(s) said Thank You: jpg

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago #319941 by Aciera
I guess for free wheel operation you would need to disconnect the encoder signal in hal but the tricky bit is that you will need to reorient the spindle to within ferror range before reconnecting the encoder again.

I'm not familiar with 'caxis.comp' I switched the controller mode using a digital signal:
forum.linuxcnc.org/10-advanced-configura...code?start=30#272218
The following user(s) said Thank You: spumco

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago #319948 by spumco
@Aciera - 

I had hoped to duplicate your C-axis process back when you were working on it, but my drive doesn't permit on-the-fly mode switching via external input.

Since I don't think I can use orient.comp and caxis.comp on the same joint, I'm thinking about ways to un-home and re-home the joint/axis.  Caxis.comp doesn't re-home or move to C0 whenever the spindle stops - it returns to the same position it was in when the spindle command was issued.

Since I don't need to freewheel in the middle of a program, what do you think about using halui to unhome/rehome the C-axis?
  • Freewheel button ON (M-code)
    • set halui.joint.C.unhome
    • Latch encoder reset pin HIGH (to keep it at 0)
    • Amp enable OFF
  • (manual spindle rotation activity)
  • Freewheel button OFF
    • Amp enable ON
    • Unlatch encoder reset pin
    • set halui.joint.C.home
See any major issues with the above before I try testing it this evening?
The following user(s) said Thank You: jpg

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago #319984 by Aciera
Sure, give it a try and report back.

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago #320278 by spumco
No joy.

I can't unhome a joint via hal commands, or at least not how I've got it set up currently.

Attempted an M-code bash file with:
Code:
#! /bin/bash #   C-AXIS FREEWHEEL ON #SET MODE TO MANUAL halcmd setp halui.mode.manual 1 #UNHOME JOINT AND RETURN PIN TO LOW STATE halcmd setp halui.joint.2.unhome 1 sleep 1 halcmd setp halui.joint.2.unhome 0 #RESET ENCODER AND LATCH THE RESET WHILE FREEWHEEL ON halcmd setp hm2_[MESA](BOARD).0.encoder.04.reset 1 #DISABLE SPINDLE MOTOR AMP halcmd sets SPIN0-AMP-DISABLE 1

And am getting a "must be in joint mode or disabled to unhome" error.

Any idea how to disable or switch to joint mode for a single axis, either in HAL or with a bash file?

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago #320302 by Aciera
As you don't want to unhome during gcode execution you might want to try a python component and use
Code:
self.command.unhome(joint)

That is what the guis use, which seems to work just fine.
The following user(s) said Thank You: spumco

Please Log in or Create an account to join the conversation.

Time to create page: 0.264 seconds
Powered by Kunena Forum