Change acceleration on the fly?

More
10 May 2019 17:10 #133380 by mjohnston
Change acceleration on the fly? was created by mjohnston
Hi all!

I'm doing something a little odd with the machine I'm working on, and I'm wondering if there's a way I can change the acceleration of a specific axis/joint or even the whole machine temporarily, then revert it? Obviously you can change it in the INI file, but I want to change and revert it without closing LinuxCNC, i.e. within the scope of a custom M-code or something.

Is there any existing facility for that, or am I out of luck for now? I did notice the motion.axis/joint.N.jog-accel-fraction pins, but I assume those can't change the acceleration for moves made by the trajectory planner.

Thanks in advance!

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

More
10 May 2019 17:51 #133389 by PCW
Replied by PCW on topic Change acceleration on the fly?
You can change acceleration when LinuxCNC is running and the interpreter is idle, via the ini.xxxx pins
The following user(s) said Thank You: mjohnston

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

More
10 May 2019 18:39 #133395 by mjohnston
Replied by mjohnston on topic Change acceleration on the fly?
Thanks, PCW! I'll give that a spin.

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

More
10 May 2019 20:32 #133407 by rodw
Replied by rodw on topic Change acceleration on the fly?
There is a module called sim_pin you can load in your ini file that opens a new window allowing you to control hal pin settings. I have used it on live confiigs.

linuxcnc.org/docs/html/man/man1/sim_pin.1.html

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

More
13 May 2019 21:46 - 13 May 2019 21:47 #133662 by mjohnston
Replied by mjohnston on topic Change acceleration on the fly?
In case anyone else out there is looking for a solution, I got this working.

For the project I'm working on, I have a prox switch input which indicates whether the Z axis is carrying an extra load; when that input is high, I want the Z axis to run at a lower acceleration. The machine can pick up and drop off this extra load mid-program with some custom M-codes, thus the need to change the acceleration on the fly.

Here's what I added to my HAL file:
loadrt mux2 names=mux2.z-acc
addf mux2.z-acc servo-thread
net z-load-present-sw => mux2.z-acc.sel
setp mux2.z-acc.in0   [AXIS_Z]MAX_ACCELERATION
setp mux2.z-acc.in1   [SETUP]Z_LOAD_ACC
net z-accel <= mux2.z-acc.out

And this in my postgui HAL file (for some reason the ini component doesn't load before the rest of my HAL file?):
net z-accel => ini.z.max_acceleration

A word of caution: If you accidentally set the ini.*.max_acceleration pin to 0 you get some, uh... interesting behaviour. ;) Namely, the interpreter skips moves which include the axis that has 0 accel. This had me very confused for a while this afternoon before I figured out what I had done.
Last edit: 13 May 2019 21:47 by mjohnston.
The following user(s) said Thank You: urvilsuthar

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

More
14 Feb 2025 06:37 - 14 Feb 2025 07:31 #321510 by urvilsuthar
Replied by urvilsuthar on topic Change acceleration on the fly?
Hello,
I have created HAL configuration as explained by mjohnston, with a single pushbutton. The functionality is that when I push and hold the button, the acceleration of all axes must be set to 10% of their actual values. However, my application is different. I'm not using M-Codes.

I found that this change of acceleration works for me, but it has a very deviated output. The button press effect occurs after a large lag in time, and the amount of time varies for different programs.

More digging with debugging tools revealed that the trajectory planner has buffered lines. When I press the button, the acceleration change works after the previous buffered lines are executed. Also, the button release event has this lag, as well.

So, my question is: Is there any way to make this acceleration change happen immediately upon button press or release? Or, is there any way to change the buffer size in the trajectory planner?

I am available if you need any more information on this.
Last edit: 14 Feb 2025 07:31 by urvilsuthar.

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

More
14 Feb 2025 10:23 #321531 by rodw
Replied by rodw on topic Change acceleration on the fly?
This is a bit left field, I wonder if you could use external offsets 
and modify ini parameter [AXIS_L]OFFSET_AV_RATIO)
linuxcnc.org/docs/stable/html/motion/external-offsets.html
To use external offsets, you need to allocate a percentage of velocity and acceleration to the external offsets so this by definition reduces what is available to the gcode

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

More
14 Feb 2025 11:47 #321541 by Aciera
Replied by Aciera on topic Change acceleration on the fly?
@urvilsuthar
We can change feed rate in real time but acceleration changes need a queuebuster command in the gcode like M66 E0 L0.

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

More
15 Feb 2025 13:48 - 15 Feb 2025 13:51 #321633 by urvilsuthar
Replied by urvilsuthar on topic Change acceleration on the fly?
@Aciera,
Yes, I did those chanes in gcode file, but that need to be fixed before we start the machining. Looking for run time solutions, like mentioned with the button push the accelaration should be change with the feed rate.
Last edit: 15 Feb 2025 13:51 by urvilsuthar.

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

More
15 Feb 2025 13:56 #321635 by urvilsuthar
Replied by urvilsuthar on topic Change acceleration on the fly?
@rodw,
I'm very grateful. The suggested external offsets operate in a manner comparable to what I require. I plan to try integrating them with my current Raspberry Pi setup.
The following user(s) said Thank You: rodw

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

Time to create page: 0.327 seconds
Powered by Kunena Forum