caxis.comp - How to freewheel axis/spindle?

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

LCNC manual on the python module is, I'm sure, adequate for someone with coding experience, but like many other manual sections it assumes a certain level of familiarity with the subject.  The explanations are meaningless without some sort of foundation:

Import the linuxcnc module.

What does 'import' mean? What is the linuxcnc module and where is it?

If you've got the patience, could you walk me through creating a python component, or pointing me towards a resource with novice-level explanations?

Or just directing me to a complete example of a python component and how to get LCNC to use it?

Thanks, I feel like I'm back at Day 1 with LCNC.
Last edit: 1 year 9 months ago by spumco.

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

More
1 year 9 months ago #320336 by PCW
You might use a different PID (with different tuning) during the "recovery" period
so the correction is gentle, that and a 'near' component to determine when to go
back into full servo mode.

So

hand mode: drive disabled, LinuxCNC motor position feedback looped
back from motor position command (via mux)

recover mode: drive enabled,  LinuxCNC motor position feedback looped
back from motor position command (via mux) Special PID used with bounded
error and no FF so correction velocity is limited

exit from recover mode when encoder feedback is "near" position command
The following user(s) said Thank You: besriworld, Aciera, spumco

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

More
1 year 9 months ago - 1 year 9 months ago #320338 by Aciera
As for the component (Bit of a rushed job as I'm short on time right now):
Save this as 'unhome_comp.py' in a folder named 'python' in your machine config and mark as 'executable':
Code:
#!/usr/bin/env python3 import hal import linuxcnc h = hal.component("unhome-comp") h.newpin("unhome-rotary", hal.HAL_BIT, hal.HAL_IN) h.ready() c = linuxcnc.command() joint = 0 homed = 1 try:     while 1:         if homed == 1 and h['unhome-rotary'] == 1:             c.teleop_enable(0)             c.wait_complete()             c.unhome(joint)             homed = 0         if homed == 0 and h['unhome-rotary'] == 0:             homed = 1 except KeyboardInterrupt:     raise SystemExit

add this line to the [HAL] section of your ini file:
Code:
HALCMD = loadusr ./python/unhome_comp.py

Start your config and open the 'Show HAL configuration' tool and 'watch' the 'unhome-comp.unhome-rotary' pin, setting it to TRUE should unhome the joint number set in the python script in the line 'joint = 0'.

 
Last edit: 1 year 9 months ago by Aciera.
The following user(s) said Thank You: besriworld, spumco

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

More
1 year 9 months ago #320340 by spumco
@PCW-
I thought about using orient.comp with it's own PID to do just what you suggested (get it close before re-linking the main PID), but caxis.comp interferes with orient (I think).

Cooking up a 3rd get-it-close PID is a fantastic idea.  I'll have a go at it.

@Aciera-
Writing a python comp for me was more than I'd expected (or deserve), but I suspect it'd take longer to explain things and bring me up to speed than to just whip something up.

I'll try to digest what the comp is doing and test it out.

Thank you both very much.
 

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

More
1 year 8 months ago - 1 year 8 months ago #320380 by Benb
Attached is block diagram showing a spindle orient example. I also attached the hal netlist.PID, limit2, offset, … etc parameters values are not complete, you will need to figure them out as you experiment. 

 
Last edit: 1 year 8 months ago by Benb.
The following user(s) said Thank You: jpg

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

More
1 year 8 months ago #320452 by spumco

Attached is block diagram showing a spindle orient example. I also attached the hal netlist.PID, limit2, offset, … etc parameters values are not complete, you will need to figure them out as you experiment. 


 
@Benb -

Thank you for the comments.

I already have orient working on my subspindle, and generally understand how it works and fits with other LCNC functions.

The problem with trying to combine orient with caxis.comp (attached in the first post) is that the caxis.comp functions are 'in charge' of the spindle motor at all times, except when a spindle-on command is issued.  When the spindle is stopped, C-axis takes over and the PID ferror returns the spindle position to the last position prior to the M3/M4.

I don't know this for a fact, but I think what would happen is a race condition where once the spindle-off signal is triggered, but before orient.comp is engaged, caxis.comp will 'take over' the spindle and return it to the original position.

Meaning orient.comp wouldn't be useful to get the spindle close enough after freewheeling and before re-engaging the c-axis.

If Aciera's unhoming python comp doesn't work, and PCW's doesn't either, I will likely revisit orient.comp.

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

Time to create page: 0.433 seconds
Powered by Kunena Forum