- Posts: 75
- Thank you received: 9
Please Log in or Create an account to join the conversation.
Hi I think you are wrong,hal file is not a program, but only a "description". It doesn't matter what order the lines are in, because it only runs at the end when linuxcnc starts. Just like when I enter HAL lines into halcmd, I have to enter start at the end, nothing happens until then.Hello Jirka,
i have noticed an "~big" error in your hal file.
you adding lcec.real-all and write-all at the beginning of the hal file.
caused that liunxcnc builds its execution order of task functions in the order they are placed in the hal file, your servo-thread calls ec-read and then immediatly writes out lcec-write. So nothing is done with the Data in the meantime. Lcec.write-all uses "old"data from the last cycle . Which causes timing issues and leads to an bad servo tuning.
the right order would be:
addf lcec.read-all (gets data from hardware)
addf motion, value-converts, pids, classicladder etc.. (works with the data)
last addf lcec.write-all (send new data to hardware).
In your case lcec.write-all is called in front of motion and pids. So it sends "old" data from the last cylce to the drives without the new calculations. You got an 1
cycle offset between input and output data.
(you can search for "execution order" in the forum, i have descripted this in detail somewhere)
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Hi I think you are wrong,hal file is not a program, but only a "description". It doesn't matter what order the lines are in, because it only runs at the end when linuxcnc starts. Just like when I enter HAL lines into halcmd, I have to enter start at the end, nothing happens until then.
Martin
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.