Macroloop to continuously adjust c-axis speed

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Macroloop to continuously adjust c-axis speed

Postby mjr1127@gmail.com » Tue Dec 05, 2023 8:22 am

Hello, I have an unusual machine and need a capability from uccnc that I haven't figured out so far. My machine has x- and z- linear axes and a c-axis (parallel with z). This layout makes r,z,theta more appropriate for me.

I haven't been able to find a cheap cam program that can do continuous 4-axis tool paths with a c-axis (deskproto was close but not quite). I am generally trying to carve concave forms into the top of cylindrical stock. Like a bowl for example. The best idea I've come up with is to have a canned cycle carve a curve in the x-z plane (deeper and deeper etc) as the c-axis turns and turns. I am wondering if there is a way of having a macroloop adjust the rotary speed such that it linearly decreases as the x position increases during the course of a gcode running.
Ex: when x=0, rpm=10 ---> when x=10, rpm=1 and a smooth speed spectrum between

I understand this is a rough way of compensating for the geometry but my tool just does a relatively gentle grinding operation so getting truly consistent surface speed isn't critical. I'm just looking for a starting point or ideas.

I did try to use inverse time feed mode and adjusting c- speed with every line of converted Cartesian -> polar coordinates but I would like smoother motion that that method seemed to produce. Any thoughts are welcome. Just getting into CNC and loving uccnc so far
mjr1127@gmail.com
 
Posts: 10
Joined: Tue Dec 05, 2023 7:22 am

Re: Macroloop to continuously adjust c-axis speed

Postby mjr1127@gmail.com » Tue Dec 05, 2023 9:00 pm

Other threads in the forum make it seem that continuous rotary motion is not possible using uccnc.

I haven't written macros / macroloops before. Can anyone explain why it would not work to drive two axes via an nc file and simultaneously drive a rotary axis via a macroloop which shuts off when the nc file concludes?

I suppose I'm not understanding how macroloops work while an nc file is running but the documentation has not cleared it up
mjr1127@gmail.com
 
Posts: 10
Joined: Tue Dec 05, 2023 7:22 am

Re: Macroloop to continuously adjust c-axis speed

Postby ger21 » Tue Dec 05, 2023 10:08 pm

You're best bet is to probable setup your C axis as a step/dir spindle, and control your spindle manually.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Macroloop to continuously adjust c-axis speed

Postby mjr1127@gmail.com » Wed Dec 06, 2023 12:31 am

Thanks Gerry. I did configure it as a spindle at first and I like that thought.

At the moment I can turn the c-axis (configured as c-axis) constantly or variably in my nc files by specifying a C travel in each G01 command in my file. Calculating and appending those c travel specs to my polar coordinate list is doable and I'm set with that method.

What I'm hoping for instead of my manual method is to have a mathematical rule in a macroloop so that every second or so the macroloop will read in a machine state (x-dist from rotary axis) and calculate the rotary speed for the following second until the next adjustment is made. Idk if that is fundamentally impossible with a macroloop or not. Can nc code run completely interrupted as the macroloop also runs uninterrupted? I won't have any c-axis commands in the nc file if I go that route.
mjr1127@gmail.com
 
Posts: 10
Joined: Tue Dec 05, 2023 7:22 am

Re: Macroloop to continuously adjust c-axis speed

Postby cncdrive » Wed Dec 06, 2023 4:38 am

well, this is currently impossible using the UC motion controllers, however we have a plan to add off-band axes which could run totally independently from the main XYZABC 6 axes.
Our plan is to support both positioning and speed control modes.
This is currently not available though, it is just a plan and probably will be only implemented in the ethernet motion controllers (UC300ETH, UC400ETH, AXBB-E)

Currently how you could achive this is e.g. program an Arduino board and make a plugin which could send updates from a macro or from a #variable value which you could change in your g-code or from macros or from macroloops and send that data to the Arduino, e.g. in Modbus protocol using the Modbus master plugin of the UCCNC.
Then write some code in the Arduino to output the step/dir signals to speed control your drive/motor.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: Macroloop to continuously adjust c-axis speed

Postby mjr1127@gmail.com » Wed Dec 06, 2023 7:39 am

Ok, I appreciate your guidance. The suggested Arduino workaround or calculating/splicing c-values into my curve plot will both work for me.

Just for my understanding of what is going on with macroloops in uccnc, can you explain why a macroloop can't drive one axis while a loaded program simultaneously drives the others? I have seen recommendations on the forum and/or in the documentation that movement commands are unwise to put in macroloops as they can interfere with movement commands from the loaded program. That is something like the case I am trying to bring about - augmenting the nc movement with a background disruption.

Is uccnc unable to ignore axis motion that isn't specified in the running nc program? Thanks again
mjr1127@gmail.com
 
Posts: 10
Joined: Tue Dec 05, 2023 7:22 am

Re: Macroloop to continuously adjust c-axis speed

Postby cncdrive » Wed Dec 06, 2023 4:19 pm

Because a macroloop is running on the computer and the motion is buffered, because Windows is not realtime, so even if a macroloop would say to change an axis speed or position would happen only later when the motion buffer runs empty.
To make this work we should make some development as I mentioned with sending data not in the motion buffer, but in parallel making some independently running axis available.
This is planned.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm


Return to Macros

Who is online

Users browsing this forum: No registered users and 4 guests