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.

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

Time to create page: 0.069 seconds
Powered by Kunena Forum