PID tuning when you have a tuned Servo in CSP mode?

More
03 Jul 2025 01:02 #331139 by jhandel
I am building out POC with Teknic ClearPath EtherCat servos and so far the Cia402 driver is working great.. I have a question around PID tuning.

I ran around in circles trying to get the right P, I, D, FF, FF1, FF2, etc settings and couldn't get the servo anywhere near its limits before it would fail out with a joint follow error.  

I got rid of all the PID settings and now it won't fail on following but it runs a f-error of about 5.8 when I do some long mock moves (the 5.8 on the scope is a nice trapazoid shape with a ramp up, flat top and a ramp down.. )

So folks with servos that have their own internal control-loop, how do you configure your PID or tune so that when you have 3 of these guys going their combined f-errors don't cause you to make wonky parts? 

Thanks in advance..  Since this is mostly a theory question I'm not posting configs, but happy to if folks ask. 

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

More
03 Jul 2025 14:41 #331161 by jhandel
finding a thread from like 2023, it looks like what I am seeing is processing delay between ethercat and where LinuxCNC thinks things should be... The actual servo error rate (according to its software's scope) is less than 4 steps out of 1280 steps per mm)..

I did some napkin math and 5mm ferror suggests a processing delay of .0083 seconds. Does that sound reasonable or should I be looking somewhere to bring that delay down?

Thanks

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

More
03 Jul 2025 17:39 - 03 Jul 2025 17:40 #331171 by Hakan
One line of thought, not the only one for sure, is to run the servo without a linuxcnc control loop. The drive tuning is what determines the precision.

There is unfortunately a delay in the linuxcnc Ethercat loop of one or two cycles, I think two.
So the actual position is old already. At high travel speeds the following error can be two cycles times multiplied by the speed off.
Without it being wrong in any way, just by delays.
Last edit: 03 Jul 2025 17:40 by Hakan.

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

More
03 Jul 2025 23:51 #331206 by jhandel
if my math is right and I am reading ferror right, I am running 36000mm/m which works out to 600mm/s and an ferror of 5 (well 4.94ish, but close enough).

5/600 = .008333333 But I am running my loop at 500000 if I have configured things right so 2 round trips should be .001ish... makes me think that something else is up in that lag....

Does EtherCat time code movements so that multiple axis would all move at the right time to each other and be at the right place regardless of what LinuxCNC sees back as the time delay?

Thanks

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

More
05 Jul 2025 21:03 #331347 by endian
Hi

Ethercat is by the developers build as written outs first and then reads inputs .. theoretically there it is a single cycle lag.. but when you have constant timing and very little cycle time it is not big deal..

If you want use pid control from lcnc you will have to use your driver in the CSV mode and do the differential counting in the lcnc itself.. regular pid tunning as with mesa cards analogs etc..

if you are running the drivers in the CSP mode, driver calculated stuff internally by known time period of the ethercat bus .. here is lcnc just a position sender and you have to tune the driver itself internally

Have a look at driver timing setup 60C2 register .. if you periods are same everywhere it can produce your lag easily

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

More
06 Jul 2025 08:19 #331373 by Hakan
Linuxcnc servo cycle is not synchronized with the ethercat cycle. That adds an extra cycle delay.
 
The following user(s) said Thank You: endian

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

More
06 Jul 2025 12:09 #331384 by endian

Linuxcnc servo cycle is not synchronized with the ethercat cycle. That adds an extra cycle delay.

Okey this is new for me ... why is there the timing setup or else ? Can you explain us more about your knowledge please?

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

More
06 Jul 2025 13:46 #331390 by kworm
I'm interested in this as well.  I have spent many hours trying to get > 11-12 m/min smooth motion on a large format router without joint following errors and/or jerky motion.  Using the old control or TwinCAT CNC with the same servo driver config works fine at 30 m/min.

I'm no expert on LCNC internals but if RTAPI_TASK_PLL_SUPPORT is defined in linuxcnc-ethercat lcec_main.c then it appears that syncronization is attempted between the ethercat application cycle and LCNC with a max error of one app period...maybe this is where Hakan is getting the potential extra cycle delay.

Since you have the ethercat master running outside LCNC it seems like it would be difficult for those to be perfectly syncronized but perhaps that does not matter in application. I know TwinCAT is running in hard realtime on one or more dedicated cpu cores outside of operating system and with their tools you can see how much time is being used in each cycle.  It would be nice if there were a tool for LCNC where you could see that info but I'm not sure it's even possible in the current architecture.

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

More
06 Jul 2025 14:45 #331392 by Hakan
It's a conclusion from the work done here

start from maybe two minutes in.
I did a lot of measurements, not reported here.
 
The following user(s) said Thank You: endian, kworm

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

More
06 Jul 2025 14:47 #331393 by endian
Be careful because it is configurable for twincat Nc task axis setup is axis lag watching possible to disable and there are any running speed possible to get... I think they have 7phase generator to control to axis movement which is probably more powerfull then lcnc trajectory generator ... They have native ec drivers for they native hardware .. but I am not specialist, I have just 15y of experiences which is nothing...

I know just about the single cycle lagging but there is possibility of having the DC timing problem which can cause the f error during high speed .. therefore is great practice to take DC config of slave take directly from the TC3...

I have problems with ferror too but they were caused by servo setup, dc config and slave timing setup... I have ran at 250us well 4axis 
The following user(s) said Thank You: kworm

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

Time to create page: 0.124 seconds
Powered by Kunena Forum