Remapping M6 for Lathe Turret

More
15 Mar 2018 05:02 #107365 by Jakemestre1
Hello all,
I desperately need some help understanding how to remap m6 for my lathe turret. After several attempts to use Axis and classic ladder to change tools I think I found out that the stepper position can't be modified with the ladder with mesa hardware. I've read through the M6 remap but I'm just not having any luck connecting the right pins and things through hal. I much prefer Gmoccapy as a user interface and I would love to continue using it . Could somebody help me modify my hal and ini to accommodate the turret?
Here is the setup: I'm running a Mesa 5i25 w 7i76 and closed loop steppers on all axis.
Turret is 8 positions, actuated by air cylinder, and spun via stepper motor(picture attached). It has a NC inductive sensor for turret lock and an NC inductive sensor for index at pocket 1. I've assigned the turret stepper as the A axis and it is functioning currently if I move it in increments of 1. (ie. I want tool 2 I call G0 A1 after M64 P0 for the unlock. Then M65 P0 to lock.) I've attached my hal and ini files as well.
So really the order of ops to change the tool would be:
Go to tool change position (G30?)
Actuate air cylinder (M64 P0)
Wait until the lock switch opens(NC in locked position)
Rotate A axis to selected tool - 1 (home it A0=pocket1)
Lock Cylinder (M65 P0)
Wait for lock inductive switch closed
return to cut

I have no idea where to put things between hal ini or postgui_hal or where the pins are controlled for io.control. I tried my very best to replicate the axis/sim/toolchange code with toolgetput and stuff but I could not get anything to actuate or move. Any help would be greatly appreciated
Attachments:

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

More
15 Mar 2018 12:04 #107371 by andypugh
Is the system configured to call a G-code subroutine? (Is that part working at least?)
Some "magic comments" in the G-code sub can be useful to check this, for example:
(DEBUG, The selected tool is #<_tool>)
Take a look at the VMC toolchange simulator for a complete config that uses remap. (The others are a bit confusingly modular).
github.com/LinuxCNC/linuxcnc/tree/master...smach/VMC_toolchange
You will need a "toplevel.py" which will probably be identical to the one there and then a remap.py, again looking exactly like the ones in that config.
Then in the INI file look at lines 20 and 21
github.com/LinuxCNC/linuxcnc/blob/master...ge/vmc_index.ini#L20
Copy those exactly too, and make sure that they are in the [RS274NGC] section.
You then need a G-code file called toolchange and containing the subroutine wrappers.
o<toolchange> sub
...
o<toolchange> endsub
The example toolchange.ngc there uses the carousel HAL component. I don't think you need that.
However you probably do need a conditional clause in your toolchange.ngc that runs a homing routine the first time it is called. (I think you should be able to store homed status in a G-code parameter, you would need to use one that is not persistent through a reboot.

Alternatively you could add your A axis to the standard homing sequence. That would need a bit of HAL logic to release the cylinder if the axis is homing _or_ if the G-code output is trying to release the cylinder.
loadrt or2
addf or2.0 servo-thread 
net release-on-homing axis.3.homing => or2.0.in0
net release-from-g-code motion.digital-out-00 => or2.0.in1
net turret release or2.0.out => parport.0.pin-00-out
The following user(s) said Thank You: Jakemestre1

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

More
15 Mar 2018 19:12 #107388 by Jakemestre1
Thank you wizard Andy!
Success.
I'll post all of my configurations for any future builders looking for an easy solution. That is after I clean it all up.
The following user(s) said Thank You: COFHAL

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

More
22 Jan 2019 19:07 #124627 by Jakemestre1
Hey Andy, I have finally got around to trying to build in a couple of start/stop buttons with some code over on This THREAD but my toolchanger goes all wonky when I try to add a new hal for the button logic. I get a bunch of errors in that code because I already have the or2 component that's in the main hal to home the turret "A axis". I changed them to be or2.1 so the errors go away but I'm pretty sure I'm doing this all wrong. Are there any good threads you know of on how to use a few different and2 or2 components for multiple devices? Thanks.

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

More
22 Jan 2019 19:14 #124629 by andypugh
Having extras of any function is generally as easy as changing
loadrt or2
to
loadrt or2 count=2

And then you would have a separate or2.0 and or2.1

But they are entirely separate, if you want a 3-input OR then you need
loadrt or2 count=2
net cond1 or2.0.in0
net cond2 or2.0.in1
net 1or2 or2.0.out => or2.1.in0
net cond3 or2.1.in1
net 1or2or3 or2.1.out

Or use the "logic" or "lut5" HAL components.

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

More
21 Jun 2022 19:33 #245549 by COFHAL
Is it possible for you to share the complete configuration of your ATC?

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

Moderators: newbynobi
Time to create page: 0.076 seconds
Powered by Kunena Forum