Change acceleration on the fly?

More
7 years 5 months ago #133380 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 to join the conversation.

More
7 years 5 months ago #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

Please Log in to join the conversation.

More
7 years 5 months ago #133395 by mjohnston
Thanks, PCW! I'll give that a spin.

Please Log in to join the conversation.

More
7 years 5 months ago #133407 by rodw
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 to join the conversation.

More
7 years 5 months ago #133662 by mjohnston
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:
Code:
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?):
Code:
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.

Please Log in to join the conversation.

More
1 year 8 months ago #321510 by urvilsuthar
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.

Please Log in to join the conversation.

More
1 year 8 months ago #321531 by rodw
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 to join the conversation.

More
1 year 8 months ago #321541 by Aciera
@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 to join the conversation.

More
1 year 8 months ago #321633 by urvilsuthar
@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.

Please Log in to join the conversation.

More
1 year 8 months ago #321635 by urvilsuthar
@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.

Please Log in to join the conversation.

Time to create page: 5.198 seconds
Powered by Kunena Forum