Using Spindle and Axis C commands simultaneously

More
18 Dec 2020 03:31 #192298 by RBC
Hi-
I am trying to build a machine that is configured as a lathe with live tools.
I am using a ClearPath servo in stepper mode with Mesa 7i92.
I can run it successfully using Sxxxx M3 command in spindle configuration.
I can also run it successfully using G1 C90, G1 C180 like command in Axis C angle mode.
I would like to run these command in the same machine configuration, so I can use the S command to turn the part, and G1 Cxx commands to mill the part.

Any ideas?
Thanks,
Rick

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

More
18 Dec 2020 20:09 #192378 by chris@cnc
If i understand correct, at the moment you have two different config files and in case of your work you start once config in C Axis and once in Spindle mode? Right
If so is it possible to to switch Spindle or C Axis componet by M-code.
Write a subprogramm with your comp in this style. For example. I auto power off my machine after long run time by this way.
#! /bin/bash
halcmd setp halui.machine.off 1
sleep 3
halcmd setp halui.machine.off 0
exit 0
make it executable with chmod and named it maybe M100. One sub Spindelmode one sub C-Achsmod maybe M101. So you could switch by M-code from Spindle to milling mode.
regards Christian

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

More
18 Dec 2020 20:31 #192382 by RBC
Thank you Christian for the reply.
That is exactly what I am trying to do. Using custom M codes makes sense.

I do not have experience compiling in linux. I am a C# programmer for windows. If you can direct me to the tools I need to write and compile, it would be great. I will look in to chmod.

Do I need to recompile the linuxcnc or would this be additional executable?

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

More
18 Dec 2020 20:48 #192384 by chris@cnc
there is no need to compile anything. you can copy paste my example and run it. the machine should then go into an emergency stop. Same way with your diff config lines

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

More
18 Dec 2020 21:00 #192386 by RBC
Sorry but I am very lost on how to do this.

1- I place the following lines into a text file called M100 to test your machine off code.

#! /bin/bash
halcmd setp halui.machine.off 1
sleep 3
halcmd setp halui.machine.off 0
exit 0
2- I use chmod to make it an executable (I do not know how this is done)

3- Where do I copy these files to, and how do I link them to linuxcnc hal or ini files?

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

More
18 Dec 2020 21:21 - 18 Dec 2020 21:49 #192391 by chris@cnc
Try
Chmod a+x m100 
is to do it executable
Check it with
./m100
File should now be running
And if that works, copy this file into your subroutine folder. You can find it at the beginning of your INI file. After that it is possible to do this in MDI or program
Last edit: 18 Dec 2020 21:49 by chris@cnc.
The following user(s) said Thank You: RBC

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

More
18 Dec 2020 21:48 #192393 by RBC
./M100 from the terminal worked.
I created home/spyder/linuxcnc/subroutines folder and copied M100 file in it.
I added SUBROUTINE_PATH = /home/spyder/linuxcnc/subroutines in the [RS274NGC]
Saved the ini and restarted linuxcnc, and tried it in MDI, and I get unknown mcode used error.

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

More
18 Dec 2020 22:01 - 18 Dec 2020 22:03 #192395 by chris@cnc
My ini example lines
SUBROUTINE_PATH = ncsubroutines:/home/ich/Programme/unterprogramme/
USER_M_PATH = /home/ich/Programme/unterprogramme

Sorry my mistake User_m_path is for User mcodes:)
Last edit: 18 Dec 2020 22:03 by chris@cnc.

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

More
19 Dec 2020 15:46 - 19 Dec 2020 17:53 #192459 by RBC
Great! Thanks. Each is working now but not one after the other. When I switch from spindle mode to angle mode, I get a following error.
If I start linuxcnc, and run M101, it works as normal in angle mode.
If I start linuxcnc, and run M102 it works as normal in spindle mode.
If I switch to M101 after M102, it will give following error, and display a large value in A axis. (it was 0 right before)
If I switch to M102 after M101, it works as intended.
When I look at halmeter, a-pos-cmd and a-pos-fb shows the same large number.
So something needs to be reset it seems like.
M101 Code
#SWITCHES TO ANGLE MODE
halcmd setp joint.4.motor-pos-fb 0
halcmd setp a-pos-fb 0

halcmd net a-output hm2_7i92.0.stepgen.04.velocity-cmd
halcmd net a-pos-fb joint.4.motor-pos-fb

M102 Code
# SWITCHES TO SPINDLE MODE
halcmd unlinkp hm2_7i92.0.stepgen.04.velocity-cmd
halcmd unlinkp joint.4.motor-pos-fb
halcmd net spindle-mode spindle-ramp.out hm2_7i92.0.stepgen.04.velocity-cmd


Thanks.
Last edit: 19 Dec 2020 17:53 by RBC. Reason: typo

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

More
19 Dec 2020 18:07 #192468 by RBC
If I home Axis A after using the spindle mode, it works as intended. However, I still get the following error as soon as I issue the M101 code.
Is there a way to home an Axis in this M101 program?

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

Time to create page: 0.127 seconds
Powered by Kunena Forum